]> granicus.if.org Git - icu/commitdiff
ICU-8452 define uintptr_t where missing
authorMarkus Scherer <markus.icu@gmail.com>
Wed, 27 Jul 2011 23:15:57 +0000 (23:15 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Wed, 27 Jul 2011 23:15:57 +0000 (23:15 +0000)
X-SVN-Rev: 30436

icu4c/source/common/putilimp.h
icu4c/source/common/unicode/ptypes.h

index e4d64aa76a8ca14634d806594607f24da88117f8..84b605ec11c49a189c40f6cdfd462d5b8f3c87db 100644 (file)
 #   define IEEE_754 1
 #endif
 
+/**
+ * uintptr_t is an optional part of the standard definitions in stdint.h.
+ * The opengroup.org documentation for stdint.h says
+ * "On XSI-conformant systems, the intptr_t and uintptr_t types are required;
+ * otherwise, they are optional."
+ * We assume that when uintptr_t is defined, UINTPTR_MAX is defined as well.
+ */
+#if !defined(__intptr_t_defined) && !defined(UINTPTR_MAX)
+typedef ptrdiff_t uintptr_t;
+#endif
+
 /**
  * \def U_HAVE_MSVC_2003_OR_EARLIER
  * Flag for workaround of MSVC 2003 optimization bugs
index 5768ccddc5e4ce44fd23b4ad632f4d34a8901186..b6615ad7913b2ca2ff544c7a16a98b00f0699d25 100644 (file)
 #ifndef _PTYPES_H
 #define _PTYPES_H
 
+/**
+ * \def __STDC_LIMIT_MACROS
+ * According to the Linux stdint.h, the ISO C99 standard specifies that in C++ implementations
+ * macros like INT32_MIN and UINTPTR_MAX should only be defined if explicitly requested.
+ * We need to define __STDC_LIMIT_MACROS before including stdint.h in C++ code
+ * that uses such limit macros.
+ * @internal
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS
+#endif
+
 #include <sys/types.h>
 
 #include "unicode/platform.h"