[PATCH]: CSE some initializations in c-parser.c file.

Uros Bizjak ubizjak@gmail.com
Sun Oct 17 18:45:00 GMT 2010


Hello!

Attached patch moves some equivalent initializations from both arms of
if expressions.

2010-10-17  Uros Bizjak  <ubizjak@gmail.com>

	* c-parser.c (c_parser_for_statement): Move initialization of
	cond and incr before if.

Tested on x86_64-pc-linux-gnu, committed to mainline as obvious.

Uros.
-------------- next part --------------
Index: c-parser.c
===================================================================
--- c-parser.c	(revision 165590)
+++ c-parser.c	(working copy)
@@ -4568,15 +4568,12 @@ c_parser_for_statement (c_parser *parser
   /* Open a compound statement in Objective-C as well, just in case this is
      as foreach expression.  */
   block = c_begin_compound_stmt (flag_isoc99 || c_dialect_objc ());
+  cond = error_mark_node;
+  incr = error_mark_node;
   if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
     {
       /* Parse the initialization declaration or expression.  */
-      cond = error_mark_node;
       object_expression = error_mark_node;
-      /* Initializing incr should not be necessary, but it avoids
-	 bogus warnings of uninitialized uses.  */
-      incr = error_mark_node;
-
       if (c_parser_next_token_is (parser, CPP_SEMICOLON))
 	{
 	  c_parser_consume_token (parser);
@@ -4694,11 +4691,6 @@ c_parser_for_statement (c_parser *parser
 	}
       c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
     }
-  else
-    {
-      cond = error_mark_node;
-      incr = error_mark_node;
-    }
   save_break = c_break_label;
   c_break_label = NULL_TREE;
   save_cont = c_cont_label;


More information about the Gcc-patches mailing list