Re: [patch 2/2] Perform a namespace lookup at every block level

Tom Tromey
2009-11-10T22:52:52Z

>>>>> "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