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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 11 12:01:04 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
----------------
AaronBallman wrote:

I'd also like to see a test that ensures you can't *disable* the option. e.g., `-fno-ms-define-stdc` should be an error.

And this current test actually shows a bug -- this is a .cpp file, not a .c file; `/Zc:__STDC__` should do nothing/diagnose in C++ mode (https://godbolt.org/z/6W4oaKf9e); I'm on the fence as to whether `-fms-define-stdc` should be allowed in C++ mode or not (I'm inclined to say it should also be unsupported in C++ mode).

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


More information about the cfe-commits mailing list