Repository navigation
Misra.md: the switch without default is a deviation (9.4.2) - #112
Merged
Merged
Conversation
CodingStyle T-15 leaves out the default of a switch over an enum class, so that -Wswitch reports a value added to the enum later, which a default would take in unnoticed; the rule asks for one. The row named T-15 as if it covered the rule. It now records the departure with its reason, and says that the rest of the structure of a switch, as where its labels stand and how many branches it has, is left to review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
docs/Misra.mdof a project records theswitchover anenum classwithoutdefaultas a deviation from MISRA C++:2023 Rule 9.4.2, with its reason. The row now also says in part: the rest of the structure of aswitch, as where its labels stand and how many branches it has, is left to review.Why
CodingStyle T-15 asks for that
switchto have nodefault, so that-Wswitchreports a value added to theenumlater, which adefaultwould take in unnoticed. The rule asks for adefaultin everyswitchbut one over an unscopedenumwithout a fixed type. The row named T-15 as if it covered the rule, where it departs from it.How it was checked
tests/check.sh lint docspasses for the Arduino library and with--no-arduino;tests/doc_indent.pypasses.Misra.mdand the CHANGELOG change; no code, no check.