-
Notifications
You must be signed in to change notification settings - Fork 94
clang-tidy.yml: updated to Clang 21 #421
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
Changes from all commits
64df78a
e982bd8
36b4c0c
446663d
197fb48
a43105f
0e31c6a
9af1b83
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 |
|---|---|---|
|
|
@@ -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(); | ||
|
|
||
|
|
@@ -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() != "?") | ||
|
|
@@ -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() { | ||
|
|
@@ -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; | ||
|
|
@@ -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); | ||
|
|
||
|
|
@@ -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; | ||
|
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 filed https://trac.cppcheck.net/ticket/14161 about this. |
||
| 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"); | ||
| } | ||
|
|
@@ -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) { | ||
|
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. False negative tracked as https://trac.cppcheck.net/ticket/14119. |
||
| if ((typeToken->str() == "unsigned" || typeToken->str() == "signed") && typeToken->next->name) | ||
| continue; | ||
| if (typeToken->str() == "*" && type.find('*') != std::string::npos) | ||
|
|
@@ -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"); | ||
| } | ||
|
|
@@ -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"); | ||
| } | ||
|
|
@@ -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); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 on lines
+429
to
430
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 filed llvm/llvm-project#157730 about this. |
||
|
|
||
| mData.emplace_back(newdata); | ||
|
|
||
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.
Same, B's members are modified below.Looks like there still is a cppcheck FN here.
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's possible. I did not check all remaining cases yet.
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.
There's several false negatives.
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 is the same as https://trac.cppcheck.net/ticket/14161.