Skip to content

Conversation

@Flamefire
Copy link
Contributor

@Flamefire Flamefire commented Apr 5, 2025

  • C++17 defines an output operator for nullptr so we need to remove the custom one.
  • GCC 13 warns about the "dangling references" returned by get<unique_ptr&> which is a false positive in this case.
  • CMake 4 removed support for 3.5 and deprecated 3.10. Most (all?) actively maintained Ubuntu distributions have at least 3.16 available. So upgrade once at a larger step

Summary by Sourcery

Update project compatibility with modern C++ standards, CMake, and compiler versions

Bug Fixes:

  • Remove custom nullptr output operator to align with C++17 standard

Enhancements:

  • Suppress false-positive compiler warnings for GCC 13

Build:

  • Upgrade CMake minimum version to 3.16, removing support for older versions
  • Add compiler-specific warning suppression for newer GCC versions

CI:

  • Update GitHub Actions checkout action to v4
  • Add output-on-failure flag to CTest command

@sourcery-ai
Copy link

sourcery-ai bot commented Apr 5, 2025

Reviewer's Guide by Sourcery

This pull request addresses compatibility issues with C++17, GCC 13, and CMake 4. It updates the minimum CMake version, suppresses a GCC warning, updates the checkout action version in the test workflow, and removes a custom output operator for nullptr when compiling with C++17 or later.

File-Level Changes

Change Details Files
Updated the minimum required CMake version to 3.16 and added a range up to 3.20.
  • Increased the minimum CMake version.
  • Added an upper bound to the CMake version range.
CMakeLists.txt
Suppressed a GCC 13 warning about dangling references.
  • Added a compiler-specific flag to disable the -Wno-dangling-reference warning for GCC versions 13 and above.
CMakeLists.txt
Updated the checkout action version in the test workflow and added output on failure for ctest.
  • Updated the checkout action to v4.
  • Added the --output-on-failure flag to the ctest command.
.github/workflows/test.yml
Removed a custom output operator for nullptr when compiling with C++17 or later.
  • The custom nullptr output operator is now only defined when using C++11 and a C++ standard version earlier than C++17.
test/test_util.hpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Flamefire - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a comment explaining why the CMake version is being bumped to 3.16.
  • It might be good to use actions/checkout@v3 instead of actions/checkout@v4 for better compatibility.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +48 to +50
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13)
add_definitions(-Wno-dangling-reference)
endif()
Copy link

Choose a reason for hiding this comment

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

suggestion: Explain the purpose of -Wno-dangling-reference.

A comment explaining why this flag is necessary for GNU compilers version 13 and above would be helpful.

Suggested change
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13)
add_definitions(-Wno-dangling-reference)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13)
# Suppress warnings about dangling references, which can occur in template-heavy code
# and are treated as errors in GNU compiler version 13 and above.
add_definitions(-Wno-dangling-reference)
endif()

@Flamefire Flamefire mentioned this pull request May 4, 2025
@satoren satoren merged commit 666d460 into satoren:main Oct 20, 2025
0 of 5 checks passed
@Flamefire Flamefire deleted the c++17-cmake branch October 20, 2025 07: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.

2 participants