]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-cfg.c (execute_warn_function_return): Break out noreturn warning too..
authorJan Hubicka <jh@suse.cz>
Sat, 14 May 2005 14:24:49 +0000 (16:24 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sat, 14 May 2005 14:24:49 +0000 (14:24 +0000)
* 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.

From-SVN: r99696

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/noreturn-7.c
gcc/tree-cfg.c
gcc/tree-optimize.c
gcc/tree-pass.h

index af16478389214d464e361e497b40e1b681b6fb62..97f56527471e04fb0339c43e2f17ffd85e47925a 100644 (file)
@@ -1,3 +1,14 @@
+2005-05-14  Jan Hubicka  <jh@suse.cz>
+
+       * 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  <kazu@cs.umass.edu>
 
        * tree-ssa-live.c (tpa_init, tpa_delete, tpa_compact,
index e3897d580c344590a9726ea7fdb97c1e46b22f26..9124a0d8a5f391f168172007d8651e17b039cecc 100644 (file)
@@ -1,3 +1,7 @@
+2005-05-14  Jan Hubicka  <jh@suse.cz>
+
+       * gcc.dg/noreturn-7.c: Allow control reaches warning.
+
 2005-05-14  Richard Guenther  <rguenth@gcc.gnu.org>
 
        * g++.dg/tree-ssa/tmmti-2.C: New testcase.
index 94a26cc3875d39e07fba3f405b0659e32e433cd6..8ae5e2382241d9a6d438d4e6cb7ee2d1abc45078 100644 (file)
@@ -39,4 +39,4 @@ int k()
   if (++z > 10)
     _exit(0);
   k();
-}
+}             /* { dg-warning "control reaches" } */
index 983530ef361957c9c82824bcb0c0e1e7c90796be..96377ec821ecfeef62ea2004b46a6ea3a5b77832 100644 (file)
@@ -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 %<noreturn%>",
-            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 %<noreturn%>",
+            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 */
+};
index 4b9feba979c12d707968095764c35757edce534b..ba35c3761c6e0a6afe2b4f9272d0c2f0344e1925 100644 (file)
@@ -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);
index c9fdd852ec2df6c9a92a502647056a1856927473..83fa184b7367248ca19094223c4ab17790a8e2e4 100644 (file)
@@ -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;