-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change C++ version to C++17 #7989
Conversation
fe7dabe
to
5088345
Compare
1d4e388
to
12c5106
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #7989 +/- ##
===========================================
+ Coverage 77.75% 79.09% +1.33%
===========================================
Files 1701 1699 -2
Lines 196465 196471 +6
===========================================
+ Hits 152762 155390 +2628
+ Misses 43703 41081 -2622 ☔ View full report in Codecov by Sentry. |
What about #7172? |
@@ -238,7 +238,7 @@ document_propertiest::get_code(const source_locationt &source_location) | |||
while(line_no.size()<4) | |||
line_no=" "+line_no; | |||
|
|||
line_no+" "; | |||
line_no += " "; |
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.
Seems unrelated?!
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.
I agree that this is worth separating into its own PR. Some of the new versions of the standard library add the [[nodiscard]]
attribute to the + operator of std::string
. This causes a compile error when the result of the concatenation is unused. It essentially promotes a logic error into a compile error. Without this commit, the check-ubuntu-22_04-cmake-gcc-13
job will fail, so it does appear to be needed before we can switch standards. However as it is a logic error currently we could fix it before switching standards.
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.
That is a fix for an issue brought up by the C++17 change as the operator+
between strings is marked nodiscard
and so it was resulting in a compilation error.
If it is too awkward to include this here, I'm happy to move the change to a separate PR, but I would need it in before upgrading the standard.
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.
I think this should be PR'ed and fixed right away. (I guess no one is using that feature so it went unnoticed, but it should really be fixed now.)
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.
@tautschnig I just read the surrounding code and the value of line_no
is never read back and output. So it is just as broken before and after this commit...
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.
Fair point. I suspect this should have been inserted as a prefix into each line of output. Let me make a stab at a PR.
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.
Fix in #7994.
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.
I will remove this commit from this PR as soon as the latter is merged.
We have traditionally been very conservative about C++ version increments as it is not uncommon to find the "approved" Linux platform some users have trailing the current version by as much as 5 years. Ubuntu 18.04 LTS is only just out of general support, still gets security fixes and I strongly suspect still has quite a user base. Generally supporting an older C++ version is a good thing. But, it can be worth increasing the version if it makes the project better in some way. From this PR it is not clear to me what the benefits are. There are probably some that I just don't see. Can anyone say what they are? |
@martin-cs Just a reminder - you approved the previous PR making the equivalent changes and you seemed satisfied with the motivating factors at the time - #7172 (review) A quick summary of some of the advantages off the top of my head -
|
@thomasspriggs thanks for the reminder; had totally forgotten about that PR! |
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.
Approve subject to @tautschnig 's comments about separate PRs.
Changing the C++ standard to C++ 17 on the cmake-based build-system.
Changing the C++ standard to C++ 17 on the gnu-make-based build-system
Changing the documentation COMPILING.md to reflect the change to C++17. Also increased the minimum G++ version to 7 as it is the lowest version with full C++17 support.
12c5106
to
032f68c
Compare
@@ -1,5 +1,9 @@ | |||
cmake_minimum_required(VERSION 3.8) | |||
|
|||
set(CMAKE_CXX_STANDARD 17) | |||
set(CMAKE_CXX_STANDARD_REQUIRED true) | |||
set(CMAKE_CXX_EXTENSIONS OFF) |
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.
Thank the stars we're not depending on any extensions from before (when I first saw this change I nearly had a heart attack, but then I noticed CI passing and I let out a sigh of relief).
Changed gnu-make and cmake-based builds to C++17.