Patchwork : CSE some initializations in c-parser.c file.

login
register
mail settings
Submitter Uros Bizjak
Date Oct. 17, 2010, 6:29 p.m.
Message ID <AANLkTi=cq4mXL3-=n93efWxu-m6A9Z2cngarThHy7UJw@mail.gmail.com>
Download mbox | patch
Permalink /patch/68088/
State New
Headers show

Comments

Uros Bizjak - Oct. 17, 2010, 6:29 p.m.
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.

Patch

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;