[cfe-dev] Clang-cl.exe and the VC++ preprocessor

Edward Diener eldlistmailingz at tropicsoft.com
Sat Jul 12 08:25:42 PDT 2014


On 7/12/2014 8:43 AM, Daniel James wrote:
> On 12 July 2014 11:07, Alp Toker <alp at nuanti.com> wrote:
>>
>> On 12/07/2014 12:10, Daniel James wrote:
>>>
>>> On 12 July 2014 03:22, Zachary Turner <zturner at google.com> wrote:
>>>>
>>>> On Fri, Jul 11, 2014 at 1:52 PM, Alp Toker <alp at nuanti.com> wrote:
>>>>>
>>>>>
>>>>> The only hangup would be uncertainty around the interface to enable it
>>>>> (pragmas, what syntax? filename regex?) and maintainability. It's the
>>>>> kind
>>>>> of feature that's easy to implement, but burdensome to keep tested and
>>>>> stable, especially since we have no automated MSVC header integration
>>>>> tests.
>>>>
>>>>
>>>> Something similar to how #pragma pack works sounds useful here.
>>>>
>>>> #pragma msvc_pp_compat(push)
>>>> #pragma msvc_pp_compat(on)
>>>>
>>>> ...
>>>>
>>>> #pragma msvc_pp_compat(pop)
>>>
>>> When a macro is defined at a point where compatibility mode is off,
>>> but expanded at a point where it's on, which mode would it use?
>>
>>
>> Nobody's tried to implement such a MSVC+standards mode precisely because we
>> don't know the answers to those questions.
>
> It's hard to understand the consequences of such a change without
> knowing. I expect mixing modes would be probably be trouble than it's
> worth, so would use whatever the current mode is, but didn't want to
> assume. I think that could be used in boost. It would be verbose, but
> that's typical. Users would have to use these pragmas when using the
> preprocessor library, but I expect most won't need to support this
> use-case.

The Boost PP library is used by many other libraries in Boost. If it 
cannot handle certain macro expansions due to the emulation of VC++ 
preprocessor bug emulation in clang-cl it may be impossible to get other 
libraries to work with clang-cl. That is why I strongly support your 
suggestion that clang-cl introduce a pragma that would change the macro 
expansion method ( C++ standard or VC++ emulation ). It would then be 
very easy to get Boost PP to work with clang-cl without any problems.





More information about the cfe-dev mailing list