bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apple LLVM 10 and `__fallthrough__`


From: Jeffrey Walton
Subject: Re: Apple LLVM 10 and `__fallthrough__`
Date: Sun, 26 Feb 2023 19:20:01 -0500

On Sun, Feb 26, 2023 at 6:36 PM Alexei Podtelezhnikov
<apodtele@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

[Prev in Thread] Current Thread [Next in Thread]