Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.6k
fixed #14267 - fixed compilation with C++17 / use simplecpp::View#7962
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
d4a758cf3dd40cbab50a51762d0d0cd473eFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -321,17 +321,17 @@ void TokenList::insertTokens(Token *dest, const Token *src, nonneg int n) | ||
| //--------------------------------------------------------------------------- | ||
| bool TokenList::createTokensFromBuffer(const uint8_t* data, size_t size) | ||
| bool TokenList::createTokensFromBuffer(const char* data, size_t size) | ||
| { | ||
| return createTokensFromBufferInternal(data, size, mFiles.empty() ? "" : *mFiles.cbegin()); | ||
| } | ||
| //--------------------------------------------------------------------------- | ||
| bool TokenList::createTokensFromBufferInternal(const uint8_t* data, size_t size, const std::string& file0) | ||
| bool TokenList::createTokensFromBufferInternal(const char* data, size_t size, const std::string& file0) | ||
| { | ||
| simplecpp::OutputList outputList; | ||
| simplecpp::TokenList tokens(data, size, mFiles, file0, &outputList); | ||
| simplecpp::TokenList tokens({data, size}, mFiles, file0, &outputList); | ||
| createTokens(std::move(tokens)); | ||
| @@ -1868,7 +1868,12 @@ namespace { | ||
| ~OnException() { | ||
| #ifndef _MSC_VER | ||
| if (std::uncaught_exception()) | ||
| #if defined(__cpp_lib_uncaught_exceptions) | ||
| const bool b = std::uncaught_exceptions() > 0; | ||
| #else | ||
| const bool b = std::uncaught_exception(); | ||
| #endif | ||
Comment on lines
+1873
to
+1875
CollaboratorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was deprecated in C++17. | ||
| if (b) | ||
| f(); | ||
| #endif | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
Does this work if
CMAKE_CXX_STANDARDis set to an empty string?It would be better to check the C++ version using a compile check rather than relying on cmake variable as the compiler could support the C++ version by default.
Its also common to set it to an empty string and set the C++ version using
CMAKE_CXX_FLAGSfor a couple of reasons: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.
Will check.
But this doesn't change any behavior (which has been around for years) it just makes sure that you don't set it something unsupported.
Actually that would be worse as we do not have a file which is included into every file so you might have compile failure before that check is ever reached. And having it in every (including tools etc.) file would require an additional check in the CI and would be rather noisy and require dependencies we didn't have before.
I also find it better to bail out as early as possible.
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.
It is not possible to set this is an empty string. CMake will completely bail out on that:
The last error is shown for every target which generates an output.
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 make this ready for review as I do not see anything else to do.