[clang] [clang] Add /Zc:__STDC__ flag to clang-cl (PR #68690)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 12 03:51:51 PDT 2023


================
@@ -123,6 +123,10 @@
 // CHECK-CHAR8_T_: "-fno-char8_t"
 
 
+// RUN: %clang_cl /dev/null /E -Xclang -dM 2> /dev/null | FileCheck -match-full-lines %s --check-prefix=STDCOFF
+// RUN: %clang_cl /dev/null /E -Xclang -dM /Zc:__STDC__ 2> /dev/null | FileCheck -match-full-lines %s --check-prefix=STDCON
----------------
xbjfk wrote:

Good catch, in this case I guess it's best to create a `cl-zc.c` file?

I think it shouldn't be allowed in clang in C++ mode - after all if someone really wants it they can use `-Xclang -fms-define-stdc` or even `-D__STDC__` manually. My guess would be the primary use case of `-fms-compatibility` with clang (rather than clang-cl) is code whose build system is compiler agnostic but the code itself depends on MSVC behavior - in which case they would not be expecting `__STDC__` to be defined.

https://github.com/llvm/llvm-project/pull/68690


More information about the cfe-commits mailing list