build: Use apple-clang 21; remove SourceLocation stub (#3123)

This commit is contained in:
Ayaz Salikhov
2026-06-30 18:13:03 +01:00
committed by GitHub
parent d7cd049ccc
commit bc556fa0e7
22 changed files with 59 additions and 160 deletions

View File

@@ -6,7 +6,7 @@ LINUX_OS = ["heavy", "heavy-arm64"]
LINUX_CONTAINERS = ['{ "image": "ghcr.io/xrplf/xrpld/nix-ubuntu:sha-cb2642b" }']
LINUX_COMPILERS = ["gcc", "clang"]
MACOS_OS = ["macos15"]
MACOS_OS = ["macos-26-apple-clang-21"]
MACOS_CONTAINERS = [""]
MACOS_COMPILERS = ["apple-clang"]

View File

@@ -22,4 +22,4 @@ rm -f conan.lock
# Create a new lockfile that is compatible with macOS.
# It should also work on Linux.
conan lock create . \
--profile:all=./conan/profiles/apple-clang-17.profile
--profile:all=./conan/profiles/apple-clang-21.profile

View File

@@ -50,7 +50,7 @@ jobs:
container: ['{ "image": "ghcr.io/xrplf/xrpld/nix-ubuntu:sha-cb2642b" }']
include:
- os: macos15
- os: macos-26-apple-clang-21
compiler: apple-clang
build_type: Release
container: ""

View File

@@ -29,7 +29,7 @@ jobs:
fetch-depth: 0
- name: Prepare runner
uses: XRPLF/actions/prepare-runner@90f11ee655d1687824fb8793db770477d52afbab
uses: XRPLF/actions/prepare-runner@9355d190fd7d4de80fadfd161e6edddc9702cd9f
with:
enable_ccache: false

View File

@@ -39,7 +39,7 @@ jobs:
lfs: true
- name: Prepare runner
uses: XRPLF/actions/prepare-runner@90f11ee655d1687824fb8793db770477d52afbab
uses: XRPLF/actions/prepare-runner@9355d190fd7d4de80fadfd161e6edddc9702cd9f
with:
enable_ccache: false

View File

@@ -47,7 +47,7 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos15
- os: macos-26-apple-clang-21
compiler: apple-clang
build_type: Release
- os: heavy
@@ -108,7 +108,7 @@ jobs:
- os: heavy
compiler: clang
container: '{ "image": "ghcr.io/xrplf/xrpld/nix-ubuntu:sha-cb2642b" }'
- os: macos15
- os: macos-26-apple-clang-21
compiler: apple-clang
container: ""
uses: ./.github/workflows/reusable-build.yml

View File

@@ -12,7 +12,7 @@ on:
jobs:
auto-update:
uses: XRPLF/actions/.github/workflows/pre-commit-autoupdate.yml@5e942d61bf32f7557a7c159cfac4712a687b3e3a
uses: XRPLF/actions/.github/workflows/pre-commit-autoupdate.yml@c7045074aafe9fb92fa537aa4446f81fbfc17e8b
with:
sign_commit: true
committer: "Clio CI <skuznetsov@ripple.com>"

View File

@@ -8,7 +8,7 @@ on:
jobs:
run-hooks:
uses: XRPLF/actions/.github/workflows/pre-commit.yml@cba1f0891650baf1a9c88624dc2d72573be2eb81
uses: XRPLF/actions/.github/workflows/pre-commit.yml@e06d4138c9ec8dceeb7c818645faa38087ea9e3d
with:
runs_on: heavy
container: '{ "image": "ghcr.io/xrplf/clio-pre-commit:14342e087ceb8b593027198bf9ef06a43833c696" }'

View File

@@ -21,7 +21,7 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos15
- os: macos-26-apple-clang-21
compiler: apple-clang
build_type: Release
- os: heavy

View File

@@ -96,7 +96,7 @@ jobs:
fetch-depth: 0
- name: Prepare runner
uses: XRPLF/actions/prepare-runner@90f11ee655d1687824fb8793db770477d52afbab
uses: XRPLF/actions/prepare-runner@9355d190fd7d4de80fadfd161e6edddc9702cd9f
with:
enable_ccache: ${{ inputs.download_ccache }}

View File

@@ -60,7 +60,7 @@ jobs:
fetch-depth: 0
- name: Prepare runner
uses: XRPLF/actions/prepare-runner@90f11ee655d1687824fb8793db770477d52afbab
uses: XRPLF/actions/prepare-runner@9355d190fd7d4de80fadfd161e6edddc9702cd9f
with:
enable_ccache: false

View File

@@ -75,7 +75,7 @@ jobs:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Prepare runner
uses: XRPLF/actions/prepare-runner@90f11ee655d1687824fb8793db770477d52afbab
uses: XRPLF/actions/prepare-runner@9355d190fd7d4de80fadfd161e6edddc9702cd9f
with:
enable_ccache: false

View File

@@ -72,7 +72,6 @@ endif()
# Clio tweaks and checks
include(CheckCompiler)
include(Settings)
include(SourceLocation)
include(PatchNixBinary)
# Clio deps

View File

@@ -5,33 +5,33 @@
"xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1782392402.420688",
"xrpl/3.2.0#c3c124909c6461012758a4fab7c90cd5%1782492037.328253",
"sqlite3/3.53.0#324ada52333108388a9a6108bfa96734%1782392403.185447",
"spdlog/1.17.0#bcbaaf7147bda6ad24ffbd1ac3d7142c%1767636069.964",
"spdlog/1.17.0#bcbaaf7147bda6ad24ffbd1ac3d7142c%1782736610.443882",
"soci/4.0.3#e726491a03468795453f7c83fc924a96%1782392402.679521",
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1782307151.633168",
"secp256k1/0.7.1#b1f450b7f78a36fff75bb6934a356f3a%1782338841.3729",
"rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1782392413.075713",
"re2/20251105#8579cfd0bda4daf0683f9e3898f964b4%1782392402.431897",
"rapidjson/cci.20220822#1b9d8c2256876a154172dc5cfbe447c6%1705070244.747",
"rapidjson/cci.20220822#1b9d8c2256876a154172dc5cfbe447c6%1782736605.214886",
"protobuf/6.33.5#ff253ead763bd8d9904a52979cd21e81%1782392410.233933",
"openssl/3.6.3#1163d4ddc603907084d08a6a0c6e580f%1782307150.583886",
"nudb/2.0.9#11149c73f8f2baff9a0198fe25971fc7%1782392402.297166",
"minizip/1.2.13#64dfec2ee447ab6c0c7eab967815a762%1781620490.148",
"minizip/1.2.13#64dfec2ee447ab6c0c7eab967815a762%1782736605.272739",
"lz4/1.10.0#982d9b673900f665a1da109e09c17cab%1782392402.164188",
"libuv/1.46.0#e1a592bf7c0f37802889ca2c795fb26c%1764745187.942",
"libuv/1.46.0#e1a592bf7c0f37802889ca2c795fb26c%1782736605.776567",
"libiconv/1.17#9923bc6dc6f106646d6967e0039a5ada%1782392792.775744",
"libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1782392402.420732",
"libarchive/3.8.7#c446109bd1f1d8ba7936c94189bc50e6%1782392403.066892",
"http_parser/2.9.4#98d91690d6fd021e9e624218a85d9d97%1743410856.678",
"http_parser/2.9.4#98d91690d6fd021e9e624218a85d9d97%1782736605.237778",
"gtest/1.17.0#5224b3b3ff3b4ce1133cbdd27d53ee7d%1782392402.791979",
"grpc/1.78.1#b1a9e74b145cc471bed4dc64dc6eb2c1%1772623605.068",
"fmt/12.1.0#50abab23274d56bb8f42c94b3b9a40c7%1761885265.231",
"grpc/1.78.1#b1a9e74b145cc471bed4dc64dc6eb2c1%1782736970.619035",
"fmt/12.1.0#50abab23274d56bb8f42c94b3b9a40c7%1782736606.427131",
"ed25519/2015.03#ae761bdc52730a843f0809bdf6c1b1f6%1782307148.15562",
"date/3.0.4#862e11e80030356b53c2c38599ceb32b%1782392402.538492",
"cassandra-cpp-driver/2.17.0#bd3934138689482102c265d01288a316%1764097402.445",
"cassandra-cpp-driver/2.17.0#bd3934138689482102c265d01288a316%1782736662.877646",
"c-ares/1.34.6#545240bb1c40e2cacd4362d6b8967650%1782392402.681654",
"bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1782392402.296732",
"boost/1.91.0#ea540ca2133d831b560036aa24dece3c%1782392419.475605",
"benchmark/1.9.5#b885dc73ad67b40a55d45684d1c88ad1%1774363287.434",
"benchmark/1.9.5#b885dc73ad67b40a55d45684d1c88ad1%1782736613.864841",
"abseil/20250127.0#bb0baf1f362bc4a725a24eddd419b8f7%1782307147.395833"
],
"build_requires": [

View File

@@ -20,11 +20,6 @@ mkdir -p "$PROFILES_DIR"
# `.github/actions/set-compiler-env`) and the sanitizers via the `SANITIZERS`
# environment variable. Builds always use the `ci` profile, which includes
# `sanitizers` and `default`.
cp "$PROFILES_SRC_DIR/default" "$PROFILES_DIR/default"
cp "$PROFILES_SRC_DIR/ci" "$PROFILES_DIR/ci"
cp "$PROFILES_SRC_DIR/sanitizers" "$PROFILES_DIR/sanitizers"
if [[ "$(uname)" == "Darwin" ]]; then
cp "$PROFILES_SRC_DIR/apple-clang-17.profile" "$PROFILES_DIR/default"
else
cp "$PROFILES_SRC_DIR/default" "$PROFILES_DIR/default"
fi

View File

@@ -4,8 +4,5 @@ build_type=Release
compiler=apple-clang
compiler.cppstd=20
compiler.libcxx=libc++
compiler.version=17.0
compiler.version=21.0
os=Macos
[conf]
grpc/1.50.1:tools.build:cxxflags+=["-Wno-missing-template-arg-list-after-template-kw"]

View File

@@ -18,11 +18,3 @@ compiler.runtime=static
{% else %}
compiler.libcxx={{detect_api.detect_libcxx(compiler, version, compiler_exe)}}
{% endif %}
[conf]
{% if compiler == "gcc" and compiler_version < 13 %}
tools.build:cxxflags+=['-Wno-restrict']
{% endif %}
{% if compiler == "clang" %}
grpc/1.50.1:tools.build:cxxflags+=['-Wno-missing-template-arg-list-after-template-kw']
{% endif %}

View File

@@ -1,7 +1,5 @@
#pragma once
#include "util/SourceLocation.hpp"
#include <boost/log/core/core.hpp>
#include <fmt/base.h>
@@ -53,7 +51,7 @@ private:
template <typename... Args>
constexpr void
assertImpl(
SourceLocationType const location,
std::source_location const location,
char const* expression,
bool const condition,
fmt::format_string<Args...> format,
@@ -86,7 +84,7 @@ assertImpl(
} // namespace util::impl
#define ASSERT(condition, ...) \
util::impl::assertImpl( \
CURRENT_SRC_LOCATION, #condition, static_cast<bool>(condition), __VA_ARGS__ \
#define ASSERT(condition, ...) \
util::impl::assertImpl( \
std::source_location::current(), #condition, static_cast<bool>(condition), __VA_ARGS__ \
)

View File

@@ -1,81 +0,0 @@
#pragma once
#if defined(HAS_SOURCE_LOCATION) && __has_builtin(__builtin_source_location)
// this is used by fully compatible compilers like gcc
#include <source_location>
#elif defined(HAS_EXPERIMENTAL_SOURCE_LOCATION)
// this is used by clang on linux where source_location is still not out of
// experimental headers
#include <experimental/source_location>
#else
#include <cstddef>
#include <string_view>
#endif
namespace util {
#if defined(HAS_SOURCE_LOCATION) && __has_builtin(__builtin_source_location)
using SourceLocationType = std::source_location;
#elif defined(HAS_EXPERIMENTAL_SOURCE_LOCATION)
using SourceLocationType = std::experimental::source_location;
#else
/**
* @brief A class representing the source location of the current code
*
* @note This is a workaround for AppleClang that is lacking source_location atm.
* TODO: remove this class when all compilers catch up to c++20
*/
class SourceLocation {
char const* file_;
std::size_t line_;
public:
/**
* @brief Construct a new Source Location object
*
* @param file The file name
* @param line The line number
*/
constexpr SourceLocation(char const* file, std::size_t line) : file_{file}, line_{line}
{
}
/**
* @brief Get the file name
*
* @return The file name
*/
constexpr std::string_view
file_name() const
{
return file_;
}
/**
* @brief Get the line number
*
* @return The line number
*/
constexpr std::size_t
line() const
{
return line_;
}
};
using SourceLocationType = SourceLocation;
#define SOURCE_LOCATION_OLD_API
#endif
} // namespace util
#if defined(SOURCE_LOCATION_OLD_API)
#define CURRENT_SRC_LOCATION util::SourceLocationType(__FILE__, __LINE__)
#else
#define CURRENT_SRC_LOCATION util::SourceLocationType::current()
#endif

View File

@@ -2,7 +2,6 @@
#include "util/Assert.hpp"
#include "util/BytesConverter.hpp"
#include "util/SourceLocation.hpp"
#include "util/config/ArrayView.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ObjectView.hpp"
@@ -29,6 +28,7 @@
#include <filesystem>
#include <memory>
#include <optional>
#include <source_location>
#include <stdexcept>
#include <string>
#include <string_view>
@@ -405,37 +405,37 @@ LogService::shutdown()
}
Logger::Pump
LogService::trace(SourceLocationType const& loc)
LogService::trace(std::source_location const& loc)
{
return Logger(spdlog::default_logger()).trace(loc);
}
Logger::Pump
LogService::debug(SourceLocationType const& loc)
LogService::debug(std::source_location const& loc)
{
return Logger(spdlog::default_logger()).debug(loc);
}
Logger::Pump
LogService::info(SourceLocationType const& loc)
LogService::info(std::source_location const& loc)
{
return Logger(spdlog::default_logger()).info(loc);
}
Logger::Pump
LogService::warn(SourceLocationType const& loc)
LogService::warn(std::source_location const& loc)
{
return Logger(spdlog::default_logger()).warn(loc);
}
Logger::Pump
LogService::error(SourceLocationType const& loc)
LogService::error(std::source_location const& loc)
{
return Logger(spdlog::default_logger()).error(loc);
}
Logger::Pump
LogService::fatal(SourceLocationType const& loc)
LogService::fatal(std::source_location const& loc)
{
return Logger(spdlog::default_logger()).fatal(loc);
}
@@ -469,7 +469,7 @@ Logger::~Logger()
Logger::Pump::Pump(
std::shared_ptr<spdlog::logger> logger,
Severity sev,
SourceLocationType const& loc
std::source_location const& loc
)
: logger_(std::move(logger))
, severity_(sev)
@@ -489,32 +489,32 @@ Logger::Pump::~Pump()
}
Logger::Pump
Logger::trace(SourceLocationType const& loc) const
Logger::trace(std::source_location const& loc) const
{
return {logger_, Severity::TRC, loc};
}
Logger::Pump
Logger::debug(SourceLocationType const& loc) const
Logger::debug(std::source_location const& loc) const
{
return {logger_, Severity::DBG, loc};
}
Logger::Pump
Logger::info(SourceLocationType const& loc) const
Logger::info(std::source_location const& loc) const
{
return {logger_, Severity::NFO, loc};
}
Logger::Pump
Logger::warn(SourceLocationType const& loc) const
Logger::warn(std::source_location const& loc) const
{
return {logger_, Severity::WRN, loc};
}
Logger::Pump
Logger::error(SourceLocationType const& loc) const
Logger::error(std::source_location const& loc) const
{
return {logger_, Severity::ERR, loc};
}
Logger::Pump
Logger::fatal(SourceLocationType const& loc) const
Logger::fatal(std::source_location const& loc) const
{
return {logger_, Severity::FTL, loc};
}

View File

@@ -1,13 +1,12 @@
#pragma once
#include "util/SourceLocation.hpp"
#include <array>
#include <cstddef>
#include <cstdint>
#include <expected>
#include <memory>
#include <optional>
#include <source_location>
#include <sstream>
#include <string>
#include <string_view>
@@ -88,14 +87,14 @@ class Logger {
class Pump final {
std::shared_ptr<spdlog::logger> logger_;
Severity const severity_;
SourceLocationType const sourceLocation_;
std::source_location const sourceLocation_;
std::ostringstream stream_;
bool const enabled_;
public:
~Pump();
Pump(std::shared_ptr<spdlog::logger> logger, Severity sev, SourceLocationType const& loc);
Pump(std::shared_ptr<spdlog::logger> logger, Severity sev, std::source_location const& loc);
Pump(Pump&&) = delete;
Pump(Pump const&) = delete;
@@ -170,7 +169,7 @@ public:
* @return The pump to use for logging
*/
[[nodiscard]] Pump
trace(SourceLocationType const& loc = CURRENT_SRC_LOCATION) const;
trace(std::source_location const& loc = std::source_location::current()) const;
/**
* @brief Interface for logging at Severity::DBG severity
@@ -179,7 +178,7 @@ public:
* @return The pump to use for logging
*/
[[nodiscard]] Pump
debug(SourceLocationType const& loc = CURRENT_SRC_LOCATION) const;
debug(std::source_location const& loc = std::source_location::current()) const;
/**
* @brief Interface for logging at Severity::NFO severity
@@ -188,7 +187,7 @@ public:
* @return The pump to use for logging
*/
[[nodiscard]] Pump
info(SourceLocationType const& loc = CURRENT_SRC_LOCATION) const;
info(std::source_location const& loc = std::source_location::current()) const;
/**
* @brief Interface for logging at Severity::WRN severity
@@ -197,7 +196,7 @@ public:
* @return The pump to use for logging
*/
[[nodiscard]] Pump
warn(SourceLocationType const& loc = CURRENT_SRC_LOCATION) const;
warn(std::source_location const& loc = std::source_location::current()) const;
/**
* @brief Interface for logging at Severity::ERR severity
@@ -206,7 +205,7 @@ public:
* @return The pump to use for logging
*/
[[nodiscard]] Pump
error(SourceLocationType const& loc = CURRENT_SRC_LOCATION) const;
error(std::source_location const& loc = std::source_location::current()) const;
/**
* @brief Interface for logging at Severity::FTL severity
@@ -215,7 +214,7 @@ public:
* @return The pump to use for logging
*/
[[nodiscard]] Pump
fatal(SourceLocationType const& loc = CURRENT_SRC_LOCATION) const;
fatal(std::source_location const& loc = std::source_location::current()) const;
private:
Logger(std::shared_ptr<spdlog::logger> logger);
@@ -333,7 +332,7 @@ public:
* @return The pump to use for logging
*/
[[nodiscard]] static Logger::Pump
trace(SourceLocationType const& loc = CURRENT_SRC_LOCATION);
trace(std::source_location const& loc = std::source_location::current());
/**
* @brief Globally accessible General logger at Severity::DBG severity
@@ -342,7 +341,7 @@ public:
* @return The pump to use for logging
*/
[[nodiscard]] static Logger::Pump
debug(SourceLocationType const& loc = CURRENT_SRC_LOCATION);
debug(std::source_location const& loc = std::source_location::current());
/**
* @brief Globally accessible General logger at Severity::NFO severity
@@ -351,7 +350,7 @@ public:
* @return The pump to use for logging
*/
[[nodiscard]] static Logger::Pump
info(SourceLocationType const& loc = CURRENT_SRC_LOCATION);
info(std::source_location const& loc = std::source_location::current());
/**
* @brief Globally accessible General logger at Severity::WRN severity
@@ -360,7 +359,7 @@ public:
* @return The pump to use for logging
*/
[[nodiscard]] static Logger::Pump
warn(SourceLocationType const& loc = CURRENT_SRC_LOCATION);
warn(std::source_location const& loc = std::source_location::current());
/**
* @brief Globally accessible General logger at Severity::ERR severity
@@ -369,7 +368,7 @@ public:
* @return The pump to use for logging
*/
[[nodiscard]] static Logger::Pump
error(SourceLocationType const& loc = CURRENT_SRC_LOCATION);
error(std::source_location const& loc = std::source_location::current());
/**
* @brief Globally accessible General logger at Severity::FTL severity
@@ -378,7 +377,7 @@ public:
* @return The pump to use for logging
*/
[[nodiscard]] static Logger::Pump
fatal(SourceLocationType const& loc = CURRENT_SRC_LOCATION);
fatal(std::source_location const& loc = std::source_location::current());
private:
/**

View File

@@ -1,16 +1,16 @@
#include "util/MockAssert.hpp"
#include "util/SourceLocation.hpp"
#include "util/log/PrettyPath.hpp"
#include <gtest/gtest.h>
#include <source_location>
#include <string_view>
using namespace util;
TEST(PrettyPath, CurrentFile)
{
auto loc = CURRENT_SRC_LOCATION;
auto loc = std::source_location::current();
auto pretty = prettyPath(loc.file_name());
EXPECT_EQ(pretty, "util/log/PrettyPathTests.cpp");
}