Skip to contentSkip to conversation

drivers: disable comma warnings selectively

PATCH Superseded Bruce Richardson 2 participants 6 messages Feb 13 – Feb 19

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: disable comma warnings selectively

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.

---
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(-)
config/meson.build +6 -0
index 02e2798cca..9ba7b9a338 100644
@@ -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')
drivers/meson.build +1 -1
index 3fe3be48fb..6ae102e943 100644
@@ -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
drivers/net/axgbe/meson.build +3 -1
index 5a14549317..1aa523a749 100644
@@ -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')
drivers/net/bnxt/meson.build +1 -0
index dc122fb3df..e13aa4e341 100644
@@ -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 = [
drivers/net/gve/meson.build +1 -0
index add431c2bb..b5d67ee490 100644
@@ -20,3 +20,4 @@ sources = files(
 includes += include_directories('base')
 
 cflags += no_wvla_cflag
+cflags += no_comma_cflag
drivers/raw/ifpga/base/meson.build +1 -0
index efebff94e9..225bde052b 100644
@@ -24,3 +24,4 @@ base_sources = files(
         'opae_at24_eeprom.c',
         'opae_eth_group.c',
 )
+base_cflags += no_comma_cflag

--
2.51.0

#1 lore raw
Quoted 6 lines · On Fri, 13 Feb 2026 15:14:00 +0000 Bruce Richardson…

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.

Some of those drivers should be easy to fix?

This change would be helped by fixing and introducing FOREACH_SAFE macros. I started that but it never got anywhere

#2 lore raw
Quoted 12 lines · Stephen Hemminger
Quoted 6 lines · On Fri, 13 Feb 2026 15:14:00 +0000 Bruce Richardson…

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.

Some of those drivers should be easy to fix?

Yep.

Unfortunately there are lots of CI errors with this patch because I forgot that the Intel driver cleanups are still on next-net-intel tree rather than main.

For other drivers, I didn't actually take time to investigate fixing these, I was mainly interested in the scope of the problem and ensuring that any drivers that are without issues stay that way. It was only after it was done that I realised how few problems there actually are.

Quoted 2 lines

This change would be helped by fixing and introducing FOREACH_SAFE macros. I started that but it never got anywhere

Right. However, it's not a really big blocker here. Quick fixes to remove the use of comma can be done without a major refactor.

/Bruce

#3 lore raw
In reply to Bruce Richardson
Quoted 7 lines · On Fri, 13 Feb 2026 15:14:00 +0000 Bruce Richardson…

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.

---

Marking as deferred until Intel driver fixes hit

#4 lore raw

PATCH v2 1/1 drivers: disable comma warnings selectively

In reply to Bruce Richardson

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.

---
V2: resubmit now that dependent patches have hit main

---
 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(-)
config/meson.build +6 -0
index 02e2798cca..9ba7b9a338 100644
@@ -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')
drivers/meson.build +1 -1
index 3fe3be48fb..6ae102e943 100644
@@ -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
drivers/net/axgbe/meson.build +3 -1
index 5a14549317..1aa523a749 100644
@@ -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')
drivers/net/bnxt/meson.build +1 -0
index dc122fb3df..e13aa4e341 100644
@@ -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 = [
drivers/net/gve/meson.build +1 -0
index add431c2bb..b5d67ee490 100644
@@ -20,3 +20,4 @@ sources = files(
 includes += include_directories('base')
 
 cflags += no_wvla_cflag
+cflags += no_comma_cflag
drivers/raw/ifpga/base/meson.build +1 -0
index efebff94e9..225bde052b 100644
@@ -24,3 +24,4 @@ base_sources = files(
         'opae_at24_eeprom.c',
         'opae_eth_group.c',
 )
+base_cflags += no_comma_cflag
Signature · 1 line
2.51.0
#5 lore raw
Quoted 7 lines · On Thu, 19 Feb 2026 15:22:25 +0000 Bruce Richardson…

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.

---

Queued to next-net