This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]