[PATCH 2/3] drivers/common: add diagnostics macros to make code portable
Andre Muezerie
andremue at linux.microsoft.com
Fri Dec 27 02:33:15 CET 2024
It was a common pattern to have "GCC diagnostic ignored" pragmas
sprinkled over the code and only activate these pragmas for certain
compilers (gcc and clang). Clang supports GCC’s pragma for
compatibility with existing source code, so #pragma GCC diagnostic
and #pragma clang diagnostic are synonyms for Clang
(https://clang.llvm.org/docs/UsersManual.html).
Now that effort is being made to make the code compatible with MSVC
these expressions would become more complex. It makes sense to hide
this complexity behind macros. This makes maintenance easier as these
macros are defined in a single place. As a plus the code becomes
more readable as well.
Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
---
drivers/common/idpf/idpf_common_rxtx_avx512.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/common/idpf/idpf_common_rxtx_avx512.c b/drivers/common/idpf/idpf_common_rxtx_avx512.c
index b8450b03ae..d298a5ca36 100644
--- a/drivers/common/idpf/idpf_common_rxtx_avx512.c
+++ b/drivers/common/idpf/idpf_common_rxtx_avx512.c
@@ -6,9 +6,7 @@
#include "idpf_common_device.h"
#include "idpf_common_rxtx.h"
-#ifndef __INTEL_COMPILER
-#pragma GCC diagnostic ignored "-Wcast-qual"
-#endif
+__rte_diagnostic_ignored_wcast_qual
#define IDPF_DESCS_PER_LOOP_AVX 8
#define PKTLEN_SHIFT 10
--
2.47.0.vfs.0.3
More information about the dev
mailing list