changeset 51853:ec62d6cab037

8211029: Have a common set of enabled warnings for all native libraries Reviewed-by: erikj
author ihse
date Mon, 24 Sep 2018 19:26:48 +0200
parents e240625311ad
children 3c6d285c8168
files make/autoconf/flags-cflags.m4 make/common/TestFilesCompilation.gmk make/hotspot/gensrc/GensrcDtrace.gmk make/hotspot/lib/CompileJvm.gmk make/launcher/Launcher-jdk.pack.gmk make/launcher/LauncherCommon.gmk make/lib/Awt2dLibraries.gmk make/lib/CoreLibraries.gmk make/lib/Lib-java.base.gmk make/lib/Lib-java.desktop.gmk make/lib/Lib-java.instrument.gmk make/lib/Lib-java.security.jgss.gmk make/lib/Lib-jdk.crypto.cryptoki.gmk make/lib/Lib-jdk.crypto.ec.gmk make/lib/Lib-jdk.hotspot.agent.gmk make/lib/Lib-jdk.jdwp.agent.gmk make/lib/Lib-jdk.management.gmk make/lib/Lib-jdk.pack.gmk make/lib/Lib-jdk.sctp.gmk src/java.desktop/unix/native/common/awt/awt_Font.c
diffstat 20 files changed, 100 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/make/autoconf/flags-cflags.m4	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/autoconf/flags-cflags.m4	Mon Sep 24 19:26:48 2018 +0200
@@ -181,8 +181,12 @@
       DISABLE_WARNING_PREFIX="-Wno-"
       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
 
-      WARNINGS_ENABLE_ALL="-Wall -Wextra -Wformat=2"
-      WARNINGS_ENABLE_ADDITIONAL_JVM="-Wpointer-arith -Wsign-compare -Wunused-function -Wundef -Wunused-value -Woverloaded-virtual -Wreorder -Wreturn-type"
+      # Additional warnings that are not activated by -Wall and -Wextra
+      WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wsign-compare \
+          -Wunused-function -Wundef -Wunused-value -Wreturn-type"
+      WARNINGS_ENABLE_ADDITIONAL_CXX="-Woverloaded-virtual -Wreorder"
+      WARNINGS_ENABLE_ALL_CFLAGS="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL"
+      WARNINGS_ENABLE_ALL_CXXFLAGS="$WARNINGS_ENABLE_ALL_CFLAGS $WARNINGS_ENABLE_ADDITIONAL_CXX"
 
       DISABLED_WARNINGS="unused-parameter unused"
 
@@ -205,10 +209,18 @@
       DISABLE_WARNING_PREFIX="-Wno-"
       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
 
-      WARNINGS_ENABLE_ALL="-Wall -Wextra -Wformat=2"
-      WARNINGS_ENABLE_ADDITIONAL_JVM="-Wpointer-arith -Wsign-compare -Wunused-function -Wundef -Wunused-value -Woverloaded-virtual -Wreorder"
+      # Additional warnings that are not activated by -Wall and -Wextra
+      WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wsign-compare -Wreorder \
+          -Wunused-function -Wundef -Wunused-value -Woverloaded-virtual"
+      WARNINGS_ENABLE_ALL="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL"
 
       DISABLED_WARNINGS="unused-parameter unused"
+
+      if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+        # missing-method-return-type triggers in JavaNativeFoundation framework
+        DISABLED_WARNINGS="$DISABLED_WARNINGS missing-method-return-type"
+      fi
+
       ;;
 
     xlc)
@@ -571,23 +583,21 @@
   # CFLAGS WARNINGS STUFF
   # Set JVM_CFLAGS warning handling
   if test "x$TOOLCHAIN_TYPE" = xgcc; then
-    WARNING_CFLAGS_JDK="$WARNINGS_ENABLE_ALL"
-    WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL $WARNINGS_ENABLE_ADDITIONAL_JVM"
+    WARNING_CFLAGS_JDK_CONLY="$WARNINGS_ENABLE_ALL_CFLAGS"
+    WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXXFLAGS"
+    WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL_CXXFLAGS"
 
   elif test "x$TOOLCHAIN_TYPE" = xclang; then
-    if test "x$OPENJDK_TARGET_OS" = xlinux; then
-      WARNING_CFLAGS_JDK="$WARNINGS_ENABLE_ALL"
-    else
-      WARNING_CFLAGS_JDK="" # currently left empty
-    fi
-    WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL $WARNINGS_ENABLE_ADDITIONAL_JVM"
+    WARNING_CFLAGS="$WARNINGS_ENABLE_ALL"
 
   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     WARNING_CFLAGS_JDK_CONLY="$WARNINGS_ENABLE_ALL_CFLAGS"
     WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXXFLAGS"
