Home GnuPG

Support building against LLVM's libc++ 18

Description

Support building against LLVM's libc++ 18

libc++ 18 by default removes unique() in 'std::shared_ptr' (in <memory>), as
a follow-up to this resolution:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0521r0.html

The stated reasoning behing unique()'s deprecation is that testing for
a particular value of use_count() is unsafe if the 'shared_ptr' is used in
parallel by more than one thread without proper synchronization.

Assuming this is not the case here, replace the existing calls by their current
meaning using use_count() (which is not deprecated).

An alternative would be to get unique() back by defining
_LIBCPP_ENABLE_CXX20_REMOVED_SHARED_PTR_UNIQUE before including the libc++
headers, but trying to fight the standard may not be a wise move going forward,
especially if/as other C++ libraries follow suit.

(cherry picked from commit 77d13583826467ce44c63fc7a2d4450eaae1769a)

Details

Provenance
Olivier Certner <olce.dev.kde@certner.fr>Authored on May 18 2024, 9:13 PM
ikloeckerCommitted on Jun 7 2024, 3:08 PM
Parents
rKLEOPATRAde406ffd8d06: Change column title to Key ID
Branches
Unknown
Tags
Unknown