On 08:35 Mon 16 May , Kelly O'Hair wrote: > > On May 16, 2011, at 7:23 AM, Dr Andrew John Hughes wrote: > > > I think the issue is actually having -Werror enabled for all builds, not > > just debug builds. Without that, these additional warnings would just be > > noise. Having -Werror on also causes problems just upgrading the version > > of gcc, regardless of distro-specific patching, as new warnings are > > introduced or old ones reclassified. > > > >> Andrew. > > > The code being compiled is different with debug vs. product builds due to > assert logic, so I consider it > important that all builds use -Werror if they use it at all. > > 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. 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. > But it only makes 100% sense when using the same compiler, same compiler > version, and on the same system. Which is extremely rare with HotSpot and the C++ compiler, but the first two are very likely for the Java code as the build uses its own javac in most cases. > For hotspot, you should be able to get rid of -Werror by setting > WARNINGS_ARE_ERRORS to empty. > Thanks for this, I wasn't aware of it. Are these flags documented somewhere? I keep seeming to find out about new ones randomly in e-mails. > I've wondered if we need to put a little more smarts in determining what > situations (compiler&os) warrant > adding the -Werror, but at the same time if it is a valid warning, maybe the > behavior we have is right. > So my attitude up to this time has been that new ports should use > WARNINGS_ARE_ERRORS= > to start, but eventually they should fix these warnings before a port is > finished. > (And I use the term 'port' very loosely here, a new version of gcc is a port > to me). > I'd go for using the version checking that's already in the build system, and only turning on Werror if gcc/g++ matches the version that's been tested against. Even then, there may be platform-dependent differences. snip... > > -kto > -- 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