]> git.dujemihanovic.xyz Git - linux.git/commitdiff
compiler_types.h: Add unified __diag_ignore_all for GCC/LLVM
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Fri, 4 Mar 2022 22:46:43 +0000 (04:16 +0530)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 5 Mar 2022 23:29:36 +0000 (15:29 -0800)
Add a __diag_ignore_all macro, to ignore warnings for both GCC and LLVM,
without having to specify the compiler type and version. By default, GCC
8 and clang 11 are used. This will be used by bpf subsystem to ignore
-Wmissing-prototypes warning for functions that are meant to be global
functions so that they are in vmlinux BTF, but don't have a prototype.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220304224645.3677453-7-memxor@gmail.com
include/linux/compiler-clang.h
include/linux/compiler-gcc.h
include/linux/compiler_types.h

index f1aa41d520bd5854c69569402ddac7bc5a8aadd1..babb1347148c5d6327601aac1d569b63825d370b 100644 (file)
@@ -90,3 +90,6 @@
 #else
 #define __diag_clang_11(s)
 #endif
+
+#define __diag_ignore_all(option, comment) \
+       __diag_clang(11, ignore, option)
index ccbbd31b3aae52f17a6d2bb2e2e73f1ce9fff25f..d364c98a4a8056c8ec507a72463947de8bb5da8b 100644 (file)
 #define __diag_GCC_8(s)
 #endif
 
+#define __diag_ignore_all(option, comment) \
+       __diag_GCC(8, ignore, option)
+
 /*
  * Prior to 9.1, -Wno-alloc-size-larger-than (and therefore the "alloc_size"
  * attribute) do not work, and must be disabled.
index 3f31ff400432bbf55c7d8a72795d0aa4ed55ada8..8e5d2f50f951a65eba5ec5691cb928d52e2ade5c 100644 (file)
@@ -371,4 +371,8 @@ struct ftrace_likely_data {
 #define __diag_error(compiler, version, option, comment) \
        __diag_ ## compiler(version, error, option)
 
+#ifndef __diag_ignore_all
+#define __diag_ignore_all(option, comment)
+#endif
+
 #endif /* __LINUX_COMPILER_TYPES_H */