c++: Fix spurious fallthrough warning on break
The C++ frontend generates a break that results in the fallthrough
warning misfiring in nested switch blocks where cases in the inner
switch block return, rendering the break pointless. The fallthrough
detection in finish_break_stmt does not work either because the
condition is encoded as an IF_STMT and not a COND_EXPR.
Fix this by adding a condition for IF_STMT in the
langhooks.block_may_fallthru for C++. Fix tested on x86_64.
gcc/cp
* cp-objcp-common.c (cxx_block_may_fallthru): Add case for
IF_STMT.
gcc/testsuite
* g++.dg/nested-switch.C: New test case.
From-SVN: r257843