-    WARNING_CFLAGS_JVM="" # currently left empty
+    WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL_CXXFLAGS"
+
   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
     WARNING_CFLAGS="$WARNINGS_ENABLE_ALL"
+
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
     WARNING_CFLAGS=""  # currently left empty
   fi
--- a/make/common/TestFilesCompilation.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/common/TestFilesCompilation.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -97,8 +97,10 @@
         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_gcc := format undef unused-function unused-value, \
+        DISABLED_WARNINGS_clang := undef format-nonliteral \
+            missing-field-initializers sometimes-uninitialized, \
         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), \
--- a/make/hotspot/gensrc/GensrcDtrace.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/hotspot/gensrc/GensrcDtrace.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -74,6 +74,8 @@
         TOOLCHAIN := $(TOOLCHAIN_BUILD), \
         LDFLAGS := -m64, \
         CFLAGS := -m64 $(JVM_CFLAGS), \
+        DISABLED_WARNINGS_solstudio := hidef w_novirtualdescr unknownpragma \
+            doubunder nokeyworddefine wunreachable, \
         EXTRA_DEPS := $(JVMTI_H), \
         OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets/objs, \
         OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets, \
--- a/make/hotspot/lib/CompileJvm.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/hotspot/lib/CompileJvm.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -82,14 +82,24 @@
 ################################################################################
 # Disabled warnings
 
-DISABLED_WARNINGS_gcc := extra all
+DISABLED_WARNINGS_gcc := extra parentheses comment unknown-pragmas address \
+    delete-non-virtual-dtor char-subscripts array-bounds int-in-bool-context \
+    ignored-qualifiers  missing-field-initializers implicit-fallthrough \
+    empty-body strict-overflow sequence-point maybe-uninitialized \
+    misleading-indentation
+
 ifeq ($(call check-jvm-feature, zero), true)
-  DISABLED_WARNINGS_gcc += return-type
+  DISABLED_WARNINGS_gcc += return-type switch
 endif
 
-DISABLED_WARNINGS_clang := extra all tautological-compare deprecated-declarations
+DISABLED_WARNINGS_clang := tautological-compare deprecated-declarations \
+    undefined-var-template sometimes-uninitialized unknown-pragmas \
+    delete-non-virtual-dtor missing-braces char-subscripts \
+    ignored-qualifiers missing-field-initializers mismatched-tags
 
-DISABLED_WARNINGS_solstudio :=
+DISABLED_WARNINGS_solstudio := labelnotused hidef w_novirtualdescr inlafteruse \
+    unknownpragma doubunder w_enumnotused w_toomanyenumnotused \
+    wvarhidenmem wunreachable wnoretvalue notemsource
 
 DISABLED_WARNINGS_xlc := 1540-0216 1540-0198 1540-1090 1540-1639 1540-1088 \
     1500-010
--- a/make/launcher/Launcher-jdk.pack.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/launcher/Launcher-jdk.pack.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -90,6 +90,7 @@
     CFLAGS_linux := -fPIC, \
     CFLAGS_solaris := -KPIC, \
     CFLAGS_macosx := -fPIC, \
+    DISABLED_WARNINGS_clang := format-nonliteral, \
     LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
         $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/launcher/LauncherCommon.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/launcher/LauncherCommon.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -152,6 +152,7 @@
       CFLAGS_linux := -fPIC, \
       CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \
       CFLAGS_windows := $$($1_CFLAGS_windows), \
+      DISABLED_WARNINGS_gcc := unused-function, \
       LDFLAGS := $$(LDFLAGS_JDKEXE) \
           $$(call SET_EXECUTABLE_ORIGIN) \
           $$($1_LDFLAGS), \
--- a/make/lib/Awt2dLibraries.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/lib/Awt2dLibraries.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -55,6 +55,7 @@
     OPTIMIZATION := HIGHEST, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(BUILD_LIBMLIB_CFLAGS), \
+    DISABLED_WARNINGS_gcc := unused-function, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(JDKLIB_LIBS), \
@@ -225,8 +226,9 @@
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
     EXTRA_HEADER_DIRS := $(LIBAWT_EXTRA_HEADER_DIRS), \
     DISABLED_WARNINGS_gcc := sign-compare unused-result maybe-uninitialized \
