<div dir="ltr">Hi All,
<div><br></div><div style>This patch is a rework of Joćo's original patch applied as r<span style="font-family:arial,sans-serif;font-size:13px">163022 and later reverted in r</span><font face="arial, sans-serif">164672. I've spent a few (long...) days attempting to get to the bottom of what caused the failures that led to the original patch being reverted. This should fix (once and for all) the error seen when compiling VS2012 type_traits and by extension most of the VS2012 STL headers:</font></div>
<div style><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div style><font face="arial, sans-serif"><div>In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\type_traits:1820:</div>
</font></div><div style><font face="arial, sans-serif"><div>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xrefwrap(156,20): error : too many arguments provided to function-like macro invocation</div></font></div>
</blockquote><div style><br></div><div style><font face="arial, sans-serif">The main changes in this patch are:</font></div><div style><ul style><li style><span style="font-family:arial,sans-serif">Tokens used as macro arguments that expand to a *single* comma have special treatment - the comma will not be treated as a macro argument separator in MicrosoftMode. Tokens that expand into multiple tokens that may include commas are treated normally.</span><br>
</li><li style><span style="font-family:arial,sans-serif">I've reused 0x04 for the IgnoredComma flag as the other case (DisableExpand) is exclusively used for identifiers and won't conflict with tok::comma. It didn't seem worth using up an entirely new value for such a rare edge case as this.</span></li>
</ul></div><div style><div style><font face="arial, sans-serif">In terms of testing, clang should now be able to compile VS2012 type_traits. I tested successfully against Nico's original GTest test case (</font><span style="color:rgb(0,0,0);white-space:pre-wrap">PR13924</span><span style="font-family:arial,sans-serif">) and against boost.python 1.42.0 which also failed with the original patch.</span> <span style="font-family:arial,sans-serif">I've also added a new test case based on the VS2012 xstddef macros that led to the patch being needed in the first place.</span></div>
<div style><span style="font-family:arial,sans-serif"><br></span></div><div style><span style="font-family:arial,sans-serif">All tests passed against latest trunk. Please review and commit if it LGTY...</span></div><div style>
<span style="font-family:arial,sans-serif"><br></span></div><div style><span style="font-family:arial,sans-serif">Cheers,</span></div><div style><span style="font-family:arial,sans-serif">Will.</span></div><div><font face="arial, sans-serif"><br>
</font></div></div></div>