From 1382a32a7382edb386a660f773a898420b8f3d67 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Tue, 5 Dec 2017 09:13:18 +0000 Subject: [PATCH] Add __WINT_MAX__. This definition is similar to __WCHAR_MAX__, except that it applies to wint_t. It's also documented as being supported by GCC 4.5 and later. llvm-svn: 319746 --- clang/lib/Frontend/InitPreprocessor.cpp | 1 + clang/test/Preprocessor/init.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 2d8caa20c065..617b6aabcc75 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -751,6 +751,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI, DefineTypeSize("__LONG_MAX__", TargetInfo::SignedLong, TI, Builder); DefineTypeSize("__LONG_LONG_MAX__", TargetInfo::SignedLongLong, TI, Builder); DefineTypeSize("__WCHAR_MAX__", TI.getWCharType(), TI, Builder); + DefineTypeSize("__WINT_MAX__", TI.getWIntType(), TI, Builder); DefineTypeSize("__INTMAX_MAX__", TI.getIntMaxType(), TI, Builder); DefineTypeSize("__SIZE_MAX__", TI.getSizeType(), TI, Builder); diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c index f767c7ad01a0..51e1233456b8 100644 --- a/clang/test/Preprocessor/init.c +++ b/clang/test/Preprocessor/init.c @@ -1243,6 +1243,7 @@ // AARCH64-FREEBSD:#define __WCHAR_TYPE__ unsigned int // AARCH64-FREEBSD:#define __WCHAR_UNSIGNED__ 1 // AARCH64-FREEBSD:#define __WCHAR_WIDTH__ 32 +// AARCH64-FREEBSD:#define __WINT_MAX__ 2147483647 // AARCH64-FREEBSD:#define __WINT_TYPE__ int // AARCH64-FREEBSD:#define __WINT_WIDTH__ 32 // AARCH64-FREEBSD:#define __aarch64__ 1 @@ -8440,6 +8441,7 @@ // X86_64-CLOUDABI:#define __WCHAR_MAX__ 2147483647 // X86_64-CLOUDABI:#define __WCHAR_TYPE__ int // X86_64-CLOUDABI:#define __WCHAR_WIDTH__ 32 +// X86_64-CLOUDABI:#define __WINT_MAX__ 2147483647 // X86_64-CLOUDABI:#define __WINT_TYPE__ int // X86_64-CLOUDABI:#define __WINT_WIDTH__ 32 // X86_64-CLOUDABI:#define __amd64 1 @@ -9364,6 +9366,7 @@ // WEBASSEMBLY32-NEXT:#define __WCHAR_TYPE__ int // WEBASSEMBLY32-NOT:#define __WCHAR_UNSIGNED__ // WEBASSEMBLY32-NEXT:#define __WCHAR_WIDTH__ 32 +// WEBASSEMBLY32-NEXT:#define __WINT_MAX__ 2147483647 // WEBASSEMBLY32-NEXT:#define __WINT_TYPE__ int // WEBASSEMBLY32-NOT:#define __WINT_UNSIGNED__ // WEBASSEMBLY32-NEXT:#define __WINT_WIDTH__ 32 @@ -9695,6 +9698,7 @@ // WEBASSEMBLY64-NEXT:#define __WCHAR_TYPE__ int // WEBASSEMBLY64-NOT:#define __WCHAR_UNSIGNED__ // WEBASSEMBLY64-NEXT:#define __WCHAR_WIDTH__ 32 +// WEBASSEMBLY64-NEXT:#define __WINT_MAX__ 2147483647 // WEBASSEMBLY64-NEXT:#define __WINT_TYPE__ int // WEBASSEMBLY64-NOT:#define __WINT_UNSIGNED__ // WEBASSEMBLY64-NEXT:#define __WINT_WIDTH__ 32