Page MenuHomeFreeBSD

sys/kern/kern_resource.c: fold lim_shared into lim_copy to mute -Wunused compiler warnings from clang with !INVARIANTS
ClosedPublic

Authored by ngie on Dec 22 2015, 7:24 PM.
Tags
None
Referenced Files
F106067144: D4683.diff
Tue, Dec 24, 8:20 PM
Unknown Object (File)
Tue, Dec 24, 4:23 AM
Unknown Object (File)
Fri, Dec 13, 1:29 AM
Unknown Object (File)
Sep 24 2024, 7:42 PM
Unknown Object (File)
Sep 24 2024, 4:09 PM
Unknown Object (File)
Sep 24 2024, 4:14 AM
Unknown Object (File)
Sep 23 2024, 10:18 PM
Unknown Object (File)
Sep 21 2024, 5:47 AM
Subscribers

Details

Summary

Fold lim_shared into lim_copy to mute -Wunused compiler warnings from clang when
the kernel is compiled without INVARIANTS

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ngie retitled this revision from to sys/kern/kern_resource.c: only expose lim_shared when INVARIANTS is enabled to mute -Wunused compiler warnings from clang.
ngie updated this object.
ngie edited the test plan for this revision. (Show Details)
ngie added a reviewer: mjg.
ngie set the repository for this revision to rS FreeBSD src repository - subversion.
ngie added subscribers: jhb, kib.

Why not inline the test into KASSERT() and get rid if lim_shared() ? It is not used otherwise and would save ten lines of code.

In D4683#98845, @kib wrote:

Why not inline the test into KASSERT() and get rid if lim_shared() ? It is not used otherwise and would save ten lines of code.

Yeah, my gut said do that too, but I wasn't sure if mjg had used the function elsewhere.

I'll go ahead and do that.

sys/kern/kern_resource.c
1150 ↗(On Diff #11606)

Also, there is no need for #ifdef INVARIANTS around a single KASSERT(). That is redundant.

ngie retitled this revision from sys/kern/kern_resource.c: only expose lim_shared when INVARIANTS is enabled to mute -Wunused compiler warnings from clang to sys/kern/kern_resource.c: fold lim_shared into lim_copy to mute -Wunused compiler warnings from clang with !INVARIANTS.
ngie updated this object.
ngie marked an inline comment as done.
ngie added inline comments.
sys/kern/kern_resource.c
1143 ↗(On Diff #11612)

I'll have to double check whether or not this would result in a compiler error because it couldn't look up the symbol for lim_shared.

Both cases have been fixed by completely inlining lim_shared into lim_copy :).

ngie marked 2 inline comments as done.Dec 22 2015, 8:15 PM
kib added a reviewer: kib.
This revision is now accepted and ready to land.Dec 22 2015, 8:41 PM
This revision was automatically updated to reflect the committed changes.