This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch 2/2] Perform a namespace lookup at every block level
- From: Tom Tromey <tromey at redhat dot com>
- To: Sami Wagiaalla <swagiaal at redhat dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>
- Date: Tue, 10 Nov 2009 15:52:43 -0700
- Subject: Re: [patch 2/2] Perform a namespace lookup at every block level
- References: <4A57512A.7090208@redhat.com> <20090710194949.GA2064@caradoc.them.org> <4A5B68A4.30006@redhat.com> <4A68B91D.2080206@redhat.com> <4A8B0FD9.7010603@redhat.com> <4AA14648.7090600@redhat.com> <m3iqejjb7a.fsf@fleche.redhat.com> <4AE09A10.9040703@redhat.com>
- Reply-to: tromey at redhat dot com
>>>>> "Sami" == Sami Wagiaalla <swagiaal@redhat.com> writes:
Sami> + directive_match = search_parents
Sami> + ? strncmp (scope, current->import_dest,
Sami> + strlen(current->import_dest)) == 0
Sami> + : strcmp (scope, current->import_dest) == 0;
In the GNU style a multi-line expression like this has to be surrounded
by parens. Put one before 'search_parents' and then another before ';'.
Also this is missing a space after 'strlen'.
Sami> + /* Mark this import as searched so that the recursive call does not
Sami> + search it again. */
Sami> + current->searched = 1;
Sami> + sym = cp_lookup_symbol_namespace (current->import_src,
Sami> + name,
Sami> + linkage_name,
Sami> + block,
Sami> + domain,
Sami> + 0);
Sami> +
Sami> + current->searched = 0;
If cp_lookup_symbol_namespace can throw an exception, then it can leave
the wrong setting of 'searched' here.
I don't know whether cp_lookup_symbol_namespace can in fact throw, but I
tend to assume that most things in GDB can and defensively use cleanups.
Do the new tests include a case which exercises this?
Sami> diff --git a/gdb/testsuite/gdb.cp/namespace-recursive.exp b/gdb/testsuite/gdb.cp/namespace-recursive.exp
Sami> + return -1;
s/;//
Sami> diff --git a/gdb/testsuite/gdb.cp/namespace-stress.exp b/gdb/testsuite/gdb.cp/namespace-stress.exp
Sami> + return -1;
Likewise.
Tom