Page MenuHomeFreeBSD

route: silence Clang set but not used warning under WITHOUT_INET
Needs ReviewPublic

Authored by emaste on Dec 31 2021, 7:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jan 14, 9:22 PM
Unknown Object (File)
Tue, Dec 31, 5:32 PM
Unknown Object (File)
Dec 5 2024, 4:38 PM
Unknown Object (File)
Oct 16 2024, 7:51 AM
Unknown Object (File)
Oct 2 2024, 2:13 AM
Unknown Object (File)
Oct 1 2024, 10:50 PM
Unknown Object (File)
Sep 25 2024, 9:22 AM
Unknown Object (File)
Sep 24 2024, 5:02 AM
Subscribers

Details

Reviewers
imp
melifaro

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emaste created this revision.
sbin/route/route.c
896

Note I changed these from 0 to NULL in an earlier local commit, which I'll push as well

-                               getaddr(RTAX_IFA, *++argv, 0, nrflags);
+                               getaddr(RTAX_IFA, *++argv, NULL, nrflags);
1184

IMO the (void) cast is better than annotating the arg with __unused for #ifdef conditional cases, so that the warning will come back if the argument later becomes unused in the other cases.

sbin/route/route.c
1157

As far as I understand, hpp usage is write-only (we zero *hpp in the beginning of INET block and write gethostname data in the end).
In newroute() (the only consumer of getaddr()), this value (stored as hp) is only used to propagate it to another getaddr() invocation for different RTA_ attribute.
As noted above, hpp is write-only, hence it's maybe better simply removing it alltogether from getaddr() and newroute() ?

sbin/route/route.c
1157

(housekeeping) - is this change still needed after D33717 ?