Build portability: enable or disable warnings
Dr Andrew John Hughes
ahughes at redhat.com
Thu May 19 20:24:47 UTC 2011
On 09:47 Thu 19 May , David Holmes wrote:
> Dr Andrew John Hughes said the following on 05/19/11 05:29:
> > On 08:35 Mon 16 May , Kelly O'Hair wrote:
> <snip>
> >> The -Werror option is a blessing and a curse. I find it highly commendable that teams (like
> >> hotspot) have taken a 'no warnings allowed' approach to their code base, more teams should do this.
> >> Given the critical nature of a VM in the JDK, it only makes sense to take all precautions in verifying the code is correct.
> >>
> >
> > I find it quite interesting that the one situation where -Werror is used is where it's likely to hit
> > the most difficulties. The HotSpot code is compiled by three different compilers (gcc and whatever
> > is used on Solaris and Windows) and the version of these used can vary considerably, as the system C++ compiler
> > is unrelated to the JDK.
>
> Hotspot only uses -Werror with gcc. And its use predates the sudden
> plethora of compiler versions now used to build OpenJDK. In prior times
> the build compiler for a given release was set in stone so we knew what
> warnings (and bugs!) to expect.
Welcome to OpenJDK. You can't expect everyone compiling a FOSS project to
use one true compiler and no other. Sorry. That's just the reality, and
it's why we now have to reassess/amend these earlier choices.
> I believe we also disable problematic
> warnings when necessary. By using -Werror when we did update compiler
> versions we quickly discovered where the compiler was tightening the
> rules and issuing new warnings - then we could determine whether to fix
> the code (if practical) or disable the warning.
>
Indeed. All that's happening here is others are using these newer
compilers before the HotSpot developers at Oracle.
> > In contrast, there are basically two Java compilers in general use (javac and ecj)
> > and one is part of OpenJDK. Yet, the Java code does not have -Werror enabled by default and there
> > are a mass of warnings there as a result.
>
> I don't understand the point you are making here. Does javac even have a
> -Werror? The bulk of javac warnings stem from legacy code being compiled
> under newer compilers with new language features - the resulting code is
> not erroneous hence only a warning is issued.
>
It does. I'm unclear how anything you say here is different to the situation
with C/C++ compilers producing new warnings in new versions. If anything, OpenJDK
is leading the way with support for these new language features, so you'd expect
it to adopt them in its own codebase. As is, we're still getting warnings resulting
from features introduced in 2004.
> I think comparing C/C++ compiler warnings with javac compiler warnings
> is like comparing apples and elephants.
>
> David
> -----
>
--
Andrew :)
Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)
Support Free Java!
Contribute to GNU Classpath and IcedTea
http://www.gnu.org/software/classpath
http://icedtea.classpath.org
PGP Key: F5862A37 (https://keys.indymedia.org/)
Fingerprint = EA30 D855 D50F 90CD F54D 0698 0713 C3ED F586 2A37
More information about the build-dev
mailing list