-        format-nonliteral parentheses, \
-    DISABLED_WARNINGS_clang := logical-op-parentheses extern-initializer, \
+        format-nonliteral parentheses unused-value unused-function, \
+    DISABLED_WARNINGS_clang := logical-op-parentheses extern-initializer \
+        sign-compare format-nonliteral, \
     DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
     DISABLED_WARNINGS_microsoft := 4244 4267 4996, \
     ASFLAGS := $(LIBAWT_ASFLAGS), \
@@ -334,7 +336,9 @@
         DISABLED_WARNINGS_gcc := type-limits pointer-to-int-cast \
             unused-result maybe-uninitialized format \
             format-security int-to-pointer-cast parentheses \
-            implicit-fallthrough, \
+            implicit-fallthrough undef unused-function, \
+        DISABLED_WARNINGS_clang := parentheses format undef \
+            logical-op-parentheses format-nonliteral int-conversion, \
         DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
             E_ASSIGNMENT_TYPE_MISMATCH E_NON_CONST_INIT, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -380,8 +384,9 @@
         common/awt/debug \
         libawt/java2d, \
     HEADERS_FROM_SRC := $(LIBLCMS_HEADERS_FROM_SRC), \
-    DISABLED_WARNINGS_gcc := format-nonliteral type-limits misleading-indentation, \
-    DISABLED_WARNINGS_clang := tautological-compare, \
+    DISABLED_WARNINGS_gcc := format-nonliteral type-limits \
+        misleading-indentation undef unused-function, \
+    DISABLED_WARNINGS_clang := tautological-compare format-nonliteral undef, \
     DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
     DISABLED_WARNINGS_microsoft := 4819, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -466,6 +471,7 @@
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(LIBAWT_HEADLESS_CFLAGS), \
       EXTRA_HEADER_DIRS := $(LIBAWT_HEADLESS_EXTRA_HEADER_DIRS), \
+      DISABLED_WARNINGS_gcc := unused-function, \
       DISABLED_WARNINGS_xlc := 1506-356, \
       DISABLED_WARNINGS_solstudio := E_EMPTY_TRANSLATION_UNIT, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -604,11 +610,13 @@
     EXTRA_HEADER_DIRS := $(LIBFONTMANAGER_EXTRA_HEADER_DIRS), \
     WARNINGS_AS_ERRORS_xlc := false, \
     DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
-        type-limits missing-field-initializers implicit-fallthrough strict-aliasing, \
+        type-limits missing-field-initializers implicit-fallthrough \
+        strict-aliasing undef unused-function, \
     DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
         maybe-uninitialized, \
     DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
-        tautological-constant-out-of-range-compare int-to-pointer-cast, \
+        tautological-constant-out-of-range-compare int-to-pointer-cast \
+        sign-compare undef missing-field-initializers, \
     DISABLED_WARNINGS_C_solstudio = \
         E_INTEGER_OVERFLOW_DETECTED \
         E_ARG_INCOMPATIBLE_WITH_ARG_L \
@@ -715,6 +723,7 @@
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(JAWT_CFLAGS), \
+      DISABLED_WARNINGS_clang := sign-compare, \
       EXTRA_HEADER_DIRS := \
           include \
           common/awt, \
@@ -848,8 +857,9 @@
           $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS) $(LIBZ_CFLAGS), \
       EXTRA_HEADER_DIRS := $(LIBSPLASHSCREEN_HEADER_DIRS), \
       DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result \
-          maybe-uninitialized shift-negative-value implicit-fallthrough, \
-      DISABLED_WARNINGS_clang := incompatible-pointer-types, \
+          maybe-uninitialized shift-negative-value implicit-fallthrough \
+          unused-function, \
+      DISABLED_WARNINGS_clang := incompatible-pointer-types sign-compare, \
       DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST E_DECLARATION_IN_CODE \
           E_STATEMENT_NOT_REACHED, \
       DISABLED_WARNINGS_microsoft := 4018 4244 4267, \
@@ -908,7 +918,9 @@
       EXTRA_HEADER_DIRS := $(LIBAWT_LWAWT_EXTRA_HEADER_DIRS), \
       DISABLED_WARNINGS_clang := incomplete-implementation enum-conversion \
           deprecated-declarations objc-method-access bitwise-op-parentheses \
-          incompatible-pointer-types parentheses-equality extra-tokens, \
+          incompatible-pointer-types parentheses-equality extra-tokens \
+          sign-compare semicolon-before-method-body format-nonliteral undef \
+          pointer-arith, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN) \
           -L$(INSTALL_LIBRARIES_HERE), \
@@ -949,7 +961,7 @@
       EXTRA_HEADER_DIRS := \
           libawt_lwawt/awt \
           libosxapp, \
