@@ -564,7 +564,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
564
564
TOOLCHAIN_CFLAGS="-errshort=tags"
565
565
566
566
TOOLCHAIN_CFLAGS_JDK="-mt $TOOLCHAIN_FLAGS"
567
- TOOLCHAIN_CFLAGS_JDK_CONLY="-xCC -Xa - W0,-noglobal $TOOLCHAIN_CFLAGS" # C only
567
+ TOOLCHAIN_CFLAGS_JDK_CONLY="-W0,-noglobal $TOOLCHAIN_CFLAGS" # C only
568
568
TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only
569
569
TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \
570
570
-library=stlport4 -mt -features=no%except $TOOLCHAIN_FLAGS"
@@ -585,6 +585,30 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
585
585
TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:wchar_t-"
586
586
fi
587
587
588
+ # CFLAGS C language level for JDK sources (hotspot only uses C++)
589
+ # Ideally we would have a common level across all toolchains so that all sources
590
+ # are sure to conform to the same standard. Unfortunately neither our sources nor
591
+ # our toolchains are in a condition to support that. But what we loosely aim for is
592
+ # C99 level.
593
+ if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xxlc; then
594
+ # This raises the language level for older 4.8 gcc, while lowering it for later
595
+ # versions. clang and xlclang support the same flag.
596
+ LANGSTD_CFLAGS="-std=c99"
597
+ elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
598
+ # We can't turn on -std=c99 without breaking compilation of the splashscreen/png
599
+ # utilities. But we can enable c99 as below (previously achieved by using -Xa).
600
+ # It is the no_lib that makes the difference.
601
+ LANGSTD_CFLAGS="-xc99=all,no_lib"
602
+ elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
603
+ # MSVC doesn't support C99/C11 explicitly, unless you compile as C++:
604
+ # LANGSTD_CFLAGS="/TP"
605
+ # but that requires numerous changes to the sources files. So we are limited
606
+ # to C89/C90 plus whatever extensions Visual Studio has decided to implement.
607
+ # This is the lowest bar for shared code.
608
+ LANGSTD_CFLAGS=""
609
+ fi
610
+ TOOLCHAIN_CFLAGS_JDK_CONLY="$LANGSTD_CFLAGS $TOOLCHAIN_CFLAGS_JDK_CONLY"
611
+
588
612
# CFLAGS WARNINGS STUFF
589
613
# Set JVM_CFLAGS warning handling
590
614
if test "x$TOOLCHAIN_TYPE" = xgcc; then
0 commit comments