r210582 - Do not predefine __EXCEPTIONS in clang-cl (PR19977)
Hans Wennborg
hans at hanshq.net
Tue Jun 10 13:46:38 PDT 2014
Author: hans
Date: Tue Jun 10 15:46:38 2014
New Revision: 210582
URL: http://llvm.org/viewvc/llvm-project?rev=210582&view=rev
Log:
Do not predefine __EXCEPTIONS in clang-cl (PR19977)
Patch by Ehsan Akhgari! (Test tweak by me.)
Differential Revision: http://reviews.llvm.org/D4065
Added:
cfe/trunk/test/Frontend/exceptions.c
Modified:
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=210582&r1=210581&r2=210582&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Tue Jun 10 15:46:38 2014
@@ -491,7 +491,7 @@ static void InitializePredefinedMacros(c
Builder.defineMacro("__BLOCKS__");
}
- if (LangOpts.CXXExceptions)
+ if (!LangOpts.MSVCCompat && LangOpts.CXXExceptions)
Builder.defineMacro("__EXCEPTIONS");
if (LangOpts.RTTI)
Builder.defineMacro("__GXX_RTTI");
Added: cfe/trunk/test/Frontend/exceptions.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/exceptions.c?rev=210582&view=auto
==============================================================================
--- cfe/trunk/test/Frontend/exceptions.c (added)
+++ cfe/trunk/test/Frontend/exceptions.c Tue Jun 10 15:46:38 2014
@@ -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
More information about the cfe-commits
mailing list