From 31938000a5921ddfc73e9d1d99d312f2aa2d5d33 Mon Sep 17 00:00:00 2001 From: Earnie Boyd Date: Mon, 30 Jul 2012 14:31:16 +0000 Subject: [PATCH] * include/inttypes.h: A few items like PRNdPTR and SCNdPTR need 64 bitness specified when _WIN64 is defined. --- winsup/mingw/ChangeLog | 2 ++ winsup/mingw/include/inttypes.h | 39 +++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index b145e597f..4f4aa481a 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -2,6 +2,8 @@ * include/stdint.h: Include _mingw.h for the definition of __int64 when _WIN64 is defined. + * include/inttypes.h: A few items like PRNdPTR and SCNdPTR need 64 + bitness specified when _WIN64 is defined. 2012-05-08 Keith Marshall diff --git a/winsup/mingw/include/inttypes.h b/winsup/mingw/include/inttypes.h index 2d2bb8d80..e13040634 100644 --- a/winsup/mingw/include/inttypes.h +++ b/winsup/mingw/include/inttypes.h @@ -44,7 +44,6 @@ typedef struct { #define PRIdFAST64 "I64d" #define PRIdMAX "I64d" -#define PRIdPTR "d" #define PRIi8 "i" #define PRIi16 "i" @@ -62,7 +61,6 @@ typedef struct { #define PRIiFAST64 "I64i" #define PRIiMAX "I64i" -#define PRIiPTR "i" #define PRIo8 "o" #define PRIo16 "o" @@ -81,8 +79,6 @@ typedef struct { #define PRIoMAX "I64o" -#define PRIoPTR "o" - /* fprintf macros for unsigned types */ #define PRIu8 "u" #define PRIu16 "u" @@ -101,7 +97,6 @@ typedef struct { #define PRIuFAST64 "I64u" #define PRIuMAX "I64u" -#define PRIuPTR "u" #define PRIx8 "x" #define PRIx16 "x" @@ -119,7 +114,6 @@ typedef struct { #define PRIxFAST64 "I64x" #define PRIxMAX "I64x" -#define PRIxPTR "x" #define PRIX8 "X" #define PRIX16 "X" @@ -137,7 +131,22 @@ typedef struct { #define PRIXFAST64 "I64X" #define PRIXMAX "I64X" + +#ifdef _WIN64 +#define PRIdPTR "I64d" +#define PRIiPTR "I64i" +#define PRIoPTR "I64o" +#define PRIuPTR "I64u" +#define PRIxPTR "I64x" +#define PRIXPTR "I64X" +#else +#define PRIdPTR "d" +#define PRIiPTR "i" +#define PRIoPTR "o" +#define PRIuPTR "u" +#define PRIxPTR "x" #define PRIXPTR "X" +#endif /* * fscanf macros for signed int types @@ -159,7 +168,6 @@ typedef struct { #define SCNdFAST64 "I64d" #define SCNdMAX "I64d" -#define SCNdPTR "d" #define SCNi16 "hi" #define SCNi32 "i" @@ -174,7 +182,6 @@ typedef struct { #define SCNiFAST64 "I64i" #define SCNiMAX "I64i" -#define SCNiPTR "i" #define SCNo16 "ho" #define SCNo32 "o" @@ -189,7 +196,6 @@ typedef struct { #define SCNoFAST64 "I64o" #define SCNoMAX "I64o" -#define SCNoPTR "o" #define SCNx16 "hx" #define SCNx32 "x" @@ -204,8 +210,6 @@ typedef struct { #define SCNxFAST64 "I64x" #define SCNxMAX "I64x" -#define SCNxPTR "x" - /* fscanf macros for unsigned int types */ @@ -222,7 +226,20 @@ typedef struct { #define SCNuFAST64 "I64u" #define SCNuMAX "I64u" + +#ifdef _WIN64 +#define SCNdPTR "I64d" +#define SCNiPTR "I64i" +#define SCNoPTR "I64o" +#define SCNxPTR "I64x" +#define SCNuPTR "I64u" +#else +#define SCNdPTR "d" +#define SCNiPTR "i" +#define SCNoPTR "o" +#define SCNxPTR "x" #define SCNuPTR "u" +#endif #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /*