| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -874,7 +874,7 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename, | |
| back()->setstr(currentToken); | ||
| location.adjust(currentToken); | ||
| if (currentToken.find_first_of("\r\n") == std::string::npos) | ||
| location.col += 2 + 2 * delim.size(); | ||
| location.col += 2 + (2 * delim.size()); | ||
| else | ||
| location.col += 1 + delim.size(); | ||
|
|
||
| Expand Down Expand Up | @@ -1329,6 +1329,7 @@ void simplecpp::TokenList::constFoldLogicalOp(Token *tok) | |
| void simplecpp::TokenList::constFoldQuestionOp(Token **tok1) | ||
| { | ||
| bool gotoTok1 = false; | ||
| // NOLINTNEXTLINE(misc-const-correctness) - technically correct but used to access non-const data | ||
| for (Token *tok = *tok1; tok && tok->op != ')'; tok = gotoTok1 ? *tok1 : tok->next) { | ||
| gotoTok1 = false; | ||
| if (tok->str() != "?") | ||
| Expand Down Expand Up | @@ -1508,7 +1509,12 @@ namespace simplecpp { | |
| } | ||
|
|
||
| Macro(const Macro &other) : nameTokDef(nullptr), files(other.files), tokenListDefine(other.files), valueDefinedInCode_(other.valueDefinedInCode_) { | ||
| *this = other; | ||
| // TODO: remove the try-catch - see #537 | ||
| // avoid bugprone-exception-escape clang-tidy warning | ||
| try { | ||
| *this = other; | ||
| } | ||
| catch (const Error&) {} // NOLINT(bugprone-empty-catch) | ||
| } | ||
|
|
||
| ~Macro() { | ||
| Expand Down Expand Up | @@ -1945,6 +1951,7 @@ namespace simplecpp { | |
| } | ||
| } | ||
|
|
||
| // NOLINTNEXTLINE(misc-const-correctness) - technically correct but used to access non-const data | ||
| Token * const output_end_1 = output.back(); | ||
|
|
||
| const Token *valueToken2; | ||
| Expand Down Expand Up | @@ -2250,7 +2257,7 @@ namespace simplecpp { | |
| const bool canBeConcatenatedStringOrChar = isStringLiteral_(A->str()) || isCharLiteral_(A->str()); | ||
| const bool unexpectedA = (!A->name && !A->number && !A->str().empty() && !canBeConcatenatedWithEqual && !canBeConcatenatedStringOrChar); | ||
|
|
||
| Token * const B = tok->next->next; | ||
| const Token * const B = tok->next->next; | ||
| if (!B->name && !B->number && B->op && !B->isOneOf("#=")) | ||
| throw invalidHashHash::unexpectedToken(tok->location, name(), B); | ||
|
|
||
| Expand Down Expand Up | @@ -2528,11 +2535,11 @@ static void simplifySizeof(simplecpp::TokenList &expr, const std::map<std::strin | |
| for (simplecpp::Token *tok = expr.front(); tok; tok = tok->next) { | ||
| if (tok->str() != "sizeof") | ||
| continue; | ||
| simplecpp::Token *tok1 = tok->next; | ||
| const simplecpp::Token *tok1 = tok->next; | ||
|
Comment thread
Copy link
Copy Markdown
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI filed https://trac.cppcheck.net/ticket/14161 about this.
Sorry, something went wrong.
All reactions
|
||
| if (!tok1) { | ||
| throw std::runtime_error("missing sizeof argument"); | ||
| } | ||
| simplecpp::Token *tok2 = tok1->next; | ||
| const simplecpp::Token *tok2 = tok1->next; | ||
| if (!tok2) { | ||
| throw std::runtime_error("missing sizeof argument"); | ||
| } | ||
| Expand All | @@ -2547,7 +2554,7 @@ static void simplifySizeof(simplecpp::TokenList &expr, const std::map<std::strin | |
| } | ||
|
|
||
| std::string type; | ||
| for (simplecpp::Token *typeToken = tok1; typeToken != tok2; typeToken = typeToken->next) { | ||
| for (const simplecpp::Token *typeToken = tok1; typeToken != tok2; typeToken = typeToken->next) { | ||
|
Comment thread
Copy link
Copy Markdown
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityFalse negative tracked as https://trac.cppcheck.net/ticket/14119.
Sorry, something went wrong.
All reactions
|
||
| if ((typeToken->str() == "unsigned" || typeToken->str() == "signed") && typeToken->next->name) | ||
| continue; | ||
| if (typeToken->str() == "*" && type.find('*') != std::string::npos) | ||
| Expand Down Expand Up | @@ -2598,11 +2605,11 @@ static void simplifyHasInclude(simplecpp::TokenList &expr, const simplecpp::DUI | |
| for (simplecpp::Token *tok = expr.front(); tok; tok = tok->next) { | ||
| if (tok->str() != HAS_INCLUDE) | ||
| continue; | ||
| simplecpp::Token *tok1 = tok->next; | ||
| const simplecpp::Token *tok1 = tok->next; | ||
| if (!tok1) { | ||
| throw std::runtime_error("missing __has_include argument"); | ||
| } | ||
| simplecpp::Token *tok2 = tok1->next; | ||
| const simplecpp::Token *tok2 = tok1->next; | ||
| if (!tok2) { | ||
| throw std::runtime_error("missing __has_include argument"); | ||
| } | ||
| Expand All | @@ -2620,7 +2627,7 @@ static void simplifyHasInclude(simplecpp::TokenList &expr, const simplecpp::DUI | |
| const bool systemheader = (tok1 && tok1->op == '<'); | ||
| std::string header; | ||
| if (systemheader) { | ||
| simplecpp::Token *tok3 = tok1->next; | ||
| const simplecpp::Token *tok3 = tok1->next; | ||
| if (!tok3) { | ||
| throw std::runtime_error("missing __has_include closing angular bracket"); | ||
| } | ||
| Expand All | @@ -2631,7 +2638,7 @@ static void simplifyHasInclude(simplecpp::TokenList &expr, const simplecpp::DUI | |
| } | ||
| } | ||
|
|
||
| for (simplecpp::Token *headerToken = tok1->next; headerToken != tok3; headerToken = headerToken->next) | ||
| for (const simplecpp::Token *headerToken = tok1->next; headerToken != tok3; headerToken = headerToken->next) | ||
| header += headerToken->str(); | ||
| } else { | ||
| header = tok1->str().substr(1U, tok1->str().size() - 2U); | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -426,6 +426,7 @@ namespace simplecpp { | |
| std::pair<FileData *, bool> get(const std::string &sourcefile, const std::string &header, const DUI &dui, bool systemheader, std::vector<std::string> &filenames, OutputList *outputList); | ||
|
|
||
| void insert(FileData data) { | ||
| // NOLINTNEXTLINE(misc-const-correctness) - FP | ||
| FileData *const newdata = new FileData(std::move(data)); | ||
|
Comment thread
Comment on lines
+429
to
430
Copy link
Copy Markdown
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI filed llvm/llvm-project#157730 about this.
Sorry, something went wrong.
All reactions
|
||
|
|
||
| mData.emplace_back(newdata); | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySame, B's members are modified below.
Looks like there still is a cppcheck FN here.
Sorry, something went wrong.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThat's possible. I did not check all remaining cases yet.
Sorry, something went wrong.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThere's several false negatives.
Sorry, something went wrong.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThis is the same as https://trac.cppcheck.net/ticket/14161.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.