diff options
Diffstat (limited to 'tools/lib/bpf/btf_dump.c')
| -rw-r--r-- | tools/lib/bpf/btf_dump.c | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c index 5dbca76b953f..894860111ddb 100644 --- a/tools/lib/bpf/btf_dump.c +++ b/tools/lib/bpf/btf_dump.c @@ -1559,10 +1559,12 @@ static void btf_dump_emit_type_chain(struct btf_dump *d,  			 * Clang for BPF target generates func_proto with no  			 * args as a func_proto with a single void arg (e.g.,  			 * `int (*f)(void)` vs just `int (*f)()`). We are -			 * going to pretend there are no args for such case. +			 * going to emit valid empty args (void) syntax for +			 * such case. Similarly and conveniently, valid +			 * no args case can be special-cased here as well.  			 */ -			if (vlen == 1 && p->type == 0) { -				btf_dump_printf(d, ")"); +			if (vlen == 0 || (vlen == 1 && p->type == 0)) { +				btf_dump_printf(d, "void)");  				return;  			} |