This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/54046] [4.6/4.7/4.8 Regression] wrong control reaches end of non-void function for switch case with throw and default
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 23 Nov 2012 16:04:14 +0000
- Subject: [Bug c++/54046] [4.6/4.7/4.8 Regression] wrong control reaches end of non-void function for switch case with throw and default
- Auto-submitted: auto-generated
- References: <bug-54046-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54046
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-23 16:04:14 UTC ---
Author: jakub
Date: Fri Nov 23 16:04:03 2012
New Revision: 193762
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193762
Log:
PR c++/54046
* Makefile.in (gimple-low.o): Depend on langhooks.h.
* gimple-low.c: Include langhooks.c.
(block_may_fallthru): Handle TARGET_EXPR and ERROR_MARK,
by default call lang_hooks.block_may_fallthru.
* langhooks.h (struct lang_hooks): Add block_may_fallthru
langhook.
* langhooks-def.h (LANG_HOOKS_BLOCK_MAY_FALLTHRU): Define.
(LANG_HOOKS_INITIALIZER): Use it.
* cp-objcp-common.h (LANG_HOOKS_BLOCK_MAY_FALLTHRU): Redefine.
* cp-objcp-common.c (cxx_block_may_fallthru): New function.
* cp-tree.h (cxx_block_may_fallthru): New prototype.
* g++.dg/warn/Wreturn-type-8.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/warn/Wreturn-type-8.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/Makefile.in
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-objcp-common.c
trunk/gcc/cp/cp-objcp-common.h
trunk/gcc/cp/cp-tree.h
trunk/gcc/gimple-low.c
trunk/gcc/langhooks-def.h
trunk/gcc/langhooks.h
trunk/gcc/testsuite/ChangeLog