8200550: Xcode 9.3 produce warning -Wexpansion-to-defined
authorkbarrett
Mon, 09 Apr 2018 20:36:04 -0400
changeset 49725 e740e1a38c96
parent 49724 bf7f42f2f025
child 49726 4ae63fcabe2e
8200550: Xcode 9.3 produce warning -Wexpansion-to-defined Summary: Removed problem macros. Reviewed-by: tschatzl, dholmes, coleenp
src/hotspot/share/gc/g1/g1HeapVerifier.hpp
src/hotspot/share/gc/g1/heapRegionSet.hpp
src/hotspot/share/utilities/nativeCallStack.cpp
src/hotspot/share/utilities/vmError.cpp
--- a/src/hotspot/share/gc/g1/g1HeapVerifier.hpp	Mon Apr 09 18:43:40 2018 +0300
+++ b/src/hotspot/share/gc/g1/g1HeapVerifier.hpp	Mon Apr 09 20:36:04 2018 -0400
@@ -28,6 +28,7 @@
 #include "gc/g1/heapRegionSet.hpp"
 #include "memory/allocation.hpp"
 #include "memory/universe.hpp"
+#include "utilities/macros.hpp"
 
 class G1CollectedHeap;
 
@@ -37,9 +38,6 @@
 
   G1CollectedHeap* _g1h;
 
-  // verify_region_sets() performs verification over the region
-  // lists. It will be compiled in the product code to be used when
-  // necessary (i.e., during heap verification).
   void verify_region_sets();
 
 public:
@@ -76,15 +74,8 @@
   void verify(VerifyOption vo);
 
   // verify_region_sets_optional() is planted in the code for
-  // list verification in non-product builds (and it can be enabled in
-  // product builds by defining HEAP_REGION_SET_FORCE_VERIFY to be 1).
-#if HEAP_REGION_SET_FORCE_VERIFY
-  void verify_region_sets_optional() {
-    verify_region_sets();
-  }
-#else // HEAP_REGION_SET_FORCE_VERIFY
-  void verify_region_sets_optional() { }
-#endif // HEAP_REGION_SET_FORCE_VERIFY
+  // list verification in debug builds.
+  void verify_region_sets_optional() { DEBUG_ONLY(verify_region_sets();) }
 
   void prepare_for_verify();
   double verify(G1VerifyType type, VerifyOption vo, const char* msg);
--- a/src/hotspot/share/gc/g1/heapRegionSet.hpp	Mon Apr 09 18:43:40 2018 +0300
+++ b/src/hotspot/share/gc/g1/heapRegionSet.hpp	Mon Apr 09 20:36:04 2018 -0400
@@ -26,6 +26,7 @@
 #define SHARE_VM_GC_G1_HEAPREGIONSET_HPP
 
 #include "gc/g1/heapRegion.hpp"
+#include "utilities/macros.hpp"
 
 #define assert_heap_region_set(p, message) \
   do {                                     \
@@ -46,13 +47,6 @@
   } while (0)
 
 
-// Set verification will be forced either if someone defines
-// 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)
-#endif // HEAP_REGION_SET_FORCE_VERIFY
-
 class HRSMtSafeChecker : public CHeapObj<mtGC> {
 public:
   virtual void check() = 0;
@@ -122,13 +116,7 @@
   void verify_next_region(HeapRegion* hr);
   void verify_end();
 
-#if HEAP_REGION_SET_FORCE_VERIFY
-  void verify_optional() {
-    verify();
-  }
-#else // HEAP_REGION_SET_FORCE_VERIFY
-  void verify_optional() { }
-#endif // HEAP_REGION_SET_FORCE_VERIFY
+  void verify_optional() { DEBUG_ONLY(verify();) }
 
   virtual void print_on(outputStream* out, bool print_contents = false);
 };
--- a/src/hotspot/share/utilities/nativeCallStack.cpp	Mon Apr 09 18:43:40 2018 +0300
+++ b/src/hotspot/share/utilities/nativeCallStack.cpp	Mon Apr 09 20:36:04 2018 -0400
@@ -38,15 +38,15 @@
     // 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 !TAIL_CALL
+#if (defined(_NMT_NOINLINE_) || defined(_WINDOWS) || !defined(_LP64))
+    // Not a tail call.
     toSkip++;
 #if (defined(_NMT_NOINLINE_) && defined(BSD) && defined(_LP64))
     // Mac OS X slowdebug builds have this odd behavior where NativeCallStack::NativeCallStack
     // appears as two frames, so we need to skip an extra frame.
     toSkip++;
-#endif
-#endif
+#endif // Special-case for BSD.
+#endif // Not a tail call.
     os::get_native_stack(_stack, NMT_TrackingStackDepth, toSkip);
   } else {
     for (int index = 0; index < NMT_TrackingStackDepth; index ++) {
--- a/src/hotspot/share/utilities/vmError.cpp	Mon Apr 09 18:43:40 2018 +0300
+++ b/src/hotspot/share/utilities/vmError.cpp	Mon Apr 09 20:36:04 2018 -0400
@@ -1478,7 +1478,7 @@
       out.print_raw   ("/bin/sh -c ");
 #elif defined(SOLARIS)
       out.print_raw   ("/usr/bin/sh -c ");
-#elif defined(WINDOWS)
+#elif defined(_WINDOWS)
       out.print_raw   ("cmd /C ");
 #endif
       out.print_raw   ("\"");