8210164: building Minimal VM fails with error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
authoravoitylov
Thu, 30 Aug 2018 16:33:14 -0400
changeset 51599 3198179d97fa
parent 51598 c88019b32bc4
child 51600 56309b1b9d9b
8210164: building Minimal VM fails with error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] Summary: Conditionalize compare with serial_phase_count. Reviewed-by: kbarrett, shade
src/hotspot/share/gc/shared/weakProcessorPhases.cpp
--- a/src/hotspot/share/gc/shared/weakProcessorPhases.cpp	Thu Aug 30 16:16:19 2018 -0400
+++ b/src/hotspot/share/gc/shared/weakProcessorPhases.cpp	Thu Aug 30 16:33:14 2018 -0400
@@ -59,7 +59,14 @@
 }
 
 bool WeakProcessorPhases::is_serial(Phase phase) {
+  // serial_phase_count is 0 if JFR and JVMTI are both not built,
+  // making this check with unsigned lhs redundant
+#if INCLUDE_JVMTI || INCLUDE_JFR
   return (index(phase) - serial_phase_start) < serial_phase_count;
+#else
+  STATIC_ASSERT(serial_phase_count == 0);
+  return false;
+#endif
 }
 
 bool WeakProcessorPhases::is_oop_storage(Phase phase) {