Build portability: enable or disable warnings
Alan Bateman
Alan.Bateman at oracle.com
Thu May 19 09:32:33 UTC 2011
David Holmes wrote:
> :
>
>> 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.
>
> I think comparing C/C++ compiler warnings with javac compiler warnings
> is like comparing apples and elephants.
Yes, javac has -Werror and the build has JAVAC_WARNINGS_FATAL to turn it
on. I just checked my recent build of the jdk7/jdk7 forest and javac
emits a total of 9 warnings (7 are unsafe usages of varargs methods and
the other two are unreachable catch clauses). That isn't a lot but javac
doesn't have many warnings enabled by default. A nice project for
someone would be to change the build to -Werror by default and gradually
crank up the warnings listed by -Xlint.
-Alan.
More information about the build-dev
mailing list