Page MenuHomeFreeBSD

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

Authored by jhb on Feb 11 2021, 10:10 PM.
Tags
None
Referenced Files
F103164831: D28598.diff
Thu, Nov 21, 7:09 PM
Unknown Object (File)
Fri, Nov 8, 1:43 AM
Unknown Object (File)
Fri, Nov 8, 1:41 AM
Unknown Object (File)
Oct 3 2024, 7:56 PM
Unknown Object (File)
Oct 3 2024, 3:26 PM
Unknown Object (File)
Oct 1 2024, 6:16 PM
Unknown Object (File)
Sep 30 2024, 12:43 AM
Unknown Object (File)
Sep 19 2024, 6:32 AM

Details

Summary

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

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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