From: Jean-Philippe Menil Date: Fri, 27 Mar 2020 20:47:13 +0000 (+0100) Subject: bpf: Fix build warning regarding missing prototypes X-Git-Tag: v5.10.7~2946^2~10^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9ff9d52540a53ce8c9eff5bf8b66467fe81eb2b;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20200327204713.28050-1-jpmenil@gmail.com --- diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c index 4c921f5..29dbdd4 100644 --- a/net/bpf/test_run.c +++ b/net/bpf/test_run.c @@ -114,6 +114,9 @@ out: * architecture dependent calling conventions. 7+ can be supported in the * future. */ +__diag_push(); +__diag_ignore(GCC, 8, "-Wmissing-prototypes", + "Global functions as their definitions will be in vmlinux BTF"); int noinline bpf_fentry_test1(int a) { return a + 1; @@ -149,6 +152,7 @@ int noinline bpf_modify_return_test(int a, int *b) *b += 1; return a + *b; } +__diag_pop(); ALLOW_ERROR_INJECTION(bpf_modify_return_test, ERRNO);