From 20f18c3ce14154eb477226aa48a12ebd32f9ead4 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 23 Jan 2014 13:54:08 -0500 Subject: re PR c++/55189 (enable -Wreturn-type by default) PR c++/55189 * cp-tree.h (struct language_function): Add infinite_loop and infinite_loops. (current_function_infinite_loop): New. * semantics.c (begin_maybe_infinite_loop, end_maybe_infinite_loop) (break_maybe_infinite_loop): New. (finish_while_stmt_cond, finish_while_stmt, begin_do_stmt) (finish_do_stmt, finish_for_cond, finish_for_stmt) (begin_range_for_stmt): Use them. * decl.c (finish_function): Don't warn about missing return if current_function_infinite_loop. * pt.c (instantiate_decl): Copy current_function_infinite_loop. * parser.c (cp_parser_jump_statement): Call break_maybe_infinite_loop. From-SVN: r207001 --- gcc/cp/parser.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/cp/parser.c') diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index c02de3b..e12a528 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -10641,6 +10641,8 @@ cp_parser_jump_statement (cp_parser* parser) gcc_assert ((in_statement & IN_SWITCH_STMT) || in_statement == IN_ITERATION_STMT); statement = finish_break_stmt (); + if (in_statement == IN_ITERATION_STMT) + break_maybe_infinite_loop (); break; case IN_OMP_BLOCK: error_at (token->location, "invalid exit from OpenMP structured block"); -- cgit v1.1