-Wimplicit-fallthrough broken?

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

 



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;
    }
}



simple.c: In function 'test1':
simple.c:7:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 1: c++; // fallthrough
                 ~^~
simple.c:8:9: note: here
         case 2: c--; // FALLTHRU
         ^~~~
simple.c:8:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 2: c--; // FALLTHRU
                 ~^~
simple.c:9:9: note: here
         case 3: c++; // FALLTHROUGH
         ^~~~
simple.c:9:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 3: c++; // FALLTHROUGH
                 ~^~
simple.c:10:9: note: here
         case 4: z = c; break;
         ^~~~
simple.c: In function 'test2':
simple.c:18:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 1: c++;
                 ~^~
simple.c:20:9: note: here
         case 2: c--;
         ^~~~
simple.c:20:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 2: c--;
                 ~^~
simple.c:22:9: note: here
         case 3: c++;
         ^~~~
simple.c:22:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 3: c++;
                 ~^~
simple.c:24:9: note: here
         case 4: z = c; break;
         ^~~~


How do I have to formulate these comments? It's under mingw32, may that be a problem?

Johann




[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