From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8212 invoked by alias); 30 Sep 2011 15:29:03 -0000 Received: (qmail 8203 invoked by uid 22791); 30 Sep 2011 15:29:02 -0000 X-SWARE-Spam-Status: No, hits=-6.7 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; Fri, 30 Sep 2011 15:28:37 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8UFSACT006028 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 30 Sep 2011 11:28:10 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p8UFS8qE007820; Fri, 30 Sep 2011 11:28:08 -0400 Received: from [0.0.0.0] (ovpn-113-113.phx2.redhat.com [10.3.113.113]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p8UFS4IF027038; Fri, 30 Sep 2011 11:28:05 -0400 Message-ID: <4E85E004.2030706@redhat.com> Date: Fri, 30 Sep 2011 15:56:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2 MIME-Version: 1.0 To: Dodji Seketeli 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> <4E793BF4.4010103@redhat.com> <4E7B497F.8060301@redhat.com> <4E80E47C.305@redhat.com> <4E83B6D5.5030907@redhat.com> <4E84C9FA.30604@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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/msg02059.txt.bz2 On 09/29/2011 05:21 PM, Dodji Seketeli wrote: > + When the token is /not/ an argument for a macro, xI is the same > + location as yI. Otherwise, xI is either the virtual location of > + that argument token if it comes from a macro expansion itself, or > + its spelling location. I think this could be a little clearer: .... Otherwise, xI is the location of the token outside this macro expansion. If this macro was expanded from another macro expansion, xI is a virtual location representing the token in that macro expansion; otherwise, it is the spelling location of the token. > + /* This is the location of the expansion point of the current macro > + map. That expansion point location is held by the map that was > + current right before the current one. It could have been either > + a macro or an ordinary map, depending on if we are in a > + nested expansion context not. */ This should clarify what location the expansion point is: is it the location of the macro name? the closing paren? > +source_location linemap_macro_map_loc_to_def_point (const struct line_map*, > + source_location); > +source_location linemap_macro_map_loc_unwind_toward_spelling (const struct line > _map*, > + source_location); > +source_location linemap_macro_map_loc_to_exp_point (const struct line_map*, > + source_location); These should be static. > +const struct line_map *linemap_enter_macro (struct line_maps *, > + struct cpp_hashnode*, > + source_location, > + unsigned int); > +source_location linemap_add_macro_token (const struct line_map *, > + unsigned int, > + source_location, > + source_location); > +int linemap_get_expansion_line (struct line_maps *, > + source_location); > +const char* linemap_get_expansion_filename (struct line_maps *, > + source_location); And these should be declared in an internal header, not the public include/line-map.h. > +/* Expand source code location LOC and return a user readable source > + code location. */ > +expanded_location linemap_expand_location (const struct line_map *, > + source_location loc); > + > +/* Expand source code location LOC and return a user readable source > + code location. The LRK parameter is the same as for > + linemap_resolve_location. */ > + > +expanded_location linemap_expand_location_full (struct line_maps *, These comments should clarify that the first function only takes spelling locations, while the second also takes virtual locations. > -finish_declspecs (struct c_declspecs *specs) > +finish_declspecs (struct c_declspecs *specs, > + location_t where) I'm not sure the beginning of the declspecs is a better place for these diagnostics than the beginning of the declarator. Why make this change? Jason