Trying to clear up gcc warnings as well.
--- a/make/autoconf/flags-cflags.m4 Thu Mar 01 15:47:48 2018 +0100
+++ b/make/autoconf/flags-cflags.m4 Thu Mar 01 17:00:23 2018 +0100
@@ -208,6 +208,14 @@
DISABLE_WARNING_PREFIX=
fi
CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
+
+ # -Wall -Wextra does not enable all warnings. We add some more that we
+ # consider relevant:
+ WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wreturn-type -Wsign-compare -Wtype-limits -Wundef -Wuninitialized -Wunused-function -Wunused-value"
+ WARNINGS_ENABLE_ADDITIONAL_CXX="-Woverloaded-virtual"
+ WARNINGS_ENABLE_ALL="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL"
+ WARNINGS_ENABLE_ALL_CXXFLAGS="$WARNINGS_ENABLE_ADDITIONAL_CXX"
+
# Repeate the check for the BUILD_CC and BUILD_CXX. Need to also reset
# CFLAGS since any target specific flags will likely not work with the
# build compiler
@@ -582,35 +590,24 @@
# CFLAGS WARNINGS STUFF
# Set JVM_CFLAGS warning handling
- if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
- # COMMON to gcc and clang
- WARNING_CFLAGS_JVM="-Wpointer-arith -Wsign-compare -Wunused-function"
- if ! HOTSPOT_CHECK_JVM_VARIANT(zero); then
- # Non-zero builds have stricter warnings
- WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wundef -Wformat=2"
- fi
+ if test "x$TOOLCHAIN_TYPE" = xgcc; then
+ JDK_DISABLED="-Wno-pointer-arith -Wno-undef -Wno-unused-function -Wno-unused-value -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-unused-label"
+ JVM_DISABLED="-Wno-unknown-pragmas -Wno-comment -Wno-delete-non-virtual-dtor -Wno-ignored-qualifiers -Wno-parentheses -Wno-reorder -Wno-unused-local-typedefs -Wno-unused-parameter -Wno-unused-variable -Wno-address -Wno-missing-field-initializers -Wno-unused-but-set-variable -Wno-char-subscripts -Wno-array-bounds -Wno-narrowing -Wno-empty-body -Wno-unused-but-set-parameter"
- fi
- if test "x$TOOLCHAIN_TYPE" = xgcc; then
- WARNING_CFLAGS_JDK="-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2"
- WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wunused-value -Woverloaded-virtual"
+ WARNING_CFLAGS_JDK="$WARNINGS_ENABLE_ALL $JDK_DISABLED"
+ WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXXFLAGS"
+ WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL $WARNINGS_ENABLE_ALL_CXXFLAGS $JVM_DISABLED"
- if ! HOTSPOT_CHECK_JVM_VARIANT(zero); then
- # Non-zero builds have stricter warnings
- WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wreturn-type"
- fi
elif test "x$TOOLCHAIN_TYPE" = xclang; then
- WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wno-deprecated"
+ WARNING_CFLAGS_JVM="-Wpointer-arith -Wsign-compare -Wunused-function -Wno-deprecated"
if test "x$OPENJDK_TARGET_OS" = xlinux; then
WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wno-sometimes-uninitialized"
WARNING_CFLAGS_JDK="-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2"
fi
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="$(WARNINGS_ENABLE_ALL_CXXFLAGS)"
-
-
+ 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" = xmicrosoft; then
WARNING_CFLAGS="-W3"
WARNING_CFLAGS_JDK="-wd4800"
--- a/src/hotspot/os/linux/os_linux.cpp Thu Mar 01 15:47:48 2018 +0100
+++ b/src/hotspot/os/linux/os_linux.cpp Thu Mar 01 17:00:23 2018 +0100
@@ -2154,7 +2154,7 @@
}
p = OSContainer::cpu_cpuset_memory_nodes();
- if (p < 0)
+ if (p == NULL)
st->print("cpu_memory_nodes() failed\n");
else {
st->print("cpu_memory_nodes: %s\n", p);
--- a/src/hotspot/share/oops/klass.cpp Thu Mar 01 15:47:48 2018 +0100
+++ b/src/hotspot/share/oops/klass.cpp Thu Mar 01 17:00:23 2018 +0100
@@ -194,7 +194,7 @@
int hsize = arrayOopDesc::base_offset_in_bytes(etype);
int esize = type2aelembytes(etype);
bool isobj = (etype == T_OBJECT);
- int tag = isobj ? _lh_array_tag_obj_value : _lh_array_tag_type_value;
+ int tag = isobj ? _lh_array_tag_obj_value : (int) _lh_array_tag_type_value;
int lh = array_layout_helper(tag, hsize, etype, exact_log2(esize));
assert(lh < (int)_lh_neutral_value, "must look like an array layout");
--- a/src/hotspot/share/opto/machnode.hpp Thu Mar 01 15:47:48 2018 +0100
+++ b/src/hotspot/share/opto/machnode.hpp Thu Mar 01 17:00:23 2018 +0100
@@ -301,7 +301,7 @@
// Bottom_type call; value comes from operand0
virtual const class Type *bottom_type() const { return _opnds[0]->type(); }
- virtual uint ideal_reg() const { const Type *t = _opnds[0]->type(); return t == TypeInt::CC ? Op_RegFlags : t->ideal_reg(); }
+ virtual uint ideal_reg() const { const Type *t = _opnds[0]->type(); return t == TypeInt::CC ? (uint) Op_RegFlags : t->ideal_reg(); }
// If this is a memory op, return the base pointer and fixed offset.
// If there are no such, return NULL. If there are multiple addresses
--- a/src/hotspot/share/prims/jvm.cpp Thu Mar 01 15:47:48 2018 +0100
+++ b/src/hotspot/share/prims/jvm.cpp Thu Mar 01 17:00:23 2018 +0100
@@ -2279,7 +2279,7 @@
ConstantPool* cp = InstanceKlass::cast(k)->constants();
for (int index = cp->length() - 1; index >= 0; index--) {
constantTag tag = cp->tag_at(index);
- types[index] = (tag.is_unresolved_klass()) ? JVM_CONSTANT_Class : tag.value();
+ types[index] = (tag.is_unresolved_klass()) ? (unsigned char) JVM_CONSTANT_Class : tag.value();
}
}
JVM_END