Re: -Wimplicit-fallthrough broken?

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

 



On Wed, Jul 19, 2017 at 4:18 PM, Georg-Johann Lay <avr@xxxxxxxx> wrote:
> Hi, with the following small small test I am getting these warnings:
>
> void test1 (unsigned char c)
> {
>     switch (c)
>     {
>         case 1: c++; // fallthrough
>         case 2: c--; // FALLTHRU
>         case 3: c++; // FALLTHROUGH
>         case 4: z = c; break;
>     }
> }
>
> void test2 (unsigned char c)
> {
>     switch (c)
>     {
>         case 1: c++;
>         /* fallthrough */
>         case 2: c--;
>         /* FALLTHRU */
>         case 3: c++;
>         /* FALLTHROUGH */
>         case 4: z = c; break;
>     }
> }
> ...
>
> How do I have to formulate these comments?  It's under mingw32, may that be
> a problem?

Clang handles the case statements in the first switch and the second switch.

GCC only handles the the second switch statement.

GCC also does not handle this form, which Clang will:

    switch (c)
    {
        // All fallthrough
        case 1: c++;
        case 2: c--;
        ...
    }

Or maybe I should say, as of GCC 7.1. I hope they will be fixing it soon.

Jeff



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux