mirror of https://github.com/microsoft/clang.git
Frontend: Define __EXCEPTIONS if -fexceptions is passed
GCC defines __EXCEPTIONS, regardless of language mode, if -fexceptions is passed. We should do the same. This fixes PR21358. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220714 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dabcb7e52a
commit
16446f30e7
|
@ -550,7 +550,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
|
|||
Builder.defineMacro("__BLOCKS__");
|
||||
}
|
||||
|
||||
if (!LangOpts.MSVCCompat && LangOpts.CXXExceptions)
|
||||
if (!LangOpts.MSVCCompat && LangOpts.Exceptions)
|
||||
Builder.defineMacro("__EXCEPTIONS");
|
||||
if (!LangOpts.MSVCCompat && LangOpts.RTTI)
|
||||
Builder.defineMacro("__GXX_RTTI");
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// RUN: %clang_cc1 -fms-compatibility -fexceptions -fcxx-exceptions -verify %s
|
||||
// RUN: %clang_cc1 -fms-compatibility -fexceptions -fcxx-exceptions -DMS_MODE -verify %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
#if defined(__EXCEPTIONS)
|
||||
// RUN: %clang_cc1 -fms-compatibility -fexceptions -verify %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
#if defined(MS_MODE) && defined(__EXCEPTIONS)
|
||||
#error __EXCEPTIONS should not be defined.
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// RUN: %clang_cc1 -x objective-c -fobjc-exceptions -fexceptions -E -dM %s | FileCheck -check-prefix=CHECK-OBJC-NOCXX %s
|
||||
// CHECK-OBJC-NOCXX: #define OBJC_ZEROCOST_EXCEPTIONS 1
|
||||
// CHECK-OBJC-NOCXX-NOT: #define __EXCEPTIONS 1
|
||||
// CHECK-OBJC-NOCXX: #define __EXCEPTIONS 1
|
||||
|
||||
// RUN: %clang_cc1 -x objective-c++ -fobjc-exceptions -fexceptions -fcxx-exceptions -E -dM %s | FileCheck -check-prefix=CHECK-OBJC-CXX %s
|
||||
// CHECK-OBJC-CXX: #define OBJC_ZEROCOST_EXCEPTIONS 1
|
||||
|
|
Loading…
Reference in New Issue