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

Uncovered default switch "branch" (vs unreachable default switch code) in gcov coverage report #1666

Open
astrogeco opened this issue Jul 15, 2021 · 2 comments
Labels

Comments

@astrogeco
Copy link
Contributor

astrogeco commented Jul 15, 2021

Is your feature request related to a problem? Please describe.
gcov reports missing branch coverage for the default case of a switch statement. Numerous examples in cFE where there is no default case and/or it's impossible to reach (all cases are handled explicitly).

Describe the solution you'd like
At minimum document this behavior in the coverage report. Would be nice if there was an option or alternative to get gcov to not report impossible cases as uncovered, or post-process the report to remove.

Describe alternatives you've considered
None

Additional context
cfe_sb_api.c - 10 uncovered branches
cfe_sb_task.c - 2 uncovered branches

Requester Info
Jacob Hageman - NASA/GSFC

@astrogeco astrogeco changed the title Document gcov limitation with default cases. Document gcov limitation with switch statements and unhandled values Jul 15, 2021
@astrogeco astrogeco transferred this issue from nasa/cFS Jul 15, 2021
@astrogeco
Copy link
Contributor Author

@skliper I added this here but we can move it to cFE if its more appropriate to have there

@skliper skliper added this to the 7.0.0 milestone Jul 15, 2021
@skliper skliper changed the title Document gcov limitation with switch statements and unhandled values Document gcov limitation with switch statements and unreachable default case Jul 19, 2021
@skliper skliper removed this from the 7.0.0 milestone Jul 30, 2021
@skliper skliper changed the title Document gcov limitation with switch statements and unreachable default case Uncovered default switch "branch" (vs unreachable default switch code) in gcov coverage report Aug 24, 2021
@skliper skliper removed their assignment Aug 27, 2021
@avan989
Copy link
Contributor

avan989 commented Jun 8, 2023

Currently tracking issue in:
10 in cfe_sb_api.c
2 in cfe_sb_task.c

PendingEventId is always set if "Status" is not CFE_SUCCESS. There is no switch case that is "default" although I do recommend having a default case in the switch statement for "defense" against future code change, just in case someone forgets to add an event message. Code coverage is not possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants