-
Notifications
You must be signed in to change notification settings - Fork 96
fixed #616 - report bad macro syntax via OutputList
#617
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3341,8 +3341,21 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL | |
| continue; | ||
| const std::string lhs(macrostr.substr(0,eq)); | ||
| const std::string rhs(eq==std::string::npos ? std::string("1") : macrostr.substr(eq+1)); | ||
| const Macro macro(lhs, rhs, dummy); | ||
| macros.insert(std::pair<TokenString,Macro>(macro.name(), macro)); | ||
| try { | ||
| const Macro macro(lhs, rhs, dummy); | ||
| macros.insert(std::pair<TokenString,Macro>(macro.name(), macro)); | ||
| } catch (const std::runtime_error& e) { | ||
| if (outputList) { | ||
| simplecpp::Output err = { | ||
|
Owner
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. I prefer that the
Collaborator
Author
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. Will clean up as a whole in a follow-up. |
||
| Output::DUI_ERROR, | ||
| {}, | ||
| e.what() | ||
| }; | ||
| outputList->push_back(std::move(err)); | ||
|
Owner
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. we can't
Collaborator
Author
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. I only adjusted those when Clang-Tidy told us to. Will adjust as a whole in a follow-up. |
||
| } | ||
| output.clear(); | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| const bool strictAnsiUndefined = dui.undefined.find("__STRICT_ANSI__") != dui.undefined.cend(); | ||
|
|
||
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 use
macros.emplace(macro.name(), macro);syntax nowadays or is a newer C++ needed for that?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.
See #596.