RFR(XS): 8043029: Change 8037816 breaks HS build with older GCC versions which don't support diagnostic pragmas
Volker Simonis
volker.simonis at gmail.com
Tue May 13 19:32:09 UTC 2014
Hi,
Change 8037816 introduced extra format checking by GCC for custom HS
printf functions by annotating them with
__attribute__((format(printf,...)). These checks have been selectively
disabled with the help of diagnostic pragmas (i.e. #pragma GCC
diagnostic ignored "-Wformat-nonliteral") in places where these
functions are called with non-constant format strings.
Unfortunately, diagnostic pragmas were only introduced in GCC 4.2 (see
http://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas).
Older GCC versions simply ignore these pragmas and issue a warning.
The fix to this problem is trivial - only enable
'__attribute__((format(printf,...))'-annotations for GCC 4.2 and
above:
http://cr.openjdk.java.net/~simonis/webrevs/8043029/
https://bugs.openjdk.java.net/browse/JDK-8043029
Additionally to the before-mentioned fix, I have also improved the
version checking for the definition of the various diagnostic pragmas.
In the original version they would have only been enabled for
__GNUC_MINOR__ versions greater and equal '6' but nor for GCC 5.0 for
example. And I've also tried to break some of the overly long lines to
make them more readable.
Thank you and best regards,
Volker
PS: as always, I kindly ask for a sponsor to push the change once it
is reviewed :)
More information about the hotspot-dev
mailing list