[poc] buildkernel + clang + -Werror
arundel at freebsd.org
Sat Nov 5 20:38:46 UTC 2011
On Sat Nov 5 11, Dimitry Andric wrote:
> On 2011-11-05 11:21, Alexander Best wrote:
> > i'm sending this mail to the mailinglist simply to prevent my work being list.
> > i've experimented with the -Werror and -Wno-error= options and got to the point
> > where i was able to compile GENERIC on amd64 with clang:
> Why don't you just use NO_WERROR? If you are aiming to simply suppress
> warnings, that is a way simpler solution.
because setting NO_WERROR to certain -Wno-error= options will complain about
broken code, which gets committed. that way clang might be used for tinderbox,
whereas with NO_WERROR simply defined to nothing, broken or unclean commits
will not make tinderbox fail.
if we could set NO_WERROR to bogus -Wno-error= options, clang will then only
error out with *real* bugs.
> The code that causes the warnings should simply be fixed, unless it is
> the contrib area, and would make merging harder, or if the warnings are
> false positives.
but lets take the follwing case:
if (x < 0 | x > 256)
this is correct code, yet clang will complain. so i think it's safe to set
on the other hand
/usr/git-freebsd-head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c:577:24: warning: implicit conversion from enumeration type 'HAL_STATUS' to different enumeration type 'HAL_BOOL' [-Wconversion]
1 warning generated.
might be a problem, so -Wno-error=conversion should not be set and the case
should be fixed inside the code.
> Only in the latter case, and only if clang cannot be fixed right now
> (such as with the ?: operator problem), there should be a workaround.
> And even then as local as possible, so share/mk/*.mk is not the right
> place to add a fix.
> > 1) this will only work with clang tot, since the clang version that ships with
> > HEAD atm doesn't understand 'shift-count-negative'; it is being implied by
> > -Werror and cannot be turned off seperately.
> > 2) there is a bug in the clang version that ships with HEAD, where -Wno-error=X
> > implies -WX. this is not correct (see gcc(1) man page) and was fixed in
> > clang tot.
> I'll have a look if it's possible to import these. Since head now has
> clang from the 3.0 release branch, and the idea is to ship FreeBSD 9.0
> with the 3.0 release, or something as close as possible to it, I don't
> plan on importing clang trunk anytime soon.
unfortunately latest clang tot is broken again. :(
/usr/git-freebsd-head/sys/dev/sound/pcm/sound.c:85:2: error: invalid conversion specifier 'b' [-Werror,-Wformat-invalid-specifier]
although -Wno-error=format-invalid-specifier was specified.
More information about the freebsd-toolchain