8074859: Turn on warnings as error
Reviewed-by: erikj
This commit is contained in:
parent
bd394344b3
commit
7ec9ed5041
@ -231,7 +231,6 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
|
|||||||
|
|
||||||
AC_SUBST(C_FLAG_REORDER)
|
AC_SUBST(C_FLAG_REORDER)
|
||||||
AC_SUBST(CXX_FLAG_REORDER)
|
AC_SUBST(CXX_FLAG_REORDER)
|
||||||
AC_SUBST(SHARED_LIBRARY_FLAGS)
|
|
||||||
AC_SUBST(SET_EXECUTABLE_ORIGIN)
|
AC_SUBST(SET_EXECUTABLE_ORIGIN)
|
||||||
AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
|
AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
|
||||||
AC_SUBST(SET_SHARED_LIBRARY_NAME)
|
AC_SUBST(SET_SHARED_LIBRARY_NAME)
|
||||||
@ -900,6 +899,24 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
|
|||||||
[COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
|
[COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
|
||||||
AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
|
AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
|
||||||
|
[do not consider native warnings to be an error @<:@enabled@:>@])])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([if native warnings are errors])
|
||||||
|
if test "x$enable_warnings_as_errors" = "xyes"; then
|
||||||
|
AC_MSG_RESULT([yes (explicitely set)])
|
||||||
|
WARNINGS_AS_ERRORS=true
|
||||||
|
elif test "x$enable_warnings_as_errors" = "xno"; then
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
WARNINGS_AS_ERRORS=false
|
||||||
|
elif test "x$enable_warnings_as_errors" = "x"; then
|
||||||
|
AC_MSG_RESULT([yes (default)])
|
||||||
|
WARNINGS_AS_ERRORS=true
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument])
|
||||||
|
fi
|
||||||
|
AC_SUBST(WARNINGS_AS_ERRORS)
|
||||||
|
|
||||||
case "${TOOLCHAIN_TYPE}" in
|
case "${TOOLCHAIN_TYPE}" in
|
||||||
microsoft)
|
microsoft)
|
||||||
DISABLE_WARNING_PREFIX="-wd"
|
DISABLE_WARNING_PREFIX="-wd"
|
||||||
|
@ -684,6 +684,7 @@ ZIP_DEBUGINFO_FILES
|
|||||||
ENABLE_DEBUG_SYMBOLS
|
ENABLE_DEBUG_SYMBOLS
|
||||||
CFLAGS_WARNINGS_ARE_ERRORS
|
CFLAGS_WARNINGS_ARE_ERRORS
|
||||||
DISABLE_WARNING_PREFIX
|
DISABLE_WARNING_PREFIX
|
||||||
|
WARNINGS_AS_ERRORS
|
||||||
COMPILER_SUPPORTS_TARGET_BITS_FLAG
|
COMPILER_SUPPORTS_TARGET_BITS_FLAG
|
||||||
ZERO_ARCHFLAG
|
ZERO_ARCHFLAG
|
||||||
LDFLAGS_TESTEXE_SUFFIX
|
LDFLAGS_TESTEXE_SUFFIX
|
||||||
@ -727,7 +728,6 @@ SET_SHARED_LIBRARY_MAPFILE
|
|||||||
SET_SHARED_LIBRARY_NAME
|
SET_SHARED_LIBRARY_NAME
|
||||||
SET_SHARED_LIBRARY_ORIGIN
|
SET_SHARED_LIBRARY_ORIGIN
|
||||||
SET_EXECUTABLE_ORIGIN
|
SET_EXECUTABLE_ORIGIN
|
||||||
SHARED_LIBRARY_FLAGS
|
|
||||||
CXX_FLAG_REORDER
|
CXX_FLAG_REORDER
|
||||||
C_FLAG_REORDER
|
C_FLAG_REORDER
|
||||||
SYSROOT_LDFLAGS
|
SYSROOT_LDFLAGS
|
||||||
@ -1086,6 +1086,7 @@ with_jtreg
|
|||||||
with_extra_cflags
|
with_extra_cflags
|
||||||
with_extra_cxxflags
|
with_extra_cxxflags
|
||||||
with_extra_ldflags
|
with_extra_ldflags
|
||||||
|
enable_warnings_as_errors
|
||||||
enable_debug_symbols
|
enable_debug_symbols
|
||||||
enable_zip_debug_info
|
enable_zip_debug_info
|
||||||
enable_native_coverage
|
enable_native_coverage
|
||||||
@ -1852,6 +1853,9 @@ Optional Features:
|
|||||||
--enable-rmiconnector-iiop
|
--enable-rmiconnector-iiop
|
||||||
enable the JMX RMIConnector iiop transport
|
enable the JMX RMIConnector iiop transport
|
||||||
[disabled]
|
[disabled]
|
||||||
|
--disable-warnings-as-errors
|
||||||
|
do not consider native warnings to be an error
|
||||||
|
[enabled]
|
||||||
--disable-debug-symbols disable generation of debug symbols [enabled]
|
--disable-debug-symbols disable generation of debug symbols [enabled]
|
||||||
--disable-zip-debug-info
|
--disable-zip-debug-info
|
||||||
disable zipping of debug-info files [enabled]
|
disable zipping of debug-info files [enabled]
|
||||||
@ -4359,7 +4363,7 @@ VS_SDK_PLATFORM_NAME_2013=
|
|||||||
#CUSTOM_AUTOCONF_INCLUDE
|
#CUSTOM_AUTOCONF_INCLUDE
|
||||||
|
|
||||||
# Do not change or remove the following line, it is needed for consistency checks:
|
# Do not change or remove the following line, it is needed for consistency checks:
|
||||||
DATE_WHEN_GENERATED=1430918902
|
DATE_WHEN_GENERATED=1431074105
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
@ -41761,7 +41765,6 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
||||||
CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
|
CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
|
||||||
CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
|
CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
|
||||||
@ -42471,6 +42474,31 @@ $as_echo "$supports" >&6; }
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Check whether --enable-warnings-as-errors was given.
|
||||||
|
if test "${enable_warnings_as_errors+set}" = set; then :
|
||||||
|
enableval=$enable_warnings_as_errors;
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if native warnings are errors" >&5
|
||||||
|
$as_echo_n "checking if native warnings are errors... " >&6; }
|
||||||
|
if test "x$enable_warnings_as_errors" = "xyes"; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (explicitely set)" >&5
|
||||||
|
$as_echo "yes (explicitely set)" >&6; }
|
||||||
|
WARNINGS_AS_ERRORS=true
|
||||||
|
elif test "x$enable_warnings_as_errors" = "xno"; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
$as_echo "no" >&6; }
|
||||||
|
WARNINGS_AS_ERRORS=false
|
||||||
|
elif test "x$enable_warnings_as_errors" = "x"; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5
|
||||||
|
$as_echo "yes (default)" >&6; }
|
||||||
|
WARNINGS_AS_ERRORS=true
|
||||||
|
else
|
||||||
|
as_fn_error $? "--enable-warnings-as-errors accepts no argument" "$LINENO" 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
case "${TOOLCHAIN_TYPE}" in
|
case "${TOOLCHAIN_TYPE}" in
|
||||||
microsoft)
|
microsoft)
|
||||||
DISABLE_WARNING_PREFIX="-wd"
|
DISABLE_WARNING_PREFIX="-wd"
|
||||||
|
@ -321,6 +321,9 @@ CXX_FLAG_DEPS:=@CXX_FLAG_DEPS@
|
|||||||
DISABLE_WARNING_PREFIX := @DISABLE_WARNING_PREFIX@
|
DISABLE_WARNING_PREFIX := @DISABLE_WARNING_PREFIX@
|
||||||
CFLAGS_WARNINGS_ARE_ERRORS:=@CFLAGS_WARNINGS_ARE_ERRORS@
|
CFLAGS_WARNINGS_ARE_ERRORS:=@CFLAGS_WARNINGS_ARE_ERRORS@
|
||||||
|
|
||||||
|
# A global flag (true or false) determining if native warnings are considered errors.
|
||||||
|
WARNINGS_AS_ERRORS := @WARNINGS_AS_ERRORS@
|
||||||
|
|
||||||
CFLAGS_CCACHE:=@CFLAGS_CCACHE@
|
CFLAGS_CCACHE:=@CFLAGS_CCACHE@
|
||||||
|
|
||||||
# Tools that potentially need to be cross compilation aware.
|
# Tools that potentially need to be cross compilation aware.
|
||||||
@ -394,9 +397,6 @@ STRIP:=@STRIP@
|
|||||||
|
|
||||||
LIPO:=@LIPO@
|
LIPO:=@LIPO@
|
||||||
|
|
||||||
# Command to create a shared library
|
|
||||||
SHARED_LIBRARY_FLAGS:=@SHARED_LIBRARY_FLAGS@
|
|
||||||
|
|
||||||
# Options to linker to specify a mapfile.
|
# Options to linker to specify a mapfile.
|
||||||
# (Note absence of := assignment, because we do not want to evaluate the macro body here)
|
# (Note absence of := assignment, because we do not want to evaluate the macro body here)
|
||||||
SET_SHARED_LIBRARY_MAPFILE=@SET_SHARED_LIBRARY_MAPFILE@
|
SET_SHARED_LIBRARY_MAPFILE=@SET_SHARED_LIBRARY_MAPFILE@
|
||||||
|
@ -267,7 +267,9 @@ else # HAS_SPEC=true
|
|||||||
( cd $(TOPDIR) && \
|
( cd $(TOPDIR) && \
|
||||||
$(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
|
$(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
|
||||||
-j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
|
-j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
|
||||||
$(PARALLEL_TARGETS) )
|
$(PARALLEL_TARGETS) || \
|
||||||
|
( exitcode=$$? && $(BUILD_LOG_WRAPPER) $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" && \
|
||||||
|
$(PRINTF) "Hint: If caused by a warning, try configure --disable-warnings-as-errors \n\n" && exit $$exitcode ) )
|
||||||
$(call CleanupSmartJavac)
|
$(call CleanupSmartJavac)
|
||||||
$(call StopGlobalTimer)
|
$(call StopGlobalTimer)
|
||||||
$(call ReportBuildTimes)
|
$(call ReportBuildTimes)
|
||||||
|
@ -487,6 +487,21 @@ define SetupNativeCompilationBody
|
|||||||
$1_EXTRA_CXXFLAGS += $$(addprefix $(DISABLE_WARNING_PREFIX), $$($1_DISABLED_WARNINGS_$(TOOLCHAIN_TYPE)))
|
$1_EXTRA_CXXFLAGS += $$(addprefix $(DISABLE_WARNING_PREFIX), $$($1_DISABLED_WARNINGS_$(TOOLCHAIN_TYPE)))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Check if warnings should be considered errors.
|
||||||
|
# Pick first binary and toolchain specific, then binary specific, then general setting.
|
||||||
|
ifeq ($$($1_WARNINGS_AS_ERRORS_$(TOOLCHAIN_TYPE)),)
|
||||||
|
ifeq ($$($1_WARNINGS_AS_ERRORS),)
|
||||||
|
$1_WARNINGS_AS_ERRORS_$(TOOLCHAIN_TYPE) := $$(WARNINGS_AS_ERRORS)
|
||||||
|
else
|
||||||
|
$1_WARNINGS_AS_ERRORS_$(TOOLCHAIN_TYPE) := $$($1_WARNINGS_AS_ERRORS)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($$($1_WARNINGS_AS_ERRORS_$(TOOLCHAIN_TYPE)), true)
|
||||||
|
$1_EXTRA_CFLAGS += $(CFLAGS_WARNINGS_ARE_ERRORS)
|
||||||
|
$1_EXTRA_CXXFLAGS += $(CFLAGS_WARNINGS_ARE_ERRORS)
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq (NONE, $$($1_OPTIMIZATION))
|
ifeq (NONE, $$($1_OPTIMIZATION))
|
||||||
$1_EXTRA_CFLAGS += $(C_O_FLAG_NONE)
|
$1_EXTRA_CFLAGS += $(C_O_FLAG_NONE)
|
||||||
$1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_NONE)
|
$1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_NONE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user