Skip to content

Commit

Permalink
Fix #2478, Add missing deafult/break to switch statements
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Mar 23, 2024
1 parent ed1faf4 commit a7654a2
Show file tree
Hide file tree
Showing 23 changed files with 60 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ jobs:
- name: Confirm Minimum Coverage
run: |
missed_branches=50
missed_lines=17
missed_branches=47
missed_lines=36
branch_nums=$(grep -A 3 "Overall coverage rate" lcov_out.txt | grep branches | grep -oP "[0-9]+[0-9]*")
line_nums=$(grep -A 3 "Overall coverage rate" lcov_out.txt | grep lines | grep -oP "[0-9]+[0-9]*")
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
codeql:
uses: nasa/cFS/.github/workflows/codeql-reusable.yml@main
with:
with:
component-path: cfe
make: make -j8
test: true
2 changes: 1 addition & 1 deletion .github/workflows/icbundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
done
changelog_entry="${changelog_entry}\n${see_entry}\n"
sed -ir "s|# Changelog|$changelog_entry|" CHANGELOG.md
buildnumber_entry=$'#define CFE_BUILD_NUMBER '${rev_num}$' /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */'
sed -ir "s|#define CFE_BUILD_NUMBER.*|$buildnumber_entry|" modules/core_api/fsw/inc/cfe_version.h
- name: Commit and Push Updates to IC Branch
Expand Down
2 changes: 1 addition & 1 deletion docs/cFS_IdentifierNamingConvention.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Common command/event descriptions include:
| `LEN_ERR` | Incorrect Message Length | Error |
| `CC_ERR` | Invalid Command Code Received | Error |
| `NOOP_INF` | No-op Command Success | Informational |
| `INIT_INF` | Applicaiton Initialization Success | Informational |
| `INIT_INF` | Application Initialization Success | Informational |
| `RESET_INF` | Reset Command Counters Command Success | Informational |

# Appendix: Abbreviation Guide
Expand Down
2 changes: 1 addition & 1 deletion modules/cfe_assert/src/cfe_assert_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ bool CFE_Assert_Status_DeferredCheck(CFE_Status_t Status, UtAssert_CaseType_t Ca
}
else
{
/* if condition was false add an exta marker so user does not necessarily need to decode the string */
/* if condition was false add an extra marker so user does not necessarily need to decode the string */
ExtraTag = " [false]";
}

Expand Down
2 changes: 1 addition & 1 deletion modules/cfe_testcase/src/cfe_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void CFE_TestMain(void)
* Register test cases in UtAssert
*/
ESApplicationControlTestSetup();
ESBehaviorestSetup();
ESBehaviorTestSetup();
ESCDSTestSetup();
ESCounterTestSetup();
ESErrorTestSetup();
Expand Down
2 changes: 1 addition & 1 deletion modules/cfe_testcase/src/cfe_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void TimeInRange(CFE_TIME_SysTime_t Start, CFE_TIME_SysTime_t Time, CFE_TIME_Sys

void CFE_TestMain(void);
void ESApplicationControlTestSetup(void);
void ESBehaviorestSetup(void);
void ESBehaviorTestSetup(void);
void ESCDSTestSetup(void);
void ESCounterTestSetup(void);
void ESErrorTestSetup(void);
Expand Down
2 changes: 1 addition & 1 deletion modules/cfe_testcase/src/es_behavior_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void TestWaitBehavior(void)
UtAssert_UINT32_EQ(CFE_TIME_Compare(TimePassed, TimeExpected), CFE_TIME_A_LT_B);
}

