epastor added a comment.

In D69626#1728113 <https://reviews.llvm.org/D69626#1728113>, @thakis wrote:

> Is this needed to parse system headers?


Interesting question. This change isn't - but I presume the (pre-existing) 
introduction of IgnoredComma was.

> In general, we try to emulate only warts we must emulate, and if feasible we 
> try to emit some -Wmicrosoft warning when the compat path is taken.

Sure - this change actually brings the preprocessor closer to compliance. I 
think the prior use of IgnoredComma had overshot MSVC by a bit. For an 
illustration, see
https://gcc.godbolt.org/z/XakAYf (same code as above, but in MSVC, clang, and 
clang -fms-compatibility)
MSVC shows it's non-compliant on TEST, and -fms-compatibility matches it there. 
However, MSVC matches clang's behavior for WRAPPED_TEST, as adding another 
layer of macro expansion is a standard trick for forcing MSVC's preprocessor to 
act compliant... but clang -fms-compatibility still gives the non-compliant 
result, since that trick doesn't work to remove IgnoredCommas.

If we wanted to detect use of the compatibility feature, we might need to apply 
the preprocessor both ways and see if the results were different; I'm not sure 
all IgnoredCommas will actually make a difference in the parsing. As is, we'd 
need to emit a -Wmicrosoft warning any time we saw an isolated comma as a macro 
parameter... which I think might get confusing?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69626



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to