From: David Majnemer Date: Wed, 15 Jul 2015 17:32:34 +0000 (+0000) Subject: [Targets] Define __BOOL_DEFINED for Windows targets in C++ mode X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=066fa34528193dda594162429f0b7f859efd3b63;p=clang [Targets] Define __BOOL_DEFINED for Windows targets in C++ mode MSVC 4.2 didn't have bool as a builtin type but MSVC 5.0 does. When they added it, they added a macro (__BOOL_DEFINED) which allows build scripts and the like to know if they should provide their own bool. Clang always supports bool as a builtin type in C++ mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242307 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 2b4f945ac3..af4104fef5 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -643,6 +643,8 @@ protected: if (Opts.CXXExceptions) Builder.defineMacro("_CPPUNWIND"); + + Builder.defineMacro("__BOOL_DEFINED"); } if (!Opts.CharIsSigned) diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index e80d57b82c..733e822b89 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -144,12 +144,14 @@ // // MSEXT-CXX:#define _NATIVE_WCHAR_T_DEFINED 1 // MSEXT-CXX:#define _WCHAR_T_DEFINED 1 +// MSEXT-CXX:#define __BOOL_DEFINED 1 // // // RUN: %clang_cc1 -x c++ -fno-wchar -fms-extensions -triple i686-pc-win32 -E -dM < /dev/null | FileCheck -check-prefix MSEXT-CXX-NOWCHAR %s // // MSEXT-CXX-NOWCHAR-NOT:#define _NATIVE_WCHAR_T_DEFINED 1 // MSEXT-CXX-NOWCHAR-NOT:#define _WCHAR_T_DEFINED 1 +// MSEXT-CXX-NOWCHAR:#define __BOOL_DEFINED 1 // // // RUN: %clang_cc1 -x objective-c -E -dM < /dev/null | FileCheck -check-prefix OBJC %s