* tree-cfg.c (execute_warn_function_return): Break out noreturn
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 14 May 2005 14:24:49 +0000 (14:24 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 14 May 2005 14:24:49 +0000 (14:24 +0000)
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

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 af16478..97f5652 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 e3897d5..9124a0d 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 94a26cc..8ae5e23 100644 (file)
@@ -39,4 +39,4 @@ int k()
   if (++z > 10)
     _exit(0);
   k();
-}
+}             /* { dg-warning "control reaches" } */
index 983530e..96377ec 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 4b9feba..ba35c37 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 c9fdd85..83fa184 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;