chore: Fix compilation error with clang-20 and cleanup (#5543)

Removes clutter for old compilers, defaults to non-unity builds in cmake to match conanfile.py, and workaround for clang-20 compilation errors.
This commit is contained in:
Bronek Kozicki
2025-07-09 18:47:34 +01:00
committed by GitHub
parent a7eea9546f
commit f47e2f4e82
4 changed files with 40 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ if(tests)
endif() endif()
endif() endif()
option(unity "Creates a build using UNITY support in cmake. This is the default" ON) option(unity "Creates a build using UNITY support in cmake." OFF)
if(unity) if(unity)
if(NOT is_ci) if(NOT is_ci)
set(CMAKE_UNITY_BUILD_BATCH_SIZE 15 CACHE STRING "") set(CMAKE_UNITY_BUILD_BATCH_SIZE 15 CACHE STRING "")

View File

@@ -22,8 +22,18 @@
#include <xrpl/basics/contract.h> #include <xrpl/basics/contract.h>
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
#include <boost/outcome.hpp> #include <boost/outcome.hpp>
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#include <stdexcept> #include <stdexcept>
namespace ripple { namespace ripple {

View File

@@ -24,13 +24,38 @@
#include <boost/container/flat_set.hpp> #include <boost/container/flat_set.hpp>
#include <boost/endian/conversion.hpp> #include <boost/endian/conversion.hpp>
/*
Workaround for overzealous clang warning, which trips on libstdc++ headers
In file included from
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:61:
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tempbuf.h:263:8:
error: 'get_temporary_buffer<std::pair<ripple::Quality, const
std::vector<std::unique_ptr<ripple::Step>> *>>' is deprecated
[-Werror,-Wdeprecated-declarations] 263 |
std::get_temporary_buffer<value_type>(_M_original_len));
^
*/
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
#include <functional>
#include <memory>
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#include <array> #include <array>
#include <chrono> #include <chrono>
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>
#include <functional>
#include <map> #include <map>
#include <memory>
#include <set> #include <set>
#include <string> #include <string>
#include <system_error> #include <system_error>

View File

@@ -98,8 +98,7 @@ struct Buffer_test : beast::unit_test::suite
x = b0; x = b0;
BEAST_EXPECT(x == b0); BEAST_EXPECT(x == b0);
BEAST_EXPECT(sane(x)); BEAST_EXPECT(sane(x));
#if defined(__clang__) && (!defined(__APPLE__) && (__clang_major__ >= 7)) || \ #if defined(__clang__)
(defined(__APPLE__) && (__apple_build_version__ >= 10010043))
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wself-assign-overloaded" #pragma clang diagnostic ignored "-Wself-assign-overloaded"
#endif #endif
@@ -111,8 +110,7 @@ struct Buffer_test : beast::unit_test::suite
BEAST_EXPECT(y == b3); BEAST_EXPECT(y == b3);
BEAST_EXPECT(sane(y)); BEAST_EXPECT(sane(y));
#if defined(__clang__) && (!defined(__APPLE__) && (__clang_major__ >= 7)) || \ #if defined(__clang__)
(defined(__APPLE__) && (__apple_build_version__ >= 10010043))
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif #endif
} }