From 148bf27107ea5444fdd3fc4d9e4b086e7b213665 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319746 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/InitPreprocessor.cpp | 1 + test/Preprocessor/init.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index 2d8caa20c0..617b6aabcc 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/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/test/Preprocessor/init.c b/test/Preprocessor/init.c index f767c7ad01..51e1233456 100644 --- a/test/Preprocessor/init.c +++ b/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 -- 2.40.0