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
Unknown Object (File)
Thu, Apr 18, 12:23 AM
Unknown Object (File)
Fri, Mar 29, 3:04 PM
Unknown Object (File)
Feb 11 2024, 5:09 AM
Unknown Object (File)
Jan 10 2024, 2:47 AM
Unknown Object (File)
Dec 28 2023, 2:42 AM
Unknown Object (File)
Dec 23 2023, 3:19 AM
Unknown Object (File)
Dec 12 2023, 11:48 AM
Unknown Object (File)
Sep 29 2023, 8:43 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 37138
Build 34027: 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