Date: Sat, 5 Nov 2011 20:38:46 +0000 From: Alexander Best <arundel@freebsd.org> To: Dimitry Andric <dim@FreeBSD.org> Cc: freebsd-toolchain@freebsd.org Subject: Re: [poc] buildkernel + clang + -Werror Message-ID: <20111105203846.GA37114@freebsd.org> In-Reply-To: <4EB58B1D.30705@FreeBSD.org> References: <20111105102102.GA54596@freebsd.org> <4EB58B1D.30705@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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: uint x; if (x < 0 | x > 256) this is correct code, yet clang will complain. so i think it's safe to set -Wno-error=tautological-compare 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] return HAL_EINVAL; ~~~~~~ ^~~~~~~~~~ 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. :( i got /usr/git-freebsd-head/sys/dev/sound/pcm/sound.c:85:2: error: invalid conversion specifier 'b' [-Werror,-Wformat-invalid-specifier] SNDSTAT_PREPARE_PCM_END(); ^~~~~~~~~~~~~~~~~~~~~~~~ although -Wno-error=format-invalid-specifier was specified. cheers. alex
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111105203846.GA37114>