Opened 6 years ago

Last modified 6 years ago

#12375 new Patches

Patch fixing use of boost::icl w/ MSVC CL.exe /P

Reported by: anonymous Owned by: Joachim Faulhaber
Milestone: To Be Determined Component: ICL
Version: Boost 1.61.0 Severity: Problem
Keywords: Cc:

Description

This patch makes it possible to use this header in programs built using the FASTbuild (http://fastbuild.org) and more precisely its caching feature.

Considering the following code:

clmacro.cpp:

int main(void)
{
#define funny_type(x) x
funny_type(int)const a = 2; // cl.exe -P clmacro.cpp -> `intconst a`
}

On MSVC (Visual Studio 2013) Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x86 Copyright (C) Microsoft Corporation. All rights reserved.

This compiles correctly by default with CL.exe

Cl.exe clmacro.cpp

However when using the /P compilation flag to obtain the pre-processed source, then trying to compile the resulting file this will fail because const gets stitched to the other symbol before compilation.

See:

cl.exe -P -Ficlmacro.i.cpp clmacro.cpp && cl.exe clmacro.i.cpp

Attachments (1)

0001-Allow-compilation-on-MSVC-with-P.patch (2.4 KB ) - added by anonymous 6 years ago.
Patch against boost::icl

Download all attachments as: .zip

Change History (3)

by anonymous, 6 years ago

Patch against boost::icl

comment:1 by anonymous, 6 years ago

The header in question is boost/icl/detail/element_iterator.hpp where the ICL_INTERVAL_TYPE macro is used to create a new const type. The const is glued to the name of the type, which causes problem when using the /P option in CL.exe.

So for compatibility it would be appreciated if a space was added.

comment:1 by anonymous, 6 years ago

The header in question is boost/icl/detail/element_iterator.hpp where the ICL_INTERVAL_TYPE macro is used to create a new const type. The const is glued to the name of the type, which causes problem when using the /P option in CL.exe.

So for compatibility it would be appreciated if a space was added.

Note: See TracTickets for help on using tickets.