Boost logo

Boost :

Subject: Re: [boost] Fwd: [clang] clang-cl expansion of macros
From: degski (degski_at_[hidden])
Date: 2017-04-30 06:53:49


On 29 April 2017 at 21:51, Edward Diener via Boost <boost_at_[hidden]>
wrote:

> What are you trying to compile/build/run ?
>

An application that pulls in the boost::file_system headers. I am not
trying to build boost with clang. For completeness sake, I have the
following PP defines:

__clang__
BOOST_SP_USE_STD_ATOMIC
BOOST_MSVC=1900
BOOST_HAS_MS_INT64

> As explained Boost PP does not support clang-cl, which has a buggy
> emulation of the non-standard VC++ preprocessor.

You have expressed your point of view before and very clearly.

In Boost, using:
>
> using clang : 4.0 : some_path/clang++
> :
> <cxxflags>-fmacro-backtrace-limit=0
> <cxxflags>-Wno-invalid-token-paste
> <compileflags>-fmsc-version=1900
> <linkflags>-fuse-ld=lld
> ;
>

I will eventually try this, thanks for it.

> A change was made to Boost PP to support this by having Boost PP use a C++
> standard preprocessor whenever both _MSC_VER and __clang__ was defined.

Although we can now (with the above change) build boost with clang, this
also implies that we can now NOT use boost in a project on windows (i.e.
with windows headers), as the C++ standard preprocessor (the one that gets
used) does not play well with the Dinkumware-STL. If it is not clear what I
mean, please say so.

> This decision was based on the fact that VC++'s clang/c2 uses this mode
> and should work using the normal Boost Build clang.jam instead of
> clang-win.jam.
>

 As I wrote before, the same PP errors are generated with both Clang/LLVM
and Clang/C2, there is no difference in behaviour between the two.

There is an additional issue that AFAICS (due to the (relatively
simplistic) way things are done by the clang team) there is no way to call
clang++.exe from the IDE. All compilers supplied by Clang/LLVM are just
copies of the same file with different names (same hash values for all
(compiler) files). A different name invokes different behaviour. msbuild
calls C:\Program Files (x86)\LLVM\msbuild-bin\cl.exe (which is just
another copy of the same compiler).

f.e. to get the build information, one has to use different commands:

>clang++ --version (linux style)
>clang-cl -v (windows style)

even though the only difference is the name (and therefor the command) of
the files.

If you (as I suspect you will) say it's a mess, I fully agree. I do think,
though, that it's less usefull to be able to build boost with clang (as it
also builds with VC), than it is to be able to use boost (compiled,
whatever way) in a project from the IDE.

boost-1.63 works (adjusted), boost-1.64 doesn't, this cannot be seen as
progress IMHO.

If I don't make sense or if I'm missing something, please tell me.

Have a good day,

degski

-- 
"*Ihre sogenannte Religion wirkt bloß wie ein Opiat reizend, betäubend,
Schmerzen aus Schwäche stillend.*" - Novalis 1798

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk