# Fix build failure on Darwin due to -Wformat errors. # Alexander Strange diff -u -r ../work-orig/hotspot/src/cpu/x86/vm/jni_x86.h ./hotspot/src/cpu/x86/vm/jni_x86.h --- ../work-orig/hotspot/src/cpu/x86/vm/jni_x86.h 2010-11-04 21:15:16.000000000 +0800 +++ ./hotspot/src/cpu/x86/vm/jni_x86.h 2010-11-04 21:20:08.000000000 +0800 @@ -32,8 +32,7 @@ #define JNICALL typedef int jint; - -#ifdef _LP64 +#if defined(_LP64) && !defined(__APPLE__) typedef long jlong; #else typedef long long jlong; diff -u -r ../work-orig/hotspot/src/share/vm/utilities/globalDefinitions.hpp ./hotspot/src/share/vm/utilities/globalDefinitions.hpp --- ../work-orig/hotspot/src/share/vm/utilities/globalDefinitions.hpp 2010-11-04 21:15:17.000000000 +0800 +++ ./hotspot/src/share/vm/utilities/globalDefinitions.hpp 2010-11-04 21:20:11.000000000 +0800 @@ -1110,6 +1110,8 @@ // Format 32-bit quantities. #define INT32_FORMAT "%d" #define UINT32_FORMAT "%u" +#define LONG_FORMAT "%ld" +#define ULONG_FORMAT "%lu" #define INT32_FORMAT_W(width) "%" #width "d" #define UINT32_FORMAT_W(width) "%" #width "u" @@ -1145,16 +1147,30 @@ // GCC 4.3.2, however requires the data to be converted to "intptr_t" when // using "%x". #ifdef _LP64 +#ifdef __APPLE__ +#define PTR_FORMAT LONG_FORMAT +#define UINTX_FORMAT ULONG_FORMAT +#define INTX_FORMAT LONG_FORMAT +#define SIZE_FORMAT LONG_FORMAT +#else #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 +#endif #else // !_LP64 +#ifdef __APPLE__ +#define PTR_FORMAT LONG_FORMAT +#define UINTX_FORMAT ULONG_FORMAT +#define INTX_FORMAT LONG_FORMAT +#define SIZE_FORMAT LONG_FORMAT +#else #define PTR_FORMAT PTR32_FORMAT #define UINTX_FORMAT UINT32_FORMAT #define INTX_FORMAT INT32_FORMAT #define SIZE_FORMAT UINT32_FORMAT +#endif #define SSIZE_FORMAT INT32_FORMAT #endif // _LP64 diff -u -r ../work-orig/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp ./hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp --- ../work-orig/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp 2010-11-04 21:15:17.000000000 +0800 +++ ./hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp 2010-11-04 21:20:11.000000000 +0800 @@ -275,7 +275,11 @@ // Formatting. #ifdef _LP64 +#ifdef __APPLE__ +#define FORMAT64_MODIFIER "ll" +#else /* __APPLE__ */ #define FORMAT64_MODIFIER "l" +#endif /* __APPLE__ */ #else // !_LP64 #define FORMAT64_MODIFIER "ll" #endif // _LP64