Boost logo

Boost Users :

From: m.doppler_at_[hidden]
Date: 2003-09-19 10:34:42


Hi,

the header files boost/iterator_adaptors.hpp and
boost/regex/v3/instances.hpp contain macro constructs that are icompatible
with the Microsoft compiler cl when using them in a source file,
preprocessing the source to a another source file and afterwards compiling
the preprocessed source file.

For iterator_adaptors.hpp, cl version 13.00 is affected, for instances.hpp
cl 13.00 and 13.10.

The problem can be reproduced by compiling the following simple source
file (test.cpp) in the base boost directory (boost-1.30.2):

#include "boost/iterator_adaptors.hpp"
#include "boost/regex.hpp"

int main(void)
{
        return 0;
}

The commandline to preprocess the file is:
cl /TP /GX /EHsc /Zc:wchar_t /Zc:forScope /c /I. /P test.cpp

The commandline to compile the previously preprocessed file is:
cl /TP /GX /EHsc /Zc:wchar_t /Zc:forScope /c /I. test.i

Note that when directly compiling the same test program using the
following commandline the problem disappears:
cl /TP /GX /EHsc /Zc:wchar_t /Zc:forScope /c /I. test.cpp

One might expect that the last command line should produce the same result
as the first two, but unfortunately this is not the case.

I have attached a patch file that solves the icompatibility with the
preprocessor by incorporating the following changes:

- In instances.hpp the patch adds single spaces between the
BOOST_DEFAULT_ALLOCATOR and the end of some template declarations.

- In iterator_adaptors.hpp the conditional BOOST_WORKAROUND macros are
refactored from inside the template declarations of
indirect_iterator_generator and indirect_iterator_pair_generator to the
front of them by duplicating the template struct definitions minus the
BOOST_WORKAROUND code in the else branch of the conditional macro.

In case you wonder why we need to preprocess the source file into a
seperate file before compiling it:
This is required to use distcc (http://distcc.samba.org) with Microsofts
cl.

Is there a chance this patch gets accepted for the next boost version?

Michael

--- michael doppler -----------------------------------
      developer
      icoserve it gmbh
 
      innrain 98, 6020 innsbruck
      tel: +43 - 512 - 567622 - 250
      fax: +43 - 512 - 567622 - 111
      web: www.icoserve.com
      email: m.doppler_at_[hidden]
---------------------------------------------------------------




Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net