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
Unknown Object (File)
Tue, Jun 24, 9:49 PM
Unknown Object (File)
Wed, Jun 18, 2:22 AM
Unknown Object (File)
Mon, Jun 16, 8:56 AM
Unknown Object (File)
Jun 11 2025, 1:47 AM
Unknown Object (File)
Jun 3 2025, 8:10 AM
Unknown Object (File)
May 26 2025, 2:12 AM
Unknown Object (File)
May 16 2025, 12:59 AM
Unknown Object (File)
May 14 2025, 10:29 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.