[PATCH] D149997: [clang] [test] Narrow down MSVC specific behaviours from "any windows" to only MSVC/clang-cl

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 12 13:28:46 PDT 2023


mstorsjo added a comment.

In D149997#4338304 <https://reviews.llvm.org/D149997#4338304>, @rnk wrote:

> I think `_MSC_EXTENSIONS` will work, but it's kind of gross. `_MSC_VER` is controlled by `-fms-compatibility-verson=`, which I think is off by default or unset at the cc1 level:
> https://github.com/llvm/llvm-project/blob/main/clang/lib/Basic/Targets/OSTargets.cpp#L206
> `-fms-extensions` is on by default at cc1, I think.

Ah, I see, thanks!

Since `_MSC_VER` is the most canonical way of checking for an MSVC-like environment anyway, do you think it'd make sense to define it to a dummy value like 1, if the target is an MSVC triple but no `-fms-compatibility-version=` is provided?

Using `_MSC_EXTENSIONS` instead of `_MSC_VER` in these tests isn't very pretty, but I guess it could be passable still? (I'm not setting out to improve all the world here right now, I'm just trying to get the tests passing in a mingw environment.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149997/new/

https://reviews.llvm.org/D149997



More information about the cfe-commits mailing list