Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ is a certification, a validation for medical-device use, or a production-readine

## Unreleased

- Fix `mddlog::mddlog` failing to compile with Clang on libstdc++ (Clang's Linux default) under
warnings-as-errors: `SinkRegistry`'s deliberate use of the deprecated `shared_ptr` atomic free
functions is now silenced for Clang too, including clang-cl on MSVC's STL. The core was not
affected (#150).

- Propose the 1.0 compatibility commitments in
[ADR-007](docs/adr/ADR-007-compatibility-and-distribution.md): surface tiers recorded in a
checked [inventory](docs/api/public-surface.json), SemVer and deprecation without an ABI/BMI
Expand Down
32 changes: 22 additions & 10 deletions include/mddlog/adapter/SinkRegistry.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -498,36 +498,48 @@ private:
// included - must go through them; a plain load/store on a shared_ptr is not thread-safe.
// GCC 16.1's libstdc++ and MSVC's STL *do* have that specialization and deprecate these free
// functions in favor of it; keeping them anyway is intentional portability, not an oversight,
// so the two helpers below silence that one diagnostic on those toolchains rather than letting
// so the two helpers below silence that one diagnostic on those libraries rather than letting
// warnings-as-errors block a build whose real fix (migrating to std::atomic<shared_ptr<T>>)
// would drop libc++ 21 support.
// would drop libc++ 21 support. The deprecation belongs to the standard library, not the
// compiler: Clang reports it too when it uses libstdc++ (its Linux default) or MSVC's STL
// (clang-cl), so Clang gets its own branch, tested first because it also defines __GNUC__.
[[nodiscard]] static std::shared_ptr<const Snapshot> loadPublished(const std::shared_ptr<const Snapshot>& target, std::memory_order order) noexcept {
#if defined(__GNUC__) && !defined(__clang__)
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif defined(_MSC_VER) && !defined(__clang__)
#elif defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4996)
#endif
return std::atomic_load_explicit(&target, order);
#if defined(__GNUC__) && !defined(__clang__)
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER) && !defined(__clang__)
#elif defined(_MSC_VER)
#pragma warning(pop)
#endif
}
static void storePublished(std::shared_ptr<const Snapshot>& target, std::shared_ptr<const Snapshot> value, std::memory_order order) noexcept {
#if defined(__GNUC__) && !defined(__clang__)
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif defined(_MSC_VER) && !defined(__clang__)
#elif defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4996)
#endif
std::atomic_store_explicit(&target, std::move(value), order);
#if defined(__GNUC__) && !defined(__clang__)
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER) && !defined(__clang__)
#elif defined(_MSC_VER)
#pragma warning(pop)
#endif
}
Expand Down
Loading