src/share/vm/utilities/globalDefinitions.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7089790_shared Cdiff src/share/vm/utilities/globalDefinitions.hpp

src/share/vm/utilities/globalDefinitions.hpp

Print this page
rev 2695 : shared changes
rev 2697 : imported patch formatfixes

*** 23,32 **** --- 23,34 ---- */ #ifndef SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP #define SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP + #define __STDC_FORMAT_MACROS + #ifdef TARGET_COMPILER_gcc # include "utilities/globalDefinitions_gcc.hpp" #endif #ifdef TARGET_COMPILER_visCPP # include "utilities/globalDefinitions_visCPP.hpp"
*** 1176,1222 **** inline int build_int_from_shorts( jushort low, jushort high ) { return ((int)((unsigned int)high << 16) | (unsigned int)low); } // Printf-style formatters for fixed- and variable-width types as pointers and ! // integers. ! // ! // Each compiler-specific definitions file (e.g., globalDefinitions_gcc.hpp) ! // must define the macro FORMAT64_MODIFIER, which is the modifier for '%x' or ! // '%d' formats to indicate a 64-bit quantity; commonly "l" (in LP64) or "ll" ! // (in ILP32). #define BOOL_TO_STR(_b_) ((_b_) ? "true" : "false") // Format 32-bit quantities. ! #define INT32_FORMAT "%d" ! #define UINT32_FORMAT "%u" ! #define INT32_FORMAT_W(width) "%" #width "d" ! #define UINT32_FORMAT_W(width) "%" #width "u" ! #define PTR32_FORMAT "0x%08x" // Format 64-bit quantities. ! #define INT64_FORMAT "%" FORMAT64_MODIFIER "d" ! #define UINT64_FORMAT "%" FORMAT64_MODIFIER "u" ! #define PTR64_FORMAT "0x%016" FORMAT64_MODIFIER "x" ! #define INT64_FORMAT_W(width) "%" #width FORMAT64_MODIFIER "d" ! #define UINT64_FORMAT_W(width) "%" #width FORMAT64_MODIFIER "u" - // Format macros that allow the field width to be specified. The width must be - // a string literal (e.g., "8") or a macro that evaluates to one. - #ifdef _LP64 - #define UINTX_FORMAT_W(width) UINT64_FORMAT_W(width) - #define SSIZE_FORMAT_W(width) INT64_FORMAT_W(width) - #define SIZE_FORMAT_W(width) UINT64_FORMAT_W(width) - #else - #define UINTX_FORMAT_W(width) UINT32_FORMAT_W(width) - #define SSIZE_FORMAT_W(width) INT32_FORMAT_W(width) - #define SIZE_FORMAT_W(width) UINT32_FORMAT_W(width) - #endif // _LP64 - // Format pointers and size_t (or size_t-like integer types) which change size // between 32- and 64-bit. The pointer format theoretically should be "%p", // however, it has different output on different platforms. On Windows, the data // will be padded with zeros automatically. On Solaris, we can use "%016p" & // "%08p" on 64 bit & 32 bit platforms to make the data padded with extra zeros. --- 1178,1212 ---- inline int build_int_from_shorts( jushort low, jushort high ) { return ((int)((unsigned int)high << 16) | (unsigned int)low); } // 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 ! // the compiler-specific definitions file (e.g., globalDefinitions_gcc.hpp) #define BOOL_TO_STR(_b_) ((_b_) ? "true" : "false") // Format 32-bit quantities. ! #define INT32_FORMAT "%" PRId32 ! #define UINT32_FORMAT "%" PRIu32 ! #define INT32_FORMAT_W(width) "%" #width PRId32 ! #define UINT32_FORMAT_W(width) "%" #width PRIu32 ! #define PTR32_FORMAT "0x%08" PRIx32 // Format 64-bit quantities. ! #define INT64_FORMAT "%" PRId64 ! #define UINT64_FORMAT "%" PRIu64 ! #define PTR64_FORMAT "0x%016" PRIx64 ! #define INT64_FORMAT_W(width) "%" #width PRId64 ! #define UINT64_FORMAT_W(width) "%" #width PRIu64 ! #define SSIZE_FORMAT_W(width) "%" #width PRIdPTR ! #define SIZE_FORMAT_W(width) "%" #width PRIuPTR ! #define UINTX_FORMAT_W(width) "%" #width PRIuPTR // Format pointers and size_t (or size_t-like integer types) which change size // between 32- and 64-bit. The pointer format theoretically should be "%p", // however, it has different output on different platforms. On Windows, the data // will be padded with zeros automatically. On Solaris, we can use "%016p" & // "%08p" on 64 bit & 32 bit platforms to make the data padded with extra zeros.
*** 1223,1247 **** // On Linux, "%016p" or "%08p" is not be allowed, at least on the latest GCC // 4.3.2. So we have to use "%016x" or "%08x" to simulate the printing format. // GCC 4.3.2, however requires the data to be converted to "intptr_t" when // using "%x". #ifdef _LP64 ! #define PTR_FORMAT PTR64_FORMAT ! #define UINTX_FORMAT UINT64_FORMAT ! #define INTX_FORMAT INT64_FORMAT ! #define SIZE_FORMAT UINT64_FORMAT ! #define SSIZE_FORMAT INT64_FORMAT #else // !_LP64 ! #define PTR_FORMAT PTR32_FORMAT ! #define UINTX_FORMAT UINT32_FORMAT ! #define INTX_FORMAT INT32_FORMAT ! #define SIZE_FORMAT UINT32_FORMAT ! #define SSIZE_FORMAT INT32_FORMAT #endif // _LP64 ! #define INTPTR_FORMAT PTR_FORMAT // Enable zap-a-lot if in debug version. # ifdef ASSERT # ifdef COMPILER2 # define ENABLE_ZAP_DEAD_LOCALS --- 1213,1236 ---- // On Linux, "%016p" or "%08p" is not be allowed, at least on the latest GCC // 4.3.2. So we have to use "%016x" or "%08x" to simulate the printing format. // GCC 4.3.2, however requires the data to be converted to "intptr_t" when // using "%x". #ifdef _LP64 ! #define INTPTR_FORMAT "0x%016" PRIxPTR ! #define PTR_FORMAT "0x%016" PRIxPTR #else // !_LP64 ! #define INTPTR_FORMAT "0x%08" PRIxPTR ! #define PTR_FORMAT "0x%08" PRIxPTR #endif // _LP64 ! #define SSIZE_FORMAT "%" PRIdPTR ! #define SIZE_FORMAT "%" PRIuPTR + #define UINTX_FORMAT "%" PRIuPTR + #define INTX_FORMAT "%" PRIdPTR + + // Enable zap-a-lot if in debug version. # ifdef ASSERT # ifdef COMPILER2 # define ENABLE_ZAP_DEAD_LOCALS
src/share/vm/utilities/globalDefinitions.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File