8210920: Native C++ tests are not using CXXFLAGS
authorihse
Thu, 20 Sep 2018 08:59:03 +0200
changeset 51814 43668e3cae4d
parent 51813 cfa50d6a6fba
child 51815 d23d7389142f
8210920: Native C++ tests are not using CXXFLAGS Reviewed-by: tbell, erikj
make/autoconf/flags-cflags.m4
make/autoconf/flags-ldflags.m4
make/autoconf/spec.gmk.in
make/common/TestFilesCompilation.gmk
--- a/make/autoconf/flags-cflags.m4	Wed Sep 19 20:07:02 2018 -0400
+++ b/make/autoconf/flags-cflags.m4	Thu Sep 20 08:59:03 2018 +0200
@@ -386,17 +386,6 @@
 	IF_FALSE: [FDLIBM_CFLAGS=""])
   fi
   AC_SUBST(FDLIBM_CFLAGS)
-
-  # Tests are only ever compiled for TARGET
-  CFLAGS_TESTLIB="$CFLAGS_JDKLIB"
-  CXXFLAGS_TESTLIB="$CXXFLAGS_JDKLIB"
-  CFLAGS_TESTEXE="$CFLAGS_JDKEXE"
-  CXXFLAGS_TESTEXE="$CXXFLAGS_JDKEXE"
-
-  AC_SUBST(CFLAGS_TESTLIB)
-  AC_SUBST(CFLAGS_TESTEXE)
-  AC_SUBST(CXXFLAGS_TESTLIB)
-  AC_SUBST(CXXFLAGS_TESTEXE)
 ])
 
 ################################################################################
--- a/make/autoconf/flags-ldflags.m4	Wed Sep 19 20:07:02 2018 -0400
+++ b/make/autoconf/flags-ldflags.m4	Thu Sep 20 08:59:03 2018 +0200
@@ -51,9 +51,7 @@
 
   FLAGS_SETUP_LDFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
 
-  LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
-  LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE ${TARGET_LDFLAGS_JDK_LIBPATH}"
-  AC_SUBST(LDFLAGS_TESTLIB)
+  LDFLAGS_TESTEXE="${TARGET_LDFLAGS_JDK_LIBPATH}"
   AC_SUBST(LDFLAGS_TESTEXE)
 ])
 
--- a/make/autoconf/spec.gmk.in	Wed Sep 19 20:07:02 2018 -0400
+++ b/make/autoconf/spec.gmk.in	Thu Sep 20 08:59:03 2018 +0200
@@ -488,11 +488,6 @@
 LIBCXX:=@LIBCXX@
 
 # Compiler and linker flags used when building native tests
-CFLAGS_TESTLIB:=@CFLAGS_TESTLIB@
-CXXFLAGS_TESTLIB:=@CXXFLAGS_TESTLIB@
-CFLAGS_TESTEXE:=@CFLAGS_TESTEXE@
-CXXFLAGS_TESTEXE:=@CXXFLAGS_TESTEXE@
-LDFLAGS_TESTLIB:=@LDFLAGS_TESTLIB@
 LDFLAGS_TESTEXE:=@LDFLAGS_TESTEXE@
 
 # BUILD_CC/BUILD_LD is a compiler/linker that generates code that is runnable on the
--- a/make/common/TestFilesCompilation.gmk	Wed Sep 19 20:07:02 2018 -0400
+++ b/make/common/TestFilesCompilation.gmk	Thu Sep 20 08:59:03 2018 +0200
@@ -60,14 +60,16 @@
   ifeq ($$($1_TYPE), LIBRARY)
     $1_PREFIX = lib
     $1_OUTPUT_SUBDIR := lib
-    $1_CFLAGS += $(CFLAGS_TESTLIB)
-    $1_LDFLAGS := $(LDFLAGS_TESTLIB) $(call SET_SHARED_LIBRARY_ORIGIN)
+    $1_BASE_CFLAGS := $(CFLAGS_JDKLIB)
+    $1_BASE_CXXFLAGS := $(CXXFLAGS_JDKLIB)
+    $1_LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN)
     $1_COMPILATION_TYPE := LIBRARY
   else ifeq ($$($1_TYPE), PROGRAM)
     $1_PREFIX = exe
     $1_OUTPUT_SUBDIR := bin
-    $1_CFLAGS += $(CFLAGS_TESTEXE)
-    $1_LDFLAGS := $(LDFLAGS_TESTEXE)
+    $1_BASE_CFLAGS := $(CFLAGS_JDKEXE)
+    $1_BASE_CXXFLAGS := $(CXXFLAGS_JDKEXE)
+    $1_LDFLAGS := $(LDFLAGS_JDKEXE) $(LDFLAGS_TESTEXE)
     $1_COMPILATION_TYPE := EXECUTABLE
   else
     $$(error Unknown type: $$($1_TYPE))
@@ -92,8 +94,11 @@
         INCLUDE_FILES := $$(notdir $$(file)), \
         OBJECT_DIR := $$($1_OUTPUT_DIR)/support/$$(name), \
         OUTPUT_DIR := $$($1_OUTPUT_DIR)/$$($1_OUTPUT_SUBDIR), \
-        CFLAGS := $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
+        CFLAGS := $$($1_BASE_CFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
+        CXXFLAGS := $$($1_BASE_CXXFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
         LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$(name)), \
+        DISABLED_WARNINGS_CXX_solstudio := wvarhidenmem, \
+        DISABLED_WARNINGS_CXX_gcc := format, \
         LIBS := $$($1_LIBS_$$(name)), \
         TOOLCHAIN := $(if $$(filter %.cpp, $$(file)), TOOLCHAIN_LINK_CXX, TOOLCHAIN_DEFAULT), \
         OPTIMIZATION := $$(if $$($1_OPTIMIZATION_$$(name)),$$($1_OPTIMIZATION_$$(name)),LOW), \