[Bug c/82508] Possibly false positive implicit-fallthrough warning
egallager at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 10 21:10:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82508
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
$ /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?
More information about the Gcc-bugs
mailing list