From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3280 invoked by alias); 11 Nov 2009 15:12:08 -0000 Received: (qmail 3270 invoked by uid 22791); 11 Nov 2009 15:12:07 -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; Wed, 11 Nov 2009 15:12:02 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nABFC1wn002749 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 11 Nov 2009 10:12:01 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nABFC08F014118; Wed, 11 Nov 2009 10:12:00 -0500 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 nABFBxcB019349; Wed, 11 Nov 2009 10:12:00 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 93C61378113; Wed, 11 Nov 2009 08:11:59 -0700 (MST) From: Tom Tromey To: Keith Seitz Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Add parsing support for C++ operators References: <4AFA0A93.7040709@redhat.com> Reply-To: tromey@redhat.com Date: Wed, 11 Nov 2009 15:12:00 -0000 In-Reply-To: <4AFA0A93.7040709@redhat.com> (Keith Seitz's message of "Tue, 10 Nov 2009 16:51:31 -0800") 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-11/txt/msg00254.txt.bz2 >>>>> "Keith" == Keith Seitz writes: Keith> 2009-11-10 Keith Seitz Keith> * c-expy. (operator_stoken): New function. Keith> (OPERATOR): New token. Keith> (NEW): New token. Keith> (DELETE): New token. Keith> (operator): New rule. Keith> (name): Add operator. Keith> (ident_tokens): Add "new", "delete", and "operator". Keith> * gdbtypes.c (rank_one_type): Don't complain about Keith> void pointer conversion badness if both types are Keith> void pointers. Keith> + | OPERATOR ptype Keith> + { char *name; Keith> + long length; Keith> + struct ui_file *buf = mem_fileopen (); Keith> + Keith> + c_print_type ($2, NULL, buf, -1, 0); Keith> + name = ui_file_xstrdup (buf, &length); Keith> + ui_file_delete (buf); Keith> + $$ = operator_stoken (name); This leaks 'name', you need a free after the call to operator_stoken. Keith> + /* The toplevel (c_parse) will free the memory allocated here. */ Keith> + make_cleanup (free, st.ptr); Keith> + return st; On irc you expressed some doubt about this approach. It is fine. This is ok with the above change. Thanks. Tom