[PATCH v2] Add pragma to ignore gcc-compat warnings in clang when used with diagnose_if.
Michael Barker
mikeb01 at gmail.com
Tue Jan 18 00:23:18 CET 2022
When using clang with -Wall the use of diagnose_if kicks up a warning,
requiring all dpdk includes to be wrapped with the pragma. This change
isolates the ignore just the appropriate location and makes it easier
for users to apply -Wall,-Werror
Signed-off-by: Michael Barker <mikeb01 at gmail.com>
---
lib/eal/include/rte_compat.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/eal/include/rte_compat.h b/lib/eal/include/rte_compat.h
index 2718612cce..9556bbf4d0 100644
--- a/lib/eal/include/rte_compat.h
+++ b/lib/eal/include/rte_compat.h
@@ -33,8 +33,11 @@ section(".text.internal")))
#elif !defined ALLOW_INTERNAL_API && __has_attribute(diagnose_if) /* For clang */
#define __rte_internal \
+_Pragma("GCC diagnostic push") \
+_Pragma("GCC diagnostic ignored \"-Wgcc-compat\"") \
__attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \
-section(".text.internal")))
+section(".text.internal"))) \
+_Pragma("GCC diagnostic pop")
#else
--
2.25.1
More information about the dev
mailing list