-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add dummy macros for conditionally defined macros #211
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
Conversation
cppcheck reports "unknownMacro" when a conditionally defined macro is used. This patch adds dummy macros to make code pass the static analytics without other effects. The assignments and increments make cppcheck consider the variables are used to suppress potential reports about uninitialized variables, unused variables, and can-be-constant variables. The pointers with value 1 instead of NULL suppress reports about indirectly getting value of null pointers. Closes sysprog21#210. Change-Id: Ia8db49c0c71ab82d5da10ce389f57ebb69c99051
Change-Id: I1da359df006f058c3e27a0d4bc91b50c4441a1da
Change-Id: I85c21c24bbd5856a5a22cbd983f5150a56c13345
Thank @lumynou5 for contributing! |
Cppcheck reports "unknownMacro" when a conditionally defined macro is used. This patch adds dummy macros to make code pass the static analytics without other effects. The assignments and increments make cppcheck consider the variables are used to suppress potential reports about uninitialized variables, unused variables, and can-be-constant variables. The pointers with value 1 instead of NULL suppress reports about indirectly getting value of null pointers. Closes sysprog21#210 Change-Id: Ia8db49c0c71ab82d5da10ce389f57ebb69c99051
Cppcheck reports "unknownMacro" when a conditionally defined macro is used. This patch adds dummy macros to make code pass the static analytics without other effects. The assignments and increments make cppcheck consider the variables are used to suppress potential reports about uninitialized variables, unused variables, and can-be-constant variables. The pointers with value 1 instead of NULL suppress reports about indirectly getting value of null pointers. Closes sysprog21#210 Change-Id: Ia8db49c0c71ab82d5da10ce389f57ebb69c99051
The anonymous bit field cause the cppcheck (version 2.13.0) to report "Label 'int' is not used. [unusedLabel]" during static analysis. |
@backink I suspect it's a bug of Cppcheck while it incorrectly recognizes |
Hi @lumynou5 |
I think it's not a compatibility issue, but it's indeed better to work with 2.13.0. Other than installing from other repositories or building from source, the only option is trying not to trigger the false positive. Does giving the data member a name help Cppcheck parse it correctly without other errors? If so, you may open a pull request to change it like - for (entry = (void *) 1; sizeof(struct { int : -1; }); ++(entry))
+ for (entry = (void *) 1; sizeof(struct { int i : -1; }); ++(entry)) and probably note the reason of adding the useless name. |
Cppcheck reports "unknownMacro" when a conditionally defined macro is used. This patch adds dummy macros to make code pass the static analytics without other effects. The assignments and increments make cppcheck consider the variables are used to suppress potential reports about uninitialized variables, unused variables, and can-be-constant variables. The pointers with value 1 instead of NULL suppress reports about indirectly getting value of null pointers. Closes sysprog21#210 Change-Id: Ia8db49c0c71ab82d5da10ce389f57ebb69c99051
Cppcheck reports "unknownMacro" when a conditionally defined macro is used. This patch adds dummy macros to make code pass the static analytics without other effects. The assignments and increments make cppcheck consider the variables are used to suppress potential reports about uninitialized variables, unused variables, and can-be-constant variables. The pointers with value 1 instead of NULL suppress reports about indirectly getting value of null pointers. Closes sysprog21#210 Change-Id: Ia8db49c0c71ab82d5da10ce389f57ebb69c99051
cppcheck reports "unknownMacro" when a conditionally defined macro is used.
This patch adds dummy macros to make code pass the static analytics without other effects. The assignments and increments make cppcheck consider the variables are used to suppress potential reports about uninitialized variables, unused variables, and can-be-constant variables. The pointers with value 1 instead of NULL suppress reports about indirectly getting value of null pointers.
Closes #210.
Change-Id: Ia8db49c0c71ab82d5da10ce389f57ebb69c99051