-      DISABLED_WARNINGS_clang := deprecated-declarations, \
+      DISABLED_WARNINGS_clang := deprecated-declarations sign-compare, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN) \
           -Wl$(COMMA)-rpath$(COMMA)@loader_path \
--- a/make/lib/CoreLibraries.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/lib/CoreLibraries.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -59,6 +59,7 @@
     CFLAGS_windows_debug := -DLOGGING, \
     CFLAGS_aix := -qfloat=nomaf, \
     DISABLED_WARNINGS_gcc := sign-compare misleading-indentation array-bounds, \
+    DISABLED_WARNINGS_clang := sign-compare, \
     DISABLED_WARNINGS_microsoft := 4146 4244 4018, \
     ARFLAGS := $(ARFLAGS), \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
@@ -77,7 +78,7 @@
     NAME := verify, \
     OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \
     CFLAGS := $(CFLAGS_JDKLIB), \
-    DISABLED_WARNINGS_gcc := implicit-fallthrough, \
+    DISABLED_WARNINGS_gcc := implicit-fallthrough unused-function, \
     DISABLED_WARNINGS_microsoft := 4244 4267, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -105,7 +106,7 @@
     jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
     EXTRA_HEADER_DIRS := libfdlibm, \
     WARNINGS_AS_ERRORS_xlc := false, \
-    DISABLED_WARNINGS_gcc := unused-result, \
+    DISABLED_WARNINGS_gcc := unused-result unused-function, \
     DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -148,6 +149,7 @@
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(LIBZ_CFLAGS), \
     CFLAGS_unix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
+    DISABLED_WARNINGS_gcc := unused-function, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := -ljvm -ljava $(LIBZ_LIBS), \
@@ -213,6 +215,8 @@
     EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
     OPTIMIZATION := HIGH, \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
+    DISABLED_WARNINGS_gcc := unused-function, \
+    DISABLED_WARNINGS_clang := sometimes-uninitialized format-nonliteral, \
     DISABLED_WARNINGS_solstudio := \
         E_ASM_DISABLES_OPTIMIZATION \
         E_STATEMENT_NOT_REACHED, \
--- a/make/lib/Lib-java.base.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/lib/Lib-java.base.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -43,8 +43,9 @@
     NAME := net, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB), \
-    DISABLED_WARNINGS_gcc := format-nonliteral, \
-    DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand, \
+    DISABLED_WARNINGS_gcc := format-nonliteral unused-function, \
+    DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand \
+        format-nonliteral undef, \
     DISABLED_WARNINGS_microsoft := 4244 4047 4133 4996, \
     DISABLED_WARNINGS_solstudio := E_ARG_INCOMPATIBLE_WITH_ARG_L, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -71,6 +72,8 @@
     OPTIMIZATION := HIGH, \
     WARNINGS_AS_ERRORS_xlc := false, \
     CFLAGS := $(CFLAGS_JDKLIB), \
+    DISABLED_WARNINGS_gcc := undef, \
+    DISABLED_WARNINGS_clang := undef, \
     EXTRA_HEADER_DIRS := \
         libnio/ch \
         libnio/fs \
@@ -104,7 +107,8 @@
         NAME := osxsecurity, \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB), \
-        DISABLED_WARNINGS_clang := deprecated-declarations, \
+        DISABLED_WARNINGS_clang := deprecated-declarations \
+            missing-method-return-type, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base \
             $(call SET_SHARED_LIBRARY_ORIGIN) \
@@ -132,6 +136,7 @@
         NAME := jsig, \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) $(LIBJSIG_CFLAGS), \
+        DISABLED_WARNINGS_gcc := undef, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
         LIBS_linux := $(LIBDL), \
--- a/make/lib/Lib-java.desktop.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/lib/Lib-java.desktop.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -66,6 +66,8 @@
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(LIBJSOUND_CFLAGS), \
       CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
+      DISABLED_WARNINGS_gcc := undef, \
+      DISABLED_WARNINGS_clang := undef, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS_unix := -ljava -ljvm, \
@@ -92,7 +94,7 @@
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB), \
       DISABLED_WARNINGS_clang := objc-method-access objc-root-class \
-          deprecated-declarations, \
+          deprecated-declarations format-nonliteral, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := \
--- a/make/lib/Lib-java.instrument.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/lib/Lib-java.instrument.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -42,6 +42,7 @@
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBINSTRUMENT_CFLAGS), \
     CFLAGS_debug := -DJPLIS_LOGGING, \
     CFLAGS_release := -DNO_JPLIS_LOGGING, \
+    DISABLED_WARNINGS_gcc := unused-function, \
     EXTRA_HEADER_DIRS := java.base:libjli, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN) \
