On Mon, Aug 18, 2025 at 09:18:14AM -0700, Stephen Hemminger wrote: > Clang (3.9 or later) has a -Wcomma that emits warnings for questionable > uses of the comma operator. > > Don't enable it for drivers since many drivers still use > comma operator unnecessarily. > > Signed-off-by: Stephen Hemminger <step...@networkplumber.org> > Acked-by: Konstantin Ananyev <konstantin.anan...@huawei.com> > Acked-by: Chengwen Feng <fengcheng...@huawei.com> > Acked-by: Morten Brørup <m...@smartsharesystems.com> > --- > config/meson.build | 1 + > drivers/meson.build | 2 +- > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/config/meson.build b/config/meson.build > index f31fef216c..d9ff0e31c0 100644 > --- a/config/meson.build > +++ b/config/meson.build > @@ -313,6 +313,7 @@ endif > global_cflags = [ > # additional warnings in alphabetical order > '-Wcast-qual', > + '-Wcomma', > '-Wdeprecated', > '-Wformat', > '-Wformat-nonliteral', > diff --git a/drivers/meson.build b/drivers/meson.build > index b62880db02..4c08a1dd9d 100644 > --- a/drivers/meson.build > +++ b/drivers/meson.build > @@ -59,7 +59,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'] > +warning_disable_cflags = ['-Wno-format-truncation', > '-Wno-address-of-packed-member', '-Wno-comma']
Since this patchset has already fixed some drivers, are we at a point where we can just disable this warning on a driver-by-driver basis rather than globally? That makes it easier to spot where the issues are and easier allows incremental improvement. > foreach cflag:warning_disable_cflags > if cc.has_argument(cflag) > default_cflags += cflag > -- > 2.47.2 >