-
Notifications
You must be signed in to change notification settings - Fork 215
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
repeated assignments without using the value (unit test edition) #157
Comments
Imported from trac issue 134. Created by glimes on 2015-12-10T14:51:26, last modified: 2019-08-14T14:11:46 |
Trac comment by glimes on 2015-12-10 14:52:22: See ticket #158 for this warning outside unit test code. |
Trac comment by glimes on 2015-12-31 13:00:35: Going to start grinding on these as I have time available. |
See also #309, these are now reported as 'style' issues by cppcheck. No plan to fix style issues in test code. |
cppcheck messages:
{{{
src/tests/mutex-test/mutex-test.c:47: performance: Variable 'status' is reassigned a value before the old one has been used.
src/tests/mutex-test/mutex-test.c:100: performance: Variable 'status' is reassigned a value before the old one has been used.
src/tests/mutex-test/mutex-test.c:154: performance: Variable 'status' is reassigned a value before the old one has been used.
src/unit-tests/oscore-test/ut_oscore_task_test.c:205: performance: Variable 'res' is reassigned a value before the old one has been used.
src/unit-tests/oscore-test/ut_oscore_task_test.c:508: performance: Variable 'res' is reassigned a value before the old one has been used.
src/unit-tests/oscore-test/ut_oscore_task_test.c:522: performance: Variable 'res' is reassigned a value before the old one has been used.
src/unit-tests/oscore-test/ut_oscore_task_test.c:594: performance: Variable 'res' is reassigned a value before the old one has been used.
(484 more lines...)
}}}
There are two lines indicating sources outside testing, a separate bug
has been filed as we may put more priority on fixing those lines than
on globally smashing this bug in the test code.
Recommended fix methods, PICK ONE:
(void)
cast on the function call instead of storing the data that is not actually ever going to be looked at. This advertises to maintainers and to the compiler and to static analysis that we are purposefully ignoring the return value of the function.The text was updated successfully, but these errors were encountered: