Describe the bug
Do the coding guidelines (or general cFS custom) require all else if constructs to have a final 'catch all' else block?
If so, there are a couple of remaining cases here in PSP that are missing one.
Code snips
|
if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID) |
|
{ |
|
OS_printf("CFE_PSP: Normal exit from previous cFE instance\n"); |
|
} |
|
else if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) |
|
{ |
|
OS_printf("CFE_PSP: Abnormal exit from previous cFE instance\n"); |
|
} |
|
|
|
/* |
|
* determine reset type... |
|
* If not specified at the command line, then check the "boot record" |
|
*/ |
|
reset_type = 0; |
|
if (!CommandData.GotResetType) |
|
{ |
|
if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID || |
|
CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) |
|
{ |
|
reset_type = CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType; |
|
} |
|
} |
|
else if (strncmp("PR", CommandData.ResetType, 2) == 0) |
|
{ |
|
reset_type = CFE_PSP_RST_TYPE_PROCESSOR; |
|
} |
|
|
|
if (reset_type == CFE_PSP_RST_TYPE_PROCESSOR) |
Suggestion
1st case can simply be replaced by an else (there are only 2 options for the validity flag) or just leave as is, but add an empty else at the end to make it explicit).

Note: there is 1 more case in the test code
Reporter Info
Avi Weiss @thnkslprpt
Describe the bug
Do the coding guidelines (or general cFS custom) require all
else ifconstructs to have a final 'catch all'elseblock?If so, there are a couple of remaining cases here in PSP that are missing one.
Code snips
PSP/fsw/pc-linux/src/cfe_psp_start.c
Lines 378 to 405 in 6fceb13
Suggestion

1st case can simply be replaced by an
else(there are only 2 options for the validity flag) or just leave as is, but add an emptyelseat the end to make it explicit).Note: there is 1 more case in the test code
Reporter Info
Avi Weiss @thnkslprpt