From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5668 invoked by alias); 20 Sep 2011 14:06:16 -0000 Received: (qmail 5659 invoked by uid 22791); 20 Sep 2011 14:06:15 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Sep 2011 14:05:58 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8KE5W3P025659 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 20 Sep 2011 10:05:32 -0400 Received: from localhost (ovpn-113-40.phx2.redhat.com [10.3.113.40]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p8KE5UAX020324 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 20 Sep 2011 10:05:31 -0400 Received: by localhost (Postfix, from userid 500) id A219729C111; Tue, 20 Sep 2011 16:05:29 +0200 (CEST) From: Dodji Seketeli To: Jason Merrill Cc: gcc-patches@gcc.gnu.org, tromey@redhat.com, gdr@integrable-solutions.net, joseph@codesourcery.com, burnus@net-b.de, charlet@act-europe.fr, bonzini@gnu.org Subject: Re: [PATCH 3/7] Emit macro expansion related diagnostics References: <1291979498-1604-1-git-send-email-dodji@redhat.com> <7ab852c58faea9efd81130c5a1ddc9e78b34bcc5.1310824121.git.dodji@redhat.com> <4E6E73F8.4030603@redhat.com> <4E74AA75.8090106@redhat.com> <4E778A26.1000707@redhat.com> <4E77ACA1.80205@redhat.com> <4E789C5B.20509@redhat.com> X-URL: http://www.redhat.com Date: Tue, 20 Sep 2011 14:12:00 -0000 In-Reply-To: <4E789C5B.20509@redhat.com> (Jason Merrill's message of "Tue, 20 Sep 2011 09:59:55 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2011-09/txt/msg01161.txt.bz2 Jason Merrill writes: > On 09/20/2011 03:23 AM, Dodji Seketeli wrote: >> Jason Merrill writes: > >>> Certainly all the calls to tokens_buff_add_token pass src->src_loc for >>> the second. So why don't we look up the second location in the macro >>> definition when we need it rather than store a copy in the map? >> >> Because when you have the first location, looking up the second is not >> easy. > > In linemap_macro_map_loc_to_def_point you get the token number and > then use that to index into MACRO_MAP_LOCATIONS. Can't you use the > same token number to index into macro->exp.tokens instead? No, because a macro argument can be made of several tokens. So after the first macro parameter of the replacement-list has been replaced by the tokens of the argument, there is a shift between the indexes of the tokens resulting from the replacement, and the original tokens of the macro replacement list. -- Dodji