From patchwork Fri May 31 09:05:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 1108248 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-502047-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="dj18akWQ"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="F5f0AbKo"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Fdnm4SWHz9sBr for ; Fri, 31 May 2019 19:05:16 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=pwtDGRKZklAKMsOhAaMjfSHVXWVkFFpyRwHPULCUB56Dipyn0l 92D/c7Rt9ltnVMt+8BkzyP+qJUvD9IDMaA+p4QNUDiP6mGPQSkxH2GNQhm3e6o+1 S+wFFLVY9KO8FYGJZbwJmZheL9f7AP5RItABYBKtVfz58VwSTP+BfuMS4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=QlRT8Jkc8zLN0x7MuOn5DS21D0E=; b=dj18akWQp2E3m7cmvKKc UfOeid2Xoinox1jQ0Ala/dS6663+/yLv45ECEeiNe3BiFxrF6ImFFcUw0ZPUmiMJ qpGkUjNQZL3VXrmW9p5zT38drAPNbsZ9iIbUY8w2zqwrH2miDHXXPcb/BpaverUk m1bC9im75xtGvSrFW63UPjw= Received: (qmail 38331 invoked by alias); 31 May 2019 09:05:08 -0000 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 Received: (qmail 38297 invoked by uid 89); 31 May 2019 09:05:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=sk:build_m X-HELO: userp2120.oracle.com Received: from userp2120.oracle.com (HELO userp2120.oracle.com) (156.151.31.85) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 31 May 2019 09:05:06 +0000 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4V93taV040782; Fri, 31 May 2019 09:05:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : from : subject : message-id : date : mime-version : content-type; s=corp-2018-07-02; bh=bzrkGwmwnlDuB1j7I8ktcptfQ02plCej1r5rpMUAXdQ=; b=F5f0AbKoCGjor5iDPy4GYACXVDgO8VI7R4LlS6gKFBOdlQF7CVE472M6QHShnn2oW4s7 CDmGYe/cpVolW2Mb88CBa0QrUyoAFQAVRhbY/cGZ/AI97niQyMB9nVlH+SScHHlVAm0u dnfcPkvr4JaQI5OQhk59y95KJIjuAgX+ZR82TjsRDi6Unyu0RLiXdy4bz+XIV84gEiej pkU68YH5+FxbmjwxzsGtz3hpYr1Cx4A3gU3XnnTaQe7CzlBwboQMEJ+tqKZUc4wt6vwj jDMjuBh3gwMaAAth9y4nGIzX7LPZ+oQrEXBiPvDe7O2zBTZO1X6g6O+Nc/o5sK1WvOVh 7A== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2spxbqmwwr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 May 2019 09:05:04 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4V94Txr144711; Fri, 31 May 2019 09:05:03 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2sqh74s7qw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 May 2019 09:05:03 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x4V952HE008855; Fri, 31 May 2019 09:05:02 GMT Received: from [192.168.1.4] (/79.42.221.26) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 31 May 2019 02:05:02 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] Fix cp_parser_unqualified_id typo Message-ID: Date: Fri, 31 May 2019 11:05:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 X-IsSubscribed: yes Hi, noticed this typo: we are passing the location to build_nt as third argument instead of passing it to cp_expr as second argument. Tested x86_64-linux. By the way, we have the option of using build_min_nt_loc instead of build_nt in all these places for BIT_NOT_EXPR in cp_parser_unqualified_id, Certainly it has the advantage that the location information survives in the tree node when cp_expr is eventually converted to a plain tree... (below tests fine) What do you think? Thanks, Paolo. //////////////////// 2019-05-31 Paolo Carlini * parser.c (cp_parser_unqualified_id): Fix typo, properly call build_nt. Index: parser.c =================================================================== --- parser.c (revision 271761) +++ parser.c (working copy) @@ -6052,7 +6052,7 @@ cp_parser_unqualified_id (cp_parser* parser, && constructor_name_p (token->u.value, scope)))) { cp_lexer_consume_token (parser->lexer); - return cp_expr (build_nt (BIT_NOT_EXPR, scope), loc); + return build_min_nt_loc (loc, BIT_NOT_EXPR, scope); } /* ~auto means the destructor of whatever the object is. */ @@ -6063,7 +6063,7 @@ cp_parser_unqualified_id (cp_parser* parser, "%<~auto%> only available with " "%<-std=c++14%> or %<-std=gnu++14%>"); cp_lexer_consume_token (parser->lexer); - return cp_expr (build_nt (BIT_NOT_EXPR, make_auto (), loc)); + return build_min_nt_loc (loc, BIT_NOT_EXPR, make_auto ()); } /* If there was an explicit qualification (S::~T), first look @@ -6153,8 +6153,8 @@ cp_parser_unqualified_id (cp_parser* parser, time. */ type_decl = cp_parser_identifier (parser); if (type_decl != error_mark_node) - type_decl = build_nt (BIT_NOT_EXPR, type_decl); - return cp_expr (type_decl, loc); + type_decl = build_min_nt_loc (loc, BIT_NOT_EXPR, type_decl); + return type_decl; } } /* If an error occurred, assume that the name of the @@ -6162,7 +6162,7 @@ cp_parser_unqualified_id (cp_parser* parser, class. That allows us to keep parsing after running into ill-formed destructor names. */ if (type_decl == error_mark_node && scope) - return build_nt (BIT_NOT_EXPR, scope); + return build_min_nt_loc (loc, BIT_NOT_EXPR, scope); else if (type_decl == error_mark_node) return error_mark_node; @@ -6189,7 +6189,7 @@ cp_parser_unqualified_id (cp_parser* parser, "typedef-name %qD used as destructor declarator", type_decl); - return cp_expr (build_nt (BIT_NOT_EXPR, TREE_TYPE (type_decl), loc)); + return build_min_nt_loc (loc, BIT_NOT_EXPR, TREE_TYPE (type_decl)); } case CPP_KEYWORD: Index: parser.c =================================================================== --- parser.c (revision 271785) +++ parser.c (working copy) @@ -6063,7 +6063,7 @@ cp_parser_unqualified_id (cp_parser* parser, "%<~auto%> only available with " "%<-std=c++14%> or %<-std=gnu++14%>"); cp_lexer_consume_token (parser->lexer); - return cp_expr (build_nt (BIT_NOT_EXPR, make_auto (), loc)); + return cp_expr (build_nt (BIT_NOT_EXPR, make_auto ()), loc); } /* If there was an explicit qualification (S::~T), first look