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
F167920939: D4683.id11617.diff
Tue, Aug 25, 10:49 AM
Unknown Object (File)
Mon, Aug 24, 6:08 AM
Unknown Object (File)
Sun, Aug 23, 9:40 PM
Unknown Object (File)
Sun, Aug 23, 2:42 PM
Unknown Object (File)
Sat, Aug 22, 11:12 AM
Unknown Object (File)
Sat, Aug 22, 6:07 AM
Unknown Object (File)
Fri, Aug 21, 6:06 AM
Unknown Object (File)
Jul 18 2026, 9:09 PM
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.