From: hubicka Date: Sat, 14 May 2005 14:24:49 +0000 (+0000) Subject: * tree-cfg.c (execute_warn_function_return): Break out noreturn X-Git-Tag: upstream/4.9.2~61212 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=73d5fb10e28767961dded3d66f198afaef5910fc;p=platform%2Fupstream%2Flinaro-gcc.git * tree-cfg.c (execute_warn_function_return): Break out noreturn warning too.. (execute_warn_function_noreturn): ... here. (pass_warn_function_noreturn): New pass. * tree-pass.h (pass_warn_function_noreturn): Declare * tree-optimize.c (init_tree_optimization_passes): Move return warnings early and add noreturn warnings at place of previous return warnings. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99696 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index af16478..97f5652 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2005-05-14 Jan Hubicka + + * tree-cfg.c (execute_warn_function_return): Break out noreturn + warning too.. + (execute_warn_function_noreturn): ... here. + (pass_warn_function_noreturn): New pass. + * tree-pass.h (pass_warn_function_noreturn): Declare + * tree-optimize.c (init_tree_optimization_passes): Move return + warnings early and add noreturn warnings at place of previous + return warnings. + 2005-05-14 Kazu Hirata * tree-ssa-live.c (tpa_init, tpa_delete, tpa_compact, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e3897d5..9124a0d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-05-14 Jan Hubicka + + * gcc.dg/noreturn-7.c: Allow control reaches warning. + 2005-05-14 Richard Guenther * g++.dg/tree-ssa/tmmti-2.C: New testcase. diff --git a/gcc/testsuite/gcc.dg/noreturn-7.c b/gcc/testsuite/gcc.dg/noreturn-7.c index 94a26cc..8ae5e23 100644 --- a/gcc/testsuite/gcc.dg/noreturn-7.c +++ b/gcc/testsuite/gcc.dg/noreturn-7.c @@ -39,4 +39,4 @@ int k() if (++z > 10) _exit(0); k(); -} +} /* { dg-warning "control reaches" } */ diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 983530e..96377ec 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -5630,14 +5630,6 @@ execute_warn_function_return (void) edge e; edge_iterator ei; - if (warn_missing_noreturn - && !TREE_THIS_VOLATILE (cfun->decl) - && EDGE_COUNT (EXIT_BLOCK_PTR->preds) == 0 - && !lang_hooks.function.missing_noreturn_ok_p (cfun->decl)) - warning (0, "%Jfunction might be possible candidate for " - "attribute %", - cfun->decl); - /* If we have a path to EXIT, then we do return. */ if (TREE_THIS_VOLATILE (cfun->decl) && EDGE_COUNT (EXIT_BLOCK_PTR->preds) > 0) @@ -5741,3 +5733,34 @@ struct tree_opt_pass pass_warn_function_return = 0, /* todo_flags_finish */ 0 /* letter */ }; + +/* Emit noreturn warnings. */ + +static void +execute_warn_function_noreturn (void) +{ + if (warn_missing_noreturn + && !TREE_THIS_VOLATILE (cfun->decl) + && EDGE_COUNT (EXIT_BLOCK_PTR->preds) == 0 + && !lang_hooks.function.missing_noreturn_ok_p (cfun->decl)) + warning (0, "%Jfunction might be possible candidate for " + "attribute %", + cfun->decl); +} + +struct tree_opt_pass pass_warn_function_noreturn = +{ + NULL, /* name */ + NULL, /* gate */ + execute_warn_function_noreturn, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + PROP_cfg, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index 4b9feba..ba35c37 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -327,10 +327,11 @@ init_tree_optimization_passes (void) NEXT_PASS (pass_lower_eh); NEXT_PASS (pass_build_cfg); NEXT_PASS (pass_pre_expand); + NEXT_PASS (pass_warn_function_return); NEXT_PASS (pass_tree_profile); NEXT_PASS (pass_init_datastructures); NEXT_PASS (pass_all_optimizations); - NEXT_PASS (pass_warn_function_return); + NEXT_PASS (pass_warn_function_noreturn); NEXT_PASS (pass_mudflap_2); NEXT_PASS (pass_free_datastructures); NEXT_PASS (pass_expand); diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index c9fdd85..83fa184 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -197,6 +197,7 @@ extern struct tree_opt_pass pass_stdarg; extern struct tree_opt_pass pass_early_warn_uninitialized; extern struct tree_opt_pass pass_late_warn_uninitialized; extern struct tree_opt_pass pass_warn_function_return; +extern struct tree_opt_pass pass_warn_function_noreturn; extern struct tree_opt_pass pass_phiopt; extern struct tree_opt_pass pass_forwprop; extern struct tree_opt_pass pass_redundant_phi;