From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13464 invoked by alias); 13 Oct 2009 21:24:27 -0000 Received: (qmail 13453 invoked by uid 22791); 13 Oct 2009 21:24:26 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_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, 13 Oct 2009 21:24:22 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9DLOK1K005143 for ; Tue, 13 Oct 2009 17:24:20 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9DLOJrw023337; Tue, 13 Oct 2009 17:24:20 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n9DLOIsZ015892; Tue, 13 Oct 2009 17:24:19 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 42E59378188; Tue, 13 Oct 2009 15:24:18 -0600 (MDT) From: Tom Tromey To: Keith Seitz Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Add method overload resolution to expression parser References: <4A9D628B.1070300@redhat.com> Reply-To: tromey@redhat.com Date: Tue, 13 Oct 2009 21:24:00 -0000 In-Reply-To: <4A9D628B.1070300@redhat.com> (Keith Seitz's message of "Tue, 01 Sep 2009 11:06:03 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-10/txt/msg00287.txt.bz2 >>>>> "Keith" == Keith Seitz writes: Keith> The attached patch is the first of several patches which will attempt Keith> mitigate the requirement of single-quoting every single C++ expression Keith> passed to the parser. I have a couple of questions about this. First, since this is an extension to C++, I wonder whether it will introduce any parsing ambiguities once the parser is complete. I suspect not, but I thought you might have a better view. Keith> +exp : exp '(' nonempty_typelist ')' const_or_volatile This is an interesting production. I would have expected it to explicitly look for maybe-qualified identifiers -- not an arbitrary expression. Does this let us do something we could not otherwise do? Or, what does this do: print (return_a_function ()) (int) Does it work to call an explicitly-specified overload? print overloaded(int)(5) (I assume from reading the patch that this works as expected.) Keith> func_mod: '(' ')' Keith> { $$ = 0; } Keith> | '(' nonempty_typelist ')' Keith> - { free ($2); $$ = 0; } Keith> + { do_cleanups (typelist_cleanup); $$ = 0; } I'm a bit surprised that the cleanup stuff works in the parser. Interesting. Keith> +static void Keith> +free_param_types (void *arg) Needs a short intro comment. Keith> +static struct type * Keith> +make_params (int num_types, struct type **param_types) [...] Keith> + make_cleanup (free_param_types, type); It is a little unusual to make a cleanup that isn't returned. Is it really safe in this case? To know that, I think you'd have to examine all callers of evaluate_subexp_standard. It seems somewhat safer to do explicit cleanups in the TYPE_INSTANCE case, what do you think? At the very least I think the comment for make_params should mention this cleanup side effect. Tom