Thread (11 messages) 11 messages, 4 authors, 2020-03-28
STALE2299d LANDED

[PATCH v4] bpf: fix build warning - missing prototype

From: Jean-Philippe Menil <hidden>
Date: 2020-03-27 20:47:28
Also in: bpf, kernel-janitors, lkml
Subsystem: bpf [general] (safe dynamic programs and tools), networking [general], the rest · Maintainers: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

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 by Alexei.

Signed-off-by: Jean-Philippe Menil <redacted>
---
 net/bpf/test_run.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 4c921f5154e0..73e703895343 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -114,6 +114,9 @@ static int bpf_test_finish(const union bpf_attr *kattr,
  * 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;
@@ -150,6 +153,8 @@ int noinline bpf_modify_return_test(int a, int *b)
 	return a + *b;
 }
 
+__diag_pop();
+
 ALLOW_ERROR_INJECTION(bpf_modify_return_test, ERRNO);
 
 static void *bpf_test_init(const union bpf_attr *kattr, u32 size,
-- 
2.26.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help