-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix #14471: Improve check: shadowVariable for function argument #8303
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: main
Are you sure you want to change the base?
Changes from all commits
a2be91a
31d2812
9ae1f59
c3339ac
66aca80
7b94164
40ad29e
e145975
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 |
|---|---|---|
|
|
@@ -270,10 +270,10 @@ private slots: | |
| * @brief Analyze the project. | ||
| * @param projectFile Pointer to the project to analyze. | ||
| * @param recheckFiles files to recheck, empty => check all files | ||
| * @param checkLibrary Flag to indicate if the library should be checked. | ||
| * @param checkConfiguration Flag to indicate if the configuration should be checked. | ||
| * @param doCheckLibrary Flag to indicate if the library should be checked. | ||
|
Collaborator
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. to me the "do" prefix makes it sound more like a function. how about renaming the parameters to checkConfig and checkLib instead. |
||
| * @param doCheckConfiguration Flag to indicate if the configuration should be checked. | ||
| */ | ||
| void analyzeProject(const ProjectFile *projectFile, const QStringList& recheckFiles, bool checkLibrary = false, bool checkConfiguration = false); | ||
| void analyzeProject(const ProjectFile *projectFile, const QStringList& recheckFiles, bool doCheckLibrary = false, bool doCheckConfiguration = false); | ||
|
|
||
| /** | ||
| * @brief Set current language | ||
|
|
@@ -309,19 +309,19 @@ private slots: | |
| /** | ||
| * @brief Analyze project | ||
| * @param p imported project | ||
| * @param checkLibrary Flag to indicate if library should be checked | ||
| * @param checkConfiguration Flag to indicate if the configuration should be checked. | ||
| * @param doCheckLibrary Flag to indicate if library should be checked | ||
| * @param doCheckConfiguration Flag to indicate if the configuration should be checked. | ||
| */ | ||
| void doAnalyzeProject(ImportProject p, bool checkLibrary = false, bool checkConfiguration = false); | ||
| void doAnalyzeProject(ImportProject p, bool doCheckLibrary = false, bool doCheckConfiguration = false); | ||
|
|
||
| /** | ||
| * @brief Analyze all files specified in parameter files | ||
| * | ||
| * @param files List of files and/or directories to analyze | ||
| * @param checkLibrary Flag to indicate if library should be checked | ||
| * @param checkConfiguration Flag to indicate if the configuration should be checked. | ||
| * @param doCheckLibrary Flag to indicate if library should be checked | ||
| * @param doCheckConfiguration Flag to indicate if the configuration should be checked. | ||
| */ | ||
| void doAnalyzeFiles(const QStringList &files, bool checkLibrary = false, bool checkConfiguration = false); | ||
| void doAnalyzeFiles(const QStringList &files, bool doCheckLibrary = false, bool doCheckConfiguration = false); | ||
|
|
||
| /** | ||
| * @brief Get our default cppcheck settings and read project file. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2071,10 +2071,10 @@ void CheckCondition::checkCompareValueOutOfTypeRange() | |
| } | ||
| } | ||
|
|
||
| void CheckCondition::compareValueOutOfTypeRangeError(const Token *comparison, const std::string &type, MathLib::bigint value, bool result) | ||
| void CheckCondition::compareValueOutOfTypeRangeError(const Token *comp, const std::string &type, MathLib::bigint value, bool result) | ||
|
Collaborator
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 suggest |
||
| { | ||
| reportError( | ||
| comparison, | ||
| comp, | ||
| Severity::style, | ||
| "compareValueOutOfTypeRangeError", | ||
| "Comparing expression of type '" + type + "' against value " + MathLib::toString(value) + ". Condition is always " + bool_to_string(result) + ".", | ||
|
|
||
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.
Would be great if you could publish an upstream PR which fixes these so we can drop the suppressions on the next bump.
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 checked and we have
-Wshadow-fieldfrom Clang enabled in simplecpp. And-Wshadowfrom GCC only reports shadowing in constructors (as expected), so I am curious about these.