Skip to content

Commit e9ff9d5

Browse files
jpmenilborkmann
authored andcommitted
bpf: Fix build warning regarding missing prototypes
Fix build warnings when building net/bpf/test_run.o with W=1 due to missing prototype for bpf_fentry_test{1..6}. Instead of declaring prototypes, turn off warnings with __diag_{push,ignore,pop} as pointed out by Alexei. Signed-off-by: Jean-Philippe Menil <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 291cfe3 commit e9ff9d5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/bpf/test_run.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ static int bpf_test_finish(const union bpf_attr *kattr,
114114
* architecture dependent calling conventions. 7+ can be supported in the
115115
* future.
116116
*/
117+
__diag_push();
118+
__diag_ignore(GCC, 8, "-Wmissing-prototypes",
119+
"Global functions as their definitions will be in vmlinux BTF");
117120
int noinline bpf_fentry_test1(int a)
118121
{
119122
return a + 1;
@@ -149,6 +152,7 @@ int noinline bpf_modify_return_test(int a, int *b)
149152
*b += 1;
150153
return a + *b;
151154
}
155+
__diag_pop();
152156

153157
ALLOW_ERROR_INJECTION(bpf_modify_return_test, ERRNO);
154158

0 commit comments

Comments
 (0)