diff src/share/vm/utilities/globalDefinitions.hpp @ 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 7384f6a12fc1
children 52b4284cb496 b6a8cc1e0d92
line wrap: on
line diff
--- a/src/share/vm/utilities/globalDefinitions.hpp	Thu May 15 18:23:26 2014 -0400
+++ b/src/share/vm/utilities/globalDefinitions.hpp	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
@@ -42,6 +42,32 @@
 # include "utilities/globalDefinitions_xlc.hpp"
 #endif
 
+#ifndef PRAGMA_DIAG_PUSH
+#define PRAGMA_DIAG_PUSH
+#endif
+#ifndef PRAGMA_DIAG_POP
+#define PRAGMA_DIAG_POP
+#endif
+#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED
+#endif
+#ifndef PRAGMA_FORMAT_IGNORED
+#define PRAGMA_FORMAT_IGNORED
+#endif
+#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
+#endif
+#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
+#endif
+#ifndef PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+#define PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+#endif
+#ifndef ATTRIBUTE_PRINTF
+#define ATTRIBUTE_PRINTF(fmt, vargs)
+#endif
+
+
 #include "utilities/macros.hpp"
 
 // This file holds all globally used constants & types, class (forward)
@@ -1284,6 +1310,11 @@
   return ((int)((unsigned int)high << 16) | (unsigned int)low);
 }
 
+// Convert pointer to intptr_t, for use in printing pointers.
+inline intptr_t p2i(const void * p) {
+  return (intptr_t) p;
+}
+
 // Printf-style formatters for fixed- and variable-width types as pointers and
 // integers.  These are derived from the definitions in inttypes.h.  If the platform
 // doesn't provide appropriate definitions, they should be provided in
@@ -1302,6 +1333,7 @@
 // Format 64-bit quantities.
 #define INT64_FORMAT           "%" PRId64
 #define UINT64_FORMAT          "%" PRIu64
+#define UINT64_FORMAT_X        "%" PRIx64
 #define INT64_FORMAT_W(width)  "%" #width PRId64
 #define UINT64_FORMAT_W(width) "%" #width PRIu64
 
@@ -1324,10 +1356,14 @@
 #define PTR_FORMAT    "0x%08"  PRIxPTR
 #endif  // _LP64
 
-#define SSIZE_FORMAT          "%" PRIdPTR
-#define SIZE_FORMAT           "%" PRIuPTR
-#define SSIZE_FORMAT_W(width) "%" #width PRIdPTR
-#define SIZE_FORMAT_W(width)  "%" #width PRIuPTR
+#define INTPTR_FORMAT_W(width)   "%" #width PRIxPTR
+
+#define SSIZE_FORMAT          "%"   PRIdPTR
+#define SIZE_FORMAT           "%"   PRIuPTR
+#define SIZE_FORMAT_HEX       "0x%" PRIxPTR
+#define SSIZE_FORMAT_W(width) "%"   #width PRIdPTR
+#define SIZE_FORMAT_W(width)  "%"   #width PRIuPTR
+#define SIZE_FORMAT_HEX_W(width) "0x%" #width PRIxPTR
 
 #define INTX_FORMAT           "%" PRIdPTR
 #define UINTX_FORMAT          "%" PRIuPTR
@@ -1353,7 +1389,6 @@
   return *(void**)addr;
 }
 
-
 #ifndef PRODUCT
 
 // For unit testing only