void ESBehaviorestSetup(void)
void ESBehaviorTestSetup(void)
{
UtTest_Add(TestRunCounter, NULL, NULL, "Test Run Counter");
UtTest_Add(TestWaitBehavior, NULL, NULL, "Test Wait Behavior");
Expand Down
2 changes: 1 addition & 1 deletion modules/cfe_testcase/src/sb_pipe_mang_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void TestPipeCreateMax(void)
* Normally, this will return CFE_SUCCESS, until the max number of pipes is reached.
* Confirm that the last creation attempt returned CFE_SB_MAX_PIPES_MET
*
* NOTE: this also mimics the same format as UtAssert_INT32_EQ so that any post-procesing
* NOTE: this also mimics the same format as UtAssert_INT32_EQ so that any post-processing
* test log analysis tools will see this call as well.
*/
if (CFE_Assert_STATUS_MAY_BE(CFE_SB_MAX_PIPES_MET))
Expand Down
2 changes: 1 addition & 1 deletion modules/cfe_testcase/tables/cfe_test_tbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

/*
* The test table data should contain some identifiable numeric values,
* so any issues with paritial loading/byteswapping are morely likely
* so any issues with partial loading/byteswapping are more likely
* to be detected.
*/
CFE_TEST_TestTable_t TestTable = {0xf007, 0xba11};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@
*/
#define CFE_MISSION_MAX_NUM_FILES 50

#endif /* SAMPLE_MISSION_CFG_H */
#endif /* CFE_CORE_API_INTERFACE_CFG_H */
2 changes: 1 addition & 1 deletion modules/core_private/ut-stubs/inc/ut_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ extern const char *UT_OSP_MESSAGES[];
*/
#define UT_LITTLE_ENDIAN 1
#define UT_BIG_ENDIAN 2
extern uint8 UT_Endianess;
extern uint8 UT_Endianness;

typedef struct
{
Expand Down
6 changes: 3 additions & 3 deletions modules/core_private/ut-stubs/src/ut_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
/*
** Global variables
*/
uint8 UT_Endianess;
uint8 UT_Endianness;

static char UT_appname[80];
static char UT_subsys[5];
Expand Down Expand Up @@ -110,11 +110,11 @@ void UT_Init(const char *subsys)

if ((*(char *)&EndianCheck) == 0x04)
{
UT_Endianess = UT_LITTLE_ENDIAN;
UT_Endianness = UT_LITTLE_ENDIAN;
}
else
{
UT_Endianess = UT_BIG_ENDIAN;
UT_Endianness = UT_BIG_ENDIAN;
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/es/fsw/src/cfe_es_erlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ bool CFE_ES_RunExceptionScan(uint32 ElapsedTime, void *Arg)
if (PspStatus != CFE_PSP_SUCCESS)
{
/* reason string is not available - populate with something for the PspStatus*/
snprintf(ReasonString, sizeof(ReasonString), "Unknown - CFE_PSP_ExceptionGetSummary() error %ld",
snprintf(ReasonString, sizeof(ReasonString), "Unknown - CFE_PSP_Exception_GetSummary() error %ld",
(long)PspStatus);
PspContextId = 0;
ExceptionTaskID = OS_OBJECT_ID_UNDEFINED;
Expand Down
2 changes: 1 addition & 1 deletion modules/es/ut-coverage/es_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -4237,7 +4237,7 @@ void TestAPI(void)
AppId = CFE_ES_AppRecordGetID(UtAppRecPtr);
CFE_UtAssert_SUCCESS(CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)));

/* Bad arguement calls */
/* Bad argument calls */
UtAssert_INT32_EQ(CFE_ES_GetAppName(NULL, AppId, sizeof(AppName)), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetAppName(AppName, AppId, 0), CFE_ES_BAD_ARGUMENT);

Expand Down
2 changes: 1 addition & 1 deletion modules/evs/ut-coverage/evs_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void UT_InitData_EVS(void)
UT_SetHandlerFunction(UT_KEY(CFE_MSG_GetMsgTime), UT_CFE_MSG_GetMsgTime_CustomHandler, NULL);
}

/* Message init hook to stora last MsgId passed in */
/* Message init hook to store last MsgId passed in */
static int32 UT_EVS_MSGInitHook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context)
{
UT_EVS_MSGInitData_t *msgdataptr = UserObj;
Expand Down
2 changes: 1 addition & 1 deletion modules/fs/config/default_cfe_fs_filedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,4 @@ typedef struct CFE_FS_Header
char Description[CFE_FS_HDR_DESC_MAX_LEN]; /**< \brief File description */
} CFE_FS_Header_t;

#endif /* CFE_FS_EXTERN_TYPEDEFS_H */
#endif /* CFE_FS_FILEHDR_H */
2 changes: 2 additions & 0 deletions modules/msg/fsw/src/cfe_msg_ccsdspri.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ CFE_Status_t CFE_MSG_GetSegmentationFlag(const CFE_MSG_Message_t *MsgPtr, CFE_MS
case CFE_MSG_SEGFLG_UNSEG:
default:
*SegFlag = CFE_MSG_SegFlag_Unsegmented;
break;
}

return CFE_SUCCESS;
Expand Down Expand Up @@ -300,6 +301,7 @@ CFE_Status_t CFE_MSG_SetSegmentationFlag(CFE_MSG_Message_t *MsgPtr, CFE_MSG_Segm
case CFE_MSG_SegFlag_Invalid:
default:
status = CFE_MSG_BAD_ARGUMENT;
break;
}

if (status == CFE_SUCCESS)
Expand Down
23 changes: 22 additions & 1 deletion modules/sb/fsw/src/cfe_sb_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ CFE_Status_t CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const c
CFE_SB_GetAppTskName(TskId, FullName), (unsigned long)PipeIdPtr, (int)Depth,
OS_QUEUE_MAX_DEPTH);
break;

