diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 802b2a95cc84..476e214232f5 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -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"); diff --git a/clang/test/Frontend/exceptions.c b/clang/test/Frontend/exceptions.c index 4bbaaa39bfa6..981b5b9045b5 100644 --- a/clang/test/Frontend/exceptions.c +++ b/clang/test/Frontend/exceptions.c @@ -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 diff --git a/clang/test/Preprocessor/predefined-exceptions.m b/clang/test/Preprocessor/predefined-exceptions.m index c13f429e3763..0791075dfc75 100644 --- a/clang/test/Preprocessor/predefined-exceptions.m +++ b/clang/test/Preprocessor/predefined-exceptions.m @@ -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