From 056efe0fc7319f129670a68332a7d2dd7f861d39 Mon Sep 17 00:00:00 2001 From: Ken Dyck Date: Thu, 19 Nov 2009 12:21:52 +0000 Subject: [PATCH] Add __PTRDIFF_WIDTH__ macro to eventually replace __PTRDIFF_TYPE__ in stdint.h. llvm-svn: 89342 --- clang/lib/Frontend/InitPreprocessor.cpp | 1 + clang/test/Preprocessor/init.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 03d3a0039eb4..c64b846278f0 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -390,6 +390,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI, DefineTypeWidth("__INTMAX_WIDTH__", TI.getIntMaxType(), TI, Buf); DefineType("__PTRDIFF_TYPE__", TI.getPtrDiffType(0), Buf); + DefineTypeWidth("__PTRDIFF_WIDTH__", TI.getPtrDiffType(0), TI, Buf); DefineTypeWidth("__INTPTR_WIDTH__", TI.getIntPtrType(), TI, Buf); DefineType("__SIZE_TYPE__", TI.getSizeType(), Buf); DefineType("__WCHAR_TYPE__", TI.getWCharType(), Buf); diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c index 44ce0987fd06..e4b8d5eb5acc 100644 --- a/clang/test/Preprocessor/init.c +++ b/clang/test/Preprocessor/init.c @@ -177,6 +177,7 @@ // ARM:#define __NO_INLINE__ 1 // ARM:#define __POINTER_WIDTH__ 32 // ARM:#define __PTRDIFF_TYPE__ int +// ARM:#define __PTRDIFF_WIDTH__ 32 // ARM:#define __SCHAR_MAX__ 127 // ARM:#define __SHRT_MAX__ 32767 // ARM:#define __SIZE_TYPE__ unsigned int @@ -253,6 +254,7 @@ // BFIN:#define __NO_INLINE__ 1 // BFIN:#define __POINTER_WIDTH__ 32 // BFIN:#define __PTRDIFF_TYPE__ long int +// BFIN:#define __PTRDIFF_WIDTH__ 32 // BFIN:#define __SCHAR_MAX__ 127 // BFIN:#define __SHRT_MAX__ 32767 // BFIN:#define __SIZE_TYPE__ long unsigned int @@ -325,6 +327,7 @@ // I386:#define __NO_MATH_INLINES 1 // I386:#define __POINTER_WIDTH__ 32 // I386:#define __PTRDIFF_TYPE__ int +// I386:#define __PTRDIFF_WIDTH__ 32 // I386:#define __REGISTER_PREFIX__ // I386:#define __SCHAR_MAX__ 127 // I386:#define __SHRT_MAX__ 32767 @@ -400,6 +403,7 @@ // MSP430:#define __NO_INLINE__ 1 // MSP430:#define __POINTER_WIDTH__ 16 // MSP430:#define __PTRDIFF_TYPE__ int +// MSP430:#define __PTRDIFF_WIDTH__ 16 // MSP430:#define __SCHAR_MAX__ 127 // MSP430:#define __SHRT_MAX__ 32767 // MSP430:#define __SIZE_TYPE__ unsigned int @@ -468,6 +472,7 @@ // PIC16:#define __NO_INLINE__ 1 // PIC16:#define __POINTER_WIDTH__ 16 // PIC16:#define __PTRDIFF_TYPE__ int +// PIC16:#define __PTRDIFF_WIDTH__ 16 // PIC16:#define __SCHAR_MAX__ 127 // PIC16:#define __SHRT_MAX__ 32767 // PIC16:#define __SIZE_TYPE__ unsigned int @@ -553,6 +558,7 @@ // PPC64:#define __POINTER_WIDTH__ 64 // PPC64:#define __POWERPC__ 1 // PPC64:#define __PTRDIFF_TYPE__ long int +// PPC64:#define __PTRDIFF_WIDTH__ 64 // PPC64:#define __REGISTER_PREFIX__ // PPC64:#define __SCHAR_MAX__ 127 // PPC64:#define __SHRT_MAX__ 32767 @@ -630,6 +636,7 @@ // PPC:#define __POINTER_WIDTH__ 32 // PPC:#define __POWERPC__ 1 // PPC:#define __PTRDIFF_TYPE__ long int +// PPC:#define __PTRDIFF_WIDTH__ 32 // PPC:#define __REGISTER_PREFIX__ // PPC:#define __SCHAR_MAX__ 127 // PPC:#define __SHRT_MAX__ 32767 @@ -700,6 +707,7 @@ // S390X:#define __NO_INLINE__ 1 // S390X:#define __POINTER_WIDTH__ 64 // S390X:#define __PTRDIFF_TYPE__ long int +// S390X:#define __PTRDIFF_WIDTH__ 64 // S390X:#define __SCHAR_MAX__ 127 // S390X:#define __SHRT_MAX__ 32767 // S390X:#define __SIZE_TYPE__ long unsigned int @@ -769,6 +777,7 @@ // SPARC:#define __NO_INLINE__ 1 // SPARC:#define __POINTER_WIDTH__ 32 // SPARC:#define __PTRDIFF_TYPE__ long int +// SPARC:#define __PTRDIFF_WIDTH__ 32 // SPARC:#define __REGISTER_PREFIX__ // SPARC:#define __SCHAR_MAX__ 127 // SPARC:#define __SHRT_MAX__ 32767 @@ -840,6 +849,7 @@ // TCE:#define __NO_INLINE__ 1 // TCE:#define __POINTER_WIDTH__ 32 // TCE:#define __PTRDIFF_TYPE__ int +// TCE:#define __PTRDIFF_WIDTH__ 32 // TCE:#define __SCHAR_MAX__ 127 // TCE:#define __SHRT_MAX__ 32767 // TCE:#define __SIZE_TYPE__ unsigned int @@ -917,6 +927,7 @@ // X86_64:#define __NO_MATH_INLINES 1 // X86_64:#define __POINTER_WIDTH__ 64 // X86_64:#define __PTRDIFF_TYPE__ long int +// X86_64:#define __PTRDIFF_WIDTH__ 64 // X86_64:#define __REGISTER_PREFIX__ // X86_64:#define __SCHAR_MAX__ 127 // X86_64:#define __SHRT_MAX__ 32767