[Bug c++/80460] Incorrect fallthrough warning after [[noreturn]] function inside always-true conditional
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Apr 19 12:03:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80460
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2017-04-19
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I think it shouldn't affect those at all.
Another idea is to return fake FALLTHROUGH () if the else branch is dead. Let
me see.
extern void die (void) __attribute__((noreturn));
extern void nop (void);
void
f (int i)
{
switch (i)
{
case 0:
if (1)
die ();
else
nop ();
case 1:;
i++;
}
switch (i)
{
case 0:
if (0)
die ();
else
nop ();
case 1:;
i++;
}
switch (i)
{
case 0:
if (1)
nop ();
else
die ();
case 1:;
i++;
}
switch (i)
{
case 0:
if (0)
nop ();
else
die ();
case 1:;
i++;
}
}
More information about the Gcc-bugs
mailing list