Rather than disabling -Wcomma for all drivers, only disable it on a
case-by-case basis for drivers that need it disabled. Use a variable to
do so, to avoid issues with compilers like MSVC that don't support the
-Wno-comma flag.

Signed-off-by: Bruce Richardson <[email protected]>
---
NOTE: this builds cleanly for me on my system with most drivers enabled
and builds clean in the github CI. Hoping the other CIs will catch issues
with any other drivers that I haven't been able to test due to missing
deps on my system. If any issues show up in CI, will fix in V2.
---
 config/meson.build                 | 6 ++++++
 drivers/meson.build                | 2 +-
 drivers/net/axgbe/meson.build      | 4 +++-
 drivers/net/bnxt/meson.build       | 1 +
 drivers/net/gve/meson.build        | 1 +
 drivers/raw/ifpga/base/meson.build | 1 +
 6 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index 02e2798cca..9ba7b9a338 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -367,6 +367,12 @@ if cc.has_argument('-Wno-shadow')
     no_shadow_cflag = '-Wno-shadow'
 endif

+# per-driver option to disable -Wcomma if supported by the compiler
+no_comma_cflag = []
+if cc.has_argument('-Wno-comma')
+    no_comma_cflag = '-Wno-comma'
+endif
+
 foreach arg: global_cflags
     if cc.has_argument(arg)
         add_project_arguments(arg, language: 'c')
diff --git a/drivers/meson.build b/drivers/meson.build
index 3fe3be48fb..6ae102e943 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -86,7 +86,7 @@ default_cflags = machine_args
 default_cflags += ['-DALLOW_EXPERIMENTAL_API']
 default_cflags += ['-DALLOW_INTERNAL_API']

-warning_disable_cflags = ['-Wno-format-truncation', 
'-Wno-address-of-packed-member', '-Wno-comma']
+warning_disable_cflags = ['-Wno-format-truncation', 
'-Wno-address-of-packed-member']
 foreach cflag:warning_disable_cflags
     if cc.has_argument(cflag)
         default_cflags += cflag
diff --git a/drivers/net/axgbe/meson.build b/drivers/net/axgbe/meson.build
index 5a14549317..1aa523a749 100644
--- a/drivers/net/axgbe/meson.build
+++ b/drivers/net/axgbe/meson.build
@@ -15,7 +15,9 @@ sources = files(
         'axgbe_rxtx.c',
 )

-cflags += ['-Wno-cast-qual', no_shadow_cflag]
+cflags += ['-Wno-cast-qual']
+cflags += no_shadow_cflag
+cflags += no_comma_cflag

 if arch_subdir == 'x86'
     sources += files('axgbe_rxtx_vec_sse.c')
diff --git a/drivers/net/bnxt/meson.build b/drivers/net/bnxt/meson.build
index dc122fb3df..e13aa4e341 100644
--- a/drivers/net/bnxt/meson.build
+++ b/drivers/net/bnxt/meson.build
@@ -14,6 +14,7 @@ endif

 cflags += no_wvla_cflag
 cflags += no_shadow_cflag
+cflags += no_comma_cflag

 headers = files('rte_pmd_bnxt.h')
 cflags_options = [
diff --git a/drivers/net/gve/meson.build b/drivers/net/gve/meson.build
index add431c2bb..b5d67ee490 100644
--- a/drivers/net/gve/meson.build
+++ b/drivers/net/gve/meson.build
@@ -20,3 +20,4 @@ sources = files(
 includes += include_directories('base')

 cflags += no_wvla_cflag
+cflags += no_comma_cflag
diff --git a/drivers/raw/ifpga/base/meson.build 
b/drivers/raw/ifpga/base/meson.build
index efebff94e9..225bde052b 100644
--- a/drivers/raw/ifpga/base/meson.build
+++ b/drivers/raw/ifpga/base/meson.build
@@ -24,3 +24,4 @@ base_sources = files(
         'opae_at24_eeprom.c',
         'opae_eth_group.c',
 )
+base_cflags += no_comma_cflag
--
2.51.0

Reply via email to