[Bug c++/79727] New: -Wimplicit-fallthrough=3 doesn't seem to match any comments

sgunderson at bigfoot dot com gcc-bugzilla@gcc.gnu.org
Mon Feb 27 15:23:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79727

            Bug ID: 79727
           Summary: -Wimplicit-fallthrough=3 doesn't seem to match any
                    comments
           Product: gcc
           Version: 7.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sgunderson at bigfoot dot com
  Target Milestone: ---

Hi,

I can't get the supposed fallthrough comments (on
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html) to work:

gcc version 7.0.1 20170226 (experimental) [trunk revision 245744] (Debian
20170226-1) 

atum17:~> cat test.cc
#include <stdio.h>
#include <string>

int main(int argc, char **argv)
{
        switch (argc) {
        case 2:
                printf("something\n");
                // -fallthrough
        case 3:
                printf("whatever\n");
                break;
        }
}

atum17:~> /usr/lib/gcc-snapshot/bin/g++ -Wimplicit-fallthrough=3 -c test.cc
test.cc: In function 'int main(int, char**)':
test.cc:8:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
   printf("something\n");
   ~~~~~~^~~~~~~~~~~~~~~
test.cc:10:2: note: here
  case 3:
  ^~~~

I've tried a variety of the other patterns that are supposed to match, but I
can't get it to work on level 3. Level 2 appears to work as documented.


More information about the Gcc-bugs mailing list