[11u] RFR: 8234591: [11u] Build with old C compiler broken by 8223490

Hohensee, Paul hohensee at amazon.com
Thu Nov 21 15:50:43 UTC 2019


Good, and trivial.

Thanks,
Paul

On 11/21/19, 7:24 AM, "jdk-updates-dev on behalf of Doerr, Martin" <jdk-updates-dev-bounces at openjdk.java.net on behalf of martin.doerr at sap.com> wrote:

    Hi,
    
    I noticed that 11u-dev build with old C compilers broke by the backport (see headline) today.
    Such C compilers don't allow declarations in for loops:
    TimeZone_md.c:139:9: error: 'for' loop initial declarations are only allowed in C99 mode
             for (unsigned int i = 0; i < sizeof (popularZones) / sizeof (popularZones[0]); i++) {
    
    We can enable building with such compilers by this trivial fix:
    diff -r 4b221bce9367 src/java.base/unix/native/libjava/TimeZone_md.c
    --- a/src/java.base/unix/native/libjava/TimeZone_md.c   Tue Nov 12 16:13:16 2019 +0100
    +++ b/src/java.base/unix/native/libjava/TimeZone_md.c   Thu Nov 21 16:21:22 2019 +0100
    @@ -136,7 +136,8 @@
    
         if (strcmp(dir, ZONEINFO_DIR) == 0) {
             /* fast path for 1st iteration */
    -        for (unsigned int i = 0; i < sizeof (popularZones) / sizeof (popularZones[0]); i++) {
    +        unsigned int i;
    +        for (i = 0; i < sizeof (popularZones) / sizeof (popularZones[0]); i++) {
                 pathname = getPathName(dir, popularZones[i]);
                 if (pathname == NULL) {
                     continue;
    
    I'd like to fix it only in 11u.
    Please review.
    
    Best regards,
    Martin
    
    



More information about the jdk-updates-dev mailing list