From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30150 invoked by alias); 19 May 2003 14:45:21 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 30092 invoked from network); 19 May 2003 14:45:19 -0000 Received: from unknown (HELO crack.them.org) (146.82.138.56) by sources.redhat.com with SMTP; 19 May 2003 14:45:19 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 19HltX-0003zs-00; Mon, 19 May 2003 09:45:43 -0500 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 19Hlsz-0000Uj-00; Mon, 19 May 2003 10:45:09 -0400 Date: Mon, 19 May 2003 14:45:00 -0000 From: Daniel Jacobowitz To: David Carlton Cc: gdb-patches@sources.redhat.com, Elena Zannoni Subject: Re: [rfa] namespace scope, take 2 Message-ID: <20030519144508.GA25940@nevyn.them.org> Mail-Followup-To: David Carlton , gdb-patches@sources.redhat.com, Elena Zannoni References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.1i X-SW-Source: 2003-05/txt/msg00334.txt.bz2 On Sun, May 18, 2003 at 03:56:21PM -0700, David Carlton wrote: > Here's a new version of my namespace scope patch, using the language > hook that I just posted an RFA for. Assuming that's okay, then is > this okay, Daniel? I know you said that it was fine a few weeks ago, > but I wanted to give you another chance to complain since it's going > in a file you maintain. :-) (Except for a few functions in block.c, > but Elena already said those were okay. Well, block_global_block is > new to this version of the patch, but I'm sure it's > non-controversial.) I added the extra test to namespace.exp that you > requested. Just a couple small comments. Most of it looks good. > +/* Lookup NAME at namespace scope (or, in C terms, in static and > + global variables). SCOPE is the namespace that the current > + function is defined within; only consider namespaces whose length > + is at least SCOPE_LEN. (This is to make the recursion easier.) */ > + > +static struct symbol * > +lookup_namespace_scope (const char *name, > + const char *linkage_name, > + const struct block *block, > + const domain_enum domain, > + struct symtab **symtab, > + const char *scope, > + int scope_len) > +{ > + char *namespace; > + > + if (scope[scope_len] != '\0') > + { > + /* Recursively search for names in child namespaces first. */ > + > + struct symbol *sym; > + int new_scope_len = scope_len; > + > + /* If the current scope is followed by "::", skip past that. */ > + if (new_scope_len != 0) > + { > + gdb_assert (scope[new_scope_len] == ':'); > + new_scope_len += 2; > + } > + new_scope_len += cp_find_first_component (scope + new_scope_len); > + sym = lookup_namespace_scope (name, linkage_name, block, > + domain, symtab, > + scope, new_scope_len); > + if (sym != NULL) > + return sym; > + } > + > + /* Okay, we didn't find a match in our parents, so look for the name > + in the current namespace. */ I don't think you mean "parents" here - isn't it children instead? > + namespace = alloca (scope_len + 1); > + strncpy (namespace, scope, scope_len); > + namespace[scope_len] = '\0'; > + return cp_lookup_symbol_namespace (namespace, name, linkage_name, > + block, domain, symtab); > +} > +/* Look up NAME in BLOCK's static block and in global blocks. If > + ANONYMOUS_NAMESPACE is nonzero, don't look in other files' global > + blocks, just in the one belonging to this file. */ Hmm, would you mind breaking this up into two comments? One before the function which says what ANONYMOUS_NAMESPACE means, and one in the function which describes what it does. Also, you're only documenting three of the six arguments to this function. Similarly for a lot of the other functions. Aside from comment corrections, if your previous patch is approved this one is also. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer