Date: Sat, 5 Nov 2011 10:21:02 +0000 From: Alexander Best <arundel@freebsd.org> To: freebsd-toolchain@freebsd.org Subject: [poc] buildkernel + clang + -Werror Message-ID: <20111105102102.GA54596@freebsd.org>
next in thread | raw e-mail | index | archive | help
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: # # XXX The following options might indicate real problems and need to be # investigated: # array-bounds, conversion, format, format-security, shift-count-overflow, # and shift-overflow. # .if ${CC:T:Mclang} == "clang" WERROR?= -Werror -Wno-error=array-bounds -Wno-error=conversion \ -Wno-error=empty-body -Wno-error=format -Wno-error=format-extra-args \ -Wno-error=format-invalid-specifier -Wno-error=format-security \ -Wno-error=shift-count-negative -Wno-error=shift-count-overflow \ -Wno-error=shift-overflow -Wno-error=tautological-compare .else WERROR?= -Werror .endif a few drawbacks... 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. 3) the 'format-*' options are only necessary for clang tot, since it doesn't understand '-fformat-extensions'. if 1) and 2) can be fixed and the clang release that ships with HEAD can be used for compilation, the 'format-*' options can probably be removed. 4) as noted in the comment, a few flags might indicate *real* issues in the code. i've merely enabled these to prove that clang can in fact compile the src with -Werror being set. however these options probably shouldn't be set, but rather investigated. cheers. alex ps: maybe the vendor commits that fixed 1) and 2) could be imported into the the clang version in HEAD.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111105102102.GA54596>