Page MenuHomeFreeBSD

iflib: Cast the result of iflib_netmap_txq_init() to void.
ClosedPublic

Authored by jhb on Feb 11 2021, 10:10 PM.

Details

Summary

This fixes a warning from GCC for kernels without netmap since the
return value is never used.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 36905
Build 33794: arc lint + arc unit

Event Timeline

erj added subscribers: vmaffione, erj.
erj added inline comments.
sys/net/iflib.c
1288

I think @vmaffione would be the responsible one for these functions? But, why not just make this a void, too, since it only is called in one place and the return value is never checked there.

sys/net/iflib.c
1288

I think @vmaffione would be the responsible one for these functions? But, why not just make this a void, too, since it only is called in one place and the return value is never checked there.

I considered that, but wanted to defer. The other option is that if the driver wants to explicitly ignore the return value it could use '(void)' when calling the function which might also quiet the compiler complaint.

sys/net/iflib.c
1288

I would prefer to leave the return value as an int, even if the return value is not used right now by this particular driver. It's a matter of uniformity within netmap (RX counterpart, other drivers, Linux drivers, etc.).
If this change is meant to suppress a compiler warning, I think the best would be for iflib to explicitly cast the return value to void, as @jhb suggests.

erj requested changes to this revision.Feb 17 2021, 10:38 PM

So, it sounds like it'd be preferred to use (void)0 instead of using an empty stub?

This revision now requires changes to proceed.Feb 17 2021, 10:38 PM
  • Use a void cast instead.
jhb retitled this revision from iflib: Use an empty stub for iflib_netmap_txq_init(). to iflib: Cast the result of iflib_netmap_txq_init() to void..Feb 17 2021, 10:40 PM
jhb edited the summary of this revision. (Show Details)
jhb marked an inline comment as done.
This revision is now accepted and ready to land.Feb 17 2021, 11:21 PM