From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32064 invoked by alias); 22 Apr 2010 00:11:01 -0000 Received: (qmail 32046 invoked by uid 22791); 22 Apr 2010 00:10:58 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_WEB,TW_BJ X-Spam-Check-By: sourceware.org Received: from mail-bw0-f228.google.com (HELO mail-bw0-f228.google.com) (209.85.218.228) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Apr 2010 00:10:54 +0000 Received: by bwz28 with SMTP id 28so8997917bwz.14 for ; Wed, 21 Apr 2010 17:10:50 -0700 (PDT) Received: by 10.204.131.153 with SMTP id x25mr1729529bks.159.1271895050211; Wed, 21 Apr 2010 17:10:50 -0700 (PDT) Received: from localhost (186-243-252-87-dynamic-pool.gprs.mts.by [87.252.243.186]) by mx.google.com with ESMTPS id 13sm4295530bwz.15.2010.04.21.17.10.14 (version=SSLv3 cipher=RC4-MD5); Wed, 21 Apr 2010 17:10:49 -0700 (PDT) Date: Thu, 22 Apr 2010 00:11:00 -0000 From: Mihail Zenkov To: Joel Brobecker Cc: Mihail Zenkov , tromey@redhat.com, gdb-patches@sourceware.org Subject: Re: D language support Message-Id: <20100422030910.7e84f7ea.mihai.zenkov@gmail.com> In-Reply-To: <20100421155657.GA19194@adacore.com> References: <20091224015617.7092112b.mihai.zenkov@gmail.com> <20091230125539.GF2788@adacore.com> <20100109082524.263bcb17.mihai.zenkov@gmail.com> <20100109082830.dd984de8.mihai.zenkov@gmail.com> <20100109142327.GC2007@adacore.com> <20100113064026.14f75ff2.mihai.zenkov@gmail.com> <20100415012124.91ce1769.mihai.zenkov@gmail.com> <20100421025919.ad3a0830.mihai.zenkov@gmail.com> <20100421155657.GA19194@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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: 2010-04/txt/msg00720.txt.bz2 > > +static const char *mangled_str; > > I think this part needs to be rethinked, or at least I don't understand > why this needs to be a global. Can you elaborate? > > Similarly, I do not understand why ... > > +/* Temporary obstack used for holding strings. */ > > +static struct obstack tempbuf; > ... needs to be a global? It not real global. As it static it visibility limited to current file. In this case we can think about this file as if it was C++ class. IMHO it more easy readable code - we promptly see all function use same variables. I see same code in many other places (c-exp.c:3823, c-exp.c:4192, c-exp.c:4609, ada-lang.c:307, ada-exp.c:2769 and others). > > + if (gsymbol->language == language_d > > + || gsymbol->language == language_auto) > > + { > > + demangled = > > + d_demangle(mangled, 0); > > Can you join the last two lines? Current code: if (gsymbol->language == language_objc || gsymbol->language == language_auto) { demangled = objc_demangle (mangled, 0); if (demangled != NULL) { gsymbol->language = language_objc; return demangled; } } if (gsymbol->language == language_cplus || gsymbol->language == language_auto) { demangled = cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE); if (demangled != NULL) { gsymbol->language = language_cplus; return demangled; } } if (gsymbol->language == language_java) { demangled = cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI | DMGL_JAVA); Still i should join it?