RFR: JDK-8211029 Have a common set of enabled warnings for all native libraries

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Mon Sep 24 08:18:28 UTC 2018


With JDK-8210988, the foundation is in place for a more systematic way 
of handling warnings across all native libraries (hotspot and the JDK 
libraries alike).

With this patch, make sure we enable all warnings equally for all 
libaries. If an individual library triggers a specific warning, disable 
it in that library.

There was a single warning from clang in awt_Font.c (due to a very 
broken cast) that was not possible to turn off (unless -Wextra was 
turned off entirely), so I fixed the code instead.

I have tested that this compiles without warnings on all standard Oracle 
build platforms/toolchains. On top of that, I've also tested a variety 
of gcc's: 4.8.5, 5.5.0, 6.4.0 and 7.3.0 (the minor versions for each 
major versions shipped by Ubuntu). I've also tested clang 5.0 on linux, 
XCode 9.2 on macosx and Solaris Studio 12.6 on solaris. Even with such 
extensive testing, the nature of this fix which is to add the flags that 
turn on a broad range of suitable warnings (like -Wall), and then 
selectively disable individual warnings on individual libraries, there's 
a certain risk that some platform/toolchain combinations that used to 
compile without warnings, now start exhibiting warnings. If this should 
happen, the short-term workaround is to use "configure 
--disable-warnings-as-errors". The medium term fix is to disable the 
problematic warning in the library in question, and the long-term 
solution is (hopefully) to fix the code.

Bug: https://bugs.openjdk.java.net/browse/JDK-8211029
WebRev: 
http://cr.openjdk.java.net/~ihse/JDK-8211029-common-set-of-warnings/webrev.01

/Magnus




More information about the build-dev mailing list