case CFE_SB_MAX_PIPES_MET_EID:
CFE_EVS_SendEventWithAppID(CFE_SB_MAX_PIPES_MET_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId,
"CreatePipeErr:Max Pipes(%d)In Use.app %s", CFE_PLATFORM_SB_MAX_PIPES,
Expand All @@ -266,6 +265,8 @@ CFE_Status_t CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const c
"CreatePipeErr:OS_QueueCreate returned %ld,app %s", (long)OsStatus,
CFE_SB_GetAppTskName(TskId, FullName));
break;
default:
break;
}
}

Expand Down Expand Up @@ -469,6 +470,8 @@ int32 CFE_SB_DeletePipeFull(CFE_SB_PipeId_t PipeId, CFE_ES_AppId_t AppId)
"Pipe Delete Error:Caller(%s) is not the owner of pipe %ld", FullName,
CFE_RESOURCEID_TO_ULONG(PipeId));
break;
default:
break;
}
}

Expand Down Expand Up @@ -556,6 +559,8 @@ CFE_Status_t CFE_SB_SetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 Opts)
"Pipe Opts Set Error: Caller(%s) is not the owner of pipe %lu",
CFE_SB_GetAppTskName(TskId, FullName), CFE_RESOURCEID_TO_ULONG(PipeId));
break;
default:
break;
}
}

Expand Down Expand Up @@ -631,6 +636,8 @@ CFE_Status_t CFE_SB_GetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 *OptsPtr)
"Pipe Opts Error:Bad Argument,PipedId %lu,Requestor %s",
CFE_RESOURCEID_TO_ULONG(PipeId), CFE_SB_GetAppTskName(TskId, FullName));
break;
default:
break;
}
}

Expand Down Expand Up @@ -719,6 +726,8 @@ CFE_Status_t CFE_SB_GetPipeName(char *PipeNameBuf, size_t PipeNameSize, CFE_SB_P
"Pipe Id Error:Bad Argument,Id=%lu,Requestor %s",
CFE_RESOURCEID_TO_ULONG(PipeId), CFE_SB_GetAppTskName(TskId, FullName));
break;
default:
break;
}

if (PipeNameBuf != NULL && PipeNameSize > 0)
Expand Down Expand Up @@ -828,6 +837,8 @@ CFE_Status_t CFE_SB_GetPipeIdByName(CFE_SB_PipeId_t *PipeIdPtr, const char *Pipe
CFE_SB_Global.AppId, "Pipe ID By Name Error:Bad Argument,Requestor %s",
CFE_SB_GetAppTskName(TskId, FullName));
break;
default:
break;
}
}

Expand Down Expand Up @@ -1023,6 +1034,8 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, CFE_SB_
case CFE_SB_DUP_SUBSCRIP_EID:
CFE_SB_Global.HKTlmMsg.Payload.DuplicateSubscriptionsCounter++;
break;
default:
break;
}

