Boost logo

Boost :

Subject: [boost] [shared_ptr] Clang with Microsoft CodeGen in VS 2015 Update 1
From: Beman Dawes (bdawes_at_[hidden])
Date: 2015-12-08 08:07:12


See
http://blogs.msdn.com/b/vcblog/archive/2015/12/04/introducing-clang-with-microsoft-codegen-in-vs-2015-update-1.aspx

I tried building the Boost.Filesystem DLL with clang/c2 using the Visual
Studio solution from libs/filesystem/test/msvc.

As indicated the blog post, the following changes were needed in the
project's properties:

Configuration Properties
  General
    Platform Toolset : Clang 3.7 with Microsoft CodeGen (v140_clang_3_7)
  C/C++
    General
      Warning Level : EnableAllWarnings (-Wall)
    Code Generation
      Enable C++ Exceptions: Yes (-fexceptions)
    Language
      Enable Run-Time Type Information: Yes (-frtti)
    Precompiled Headers
      Precompiled Header: Not using Precompiled Headers

The operations.cpp compile failed with the following errors:

2> operations.cpp
2> In file included from ..\..\..\src\operations.cpp:44:
2> In file included from ../../../../..\boost/filesystem/operations.hpp:25:
2> In file included from ../../../../..\boost/filesystem/path.hpp:29:
2> In file included from ../../../../..\boost/shared_ptr.hpp:17:
2> In file included from ../../../../..\boost/smart_ptr/shared_ptr.hpp:28:
2> In file included from
../../../../..\boost/smart_ptr/detail/shared_count.hpp:29:
2> In file included from
../../../../..\boost/smart_ptr/detail/sp_counted_base.hpp:45:
2>../../../../..\boost/smart_ptr/detail/sp_counted_base_clang.hpp(29,1):
error : cannot mangle this C11 atomic type yet
2> inline void atomic_increment( atomic_int_least32_t * pw )
2> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2>../../../../..\boost/smart_ptr/detail/sp_counted_base_clang.hpp(34,1):
error : cannot mangle this C11 atomic type yet
2> inline boost::int_least32_t atomic_decrement( atomic_int_least32_t * pw
)
2>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2>../../../../..\boost/smart_ptr/detail/sp_counted_base_clang.hpp(39,1):
error : cannot mangle this C11 atomic type yet
2> inline boost::int_least32_t atomic_conditional_increment(
atomic_int_least32_t * pw )
2>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So it looks like the clang/c2 toolset doesn't support atomics yet. The
__c2__ and __c2_version__ macros allow detection of the clang/c2 toolset,
could a workaround be added to shared_ptr?

I know we don't usually worry about workarounds for preview (i.e. early
beta) compiler releases, but the ability to add the clang/c2 toolset to
local tests for library developers working on Windows will be a big plus
IMO.

--Beman

PS: Has anyone figured out how to invoke clang/c2 from the command line?


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