[Targets] Define __BOOL_DEFINED for Windows targets in C++ mode
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 15 Jul 2015 17:32:34 +0000 (17:32 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 15 Jul 2015 17:32:34 +0000 (17:32 +0000)
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.

llvm-svn: 242307

clang/lib/Basic/Targets.cpp
clang/test/Preprocessor/init.c

index 2b4f945..af4104f 100644 (file)
@@ -643,6 +643,8 @@ protected:
 
       if (Opts.CXXExceptions)
         Builder.defineMacro("_CPPUNWIND");
+
+      Builder.defineMacro("__BOOL_DEFINED");
     }
 
     if (!Opts.CharIsSigned)
index e80d57b..733e822 100644 (file)
 //
 // 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