From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24063 invoked by alias); 3 Jan 2013 12:33:07 -0000 Received: (qmail 24053 invoked by uid 22791); 3 Jan 2013 12:33:06 -0000 X-SWARE-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-we0-f170.google.com (HELO mail-we0-f170.google.com) (74.125.82.170) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 Jan 2013 12:32:36 +0000 Received: by mail-we0-f170.google.com with SMTP id r1so7337622wey.29 for ; Thu, 03 Jan 2013 04:32:35 -0800 (PST) MIME-Version: 1.0 Received: by 10.180.39.143 with SMTP id p15mr74710657wik.14.1357216354913; Thu, 03 Jan 2013 04:32:34 -0800 (PST) Received: by 10.194.179.130 with HTTP; Thu, 3 Jan 2013 04:32:34 -0800 (PST) In-Reply-To: <1357216224-513-1-git-send-email-brobecker@adacore.com> References: <1357216224-513-1-git-send-email-brobecker@adacore.com> Date: Thu, 03 Jan 2013 12:33:00 -0000 Message-ID: Subject: Re: [RFA] statement before variable declaration in cp_parser_initializer_list. From: Richard Biener To: Joel Brobecker Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg00107.txt.bz2 On Thu, Jan 3, 2013 at 1:30 PM, Joel Brobecker wrote: > Hello, > > I happened to notice a warning while compiling GCC, and it seemed > like an easy fix... > > gcc/cp/ChangeLog: > > * parser.c (cp_parser_initializer_list): Move declaration > of variable non_const to start of lexical block. > > Tested against x86_64-linux, no regression. > OK to commit? (obvious?) Hmm? We compile with a C++ compiler where this is perfectly valid ... Richard. > Thanks, > -- > Joel > > --- > gcc/cp/parser.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c > index 3dc2ec6..61d93f8 100644 > --- a/gcc/cp/parser.c > +++ b/gcc/cp/parser.c > @@ -17932,9 +17932,10 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p) > && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE)) > { > /* In C++11, [ could start a lambda-introducer. */ > + bool non_const = false; > + > cp_parser_parse_tentatively (parser); > cp_lexer_consume_token (parser->lexer); > - bool non_const = false; > designator = cp_parser_constant_expression (parser, true, &non_const); > cp_parser_require (parser, CPP_CLOSE_SQUARE, RT_CLOSE_SQUARE); > cp_parser_require (parser, CPP_EQ, RT_EQ); > -- > 1.7.0.4 >