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

remove MESSAGE_FORMAT_IS_CCSDS ifdefs from CFS code #240

Closed
skliper opened this issue Sep 30, 2019 · 5 comments · Fixed by #578
Closed

remove MESSAGE_FORMAT_IS_CCSDS ifdefs from CFS code #240

skliper opened this issue Sep 30, 2019 · 5 comments · Fixed by #578
Assignees
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Sep 30, 2019

Currently, most of the functions in cfe_sb_util.c and a few others are like:
{{{
void CFE_SB_InitMsg(void *MsgPtr,
CFE_SB_MsgId_t MsgId,
uint16 Length,
boolean Clear )
{
#ifdef MESSAGE_FORMAT_IS_CCSDS

CCSDS_InitPkt ((CCSDS_PriHdr_t *)MsgPtr,(uint16)MsgId,Length,Clear);

#endif
} /* end CFE_SB_InitMsg */
}}}

It's confusing what else would be done in these functions (and nothing else is done.) As Joe said, if someone implemented a wholly different SB message format, they're likely to write their own set of functions and having a bunch of #if/elseif/elseif/elseif/endif blocks would be confusing and difficult to maintain.

The suggestion from the CCB today was to remove these #ifdefs. It might be worthwhile to put in a check at the top of the file that generates a compiler warning/error if it's not defined...

@skliper skliper self-assigned this Sep 30, 2019
@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Imported from trac issue 209. Created by cdknight on 2017-10-17T13:30:25, last modified: 2019-04-01T16:34:53

@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Trac comment by tflemin1 on 2017-10-31 14:39:49:

The [http://dotat.at/prog/unifdef/ unifdef] tool can automatically remove this sort of conditional, which might be a good first cut at making this change.

@skliper skliper removed their assignment Sep 30, 2019
@skliper skliper added this to the 6.8.0 milestone Feb 7, 2020
@skliper
Copy link
Contributor Author

skliper commented Feb 7, 2020

This issue was brought up by IV&V static code analysis, added milestone so priority is raised. Basically if undefined there are code issues (returns within ifdef blocks).

@skliper
Copy link
Contributor Author

skliper commented Feb 25, 2020

Issue brought up by JP/PACE.

@skliper
Copy link
Contributor Author

skliper commented Mar 2, 2020

@jpswinski - FYI

@dmknutsen dmknutsen self-assigned this Mar 31, 2020
dmknutsen added a commit to dmknutsen/cFE that referenced this issue Apr 1, 2020
dmknutsen added a commit to dmknutsen/cFE that referenced this issue Apr 1, 2020
skliper pushed a commit to dmknutsen/cFE that referenced this issue Apr 22, 2020
jphickey added a commit that referenced this issue Apr 22, 2020
Manually merged to resolve conflicts.

From branch jphickey/fix-263-msgid-api:

Fix #245, Consistent use of MsgId type
Fix #263, Expose CFE_SB_IsValidMsgId() API

From branch dmknutsen/issue_240:

Fixes #240, removes MESSAGE_FORMAT_IS_CCSDS ifdefs from code
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.

2 participants