]> granicus.if.org Git - clang/commitdiff
Do not predefine __EXCEPTIONS in clang-cl (PR19977)
authorHans Wennborg <hans@hanshq.net>
Tue, 10 Jun 2014 20:46:38 +0000 (20:46 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 10 Jun 2014 20:46:38 +0000 (20:46 +0000)
Patch by Ehsan Akhgari! (Test tweak by me.)

Differential Revision: http://reviews.llvm.org/D4065

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210582 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/InitPreprocessor.cpp
test/Frontend/exceptions.c [new file with mode: 0644]

index fb52eb489e0fdce95a03efcb2918378d41288a40..dbb59b4f9f1fd56b4ba7cf7a772e7c807b41e712 100644 (file)
@@ -491,7 +491,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
     Builder.defineMacro("__BLOCKS__");
   }
 
-  if (LangOpts.CXXExceptions)
+  if (!LangOpts.MSVCCompat && LangOpts.CXXExceptions)
     Builder.defineMacro("__EXCEPTIONS");
   if (LangOpts.RTTI)
     Builder.defineMacro("__GXX_RTTI");
diff --git a/test/Frontend/exceptions.c b/test/Frontend/exceptions.c
new file mode 100644 (file)
index 0000000..4bbaaa3
--- /dev/null
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fms-compatibility -fexceptions -fcxx-exceptions -verify %s
+// expected-no-diagnostics
+
+#if defined(__EXCEPTIONS)
+#error __EXCEPTIONS should not be defined.
+#endif