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

Chris Johns chrisj at rtems.org
Wed Mar 10 18:46:17 UTC 2021



On 9/3/21 5:28 pm, Gedare Bloom wrote:
> On Mon, Mar 8, 2021 at 11:04 PM Sebastian Huber
> <sebastian.huber at embedded-brains.de> wrote:
>>
>> On 09/03/2021 06:47, Gedare Bloom wrote:
>>
>>>>>> 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 */
>>
>> Linux uses a macro:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2bf74771ca5610b10c3ac4cd17aacc389e6927ca
>>
>> My favorite name is RTEMS_FALL_THROUGH.
>>
> Fine with me.

Looks good to me.

Chris


More information about the devel mailing list