-
Notifications
You must be signed in to change notification settings - Fork 12
Comments
Conversation
There was a problem hiding this comment.
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 upgrades the codebase to require C++20 as the minimum standard for extension builds. The change modernizes the codebase by replacing older C++17 constructs and string formatting approaches with C++20 features.
Key changes:
- Updates minimum C++ standard requirement from C++17 to C++20
- Replaces
std::ostringstreamstring formatting with C++20std::format - Modernizes template syntax using C++20
requiresclauses instead of SFINAE - Updates build configuration and CI workflows to use C++20
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| CMakeLists.txt | Updates minimum C++ standard requirement from 17 to 20 |
| src/treespec/unflatten.cpp | Replaces ostringstream with std::format, adds std::span usage |
| src/treespec/treespec.cpp | Extensive modernization with std::format, std::span, std::ranges, and constinit |
| src/treespec/traversal.cpp | Updates string formatting to use std::format |
| src/treespec/serialization.cpp | Uses std::unordered_map::contains instead of find comparison |
| src/treespec/richcomparison.cpp | Replaces std algorithm calls with std::ranges equivalents |
| src/treespec/hashing.cpp | Uses std::unordered_map::contains for cleaner code |
| src/treespec/flatten.cpp | Comprehensive string formatting updates and template parameter renaming |
| src/treespec/constructors.cpp | String formatting modernization and std::ranges usage |
| src/registry.cpp | Updates string formatting and replaces PYBIND11_CONSTINIT with constinit |
| src/optree.cpp | String formatting updates and constinit usage |
| include/optree/treespec.h | Updates function signatures to use std::span and modernizes template parameters |
| include/optree/pytypes.h | Adds std::formatter specializations and modernizes template syntax with requires clauses |
| include/optree/pymacros.h | Replaces PYBIND11_CONSTINIT with constinit |
| include/optree/exceptions.h | Major refactoring using std::source_location and std::format for error handling |
| README.md | Updates documentation to reflect C++20 requirement |
| CPPLINT.cfg | Adds whitespace/braces filter |
| .github/workflows/tests.yml | Removes C++17 compatibility test |
| .github/workflows/lint.yml | Updates clang-tidy to use C++20 |
| .clang-format | Updates standard from c++17 to c++20 |
b266f69 to
1aea690
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## main #235 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 14 14 Lines 1416 1416 Branches 175 175 ========================================= Hits 1416 1416 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
9388aa9 to
b3e5183
Compare
std::formatsupport needs GCC 13 on Linux andMACOSX_DEPLOYMENT_TARGET13.3 on macOS.- The default GCC on Ubuntu 22.04 LTS is GCC 11, which does not support
std::format. - The AppleClang in the GHA
macos-14runner is 15.0.0, which has an incorrect implementation ofstd::source_location::current()when in the function default argument. I can build the extension with AppleClang 17.0.0 locally, which passes all tests. std::source_location::current()tests passed for macOS platform withMACOSX_DEPLOYMENT_TARGET="15.0"onmacos-15runner, and iOS platform requires to setIPHONEOS_DEPLOYMENT_TARGET="16.3".
6887698 to
c0e6a1d
Compare
a343cd1 to
b9f2140
Compare
e51ac55 to
a25b292
Compare
ce0ec4b to
5af5e9b
Compare
430d021 to
f35b9b6
Compare
74793af to
947195f
Compare
52ad667 to
c220cda
Compare
b834e96 to
4caf09f
Compare
b40c207 to
0b08991
Compare
84639eb to
2d05490
Compare
75d4ab5 to
332ab5a
Compare
Description
Describe your changes in detail.
Motivation and Context
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
You can use the syntax
close #15213if this solves the issue #15213Types of changes
What types of changes does your code introduce? Put an
xin all the boxes that apply:Checklist
Go over all the following points, and put an
xin all the boxes that apply.If you are unsure about any of these, don't hesitate to ask. We are here to help!
make format. (required)make lint. (required)make testpass. (required)