From 569c47ac1d1deef653ba2c7bfab8d3d3b10998f2 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Sun, 25 May 2025 20:27:35 -0400 Subject: [PATCH 1/7] Update Makefile for make 4.4 Make 4.4, which comes with Ubuntu 25.04, changes how recursive macros are processed. Fix to make macros not as recursive. --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d19cfc5d..73edb673 100755 --- a/Makefile +++ b/Makefile @@ -5,7 +5,6 @@ # cmake-format: on INSTALL_PREFIX?=.install/ -PROJECT?=$(shell basename $(CURDIR)) BUILD_DIR?=.build DEST?=$(INSTALL_PREFIX) CMAKE_FLAGS?= @@ -62,9 +61,11 @@ $(_build_path)/CMakeCache.txt: | $(_build_path) .gitmodules TARGET:=all compile: $(_build_path)/CMakeCache.txt ## Compile the project - cmake --build $(_build_path) --config $(CONFIG) --target all_verify_interface_header_sets -- -k 0 cmake --build $(_build_path) --config $(CONFIG) --target all -- -k 0 +compile-headers: $(_build_path)/CMakeCache.txt ## Compile the headers + cmake --build $(_build_path) --config $(CONFIG) --target all_verify_interface_header_sets -- -k 0 + install: $(_build_path)/CMakeCache.txt compile ## Install the project cmake --install $(_build_path) --config $(CONFIG) --component beman_optional_development --verbose @@ -98,7 +99,7 @@ papers: cmake --build $(_build_path) --config $(CONFIG) --target $@ -- -k 0 PYEXECPATH ?= $(shell which python3.12 || which python3.11 || which python3.10 || which python3.9 || which python3.8 || which python3.7 || which python3) -PYTHON ?= $(shell basename $(PYEXECPATH)) +PYTHON ?= $(notdir $(PYEXECPATH)) VENV := .venv ACTIVATE := . $(VENV)/bin/activate && PYEXEC := $(ACTIVATE) $(PYTHON) From 1d7341a7b55939dcb21c743f5e68687be41b424d Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Sun, 25 May 2025 20:28:35 -0400 Subject: [PATCH 2/7] Don't both set std and STANDARD in toolchain Set just the CMAKE_CXX_STANDARD, not the -std flag directly. --- etc/gcc-flags.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/gcc-flags.cmake b/etc/gcc-flags.cmake index 4747203c..1d451f59 100644 --- a/etc/gcc-flags.cmake +++ b/etc/gcc-flags.cmake @@ -2,7 +2,7 @@ include_guard(GLOBAL) set(CMAKE_CXX_STANDARD 23) -set(CMAKE_CXX_FLAGS "-std=c++23 -Wall -Wextra " CACHE STRING "CXX_FLAGS" FORCE) +set(CMAKE_CXX_FLAGS "-Wall -Wextra " CACHE STRING "CXX_FLAGS" FORCE) set(CMAKE_CXX_FLAGS_DEBUG "-O0 -fno-inline -g3" From c62b305e246ba8127f7fed895b8dc9b820f55117 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Sun, 25 May 2025 20:30:28 -0400 Subject: [PATCH 3/7] Include version before checking feature macro __cpp_lib_format_ranges is defined in version. Checking without including causes strange errors when it becomes defined later. --- include/beman/optional/optional.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/beman/optional/optional.hpp b/include/beman/optional/optional.hpp index 25e0bfe6..f7b8abb9 100644 --- a/include/beman/optional/optional.hpp +++ b/include/beman/optional/optional.hpp @@ -4,6 +4,7 @@ #ifndef BEMAN_OPTIONAL_OPTIONAL_HPP #define BEMAN_OPTIONAL_OPTIONAL_HPP +#include #include #include #if defined(__cpp_lib_format_ranges) From 06fbe20cfddbe70e21a0deacc410760b29619df3 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Sun, 25 May 2025 20:31:29 -0400 Subject: [PATCH 4/7] Add tests for format_kind GCC 15.1.1 and higher have the feature. Check that it works for the GCC version, and check if the feature is indicated available by the macro. --- .../beman/optional/optional_range_support.t.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/beman/optional/optional_range_support.t.cpp b/tests/beman/optional/optional_range_support.t.cpp index 297ebd6e..3fceb191 100644 --- a/tests/beman/optional/optional_range_support.t.cpp +++ b/tests/beman/optional/optional_range_support.t.cpp @@ -231,6 +231,23 @@ TEST(RangeSupportTest, EndOnNonEmptyOptional) { lambda(); } +#if ((__GNUC__ >= 15) && (__GNUC_MINOR__ >= 1) && (__GNUC_PATCHLEVEL__ >= 1)) || \ + ((__GNUC__ >= 16)) +static_assert(std::format_kind> == std::range_format::disabled); +#endif + +#if defined(__cpp_lib_format_ranges) +static_assert(std::format_kind> == std::range_format::disabled); +static_assert(std::format_kind> == std::range_format::disabled); +static_assert(std::format_kind> == std::range_format::disabled); +static_assert(std::format_kind> == std::range_format::disabled); +static_assert(std::format_kind> == std::range_format::disabled); +static_assert(std::format_kind> == std::range_format::disabled); +static_assert(std::format_kind> == std::range_format::disabled); +static_assert(std::format_kind> == std::range_format::disabled); +static_assert(std::format_kind> == std::range_format::disabled); +#endif + TEST(RangeSupportTest, FormatOptionalIsStillDisabled) { // TODO: Always enable when all major compilers implement P2585R1: "Improve default container formatting". #if defined(__cpp_lib_format_ranges) From b8989ef8e00178fd084d1c045990c6ea876253d8 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Sun, 25 May 2025 20:33:12 -0400 Subject: [PATCH 5/7] Add new toolchain for gcc-16 -- current trunk --- etc/gcc-16-toolchain.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 etc/gcc-16-toolchain.cmake diff --git a/etc/gcc-16-toolchain.cmake b/etc/gcc-16-toolchain.cmake new file mode 100644 index 00000000..ecb9f3c5 --- /dev/null +++ b/etc/gcc-16-toolchain.cmake @@ -0,0 +1,13 @@ +include_guard(GLOBAL) + +include("${CMAKE_CURRENT_LIST_DIR}/gcc-flags.cmake") + +set(CMAKE_C_COMPILER gcc-16) +set(CMAKE_CXX_COMPILER g++-16) + +set(CMAKE_CXX_FLAGS_ASAN + "${CMAKE_CXX_FLAGS_ASAN} -Wno-maybe-uninitialized" + CACHE STRING + "C++ ASAN Flags" + FORCE +) From 1a42c1c77a8773e04fb8ea09b7f2f6a963562db1 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Mon, 26 May 2025 10:01:58 -0400 Subject: [PATCH 6/7] Make clang-format happy --- tests/beman/optional/optional_range_support.t.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/beman/optional/optional_range_support.t.cpp b/tests/beman/optional/optional_range_support.t.cpp index 3fceb191..6d6dd479 100644 --- a/tests/beman/optional/optional_range_support.t.cpp +++ b/tests/beman/optional/optional_range_support.t.cpp @@ -231,8 +231,7 @@ TEST(RangeSupportTest, EndOnNonEmptyOptional) { lambda(); } -#if ((__GNUC__ >= 15) && (__GNUC_MINOR__ >= 1) && (__GNUC_PATCHLEVEL__ >= 1)) || \ - ((__GNUC__ >= 16)) +#if ((__GNUC__ >= 15) && (__GNUC_MINOR__ >= 1) && (__GNUC_PATCHLEVEL__ >= 1)) || ((__GNUC__ >= 16)) static_assert(std::format_kind> == std::range_format::disabled); #endif From 63455b6aef68b370c006387f62c04e3f04379365 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Mon, 26 May 2025 10:36:48 -0400 Subject: [PATCH 7/7] Add gcov command to gcc-15 and 16 toolchains --- etc/gcc-15-toolchain.cmake | 1 + etc/gcc-16-toolchain.cmake | 1 + 2 files changed, 2 insertions(+) diff --git a/etc/gcc-15-toolchain.cmake b/etc/gcc-15-toolchain.cmake index 525ada27..63874b36 100644 --- a/etc/gcc-15-toolchain.cmake +++ b/etc/gcc-15-toolchain.cmake @@ -4,6 +4,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/gcc-flags.cmake") set(CMAKE_C_COMPILER gcc-15) set(CMAKE_CXX_COMPILER g++-15) +set(GCOV_EXECUTABLE "gcov-15" CACHE STRING "GCOV executable" FORCE) set(CMAKE_CXX_FLAGS_ASAN "${CMAKE_CXX_FLAGS_ASAN} -Wno-maybe-uninitialized" diff --git a/etc/gcc-16-toolchain.cmake b/etc/gcc-16-toolchain.cmake index ecb9f3c5..8dea3fff 100644 --- a/etc/gcc-16-toolchain.cmake +++ b/etc/gcc-16-toolchain.cmake @@ -4,6 +4,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/gcc-flags.cmake") set(CMAKE_C_COMPILER gcc-16) set(CMAKE_CXX_COMPILER g++-16) +set(GCOV_EXECUTABLE "gcov-16" CACHE STRING "GCOV executable" FORCE) set(CMAKE_CXX_FLAGS_ASAN "${CMAKE_CXX_FLAGS_ASAN} -Wno-maybe-uninitialized"