Hello,   we recently switched to xlc16 / xlclang  in the AIX build .

( jdk11  stays on the  so-called   “legacy”  xlc 12 )

 

I would suggest to switch to the  clang-style  warning disabling – style now   in jdk/jdk  ( = jdk14)  to avoid some warnings in the build   .

I think we are pretty close  to  reduce the compiler warnings to 0   on AIX  , which  would make it possible to build with warnings as errors at some point in the future .

 

Any thoughts / comments  / opinions?

 

 

For now I would start  with those warnings disabled for hotspot :

 

tautological-compare  :

 

/jdk/src/hotspot/os/aix/os_aix.cpp:2400:15: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare]

    if (bytes >= Use64KPagesThreshold) {

        ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~

/jdk/src/hotspot/os/aix/os_aix.cpp:2607:15: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare]

    if (bytes >= Use64KPagesThreshold) {

 

In the product  build   the   “Use64KPagesThreshold”   is a constant  so clang  complains .  However  in the  (fast)debug  builds one can set  Use64KPagesThreshold  with an -XX setting.

So I think it is best to disable the warning.

 

 

shift-negative-value :    

 

/jdk/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp:429:97: warning: shifting a negative signed value is undefined [-Wshift-negative-value]

      (x->op() == Bytecodes::_lsub && right.value()->type()->as_LongConstant()->value() == ((-1)<<15)) ) {

                                                                                            ~~~~^

/jdk/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp:483:96: warning: shifting a negative signed value is undefined [-Wshift-negative-value]

      (x->op() == Bytecodes::_isub && right.value()->type()->as_IntConstant()->value() == ((-1)<<15)) ) {

 

 

 

We could probably replace  the -1 shift by a constant but I think it  is nicely readable .

 

 

 

A patch is below .

 

 

Best regards, Matthias

 

 

diff -r 1b0c0af50d4e make/autoconf/flags-cflags.m4

--- a/make/autoconf/flags-cflags.m4      Wed Jul 17 15:40:27 2019 +0200

+++ b/make/autoconf/flags-cflags.m4   Thu Jul 18 13:21:24 2019 +0200

@@ -229,7 +229,7 @@

       ;;

     xlc)

-      DISABLE_WARNING_PREFIX="-qsuppress="

+      DISABLE_WARNING_PREFIX="-Wno-"

       CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"

       # Possibly a better subset than "all" is "lan:trx:ret:zea:cmp:ret"

diff -r 1b0c0af50d4e make/hotspot/lib/CompileJvm.gmk

--- a/make/hotspot/lib/CompileJvm.gmk             Wed Jul 17 15:40:27 2019 +0200

+++ b/make/hotspot/lib/CompileJvm.gmk          Thu Jul 18 13:21:24 2019 +0200

@@ -95,8 +95,7 @@

     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

+DISABLED_WARNINGS_xlc := tautological-compare shift-negative-value

 DISABLED_WARNINGS_microsoft :=

diff -r 1b0c0af50d4e make/lib/Awt2dLibraries.gmk

--- a/make/lib/Awt2dLibraries.gmk         Wed Jul 17 15:40:27 2019 +0200

+++ b/make/lib/Awt2dLibraries.gmk     Thu Jul 18 13:21:24 2019 +0200

@@ -471,7 +471,6 @@

           $(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) \

           $(call SET_SHARED_LIBRARY_ORIGIN), \

@@ -481,10 +480,6 @@

       LIBS_solaris := $(LIBM) $(LIBDL) $(LIBCXX), \

   ))

-  # AIX warning explanation:

-  # 1506-356 : (W) Compilation unit is empty.

-  #            This happens during the headless build

-

   $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)

   TARGETS += $(BUILD_LIBAWT_HEADLESS)