RFR: 8228426: xlc: switch to clang-style warning disabling

Baesken, Matthias matthias.baesken at sap.com
Fri Jul 19 10:20:09 UTC 2019


Please review the following change that switches to  clang-style warning disabling  on AIX,  and  adjusts the warning  disabling to current needs .

Recently the jdk/jdk build on AIX switched to xlc16/xlclang.

This means we can now use the standard clang-style warning disabling (the old legacy qsuppress warning disablings from legacy xlc
might not fully work any more).

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

In a first step I would disable these warnings in HS for xlc16/xlclang :

tautological-compare : (seen in os_aix.cpp)

/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 : (seen in c1_LIRGenerator_ppc.cpp)

/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 .



Bug/webrev :

https://bugs.openjdk.java.net/browse/JDK-8228426

http://cr.openjdk.java.net/~mbaesken/webrevs/8228426.0/


Thanks, Matthias




More information about the build-dev mailing list