[Bug c/82508] Possibly false positive implicit-fallthrough warning

2017-10-11 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82508

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||mpolacek at gcc dot gnu.org
 Resolution|--- |INVALID

--- Comment #2 from Marek Polacek  ---
Adding the attribute is the way to go here.

[Bug c/82508] Possibly false positive implicit-fallthrough warning

2017-10-10 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82508

Eric Gallager  changed:

   What|Removed |Added

 CC||egallager at gcc dot gnu.org

--- Comment #1 from Eric Gallager  ---
$ /usr/local/bin/gcc -c -Wall -Wextra -Wmissing-noreturn -O2 82508.c
82508.c: In function ‘main’:
82508.c:15:4: warning: this statement may fall through
[-Wimplicit-fallthrough=]
nothing(0);
^~
82508.c:16:3: note: here
   case 2:
   ^~~~
82508.c: In function ‘nothing’:
82508.c:3:6: warning: function might be candidate for attribute ‘noreturn’
[-Wsuggest-attribute=noreturn]
 void nothing(int rtn_code)
  ^~~
$

Adding __attribute__((noreturn)) to nothing() leads to the implicit fallthrough
warning being silenced. Does that solve your problem?