[PATCH] Do not define __STRICT_ANSI__ in clang-cl

Ehsan Akhgari ehsan.akhgari at gmail.com
Mon Jun 30 12:32:42 PDT 2014


Hi hans,

This breaks building the cairo library with MSVC on Windows, because it uses __STRICT_ANSI__ to detect whether the inline keyword is available.

http://reviews.llvm.org/D4350

Files:
  lib/Frontend/InitPreprocessor.cpp
  test/Frontend/strict-ansi.c

Index: lib/Frontend/InitPreprocessor.cpp
===================================================================
--- lib/Frontend/InitPreprocessor.cpp
+++ lib/Frontend/InitPreprocessor.cpp
@@ -433,7 +433,7 @@
   // Initialize language-specific preprocessor defines.
 
   // Standard conforming mode?
-  if (!LangOpts.GNUMode)
+  if (!LangOpts.GNUMode && !LangOpts.MSVCCompat)
     Builder.defineMacro("__STRICT_ANSI__");
 
   if (LangOpts.CPlusPlus11)
Index: test/Frontend/strict-ansi.c
===================================================================
--- /dev/null
+++ test/Frontend/strict-ansi.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fms-compatibility -verify %s
+// expected-no-diagnostics
+
+#if defined(__STRICT_ANSI__)
+#error __STRICT_ANSI__ should not be defined.
+#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4350.10981.patch
Type: text/x-patch
Size: 778 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140630/fd9cc184/attachment.bin>


More information about the cfe-commits mailing list