From: Markus Scherer Date: Wed, 27 Jul 2011 23:15:57 +0000 (+0000) Subject: ICU-8452 define uintptr_t where missing X-Git-Tag: milestone-59-0-1~4614 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f2a684eab185178b13c4519073b84e66003ea9d;p=icu ICU-8452 define uintptr_t where missing X-SVN-Rev: 30436 --- diff --git a/icu4c/source/common/putilimp.h b/icu4c/source/common/putilimp.h index e4d64aa76a8..84b605ec11c 100644 --- a/icu4c/source/common/putilimp.h +++ b/icu4c/source/common/putilimp.h @@ -25,6 +25,17 @@ # 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 diff --git a/icu4c/source/common/unicode/ptypes.h b/icu4c/source/common/unicode/ptypes.h index 5768ccddc5e..b6615ad7913 100644 --- a/icu4c/source/common/unicode/ptypes.h +++ b/icu4c/source/common/unicode/ptypes.h @@ -20,6 +20,18 @@ #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 #include "unicode/platform.h"