summaryrefslogtreecommitdiffstats
path: root/newlib/libc/include
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/include')
-rw-r--r--newlib/libc/include/inttypes.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/newlib/libc/include/inttypes.h b/newlib/libc/include/inttypes.h
index f3943cb40..1631e21c3 100644
--- a/newlib/libc/include/inttypes.h
+++ b/newlib/libc/include/inttypes.h
@@ -13,10 +13,20 @@
#ifndef _INTTYPES_H
#define _INTTYPES_H
+#include <sys/features.h>
#include <stdint.h>
#define __need_wchar_t
#include <stddef.h>
+/* Don't use __STDINT_EXP test since GCC's stdint.h provides different
+ macros than newlib's stdint.h. */
+#if __GNUC_PREREQ(3, 2)
+ #define __INTTYPES_EXP(x) __##x##__
+#else
+ #define __INTTYPES_EXP(x) x
+ #include <limits.h>
+#endif
+
#define __STRINGIFY(a) #a
/* 8-bit types */
@@ -242,10 +252,10 @@
#define SCNxMAX __SCNMAX(x)
/* ptr types */
-#if PTRDIFF_MAX <= __STDINT_EXP(INT_MAX)
+#if PTRDIFF_MAX <= __INTTYPES_EXP(INT_MAX)
# define __PRIPTR(x) __STRINGIFY(x)
# define __SCNPTR(x) __STRINGIFY(x)
-#elif PTRDIFF_MAX <= __STDINT_EXP(LONG_MAX) || !defined(__have_longlong64)
+#elif PTRDIFF_MAX <= __INTTYPES_EXP(LONG_MAX) || !defined(__have_longlong64)
# define __PRIPTR(x) __STRINGIFY(l##x)
# define __SCNPTR(x) __STRINGIFY(l##x)
#else