From: Daniel Jacobowitz <drow@mvista.com>
To: David Carlton <carlton@bactrian.org>
Cc: gdb-patches@sources.redhat.com, Elena Zannoni <ezannoni@redhat.com>
Subject: Re: [rfa] namespace scope, take 2
Date: Mon, 19 May 2003 14:45:00 -0000 [thread overview]
Message-ID: <20030519144508.GA25940@nevyn.them.org> (raw)
In-Reply-To: <m3addjyicq.fsf@papaya.bactrian.org>
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
next prev parent reply other threads:[~2003-05-19 14:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-18 22:56 David Carlton
2003-05-19 14:45 ` Daniel Jacobowitz [this message]
2003-05-20 3:57 ` David Carlton
2003-05-20 22:55 ` David Carlton
2003-05-19 15:18 ` Elena Zannoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030519144508.GA25940@nevyn.them.org \
--to=drow@mvista.com \
--cc=carlton@bactrian.org \
--cc=ezannoni@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox