[PATCH] Do not define __STRICT_ANSI__ in clang-cl

Alp Toker alp at nuanti.com
Mon Jun 30 12:49:11 PDT 2014


On 30/06/2014 22:32, Ehsan Akhgari wrote:
> 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__");

The fix looks good (though we really ought to fix LangOpts to represent 
this properly at some point).

>   
>     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
>
test/Preprocessor/predefined-macros.c or test/Preprocessor/init.c would 
be more conventional places to test this. Could you look into that?

Alp.



>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-- 
http://www.nuanti.com
the browser experts




More information about the cfe-commits mailing list