CFE_SB_UnlockSharedData(__func__, __LINE__);
Expand Down Expand Up @@ -1081,6 +1094,8 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, CFE_SB_
(unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(PipeId),
CFE_SB_GetAppTskName(TskId, FullName), Scope);
break;
default:
break;
}
}
else if (Status == CFE_SUCCESS)
Expand Down Expand Up @@ -1268,6 +1283,8 @@ int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, uint8
(unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(PipeId),
CFE_SB_GetAppTskName(TskId, FullName), (int)Scope);
break;
default:
break;
}
}
else if (Status == CFE_SUCCESS)
Expand Down Expand Up @@ -1513,6 +1530,8 @@ int32 CFE_SB_TransmitMsgValidate(const CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t
CFE_SB_FinishSendEvent(TskId, CFE_SB_SEND_NO_SUBS_EID_BIT);
}
break;
default:
break;
}
}

Expand Down Expand Up @@ -1983,6 +2002,8 @@ CFE_Status_t CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, CFE_SB_PipeId_t Pipe
"Rcv Err:PipeId %lu does not exist,app %s", CFE_RESOURCEID_TO_ULONG(PipeId),
CFE_SB_GetAppTskName(TskId, FullName));
break;
default:
break;
}
}

Expand Down
4 changes: 4 additions & 0 deletions modules/sb/fsw/src/cfe_sb_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRouteCmd_t *data)
CFE_EVS_SendEvent(CFE_SB_ENBL_RTE2_EID, CFE_EVS_EventType_DEBUG, "Enabling Route,Msg 0x%x,Pipe %lu",
(unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(CmdPtr->Pipe));
break;
default:
break;
}

return CFE_SUCCESS;
Expand Down Expand Up @@ -509,6 +511,8 @@ int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRouteCmd_t *data)
CFE_EVS_SendEvent(CFE_SB_DSBL_RTE2_EID, CFE_EVS_EventType_DEBUG, "Route Disabled,Msg 0x%x,Pipe %lu",
(unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(CmdPtr->Pipe));
break;
default:
break;
}

return CFE_SUCCESS;
Expand Down
8 changes: 4 additions & 4 deletions modules/sb/ut-coverage/sb_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@ void Test_SB_EarlyInit_NoErrors(void)
CFE_SB_EarlyInit();
CFE_UtAssert_SUCCESS(CFE_SB_EarlyInit());

/* Confirm reset of values to cover reset requirements that are challenging operationaly */
/* Confirm reset of values to cover reset requirements that are challenging operationally */
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter);
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.NoSubscribersCounter);
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter);
Expand Down Expand Up @@ -3647,7 +3647,7 @@ static void SB_UT_PipeIdModifyHandler(void *UserObj, UT_EntryKey_t FuncKey, cons
PipeDscPtr->PipeId = CFE_SB_INVALID_PIPE;
}

/* Special handler to hit OS_QueueGet error casses */
/* Special handler to hit OS_QueueGet error cases */
static void SB_UT_QueueGetHandler(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context)
{
size_t **data = (size_t **)UT_Hook_GetArgValueByName(Context, "data", void *);
Expand Down Expand Up @@ -4238,14 +4238,14 @@ void Test_SB_SpecialCases(void)
}

/*
* Test the use count rollover prevetion
* Test the use count rollover prevention
*/
void Test_UseCount_Rollover_Prevention(void)
{
CFE_SB_BufferD_t bd;
uint16 usecount_expected = 0x7FFF;

/* Note this is just for coverage, limit can not be reached in nomal ops (would be a bug) */
/* Note this is just for coverage, limit can not be reached in normal ops (would be a bug) */
bd.UseCount = usecount_expected;
UtAssert_VOIDCALL(CFE_SB_IncrBufUseCnt(&bd));
UtAssert_UINT32_EQ(bd.UseCount, usecount_expected);
Expand Down
1 change: 1 addition & 0 deletions modules/tbl/fsw/src/cfe_tbl_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ CFE_Status_t CFE_TBL_Load(CFE_TBL_Handle_t TblHandle, CFE_TBL_SrcEnum_t SrcType,
"%s: Attempted to load from illegal source type=%d", AppName, (int)SrcType);

Status = CFE_TBL_ERR_ILLEGAL_SRC_TYPE;
break;
}

/* If the data was successfully loaded, then validate its contents */
Expand Down
Loading

0 comments on commit a7654a2

Please sign in to comment.