From 03101cc8398aac222ac2c637ac04de2471f57b9d Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sun, 17 Aug 2025 22:41:57 +0300 Subject: [PATCH] treewide: Bump C++ standard version to C++23 Compilers in nixpkgs have caught up and major distros should also have recent enough compilers. It would be nice to have newer features like more full featured ranges and deducing this. --- doc/manual/source/installation/prerequisites-source.md | 2 +- nix-meson-build-support/export/meson.build | 4 ++-- src/libcmd/meson.build | 2 +- src/libexpr-c/meson.build | 2 +- src/libexpr-test-support/meson.build | 2 +- src/libexpr-test-support/tests/value/context.cc | 1 + src/libexpr-tests/derived-path.cc | 1 + src/libexpr-tests/meson.build | 2 +- src/libexpr/meson.build | 2 +- src/libfetchers-c/meson.build | 2 +- src/libfetchers-tests/meson.build | 2 +- src/libfetchers/meson.build | 2 +- src/libflake-c/meson.build | 2 +- src/libflake-tests/meson.build | 2 +- src/libflake/meson.build | 2 +- src/libmain-c/meson.build | 2 +- src/libmain/meson.build | 2 +- src/libstore-c/meson.build | 2 +- src/libstore-test-support/derived-path.cc | 1 + .../include/nix/store/tests/outputs-spec.hh | 1 + src/libstore-test-support/meson.build | 2 +- src/libstore-test-support/path.cc | 3 ++- src/libstore-tests/meson.build | 2 +- src/libstore/meson.build | 2 +- src/libutil-c/meson.build | 2 +- src/libutil-test-support/hash.cc | 1 + src/libutil-test-support/meson.build | 2 +- src/libutil-tests/meson.build | 2 +- src/libutil/meson.build | 2 +- src/nix/meson.build | 2 +- tests/functional/meson.build | 2 +- 31 files changed, 33 insertions(+), 27 deletions(-) diff --git a/doc/manual/source/installation/prerequisites-source.md b/doc/manual/source/installation/prerequisites-source.md index c346a0a4b27..057fd444349 100644 --- a/doc/manual/source/installation/prerequisites-source.md +++ b/doc/manual/source/installation/prerequisites-source.md @@ -10,7 +10,7 @@ - Bash Shell. The `./configure` script relies on bashisms, so Bash is required. - - A version of GCC or Clang that supports C++20. + - A version of GCC or Clang that supports C++23. - `pkg-config` to locate dependencies. If your distribution does not provide it, you can get it from diff --git a/nix-meson-build-support/export/meson.build b/nix-meson-build-support/export/meson.build index 26f77832484..62a27bd48c3 100644 --- a/nix-meson-build-support/export/meson.build +++ b/nix-meson-build-support/export/meson.build @@ -14,7 +14,7 @@ extra_pkg_config_variables = get_variable('extra_pkg_config_variables', {}) extra_cflags = [] if not meson.project_name().endswith('-c') - extra_cflags += [ '-std=c++2a' ] + extra_cflags += [ '-std=c++23' ] endif import('pkgconfig').generate( @@ -34,7 +34,7 @@ meson.override_dependency( declare_dependency( include_directories : include_dirs, link_with : this_library, - compile_args : [ '-std=c++2a' ], + compile_args : [ '-std=c++23' ], dependencies : deps_public_subproject + deps_public, variables : extra_pkg_config_variables, ), diff --git a/src/libcmd/meson.build b/src/libcmd/meson.build index 2f8079496cf..24e0752462c 100644 --- a/src/libcmd/meson.build +++ b/src/libcmd/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libexpr-c/meson.build b/src/libexpr-c/meson.build index 606b93e708e..7c014d61d37 100644 --- a/src/libexpr-c/meson.build +++ b/src/libexpr-c/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libexpr-test-support/meson.build b/src/libexpr-test-support/meson.build index 89dc1d20a7b..d762eb85e32 100644 --- a/src/libexpr-test-support/meson.build +++ b/src/libexpr-test-support/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libexpr-test-support/tests/value/context.cc b/src/libexpr-test-support/tests/value/context.cc index b24d83a5ac7..d6036601a94 100644 --- a/src/libexpr-test-support/tests/value/context.cc +++ b/src/libexpr-test-support/tests/value/context.cc @@ -1,3 +1,4 @@ +#include // Needed by rapidcheck on Darwin #include #include "nix/store/tests/path.hh" diff --git a/src/libexpr-tests/derived-path.cc b/src/libexpr-tests/derived-path.cc index a4bd29c1ca3..e9f9fcd0720 100644 --- a/src/libexpr-tests/derived-path.cc +++ b/src/libexpr-tests/derived-path.cc @@ -1,5 +1,6 @@ #include #include +#include // Needed by rapidcheck on Darwin #include #include "nix/store/tests/derived-path.hh" diff --git a/src/libexpr-tests/meson.build b/src/libexpr-tests/meson.build index cc203d60ee3..a876e970550 100644 --- a/src/libexpr-tests/meson.build +++ b/src/libexpr-tests/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index e1a12106d1f..15bca88f055 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libfetchers-c/meson.build b/src/libfetchers-c/meson.build index 74ec9c9c238..8542744b4da 100644 --- a/src/libfetchers-c/meson.build +++ b/src/libfetchers-c/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libfetchers-tests/meson.build b/src/libfetchers-tests/meson.build index cd23c1f0c9e..a18f64d7981 100644 --- a/src/libfetchers-tests/meson.build +++ b/src/libfetchers-tests/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build index 3da58cb7080..922a2c49199 100644 --- a/src/libfetchers/meson.build +++ b/src/libfetchers/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libflake-c/meson.build b/src/libflake-c/meson.build index 8b844371dcd..933e06d9037 100644 --- a/src/libflake-c/meson.build +++ b/src/libflake-c/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libflake-tests/meson.build b/src/libflake-tests/meson.build index 08c48f1375d..59094abe866 100644 --- a/src/libflake-tests/meson.build +++ b/src/libflake-tests/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libflake/meson.build b/src/libflake/meson.build index faa12e7a938..191d8f0680c 100644 --- a/src/libflake/meson.build +++ b/src/libflake/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libmain-c/meson.build b/src/libmain-c/meson.build index 2c08cac4153..9e26ad8adf3 100644 --- a/src/libmain-c/meson.build +++ b/src/libmain-c/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libmain/meson.build b/src/libmain/meson.build index 252b2816999..4a90d2d83b6 100644 --- a/src/libmain/meson.build +++ b/src/libmain/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libstore-c/meson.build b/src/libstore-c/meson.build index 1d01aa3aa38..f8eaef80395 100644 --- a/src/libstore-c/meson.build +++ b/src/libstore-c/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libstore-test-support/derived-path.cc b/src/libstore-test-support/derived-path.cc index 225b86c79e5..cb1d23ac520 100644 --- a/src/libstore-test-support/derived-path.cc +++ b/src/libstore-test-support/derived-path.cc @@ -1,5 +1,6 @@ #include +#include // Needed by rapidcheck on Darwin #include #include "nix/store/tests/derived-path.hh" diff --git a/src/libstore-test-support/include/nix/store/tests/outputs-spec.hh b/src/libstore-test-support/include/nix/store/tests/outputs-spec.hh index 865a97352b4..5bbcc734086 100644 --- a/src/libstore-test-support/include/nix/store/tests/outputs-spec.hh +++ b/src/libstore-test-support/include/nix/store/tests/outputs-spec.hh @@ -1,6 +1,7 @@ #pragma once ///@file +#include // Needed by rapidcheck on Darwin #include #include "nix/store/outputs-spec.hh" diff --git a/src/libstore-test-support/meson.build b/src/libstore-test-support/meson.build index 26da5d0f282..b2977941f86 100644 --- a/src/libstore-test-support/meson.build +++ b/src/libstore-test-support/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libstore-test-support/path.cc b/src/libstore-test-support/path.cc index 5d5902cc9bf..1459203104c 100644 --- a/src/libstore-test-support/path.cc +++ b/src/libstore-test-support/path.cc @@ -1,6 +1,7 @@ -#include +#include // Needed by rapidcheck on Darwin #include +#include #include #include "nix/store/path-regex.hh" diff --git a/src/libstore-tests/meson.build b/src/libstore-tests/meson.build index 87f6a234a69..d325e57a623 100644 --- a/src/libstore-tests/meson.build +++ b/src/libstore-tests/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libstore/meson.build b/src/libstore/meson.build index ad76582d8e3..4a5f4b2cfec 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libutil-c/meson.build b/src/libutil-c/meson.build index 3688ddeb62a..8131c517cd8 100644 --- a/src/libutil-c/meson.build +++ b/src/libutil-c/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libutil-test-support/hash.cc b/src/libutil-test-support/hash.cc index ffff279262c..853da8e9077 100644 --- a/src/libutil-test-support/hash.cc +++ b/src/libutil-test-support/hash.cc @@ -1,5 +1,6 @@ #include +#include // Needed by rapidcheck on Darwin #include #include "nix/util/hash.hh" diff --git a/src/libutil-test-support/meson.build b/src/libutil-test-support/meson.build index 9bee4a1a6cd..910f1d88164 100644 --- a/src/libutil-test-support/meson.build +++ b/src/libutil-test-support/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libutil-tests/meson.build b/src/libutil-tests/meson.build index 6f04b46fdc3..0e2a2e4680c 100644 --- a/src/libutil-tests/meson.build +++ b/src/libutil-tests/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/libutil/meson.build b/src/libutil/meson.build index ffd1ebd49f2..c294f895ace 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/src/nix/meson.build b/src/nix/meson.build index e17b39f9875..8accd4755e9 100644 --- a/src/nix/meson.build +++ b/src/nix/meson.build @@ -3,7 +3,7 @@ project( 'cpp', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail diff --git a/tests/functional/meson.build b/tests/functional/meson.build index e501aa10206..54e13b26d4b 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -2,7 +2,7 @@ project( 'nix-functional-tests', version : files('.version'), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', # TODO(Qyriad): increase the warning level 'warning_level=1', 'errorlogs=true', # Please print logs for tests that fail