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

Aiden Grossman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 9 12:10:27 PDT 2023


aidengrossman added a comment.

It's something set on by default in MSVC (https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170). It's interesting that GCC doesn't set the `_MSC_EXTENSIONS` macro with `-fms-extensions`. It should if it wants to match the behavior of MSVC. It might cause an issue somewhere, but I think it'll probably be exceedingly rare and I think would be resulting from incorrect user code (assuming all the extensions enabled by MSVC with the flag they use are present in clang). I would've thought not having the macro defined would cause more issues, but given this part of the code hasn't been touched in six years (and that was a refactoring that was presumably NFC), it doesn't seem like people rely on this macro too much. Thanks for running the tests though! Having concrete data to back up hypotheses is always great to have.


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