--- a/make/lib/Lib-java.security.jgss.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/lib/Lib-java.security.jgss.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -31,6 +31,8 @@
     NAME := j2gss, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB), \
+    DISABLED_WARNINGS_gcc := undef, \
+    DISABLED_WARNINGS_clang := undef, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(LIBDL), \
--- a/make/lib/Lib-jdk.crypto.cryptoki.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/lib/Lib-jdk.crypto.cryptoki.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -31,6 +31,7 @@
     NAME := j2pkcs11, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB), \
+    DISABLED_WARNINGS_clang := format-nonliteral, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := $(LIBDL), \
--- a/make/lib/Lib-jdk.crypto.ec.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/lib/Lib-jdk.crypto.ec.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -35,7 +35,8 @@
       CFLAGS := $(CFLAGS_JDKLIB) \
           -DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B, \
       CXXFLAGS := $(CXXFLAGS_JDKLIB), \
-      DISABLED_WARNINGS_gcc := sign-compare implicit-fallthrough, \
+      DISABLED_WARNINGS_gcc := sign-compare implicit-fallthrough unused-value, \
+      DISABLED_WARNINGS_clang := sign-compare, \
       DISABLED_WARNINGS_microsoft := 4101 4244 4146 4018, \
       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
       LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/lib/Lib-jdk.hotspot.agent.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/lib/Lib-jdk.hotspot.agent.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -54,7 +54,8 @@
     NAME := saproc, \
     OPTIMIZATION := HIGH, \
     DISABLED_WARNINGS_microsoft := 4267, \
-    DISABLED_WARNINGS_gcc := sign-compare, \
+    DISABLED_WARNINGS_gcc := sign-compare pointer-arith, \
+    DISABLED_WARNINGS_clang := sign-compare pointer-arith format-nonliteral, \
     DISABLED_WARNINGS_CXX_solstudio := truncwarn unknownpragma, \
     CFLAGS := $(CFLAGS_JDKLIB) $(SA_CFLAGS), \
     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(SA_CFLAGS) $(SA_CXXFLAGS), \
--- a/make/lib/Lib-jdk.jdwp.agent.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/lib/Lib-jdk.jdwp.agent.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -53,6 +53,9 @@
     NAME := jdwp, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) -DJDWP_LOGGING, \
+    DISABLED_WARNINGS_gcc := unused-function, \
+    DISABLED_WARNINGS_clang := sometimes-uninitialized format-nonliteral \
+        self-assign, \
     EXTRA_HEADER_DIRS := \
       include \
       libjdwp/export, \
--- a/make/lib/Lib-jdk.management.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/lib/Lib-jdk.management.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -48,6 +48,7 @@
     NAME := management_ext, \
     OPTIMIZATION := $(LIBMANAGEMENT_EXT_OPTIMIZATION), \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBMANAGEMENT_EXT_CFLAGS), \
+    DISABLED_WARNINGS_clang := format-nonliteral, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(JDKLIB_LIBS), \
--- a/make/lib/Lib-jdk.pack.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/lib/Lib-jdk.pack.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -37,6 +37,7 @@
     CFLAGS_release := -DPRODUCT, \
     EXTRA_HEADER_DIRS := $(call GetJavaHeaderDir, java.base), \
     DISABLED_WARNINGS_gcc := implicit-fallthrough, \
+    DISABLED_WARNINGS_clang := format-nonliteral, \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_windows := -map:$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpack.map -debug, \
--- a/make/lib/Lib-jdk.sctp.gmk	Mon Sep 24 13:05:59 2018 -0400
+++ b/make/lib/Lib-jdk.sctp.gmk	Mon Sep 24 19:26:48 2018 +0200
@@ -34,6 +34,8 @@
         NAME := sctp, \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB), \
+        DISABLED_WARNINGS_gcc := undef, \
+        DISABLED_WARNINGS_clang := undef, \
         EXTRA_HEADER_DIRS := \
             $(call GetJavaHeaderDir, java.base) \
             java.base:libnet \
--- a/src/java.desktop/unix/native/common/awt/awt_Font.c	Mon Sep 24 13:05:59 2018 -0400
+++ b/src/java.desktop/unix/native/common/awt/awt_Font.c	Mon Sep 24 19:26:48 2018 +0200
@@ -638,7 +638,7 @@
 
             /* XXX: sometimes XLoadQueryFont returns a bogus font structure */
             /* with negative ascent. */
-            if (xfont == (Font) NULL || xfont->ascent < 0) {
+            if (xfont == NULL || xfont->ascent < 0) {
                 if (xfont != NULL) {
                     XFreeFont(display, xfont);
                 }