-
Notifications
You must be signed in to change notification settings - Fork 273
Set standard to C++17 when -std=c++17 or -std=gnu++17 are used #6402
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
Conversation
@@ -551,6 +551,15 @@ bool c_preprocess_gcc_clang( | |||
#endif | |||
argv.push_back("-std=gnu++14"); | |||
break; | |||
|
|||
case configt::cppt::cpp_standardt::CPP17: | |||
#if defined(__OpenBSD__) |
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.
This one is a bit puzzling? Why is OpenBSD different?
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.
Looks to me like this is a copy-n-paste of all the corresponding c++14, etc, condition blocks above this... And I'm suspecting that "OpenBSD" really means "is the platform using LLVM/clang by default" - which would also cover FreeBSD and similar...
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.
Can we confirm that these platforms indeed default to -std=cpp++XX instead of gnu++XX?
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.
Yes, that's just copy-pasted from the C++11/14 cases. The change @kroening refers to was made in b811680 as part of #4053 and the PR description says that:
The c_preprocess.cpp source file in ansi-c has been patched to pass the appropriate -std to Clang on OpenBSD. OpenBSD does not use GNU extensions with the system Clang.
I'd suggest that the PR title should probably change - this PR doesn't, as far as I can tell, actually implement C++17 support - it adds some support for passing appropriate C++17 flags to the preprocessor, and detection of compiler C++17 modes. The PR title should probably make that clearer. |
Thanks @chrisr-diffblue! The PR title should be more appropriate now. |
Codecov Report
@@ Coverage Diff @@
## develop #6402 +/- ##
===========================================
- Coverage 75.98% 75.98% -0.01%
===========================================
Files 1524 1523 -1
Lines 164290 164305 +15
===========================================
+ Hits 124843 124848 +5
- Misses 39447 39457 +10
Continue to review full report at Codecov.
|
CBMC will be able to understand code that is compiled with -std=c++17 or -std=gnu++17. Otherwise, it fell back to C++03 making the code un-parsable. Fixes: #6090 Co-authored-by: Michael Tautschnig <[email protected]> Co-authored-by: Lukas Zaoral <[email protected]>
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.
Looks good to me; are there any other blockers to this being merged?
Based on suggestions by @martin-cs and @tautschnig.
Fixes: #6090
Obsoletes: #6144