[PATCH] D157334: [clang] Define _MSC_EXTENSIONS on -gnu if -fms-extensions is set

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 17 11:53:51 PDT 2023


rnk added a comment.

I don't think this is the right thing to do, I think I recall saying as much on some other review. The MSVC docs <https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170> say that `/Za`/`/Ze` control `_MSC_EXTENSION`, and as I understand it, `/Za` is more like our `-fms-compatibility` flag, so it makes sense to control this macro with `-fms-compatibility`.

Even though the name of the macro and the flag correspond, they aren't covering the same thing.

Let's try to focus on the use case: We need a feature flag or macro to communicate that `-fms-extensions` is enabled on mingw. `_MSC_VER` is out because we're doing mingw. Is there something else we could check for like `__has_declspec_attribute` or `__has_builtin`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157334



More information about the cfe-commits mailing list