8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
authorsla
Fri, 21 Mar 2014 09:35:43 +0100
changeset 23423 153d4b6b1124
parent 23171 56a45cb104d1
child 23424 65039fb99fda
8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries Reviewed-by: erikj, ihse
common/autoconf/flags.m4
common/autoconf/generated-configure.sh
common/autoconf/spec.gmk.in
--- a/common/autoconf/flags.m4	Fri Mar 14 13:16:46 2014 +0100
+++ b/common/autoconf/flags.m4	Fri Mar 21 09:35:43 2014 +0100
@@ -735,4 +735,20 @@
       [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
       [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
   AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
+
+  case "${TOOLCHAIN_TYPE}" in
+    microsoft)
+      CFLAGS_WARNINGS_ARE_ERRORS="/WX"
+      ;;
+    solstudio)
+      CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
+      ;;
+    gcc)
+      CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
+      ;;
+    clang)
+      CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
+      ;;
+  esac
+  AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
 ])
--- a/common/autoconf/generated-configure.sh	Fri Mar 14 13:16:46 2014 +0100
+++ b/common/autoconf/generated-configure.sh	Fri Mar 21 09:35:43 2014 +0100
@@ -673,6 +673,7 @@
 FIXPATH
 ZIP_DEBUGINFO_FILES
 ENABLE_DEBUG_SYMBOLS
+CFLAGS_WARNINGS_ARE_ERRORS
 COMPILER_SUPPORTS_TARGET_BITS_FLAG
 ZERO_ARCHFLAG
 LDFLAGS_CXX_JDK
@@ -4232,7 +4233,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1394794899
+DATE_WHEN_GENERATED=1395236071
 
 ###############################################################################
 #
@@ -41989,6 +41990,24 @@
 
 
 
+  case "${TOOLCHAIN_TYPE}" in
+    microsoft)
+      CFLAGS_WARNINGS_ARE_ERRORS="/WX"
+      ;;
+    solstudio)
+      CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
+      ;;
+    gcc)
+      CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
+      ;;
+    clang)
+      CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
+      ;;
+  esac
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: warnings are errors: $CFLAGS_WARNINGS_ARE_ERRORS" >&5
+$as_echo "warnings are errors: $CFLAGS_WARNINGS_ARE_ERRORS" >&6; }
+
 
 # Setup debug symbols (need objcopy from the toolchain for that)
 
--- a/common/autoconf/spec.gmk.in	Fri Mar 14 13:16:46 2014 +0100
+++ b/common/autoconf/spec.gmk.in	Fri Mar 21 09:35:43 2014 +0100
@@ -324,6 +324,8 @@
 C_FLAG_DEPS:=@C_FLAG_DEPS@
 CXX_FLAG_DEPS:=@CXX_FLAG_DEPS@
 
+CFLAGS_WARNINGS_ARE_ERRORS:=@CFLAGS_WARNINGS_ARE_ERRORS@
+
 # Tools that potentially need to be cross compilation aware.
 CC:=@FIXPATH@ @CCACHE@ @CC@