diff mbox

[C++0x] avoid extra tentative parse in range-based for loops

Message ID AANLkTikiXyD21sYfLXEBKrat4rOK_fkdmK+T4xbf0VyA@mail.gmail.com
State New
Headers show

Commit Message

Rodrigo Rivas Jan. 13, 2011, 11:49 a.m. UTC
What about this?

Changelog:

gcc/cp/

2011-01-13  Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>

	* parser.c (cp_parser_range_for): Remove the "unused variable" warning
	workaround.
diff mbox

Patch

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 061e8cc..41f82ac 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -8760,15 +8760,6 @@  cp_parser_range_for (cp_parser *parser, tree scope, tree init, tree range_decl)
 {
   tree stmt, range_expr;
 
-  /* If the variable from a range-for is not actually used, GCC would issue
-     "unused variable" warnings, and the user could do little to prevent them.
-     So we always mark it as used.  */
-  if (range_decl != error_mark_node)
-    {
-      TREE_USED (range_decl) = 1;
-      DECL_READ_P (range_decl) = 1;
-    }
-
   if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
     {
       bool expr_non_constant_p;