Page MenuHomeFreeBSD

Fix statement with no effect in linuxkpi's xarray.h
AcceptedPublic

Authored by dim on Fri, Sep 18, 7:20 AM.

Details

Summary

When compiling the kernel with gcc 14, errors similar to the following
are emitted:

sys/dev/cxgbe/iw_cxgbe/ev.c: In function 'c4iw_ev_handler':
sys/compat/linuxkpi/common/include/linux/xarray.h:132:23: error: statement with no effect [-Werror=unused-value]
  132 |                 flags == 0; \
sys/dev/cxgbe/iw_cxgbe/ev.c:274:17: note: in expansion of macro 'xa_unlock_irqrestore'
  274 |                 xa_unlock_irqrestore(&dev->cqs, flag);
      |                 ^~~~~~~~~~~~~~~~~~~~
sys/compat/linuxkpi/common/include/linux/xarray.h:132:23: error: statement with no effect [-Werror=unused-value]
  132 |                 flags == 0; \
sys/dev/cxgbe/iw_cxgbe/ev.c:283:17: note: in expansion of macro 'xa_unlock_irqrestore'
  283 |                 xa_unlock_irqrestore(&dev->cqs, flag);
      |                 ^~~~~~~~~~~~~~~~~~~~

It looks like the intent of the "flags == 0" statement was to make the
'flags' macro argument not unused, but it still results in a warning.
Use the construct "(void)flags" instead.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
No Test Coverage
Build Status
Buildable 77053
Build 73936: arc lint + arc unit

Event Timeline

dim requested review of this revision.Fri, Sep 18, 7:20 AM
bz added a subscriber: bz.
bz added inline comments.
sys/compat/linuxkpi/common/include/linux/xarray.h
132

If you wanted to keep it in sync with the spinlock implementation it'd be reverse order

(void)flags;
xa_unlock((xa));

but who cares in this case.

This revision is now accepted and ready to land.Fri, Sep 18, 8:01 AM