[8u] C++ flags get passed to C compiles in the HotSpot build

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • None
    • Affects Version/s: openjdk8u
    • Component/s: infrastructure
    • None
    • Fix Understood
    • generic
    • generic

      Both C and C++ compiles in the legacy HotSpot build still used by 8u take the same set of flags. So -std=gnu++98 ends up getting passed to the C compiler where it makes no sense.

      In gcc, this has been throwing a warning for a long time:

      cc1: warning: command line option '-std=gnu++98' is valid for C++/ObjC++ but not for C

      With clang builds, this is instead an error.

      2026-01-09T18:17:34.1713580Z error: invalid argument '-std=gnu++98' not allowed with 'C'

      This escalates the problem for newer MacOS builds which need the -std flag for the C++ code to compile. Otherwise, it is assumed to be C++11 code e.g.

      g1BlockOffsetTable.inline.hpp:55:57: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]

      The same issue causes the build to fail with clang on Linux too (tested locally)

      This only affects 8u as the HotSpot build in 9 and later uses the same infrastructure as the rest of the build.

            Assignee:
            Andrew Hughes
            Reporter:
            Andrew Hughes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: