RFR: 8030350: Enable additional compiler warnings for GCC

Mike Duigou mike.duigou at oracle.com
Wed Dec 18 00:08:03 UTC 2013


Hello all;

This is a change which enables additional compiler warnings for native compilation when using GCC. The (-Wformat -Wformat-security) options are supported by GCC 3.0.4 (the earliest version I checked, c. February 2002) and later so we shouldn't see issues with incompatibility.- Wextra appears to have been added in GCC 3.4.X line (c. 2004) so it should also be reasonably well adopted and replaces -W.

The core of the change is to add :

-Wextra -Wno-unused-parameter -Wformat -Wformat-security 

for general C and CC++ compilations. For HotSpot C++ compiles a slightly less aggressive set is used:

-Wformat -Wformat-security 

is used. 

Webrev here:

http://cr.openjdk.java.net/~mduigou/JDK-8030350/0/webrev/

For the curious, yes, the additional checks do generate additional warnings. ;-)

This change is targeted at the JDK 9 repos but could be backported to JDK 8 fairly easily/safely.

Mike




More information about the build-dev mailing list