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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 12 09:33:23 PDT 2023


AaronBallman wrote:

> Okay, I made sure it says `argument unused during compilation: '/Zc:__STDC__'` and never defines **STDC** in C++ mode, but I have couple of questions:
> 
>     * Where should I put the test to make sure `-fno-ms-define-stdc` is not accepted?

I think that would make sense in `clang/test/Frontend` to ensure you can't do `-Xclang -fno-ms-define-stdc`, probably in a new test file. (I don't see an existing test that would make sense to augment.)

>     * !IsCXX feels kind of wrong - is this a justified case for creating `isC` in `clang/lib/Driver/Types.cpp`?

I know what you mean about it feeling kind of wrong, but it mirrors how the compiler's language options work. Not C++ mode means C mode, so I would probably not add an `isC()` interface. However, if either @MaskRay and @jansvoboda11 feel differently as code owners of that area, I wouldn't be opposed.

>       * now that I think about it, what should the behavior be with Objective-C? I imagine the number of people compiling Objective-C with `-fms-compatibility` is very small

Objective-C is a pure extension over C, so whatever is allowed in C should generally be allowed in Objective-C. Similarly for Objective-C++ and C++.

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


More information about the cfe-commits mailing list