From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11092 invoked by alias); 28 Sep 2011 20:46:20 -0000 Received: (qmail 11082 invoked by uid 22791); 28 Sep 2011 20:46:19 -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; Wed, 28 Sep 2011 20:46:01 +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 p8SKjZ9O002730 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 28 Sep 2011 16:45:35 -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 p8SKjYA9002754; Wed, 28 Sep 2011 16:45:34 -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 p8SKjVHX011248; Wed, 28 Sep 2011 16:45:31 -0400 Message-ID: <4E83876B.8080009@redhat.com> Date: Wed, 28 Sep 2011 21:45: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 2/7] Generate virtual locations for tokens References: <1291979498-1604-1-git-send-email-dodji@redhat.com> <4E6E65B2.2060909@redhat.com> <4E711F42.80802@redhat.com> <4E77ACFE.2080805@redhat.com> <4E7B673D.9050306@redhat.com> <4E80CDA7.10106@redhat.com> <4E832BD3.4020003@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/msg01885.txt.bz2 On 09/28/2011 03:15 PM, Dodji Seketeli wrote: > +set_arg_token (macro_arg *arg, const cpp_token *token, > + source_location location, size_t index, > + enum macro_arg_token_kind kind, > + bool track_macro_exp_p) > +{ > + const cpp_token **token_ptr; > + source_location *loc = NULL; > + > + token_ptr = > + arg_token_ptr_at (arg, index, kind, > + track_macro_exp_p ? &loc : NULL); ... > + if (virt_location) > + { > + if (kind == MACRO_ARG_TOKEN_NORMAL) > + *virt_location = &arg->virt_locs[index]; > + else if (kind == MACRO_ARG_TOKEN_EXPANDED) > + *virt_location = &arg->expanded_virt_locs[index]; > + else if (kind == MACRO_ARG_TOKEN_STRINGIFIED) > + *virt_location = > + (source_location *) &tokens_ptr[index]->src_loc; > + } If we make this block conditional on arg->virt_locs being set, then we can pass &loc in unconditionally and don't need the track_macro_exp_p flag to set_arg_token. > Note that the gotos were put there also because we needed to get out > of the for (;;) loop, similarly to what the previous return statements > were doing; so by doing this doesn't we don't do get rid of the gotos. Can't you use break instead? Jason