Page MenuHomeFreeBSD

suppress set but not used warnings for kernel builds
ClosedPublic

Authored by rew on Apr 4 2022, 11:46 PM.

Details

Summary

Turn off set but not used warnings for kernel builds with clang13.

These warnings can be turned back on by setting the following in src.conf:

WITH_SET_BUT_NOTUSED_KERNEL_WARNINGS=

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

rew requested review of this revision.Apr 4 2022, 11:46 PM
imp requested changes to this revision.Apr 5 2022, 12:07 AM

this breaks boostrapping

sys/conf/kmod.mk
119 ↗(On Diff #104593)

use ${NO_WUNUSED_BUT_SET_VARIABLE} instead.

This revision now requires changes to proceed.Apr 5 2022, 12:07 AM

feedback from imp: use ${NO_WUNUSED_BUT_SET_VARIABLE}

I have ~65 changes in my queue to eliminate all the trivial errors for the arm kernel build.
I plan on pushing them shortly, and there may be some overlap with your work, but I've finished universe with them...

This revision is now accepted and ready to land.Apr 5 2022, 2:51 AM

Modules get built even if particular code is built-in into the kernel, artificially raising the clang spam.

The fix would be to stop building said modules to begin with.

Taking this review in a different direction..

Build kernel with -Wno-unused-but-set-variable by default.

This revision now requires review to proceed.Apr 5 2022, 6:41 PM
rew retitled this revision from suppress set but not used warnings for kernel modules to suppress set but not used warnings for kernel builds.Apr 5 2022, 6:49 PM
rew edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Apr 5 2022, 7:04 PM
imp added inline comments.
sys/conf/kern.mk
46

I'd be tempted to merge just this one line to stable/13 and not make it an option there.

sys/conf/kern.mk
46

agreed.

...wonder if it'd be better to drop the option now?

just commit and mess with it later