Opened 5 years ago

Last modified 5 years ago

#9315 new Bugs

boost shared_ptr should detect __sync support in clang

Reported by: vlovich@… Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

clang (at least as of 3.4) has support for GCC sync functions. shared_ptr should properly detect that clang has such support (at least on ARM such support is not detected properly).

Change History (4)

comment:1 Changed 5 years ago by viboes

Component: Nonesmart_ptr
Owner: set to Peter Dimov

comment:2 Changed 5 years ago by Peter Dimov

Most versions of clang appear to provide a working <atomic>, so we'll probably use that instead of the obsolete !__sync intrinsics.

https://github.com/boostorg/smart_ptr/commit/fed15ad8c50921cbfc0365156e4e4f4454dc1b91 allows you to turn std::atomic support on manually by #define BOOST_SP_USE_STD_ATOMIC. This will eventually become the default when std::atomic is autodetected to be present.

comment:3 Changed 5 years ago by Peter Dimov

As it turns out, sp_has_sync.hpp should already detect the __sync support because Clang defines the macro __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4. What specific problem are you having?

comment:4 Changed 5 years ago by vlovich@…

The version is the reported field is incorrect (apologies if I supplied it). This bug report was for 1.51. As you point out it's probably fixed in newer boosts.

Note: See TracTickets for help on using tickets.