public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Use more FOR_EACH_VEC_* macros
@ 2015-10-02  8:10 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2015-10-02  8:10 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]

Tested on x86_64-suse-linux, applied on the mainline.


2015-10-02  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/trans.c (find_loop_for): Use FOR_EACH_VEC_ELT_REVERSE.
	(Loop_Statement_to_gnu): Use FOR_EACH_VEC_ELT.
	(finalize_nrv): Use FOR_EACH_VEC_SAFE_ELT and initialize field.
	(build_stmt_group): Add blank lines.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 1600 bytes --]

Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 228315)
+++ gcc-interface/trans.c	(working copy)
@@ -2644,9 +2644,7 @@ find_loop_for (tree var)
 
   gcc_assert (vec_safe_length (gnu_loop_stack) > 0);
 
-  for (i = vec_safe_length (gnu_loop_stack) - 1;
-       vec_safe_iterate (gnu_loop_stack, i, &iter);
-       i--)
+  FOR_EACH_VEC_ELT_REVERSE (*gnu_loop_stack, i, iter)
     if (var == iter->loop_var)
       break;
 
@@ -3014,9 +3012,7 @@ Loop_Statement_to_gnu (Node_Id gnat_node
 	       - the front-end quickly generates useless or redundant checks
 		 that can be entirely optimized away in the end.  */
       if (1 <= n_checks && n_checks <= 4)
-	for (i = 0;
-	     vec_safe_iterate (gnu_loop_info->checks, i, &rci);
-	     i++)
+	FOR_EACH_VEC_ELT (*gnu_loop_info->checks, i, rci)
 	  {
 	    tree low_ok
 	      = rci->low_bound
@@ -3426,8 +3422,9 @@ finalize_nrv (tree fndecl, bitmap nrv, v
   /* Prune the candidates that are referenced by other return values.  */
   data.nrv = nrv;
   data.result = NULL_TREE;
+  data.gnat_ret = Empty;
   data.visited = NULL;
-  for (i = 0; vec_safe_iterate (other, i, &iter); i++)
+  FOR_EACH_VEC_SAFE_ELT (other, i, iter)
     walk_tree_without_duplicates (&iter, prune_nrv_r, &data);
   if (bitmap_empty_p (nrv))
     return;
@@ -7905,10 +7902,12 @@ static tree
 build_stmt_group (List_Id gnat_list, bool binding_p)
 {
   start_stmt_group ();
+
   if (binding_p)
     gnat_pushlevel ();
 
   add_stmt_list (gnat_list);
+
   if (binding_p)
     gnat_poplevel ();
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-02  8:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-02  8:10 [Ada] Use more FOR_EACH_VEC_* macros Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).