Skip to content

Switch CCF builds to C++23 - #8234

Merged
Amaury Chamayou (achamayou) merged 7 commits into
mainfrom
achamayou-switch-to-cpp23
Sep 1, 2026
Merged

Switch CCF builds to C++23#8234
Amaury Chamayou (achamayou) merged 7 commits into
mainfrom
achamayou-switch-to-cpp23

Conversation

@achamayou

@achamayou Amaury Chamayou (achamayou) commented Aug 28, 2026

Copy link
Copy Markdown
Member
  • require C++23 for CCF builds via CMAKE_CXX_STANDARD in preproject.cmake, which reaches downstream consumers through ccf-config.cmake
  • update the installed-application smoke test to fall back to Clang 18, matching the packaged minimum toolchain
  • fix C++23 compatibility issues in the vendored SmallVector include sites (std::aligned_union is deprecated by P1413R3) and incomplete pimpl declarations
  • adopt C++23 std::to_underlying, string and ranges contains, and std::unreachable, and remove the obsolete comparison shim

Require and propagate C++23 across CCF and downstream application targets, update the install-test compiler fallback, and adopt the newly available standard utilities.

Fix C++23 build incompatibilities in SmallVector consumers and incomplete pimpl declarations.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Record the downstream C++23 requirement and retained Clang 18.1.2 minimum in the 7.0.13 changelog.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Apache Arrow 15 still uses std::aligned_storage, which libstdc++ 13 deprecates in C++23 mode. Suppress that warning only while parsing Arrow and Parquet headers so project warnings remain errors.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@achamayou
Amaury Chamayou (achamayou) marked this pull request as ready for review September 1, 2026 10:43
@achamayou
Amaury Chamayou (achamayou) requested a review from a team as a code owner September 1, 2026 10:43
Copilot AI lite review requested due to automatic review settings September 1, 2026 10:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates CCF’s build and public CMake targets to require C++23, and modernises several call sites to use C++23 standard library APIs (eg std::to_underlying, std::ranges::contains, std::string{,_view}::contains, std::unreachable) while keeping tests and vendored include sites compatible.

Changes:

  • Switch default CMake C++ standard to 23 and propagate cxx_std_23 via exported/linked targets.
  • Update the install-build smoke test to fall back to Clang 18.
  • Replace legacy shims/patterns with C++23 equivalents (string/ranges contains, std::to_underlying, std::unreachable) and adjust a few includes/headers accordingly.

Custom instructions used:

  • None (no additional .github/copilot-instructions.md / .github/instructions/* files were loaded via tools in this review).

Reviewed changes

Copilot reviewed 43 out of 43 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_install_build.sh Update compiler fallback to clang/clang++ 18 for install-build smoke test.
src/tasks/worker.cpp Use std::unreachable() (and include <utility>).
src/tasks/test/basic_tasks.cpp Use std::string::contains in task tests.
src/tasks/ordered_tasks.h Remove redundant = nullptr from unique_ptr pimpl member.
src/tasks/job_board.h Remove redundant = nullptr from unique_ptr pimpl member.
src/tasks/fan_in_tasks.h Remove redundant = nullptr from unique_ptr pimpl member.
src/node/test/js_policy.cpp Use std::string::contains in policy error-handling tests.
src/node/test/historical_queries.cpp Replace std::find with std::ranges::contains in historical query tests.
src/node/rpc/test/frontend_test.cpp Use std::string::contains in RPC frontend tests.
src/node/rpc/test/frontend_test_infra.h Use std::string::contains in shared test helper.
src/node/rpc/node_frontend_utils.h Use std::to_underlying for enum formatting in error path (include <utility>).
src/node/rpc/file_serving_handlers.h Use std::string::contains when parsing range headers.
src/node/node_state.h Use std::string_view::contains in hostname/IP detection.
src/node/node_inbound_message.h Use std::to_underlying for enum formatting in error path (include <utility>).
src/kv/untyped_map.h Remove obsolete operator!= shim now that C++23 is required.
src/kv/test/kv_test.cpp Use std::string::contains in KV unit tests.
src/kv/raw_serialise.h Wrap vendored SmallVector include with deprecation-warning suppression pragmas.
src/js/test/js.cpp Use std::string::contains in JS KV map access test helper.
src/js/extensions/ccf/kv_helpers.h Remove outdated comment about std::to_underlying.
src/http/test/http_test.cpp Add <algorithm> and use contains / std::ranges::contains in HTTP tests.
src/http/http2_parser.h Use std::to_underlying for HTTP status formatting (include <utility>).
src/host/test/ledger.cpp Use std::string::contains for ledger filename checks.
src/ds/test/messaging.cpp Use std::string::contains in exception message assertions.
src/ds/test/logger.cpp Use std::string::contains in logger output assertions.
src/ds/test/json_schema.cpp Add <algorithm> and use std::ranges::contains in schema tests.
src/crypto/test/crypto.cpp Use std::string::contains in certificate validity assertions.
src/crypto/pem.cpp Use std::string::contains in PEM format validation.
src/cose/test/cose_ffi_test.cpp Use std::string::contains in COSE error assertions.
src/consensus/aft/test/committable_suffix.cpp Add <algorithm> and use std::ranges::contains in AFT test helper.
src/common/cli_helper.h Use std::string::contains for IPv6 bracket validation.
include/ccf/tx_status.h Use std::to_underlying in FinalTxStatus and include <utility>.
include/ccf/service/tables/proposals.h Use std::to_underlying for proposal-state formatting and include <utility>.
include/ccf/service/node_info_network.h Use std::string::contains in address parsing/formatting helpers.
include/ccf/js/kv_access_permissions.h Implement permission intersection via std::to_underlying (include <utility>).
include/ccf/endpoint.h Use std::to_underlying in forwarding-required formatter.
include/ccf/ds/logger.h Use std::to_underlying for logger level indexing (include <utility>).
include/ccf/ds/hash.h Wrap vendored SmallVector include with deprecation-warning suppression pragmas.
include/ccf/ds/enum_formatter.h Use std::to_underlying in generic enum formatter (include <utility>).
include/ccf/byte_vector.h Wrap vendored SmallVector include with deprecation-warning suppression pragmas.
cmake/preproject.cmake Set CMAKE_CXX_STANDARD to 23 and require it.
cmake/crypto.cmake Propagate cxx_std_23 on ccfcrypto target.
cmake/ccf_app.cmake Apply/propagate cxx_std_23 on app and static library helper targets.
CHANGELOG.md Document the C++23 requirement and exported-target propagation (#8234).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmake/ccf_app.cmake
CMAKE_CXX_STANDARD from preproject.cmake already reaches consumers via
ccf-config.cmake, so the target_compile_features calls added nothing.

Match the codebase convention of #pragma clang diagnostic at the
SmallVector include sites.

Move the changelog entry to 7.0.14, as 7.0.13 has been released.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3eea2ed7-7f60-42f3-8cdc-cb7e7090cb51
Comment thread src/js/extensions/ccf/kv_helpers.h
@achamayou
Amaury Chamayou (achamayou) merged commit a1e231e into main Sep 1, 2026
13 checks passed
@achamayou
Amaury Chamayou (achamayou) deleted the achamayou-switch-to-cpp23 branch September 1, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants