[PATCH] Mere code changes to silence some warnings

David CARLIER devnexen at gmail.com
Thu Nov 30 17:06:04 UTC 2017


Hi dear list,

Here a tiny patch to address few compilation warnings, two concerns UB with
define e.g #define A <cond> it is usually better this form #if <cond>
#define A 1 ... Few types comparison miusmatches as well.

Hope is all good ... tested full build.
-------------- next part --------------
diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
--- a/src/hotspot/os/linux/os_linux.cpp
+++ b/src/hotspot/os/linux/os_linux.cpp
@@ -2153,7 +2153,7 @@
     }
 
     p = OSContainer::cpu_cpuset_memory_nodes();
-    if (p < 0)
+    if (!p)
       st->print("cpu_memory_nodes() failed\n");
     else {
       st->print("cpu_memory_nodes: %s\n", p);
diff --git a/src/hotspot/share/gc/g1/heapRegionSet.hpp b/src/hotspot/share/gc/g1/heapRegionSet.hpp
--- a/src/hotspot/share/gc/g1/heapRegionSet.hpp
+++ b/src/hotspot/share/gc/g1/heapRegionSet.hpp
@@ -50,7 +50,11 @@
 // HEAP_REGION_SET_FORCE_VERIFY to be 1, or in builds in which
 // asserts are compiled in.
 #ifndef HEAP_REGION_SET_FORCE_VERIFY
-#define HEAP_REGION_SET_FORCE_VERIFY defined(ASSERT)
+#if defined(ASSERT)
+#define HEAP_REGION_SET_FORCE_VERIFY 1
+#else
+#define HEAP_REGION_SET_FORCE_VERIFY 0
+#endif
 #endif // HEAP_REGION_SET_FORCE_VERIFY
 
 class HRSMtSafeChecker : public CHeapObj<mtGC> {
diff --git a/src/hotspot/share/oops/accessBackend.cpp b/src/hotspot/share/oops/accessBackend.cpp
--- a/src/hotspot/share/oops/accessBackend.cpp
+++ b/src/hotspot/share/oops/accessBackend.cpp
@@ -172,18 +172,3 @@
     Copy::conjoint_jlongs_atomic(src, dst, length);
   }
 }
-
-template void AccessInternal::arraycopy_conjoint<jbyte>(jbyte* src, jbyte* dst, size_t length);
-template void AccessInternal::arraycopy_conjoint<jshort>(jshort* src, jshort* dst, size_t length);
-template void AccessInternal::arraycopy_conjoint<jint>(jint* src, jint* dst, size_t length);
-template void AccessInternal::arraycopy_conjoint<jlong>(jlong* src, jlong* dst, size_t length);
-
-template void AccessInternal::arraycopy_arrayof_conjoint<jbyte>(jbyte* src, jbyte* dst, size_t length);
-template void AccessInternal::arraycopy_arrayof_conjoint<jshort>(jshort* src, jshort* dst, size_t length);
-template void AccessInternal::arraycopy_arrayof_conjoint<jint>(jint* src, jint* dst, size_t length);
-template void AccessInternal::arraycopy_arrayof_conjoint<jlong>(jlong* src, jlong* dst, size_t length);
-
-template void AccessInternal::arraycopy_conjoint_atomic<jbyte>(jbyte* src, jbyte* dst, size_t length);
-template void AccessInternal::arraycopy_conjoint_atomic<jshort>(jshort* src, jshort* dst, size_t length);
-template void AccessInternal::arraycopy_conjoint_atomic<jint>(jint* src, jint* dst, size_t length);
-template void AccessInternal::arraycopy_conjoint_atomic<jlong>(jlong* src, jlong* dst, size_t length);
diff --git a/src/hotspot/share/utilities/nativeCallStack.cpp b/src/hotspot/share/utilities/nativeCallStack.cpp
--- a/src/hotspot/share/utilities/nativeCallStack.cpp
+++ b/src/hotspot/share/utilities/nativeCallStack.cpp
@@ -37,7 +37,11 @@
     // to call os::get_native_stack. A tail call is used if _NMT_NOINLINE_ is not defined
     // (which means this is not a slowdebug build), and we are on 64-bit (except Windows).
     // This is not necessarily a rule, but what has been obvserved to date.
-#define TAIL_CALL (!defined(_NMT_NOINLINE_) && !defined(WINDOWS) && defined(_LP64))
+#if (!defined(_NMT_NOINLINE_) && !defined(WINDOWS) && defined(_LP64))
+#define TAIL_CALL 1
+#else
+#define TAIL_CALL 0
+#endif
 #if !TAIL_CALL
     toSkip++;
 #if (defined(_NMT_NOINLINE_) && defined(BSD) && defined(_LP64))
diff --git a/src/java.base/share/native/libfdlibm/e_sqrt.c b/src/java.base/share/native/libfdlibm/e_sqrt.c
--- a/src/java.base/share/native/libfdlibm/e_sqrt.c
+++ b/src/java.base/share/native/libfdlibm/e_sqrt.c
@@ -171,7 +171,7 @@
             t  = s0;
             if((t<ix0)||((t==ix0)&&(t1<=ix1))) {
                 s1  = t1+r;
-                if(((t1&sign)==sign)&&(s1&sign)==0) s0 += 1;
+                if((((int)t1&sign)==sign)&&((int)s1&sign)==0) s0 += 1;
                 ix0 -= t;
                 if (ix1 < t1) ix0 -= 1;
                 ix1 -= t1;
diff --git a/src/java.base/share/native/libfdlibm/s_ceil.c b/src/java.base/share/native/libfdlibm/s_ceil.c
--- a/src/java.base/share/native/libfdlibm/s_ceil.c
+++ b/src/java.base/share/native/libfdlibm/s_ceil.c
@@ -77,7 +77,7 @@
                     if(j0==20) i0+=1;
                     else {
                         j = i1 + (1<<(52-j0));
-                        if(j<i1) i0+=1; /* got a carry */
+                        if((int)j<i1) i0+=1; /* got a carry */
                         i1 = j;
                     }
                 }
diff --git a/src/java.base/share/native/libfdlibm/s_floor.c b/src/java.base/share/native/libfdlibm/s_floor.c
--- a/src/java.base/share/native/libfdlibm/s_floor.c
+++ b/src/java.base/share/native/libfdlibm/s_floor.c
@@ -78,7 +78,7 @@
                     if(j0==20) i0+=1;
                     else {
                         j = i1+(1<<(52-j0));
-                        if(j<i1) i0 +=1 ;       /* got a carry */
+                        if((int)j<i1) i0 +=1 ;       /* got a carry */
                         i1=j;
                     }
                 }
diff --git a/src/java.base/share/native/libfdlibm/s_log1p.c b/src/java.base/share/native/libfdlibm/s_log1p.c
--- a/src/java.base/share/native/libfdlibm/s_log1p.c
+++ b/src/java.base/share/native/libfdlibm/s_log1p.c
@@ -128,7 +128,7 @@
                  * Added redundant test against hx to work around VC++
                  * code generation problem.
                  */
-                if(x==-1.0 && (hx==0xbff00000)) /* log1p(-1)=-inf */
+                if(x==-1.0 && (hx==(int)0xbff00000)) /* log1p(-1)=-inf */
                   return -two54/zero;
                 else
                   return (x-x)/(x-x);           /* log1p(x<-1)=NaN */


More information about the jdk-dev mailing list