From patchwork Thu Jan 3 12:30:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 209241 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 9D7D22C0080 for ; Thu, 3 Jan 2013 23:31:08 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1357821069; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:From:To:Cc:Subject:Date:Message-Id: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=ri2dhtnJRjzhmzdip8bi 2f+uD6g=; b=p6/MWx0+ZXzT6/lYur8/4fjI7+JbhprEUMBj2UnbBKS2GCTUkP8Y zwcjt+VeDK2SZNd0hTfxKC8uhEHOe7r7rUlrGMxnE2WOhk6x9HsLdYmAfsa9rfVZ +2bccyX488qbNdaKpIPFqFxH5r/42fvRfRZ3/iUqxf6vEgIrV+97nrs= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:From:To:Cc:Subject:Date:Message-Id:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=CsTfrgja+FnKYReeX+h4ljVglJURMrVz92BMfHYgEu061GzL2QIsTPAButnPrG DF2V6vVWqUCcymDjrrFYQPjch5EAfjyPRk1xTTXfElouy+IkAq49CAve1b9xdUYx dQT0OwGvHTa8erBVf0uq5UO9clFkpcY0iM0OthUoFH1QI=; Received: (qmail 22874 invoked by alias); 3 Jan 2013 12:31:00 -0000 Received: (qmail 22786 invoked by uid 22791); 3 Jan 2013 12:30:56 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_NO, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 Jan 2013 12:30:37 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E37A62E4B5; Thu, 3 Jan 2013 07:30:36 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id xSvDFyRmxbMx; Thu, 3 Jan 2013 07:30:36 -0500 (EST) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id C34EA2E287; Thu, 3 Jan 2013 07:30:36 -0500 (EST) Received: by kwai.gnat.com (Postfix, from userid 4233) id C21493FF09; Thu, 3 Jan 2013 07:30:36 -0500 (EST) From: Joel Brobecker To: gcc-patches@gcc.gnu.org Cc: Joel Brobecker Subject: [RFA] statement before variable declaration in cp_parser_initializer_list. Date: Thu, 3 Jan 2013 07:30:24 -0500 Message-Id: <1357216224-513-1-git-send-email-brobecker@adacore.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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?) Thanks, 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);