Build portability: enable or disable warnings

Dmitry Samersoff Dmitry.Samersoff at oracle.com
Mon May 16 16:50:34 UTC 2011


Andrew,

I guess we can add to build system something like

ALT_COMPILER_FLAGS

and turn on all warnings and -Werror by default.

Having zero-warning build is good practice and it's not too costly.

-Dmitry

On 2011-05-16 19:56, Andrew Haley wrote:
> On 05/16/2011 04:35 PM, 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.
>>
>> 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.
>
> The core problem here, I think, is that some warnings really would be
> hard errors by any reasonable measure, so you have to use -Werror.
> The example that tripped us up this time was totally innocuous,
> though.
>
> Andrew.


-- 
Dmitry Samersoff
Java Hotspot development team, SPB04
* There will come soft rains ...



More information about the build-dev mailing list