drivers: disable comma warnings selectively
Subsystems (2)
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -24,3 +24,4 @@ base_sources = files( 'opae_at24_eeprom.c', 'opae_eth_group.c', ) +base_cflags += no_comma_cflag
--
2.51.0
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.
Signed-off-by Bruce Richardson <[email protected]>
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
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.
Signed-off-by Bruce Richardson <[email protected]>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_SAFEmacros. 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
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.
Signed-off-by Bruce Richardson <[email protected]>---
Marking as deferred until Intel driver fixes hit
PATCH v2 1/1 drivers: disable comma warnings selectively
In reply to Bruce RichardsonRather 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Stephen Hemminger
AppliedQuoted 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.
Signed-off-by Bruce Richardson <[email protected]>---
Queued to next-net