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.

But it only makes 100% sense when using the same compiler, same compiler 
version, and on the same system.
For hotspot, you should be able to get rid of -Werror  by setting 
WARNINGS_ARE_ERRORS to empty.

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've been involved in running some of the commercial static analysis tools and 
seeing what
they complain about, and there is an overlap between some of the compiler 
warnings and what
these tools are spitting out as 'critical issues'.
I find it amusing that a 20+ year old C/C++ compiler might have been issuing 
warnings about some
questionable code for a long time, but it takes an expensive purchased static 
analysis tool to say the
same thing and all of a sudden it's a "critical must fix issue".
In any case, I've always taken compiler warnings seriously, but the different 
behaviors between all
the different compiler implementations can be very frustrating when using 
options like -Werror.

-kto

Reply via email to