Date: Thu, 3 Nov 2011 19:03:12 +0000 From: Alexander Best <arundel@freebsd.org> To: Dimitry Andric <dim@FreeBSD.org> Cc: freebsd-toolchain@freebsd.org Subject: Re: state of clang(1)'s -Wshift-count-negative and -Wshift-overflow warnings Message-ID: <20111103190312.GA6709@freebsd.org> In-Reply-To: <4EB2AF08.9010806@FreeBSD.org> References: <20111103104523.GA30132@freebsd.org> <4EB2AF08.9010806@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu Nov 3 11, Dimitry Andric wrote: > On 2011-11-03 11:45, Alexander Best wrote: > ... > > /usr/git-freebsd-head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c:36:3: warning: signed shift result (0x200000000) requires 35 bits to represent, but 'int' only has 32 bits [-Wshift-overflow] > > OS_REG_RMW_FIELD(ah, AR_SCR, AR_SCR_SLE, AR_SCR_SLE_ALLOW); > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > /usr/git-freebsd-head/sys/dev/ath/ath_hal/ah_internal.h:471:42: note: expanded from macro 'OS_REG_RMW_FIELD' > > (OS_REG_READ(_a, _r) &~ (_f)) | (((_v) << _f##_S) & (_f))) > > ^ > > /usr/git-freebsd-head/sys/dev/ath/ah_osdep.h:127:49: note: expanded from macro 'OS_REG_WRITE' > > (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val)) > > > > iirc, back then, it was labeled as a clang bug. however testing with clang tot, > > i still get those warnings. so i just wanted to ask again, whether the warnings > > are really bogus, or if these warnings actually indicate issues during > > shifting? > > Those warnings are bogus, and due to this bug: > > http://llvm.org/bugs/show_bug.cgi?id=10030 > > Unfortunately, it is still not fixed for the 3.0 release branch, and I > don't expect it will be fixed for the actual release. thanks for the info. so how about something like diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index a0a595f..3cb13de 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -1,12 +1,28 @@ # $FreeBSD$ # -# Warning flags for compiling the kernel and components of the kernel: +# XXX Disable bogus llvm warnings, complaining about perfectly valid shifts. +# See http://llvm.org/bugs/show_bug.cgi?id=10030 for more details. +# +.if ${CC:T:Mclang} == "clang" +NOSHIFTWARNS= -Wno-shift-count-negative -Wno-shift-count-overflow \ + -Wno-shift-overflow +.endif + ...and then add ${NOSHIFTWARNS} to the end of CWARNFLAGS? cheers. alex
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111103190312.GA6709>