re PR c/49859 (gcc could warn about statements between "switch" and first "case")
authorMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 23 May 2016 15:37:09 +0000 (15:37 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 23 May 2016 15:37:09 +0000 (15:37 +0000)
commita7dc5980e91d758905750a5c0a533f689eca355e
treed51176bb0505d6371f073a25030266ac0a853be1
parent7e5a3c96db2383a41587d6525b4ac9ea1fafe091
re PR c/49859 (gcc could warn about statements between "switch" and first "case")

PR c/49859
* common.opt (Wswitch-unreachable): New option.
* doc/invoke.texi: Document -Wswitch-unreachable.
* gimplify.c (gimplify_switch_expr): Implement the -Wswitch-unreachable
warning.

* c-c++-common/Wswitch-unreachable-1.c: New test.
* gcc.dg/Wswitch-unreachable-1.c: New test.
* c-c++-common/goacc/sb-2.c (void foo): Add dg-warning.
* g++.dg/cpp0x/lambda/lambda-switch.C (main): Likewise.
* g++.dg/gomp/block-10.C: Likewise.
* gcc.dg/gomp/block-10.c: Likewise.
* g++.dg/gomp/block-9.C: Likewise.
* gcc.dg/gomp/block-9.c: Likewise.
* g++.dg/gomp/target-1.C: Likewise.
* g++.dg/gomp/target-2.C: Likewise.
* gcc.dg/gomp/target-1.c: Likewise.
* gcc.dg/gomp/target-2.c: Likewise.
* g++.dg/gomp/taskgroup-1.C: Likewise.
* gcc.dg/gomp/taskgroup-1.c: Likewise.
* gcc.dg/gomp/teams-1.c: Likewise.
* g++.dg/gomp/teams-1.C: Likewise.
* g++.dg/overload/error3.C: Likewise.
* g++.dg/tm/jump1.C: Likewise.
* g++.dg/torture/pr40335.C: Likewise.
* gcc.dg/c99-vla-jump-5.c: Likewise.
* gcc.dg/switch-warn-1.c: Likewise.
* gcc.dg/Wjump-misses-init-1.c: Use -Wno-switch-unreachable.
* gcc.dg/nested-func-1.c: Likewise.
* gcc.dg/pr67784-4.c: Likewise.

From-SVN: r236597
29 files changed:
gcc/ChangeLog
gcc/common.opt
gcc/doc/invoke.texi
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Wswitch-unreachable-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/goacc/sb-2.c
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-switch.C
gcc/testsuite/g++.dg/gomp/block-10.C
gcc/testsuite/g++.dg/gomp/block-9.C
gcc/testsuite/g++.dg/gomp/target-1.C
gcc/testsuite/g++.dg/gomp/target-2.C
gcc/testsuite/g++.dg/gomp/taskgroup-1.C
gcc/testsuite/g++.dg/gomp/teams-1.C
gcc/testsuite/g++.dg/overload/error3.C
gcc/testsuite/g++.dg/tm/jump1.C
gcc/testsuite/g++.dg/torture/pr40335.C
gcc/testsuite/gcc.dg/Wjump-misses-init-1.c
gcc/testsuite/gcc.dg/Wswitch-unreachable-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c99-vla-jump-5.c
gcc/testsuite/gcc.dg/gomp/block-10.c
gcc/testsuite/gcc.dg/gomp/block-9.c
gcc/testsuite/gcc.dg/gomp/target-1.c
gcc/testsuite/gcc.dg/gomp/target-2.c
gcc/testsuite/gcc.dg/gomp/taskgroup-1.c
gcc/testsuite/gcc.dg/gomp/teams-1.c
gcc/testsuite/gcc.dg/nested-func-1.c
gcc/testsuite/gcc.dg/pr67784-4.c
gcc/testsuite/gcc.dg/switch-warn-1.c