diff src/share/vm/interpreter/bytecodeTracer.cpp @ 17937:78bbf4d43a14

8037816: Fix for 8036122 breaks build with Xcode5/clang 8043029: Change 8037816 breaks HS build with older GCC versions which don't support diagnostic pragmas 8043164: Format warning in traceStream.hpp Summary: Backport of main fix + two corrections, enables clang compilation, turns on format attributes, corrects/mutes warnings Reviewed-by: kvn, coleenp, iveresov, twisti
author drchase
date Thu, 22 May 2014 15:52:41 -0400
parents b8413a9cbb84
children 52b4284cb496
line wrap: on
line diff
--- a/src/share/vm/interpreter/bytecodeTracer.cpp	Thu May 15 18:23:26 2014 -0400
+++ b/src/share/vm/interpreter/bytecodeTracer.cpp	Thu May 22 15:52:41 2014 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -215,7 +215,7 @@
       st->print_cr(" %s", buf);
     }
   } else {
-    st->print_cr(" " PTR_FORMAT, (void *)value);
+    st->print_cr(" " PTR_FORMAT, p2i((void *)value));
   }
 }
 
@@ -284,7 +284,7 @@
   if (i >= 0 && i < climit) {
     cp_index = cache->entry_at(i)->constant_pool_index();
   } else {
-    st->print_cr(" not in CP[*]?", i);
+    st->print_cr("%d not in CP[*]?", i);
       return false;
     }
   return true;
@@ -299,7 +299,7 @@
      cp_index = constants->object_to_cp_index(i);
      return true;
   } else {
-    st->print_cr(" not in OBJ[*]?", i);
+    st->print_cr("%d not in OBJ[*]?", i);
   return false;
 }
 }
@@ -323,7 +323,7 @@
   if (tag.is_int()) {
     st->print_cr(" " INT32_FORMAT, constants->int_at(i));
   } else if (tag.is_long()) {
-    st->print_cr(" " INT64_FORMAT, constants->long_at(i));
+    st->print_cr(" " INT64_FORMAT, (int64_t)(constants->long_at(i)));
   } else if (tag.is_float()) {
     st->print_cr(" %f", constants->float_at(i));
   } else if (tag.is_double()) {
@@ -342,7 +342,7 @@
   } else if (tag.is_method_handle()) {
     int kind = constants->method_handle_ref_kind_at(i);
     int i2 = constants->method_handle_index_at(i);
-    st->print(" <MethodHandle of kind %d>", kind, i2);
+    st->print(" <MethodHandle of kind %d index at %d>", kind, i2);
     print_field_or_method(-i, i2, st);
   } else {
     st->print_cr(" bad tag=%d at %d", tag.value(), i);
@@ -391,6 +391,7 @@
 }
 
 
+PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
 void BytecodePrinter::print_attributes(int bci, outputStream* st) {
   // Show attributes of pre-rewritten codes
   Bytecodes::Code code = Bytecodes::java_code(raw_code());
@@ -517,7 +518,10 @@
           int idx = ll - lo;
           const char *format = first ? " %d:" INT32_FORMAT " (delta: %d)" :
                                        ", %d:" INT32_FORMAT " (delta: %d)";
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
           st->print(format, ll, dest[idx], dest[idx]-bci);
+PRAGMA_DIAG_POP
         }
         st->cr();
       }
@@ -537,7 +541,10 @@
         for (int ll = 0; ll < len; ll++, first = false)  {
           const char *format = first ? " " INT32_FORMAT ":" INT32_FORMAT :
                                        ", " INT32_FORMAT ":" INT32_FORMAT ;
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
           st->print(format, key[ll], dest[ll]);
+PRAGMA_DIAG_POP
         }
         st->cr();
       }