From dd9ee390450abee8b910961ebee92b8577c88b21 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 7 Feb 2012 16:42:20 +0000 Subject: [PATCH] * libc/include/inttypes.h: Redefine pointer type macros. --- newlib/ChangeLog | 4 ++++ newlib/libc/include/inttypes.h | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index fb697e0e7..330f53c61 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,7 @@ +2012-02-07 Corinna Vinschen + + * libc/include/inttypes.h: Redefine pointer type macros. + 2012-01-13 Yaakov Selkowitz * libc/stdio/sprintf.c: Document 'm' conversion specifier. diff --git a/newlib/libc/include/inttypes.h b/newlib/libc/include/inttypes.h index 02bef1aca..f3943cb40 100644 --- a/newlib/libc/include/inttypes.h +++ b/newlib/libc/include/inttypes.h @@ -242,15 +242,15 @@ #define SCNxMAX __SCNMAX(x) /* ptr types */ -#if __have_long64 -#define __PRIPTR(x) __STRINGIFY(l##x) -#define __SCNPTR(x) __STRINGIFY(l##x) -#elif __have_longlong64 -#define __PRIPTR(x) __STRINGIFY(ll##x) -#define __SCNPTR(x) __STRINGIFY(ll##x) +#if PTRDIFF_MAX <= __STDINT_EXP(INT_MAX) +# define __PRIPTR(x) __STRINGIFY(x) +# define __SCNPTR(x) __STRINGIFY(x) +#elif PTRDIFF_MAX <= __STDINT_EXP(LONG_MAX) || !defined(__have_longlong64) +# define __PRIPTR(x) __STRINGIFY(l##x) +# define __SCNPTR(x) __STRINGIFY(l##x) #else -#define __PRIPTR(x) __STRINGIFY(x) -#define __SCNPTR(x) __STRINGIFY(x) +# define __PRIPTR(x) __STRINGIFY(ll##x) +# define __SCNPTR(x) __STRINGIFY(ll##x) #endif #define PRIdPTR __PRIPTR(d)