On Sun, Feb 26, 2023 at 6:36 PM Alexei Podtelezhnikov
<apodt...@gmail.com> wrote:
> [...]
> Would  it perhaps be better if clang used [[fallthrough]]  instead of
> __attribute__((fallthrough))? They have supported [[fallthrough]]
> since at least 3.5.0 circa 2014. In this particular case they are
> ahead of GCC and towards the standard acceptance.
> https://releases.llvm.org/3.5.0/tools/clang/docs/AttributeReference.html

I think the best course of action is to use a C comment. GCC and Clang
recognize them, and it does not require compiler extensions or new C
language features:

    switch (n)
    {
        case 1:
            n--;
            /* fallthrough */
        case 0:
            /* do something */
            break;
        default:
            /* do something else */
    }

Jeff

Reply via email to