nasa / cFE

The Core Flight System (cFS) Core Flight Executive (cFE)
Apache License 2.0
413 stars 202 forks source link

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

Open astrogeco opened 3 years ago

astrogeco commented 3 years ago

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 commented 3 years ago

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

avan989 commented 1 year ago

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.