Skip to content
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

New Cppcheck errors: '[unreadVariable]' and '[unusedVariable]' #54

Closed
2 tasks done
thnkslprpt opened this issue Nov 6, 2022 · 0 comments · Fixed by #56
Closed
2 tasks done

New Cppcheck errors: '[unreadVariable]' and '[unusedVariable]' #54

thnkslprpt opened this issue Nov 6, 2022 · 0 comments · Fixed by #56

Comments

@thnkslprpt
Copy link
Contributor

thnkslprpt commented Nov 6, 2022

Checklist

  • I reviewed the Contributing Guide.
  • I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug
Latest version of Cppcheck is issuing the following failures for MM:

fsw/src/mm_dump.c:50:25: style: Variable 'Valid' is assigned a value that is never used. [unreadVariable]
    bool          Valid = true;
                        ^
fsw/src/mm_dump.c:190:40: style: Variable 'OS_Status' is assigned a value that is never used. [unreadVariable]
    int32                   OS_Status  = OS_SUCCESS;
                                       ^
fsw/src/mm_dump.c:573:11: style: Unused variable: PSP_Status [unusedVariable]
    int32 PSP_Status;
          ^
fsw/src/mm_load.c:296:40: style: Variable 'ComputedCRC' is assigned a value that is never used. [unreadVariable]
    uint32              ComputedCRC    = 0;
                                       ^
fsw/src/mm_load.c:366:42: style: Variable 'OS_Status' is assigned a value that is never used. [unreadVariable]
    int32                    OS_Status   = OS_SUCCESS;
                                         ^
fsw/src/mm_mem16.c:54:28: style: Variable 'i' is assigned a value that is never used. [unreadVariable]
    uint32  i              = 0;
                           ^
fsw/src/mm_mem16.c:55:28: style: Variable 'ReadLength' is assigned a value that is never used. [unreadVariable]
    int32   ReadLength     = 0;
                           ^
fsw/src/mm_mem16.c:138:28: style: Variable 'OS_Status' is assigned a value that is never used. [unreadVariable]
    int32   OS_Status      = OS_ERROR;
                           ^
fsw/src/mm_mem16.c:140:28: style: Variable 'i' is assigned a value that is never used. [unreadVariable]
    uint32  i              = 0;
                           ^
fsw/src/mm_mem16.c:223:31: style: Variable 'i' is assigned a value that is never used. [unreadVariable]
    uint32  i                 = 0;
                              ^
fsw/src/mm_mem16.c:227:31: style: Variable 'NewBytesRemaining' is assigned a value that is never used. [unreadVariable]
    uint32  NewBytesRemaining = 0;
                              ^
fsw/src/mm_mem32.c:54:28: style: Variable 'i' is assigned a value that is never used. [unreadVariable]
    uint32  i              = 0;
                           ^
fsw/src/mm_mem32.c:55:28: style: Variable 'ReadLength' is assigned a value that is never used. [unreadVariable]
    int32   ReadLength     = 0;
                           ^
fsw/src/mm_mem32.c:138:28: style: Variable 'OS_Status' is assigned a value that is never used. [unreadVariable]
    int32   OS_Status      = OS_ERROR;
                           ^
fsw/src/mm_mem32.c:140:28: style: Variable 'i' is assigned a value that is never used. [unreadVariable]
    uint32  i              = 0;
                           ^
fsw/src/mm_mem32.c:224:31: style: Variable 'i' is assigned a value that is never used. [unreadVariable]
    uint32  i                 = 0;
                              ^
fsw/src/mm_mem32.c:228:31: style: Variable 'NewBytesRemaining' is assigned a value that is never used. [unreadVariable]
    uint32  NewBytesRemaining = 0;
                              ^
fsw/src/mm_mem8.c:54:27: style: Variable 'i' is assigned a value that is never used. [unreadVariable]
    uint32 i              = 0;
                          ^
fsw/src/mm_mem8.c:55:27: style: Variable 'ReadLength' is assigned a value that is never used. [unreadVariable]
    int32  ReadLength     = 0;
                          ^
fsw/src/mm_mem8.c:138:27: style: Variable 'OS_Status' is assigned a value that is never used. [unreadVariable]
    int32  OS_Status      = OS_ERROR;
                          ^
fsw/src/mm_mem8.c:140:27: style: Variable 'i' is assigned a value that is never used. [unreadVariable]
    uint32 i              = 0;
                          ^
fsw/src/mm_mem8.c:223:27: style: Variable 'i' is assigned a value that is never used. [unreadVariable]
    uint32 i              = 0;
                          ^
fsw/src/mm_utils.c:505:21: style: Variable 'OS_Status' is assigned a value that is never used. [unreadVariable]
    int32 OS_Status = OS_SUCCESS;
                    ^
##[error]Process completed with exit code 255.

To Reproduce
Run the current version of Cppcheck on the current main branch MM source code.

Expected behavior
Cppcheck should run without errors.

Reporter Info
Avi @thnkslprpt

thnkslprpt added a commit to thnkslprpt/MM that referenced this issue Nov 7, 2022
dzbaker added a commit that referenced this issue Jan 12, 2023
…causing-cppcheck-failure

Fix #54, Update initializations causing Cppcheck failure
@dmknutsen dmknutsen added this to the Draco milestone Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants