Skip to content

Commit

Permalink
Augment --disable-warnings-as-errors for clang >= 14.x.y
Browse files Browse the repository at this point in the history
  • Loading branch information
vieiro committed Nov 25, 2024
1 parent 0a5ecb0 commit c8aa170
Showing 8 changed files with 9 additions and 34 deletions.
24 changes: 7 additions & 17 deletions make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
@@ -142,23 +142,6 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],

AC_DEFUN([FLAGS_SETUP_WARNINGS],
[
AC_ARG_ENABLE([xcode14], [AS_HELP_STRING([--enable-xcode14],
[add additional CFLAGS for compiling with XCode 14 toolset @<:@enabled@:>@])])
# Set default values
CFLAGS_XCODE14_DEPR_DECLARATIONS=""
CFLAGS_XCODE14_DEPR_NON_PROTOTYPE=""
if test "x$enable_xcode14" = "xyes"; then
if test "x$OPENJDK_BUILD_OS" != "xmacosx"; then
AC_MSG_ERROR([--enable-xcode14 can only be set if building on macosx])
fi
CFLAGS_XCODE14_DEPR_DECLARATIONS="-Wno-deprecated-declarations"
CFLAGS_XCODE14_DEPR_NON_PROTOTYPE="-Wno-deprecated-non-prototype"
AC_MSG_RESULT([Building on macosx with XCode 14 flags])
fi
AC_SUBST(CFLAGS_XCODE14_DEPR_DECLARATIONS)
AC_SUBST(CFLAGS_XCODE14_DEPR_NON_PROTOTYPE)
AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
[do not consider native warnings to be an error @<:@enabled@:>@])])
@@ -226,6 +209,13 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
WARNINGS_ENABLE_ADDITIONAL_JVM="-Wpointer-arith -Wsign-compare -Wunused-function -Wundef -Wunused-value -Woverloaded-virtual"
DISABLED_WARNINGS="unused-parameter unused"
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
CLANG_VERSION_MAJOR=`echo $CLANG_VERSION_NUMBER | awk -F. '{print $1}'`
# Add "-Wno-deprecated-declarations" and "-Wno-deprecated-non-prototype" on macosx/clang >= 14.x.y
if [ "0$CLANG_VERSION_MAJOR" -gt 13 ]; then
DISABLED_WARNINGS="unused-parameter unused deprecated-declarations deprecated-non-prototype"
fi
fi
;;
xlc)
2 changes: 0 additions & 2 deletions make/autoconf/spec.gmk.in
Original file line number Diff line number Diff line change
@@ -772,8 +772,6 @@ JT_HOME:=@JT_HOME@
JTREGEXE:=@JTREGEXE@
JIB_HOME:=@JIB_HOME@
XCODEBUILD=@XCODEBUILD@
CFLAGS_XCODE14_DEPR_DECLARATIONS=@CFLAGS_XCODE14_DEPR_DECLARATIONS@
CFLAGS_XCODE14_DEPR_NON_PROTOTYPE=@CFLAGS_XCODE14_DEPR_NON_PROTOTYPE@
DTRACE := @DTRACE@
FIXPATH := @FIXPATH@
FIXPATH_BASE := @FIXPATH_BASE@
2 changes: 0 additions & 2 deletions make/hotspot/gensrc/GensrcAdlc.gmk
Original file line number Diff line number Diff line change
@@ -43,8 +43,6 @@ ifeq ($(call check-jvm-feature, compiler2), true)
else ifeq ($(call isBuildOs, aix), true)
ADLC_LDFLAGS := -q64
ADLC_CFLAGS := -qnortti -qeh -q64 -DAIX
else ifeq ($(call isBuildOs, macosx), true)
ADLC_CFLAGS := $(CFLAGS_XCODE14_DEPR_DECLARATIONS)
else ifeq ($(call isBuildOs, windows), true)
ADLC_LDFLAGS := -nologo
ADLC_CFLAGS := -nologo -EHsc
2 changes: 1 addition & 1 deletion make/launcher/Launcher-jdk.pack.gmk
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ $(eval $(call SetupJdkExecutable, BUILD_UNPACKEXE, \
CFLAGS_release := -DPRODUCT, \
CFLAGS_linux := -fPIC, \
CFLAGS_solaris := -KPIC, \
CFLAGS_macosx := -fPIC $(CFLAGS_XCODE14_DEPR_DECLARATIONS), \
CFLAGS_macosx := -fPIC, \
LDFLAGS := $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \
6 changes: 1 addition & 5 deletions make/lib/Awt2dLibraries.gmk
Original file line number Diff line number Diff line change
@@ -208,10 +208,6 @@ ifeq ($(call isTargetOs, linux), true)
LIBAWT_CFLAGS += $(EXPORT_ALL_SYMBOLS)
endif

ifeq ($(call isBuildOs, macosx), true)
LIBAWT_CFLAGS += $(CFLAGS_XCODE14_DEPR_NON_PROTOTYPE)
endif

# Turn off all warnings for debug_mem.c This is needed because the specific warning
# about initializing a declared 'extern' cannot be turned off individually. Only
# applies to debug builds.
@@ -935,7 +931,7 @@ ifeq ($(call isTargetOs, macosx), true)
libosxapp \
#

LIBAWT_LWAWT_CFLAGS := $(X_CFLAGS) $(X_LIBS) $(CFLAGS_XCODE14_DEPR_NON_PROTOTYPE)
LIBAWT_LWAWT_CFLAGS := $(X_CFLAGS) $(X_LIBS)

LIBAWT_LWAWT_EXFILES := fontpath.c awt_Font.c X11Color.c
LIBAWT_LWAWT_EXCLUDES := $(TOPDIR)/src/$(MODULE)/unix/native/common/awt/medialib
1 change: 0 additions & 1 deletion make/lib/Lib-java.desktop.gmk
Original file line number Diff line number Diff line change
@@ -65,7 +65,6 @@ ifeq ($(call isTargetOs, aix), false)
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJSOUND_CFLAGS), \
CFLAGS_macosx := $(CFLAGS_XCODE14_DEPR_DECLARATIONS), \
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
1 change: 0 additions & 1 deletion make/lib/Lib-jdk.pack.gmk
Original file line number Diff line number Diff line change
@@ -35,7 +35,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBUNPACK, \
CFLAGS := $(CXXFLAGS_JDKLIB) \
-DNO_ZLIB -DUNPACK_JNI -DFULL, \
CFLAGS_release := -DPRODUCT, \
CFLAGS_macosx := $(CFLAGS_XCODE14_DEPR_DECLARATIONS), \
EXTRA_HEADER_DIRS := $(call GetJavaHeaderDir, java.base), \
DISABLED_WARNINGS_gcc := implicit-fallthrough, \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
5 changes: 0 additions & 5 deletions make/test/JtregNativeHotspot.gmk
Original file line number Diff line number Diff line change
@@ -146,11 +146,6 @@ endif

JVMTI_COMMON_INCLUDES=-I$(TOPDIR)/test/lib/jdk/test/lib/jvmti

ifeq ($(call isBuildOs, macosx), true)
NSK_AOD_INCLUDES += $(CFLAGS_XCODE14_DEPR_DECLARATIONS)
JVMTI_COMMON_INCLUDES += $(CFLAGS_XCODE14_DEPR_DECLARATIONS)
endif

BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libNoFramePointer := $(NO_FRAMEPOINTER_CFLAGS)
# Optimization -O3 needed, HIGH == -O3
BUILD_HOTSPOT_JTREG_LIBRARIES_OPTIMIZATION_libNoFramePointer := HIGH

0 comments on commit c8aa170

Please sign in to comment.