[PATCH 0/3] Fix Missing break in switch Coverity issues

Gedare Bloom gedare at rtems.org
Tue Mar 9 05:47:15 UTC 2021


On Mon, Mar 8, 2021 at 7:21 PM Chris Johns <chrisj at rtems.org> wrote:
>
> On 6/3/21 6:04 am, Gedare Bloom wrote:
> > On Fri, Mar 5, 2021 at 11:48 AM Sebastian Huber
> > <sebastian.huber at embedded-brains.de> wrote:
> >>
> >> On 05/03/2021 19:40, Joel Sherrill wrote:
> >>
> >>> On Fri, Mar 5, 2021, 12:25 PM Sebastian Huber
> >>> <sebastian.huber at embedded-brains.de
> >>> <mailto:sebastian.huber at embedded-brains.de>> wrote:
> >>>
> >>>     On 05/03/2021 16:27, Gedare Bloom wrote:
> >>>
> >>>     > Should we add a macro for this, e.g., "RTEMS_CASE_NO_BREAK" so
> >>>     that we
> >>>     > can update them in future if needed for other tools?
> >>>     I would just pick a name which is understood by GCC, clang, and
> >>>     Coverity. I guess other tools will understand this or why did you
> >>>     buy them?
> >>>
> >>>
> >>> Well we didn't pay for any of those but are you wanting a macro or
> >>> just the comment?
> >>
> >> I would just use a comment which is understood by GCC, clang, and
> >> Coverity. What does Linux use?
> >>
> > That's fine, if there is a de facto standard to use, we can go for it.
>
> Looking at the option documentation gcc supports a lot of different possible
> ways and the warning option can change what is selected.
>
> Do we allow all that gcc allows? I hope not.
>

As with other things we should provide a portable way to maintain it.
I would suggest adding to basedefs.h:
#define RTEMS_CASE_FALL_THROUGH
macro as reasonably simple. We can debate a few variations
RTEMS_CASE_FALLTHRU is short and sufficient.

Most likely we'll never have to change it, but this will simplify code
review and avoid typos /* fall-trough */

> Chris


More information about the devel mailing list