From 115b7257d9f29bd17b97b1cda727a67e29021f8c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 25 May 2025 11:15:08 +0200 Subject: Bump CMAKE_CXX_STANDARD to 23 and fix code ftparchive/contents.h failed with operator< defined only, so define operator<=> instead. The operator and FileCopyType constructor both had a warning about not throwing and adding a noexcept, so add one --- CMakeLists.txt | 2 +- ftparchive/contents.h | 2 +- methods/copy.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b4773d63..23eeba49b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,7 @@ add_definitions(${LFS_DEFINITIONS}) link_libraries(${LFS_LIBRARIES}) # Set compiler flags -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) diff --git a/ftparchive/contents.h b/ftparchive/contents.h index e23191cd3..a78f9d5e9 100644 --- a/ftparchive/contents.h +++ b/ftparchive/contents.h @@ -27,7 +27,7 @@ class GenContents { const char *data; const char *c_str() const { return data; } - bool operator<(const StringInBlock &other) const { return strcmp(data, other.data) < 0; } + auto operator<=>(const StringInBlock &other) const noexcept { return strcmp(data, other.data); } }; struct BigBlock { diff --git a/methods/copy.cc b/methods/copy.cc index e3f2a29a2..91f831e30 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -41,7 +41,7 @@ bool CopyMethod::URIAcquire(std::string const &Message, FetchItem *Itm) struct FileCopyType { std::string name; struct stat stat{}; - explicit FileCopyType(std::string &&file) : name{std::move(file)} {} + explicit FileCopyType(std::string &&file) noexcept : name{std::move(file)} {} }; std::vector files; // this ensures that relative paths work -- cgit v1.2.3-70-g09d2