[PATCH 2/2] namespace support

Tom Tromey tromey@redhat.com
Fri Jun 5 21:20:00 GMT 2009


>>>>> "Sami" == Sami Wagiaalla <swagiaal@redhat.com> writes:

Sami> Import data structure ( struct using_direct) is limited to
Sami> representing import statements where the destination is a parent
Sami> of the source (true for anonymous namespaces). This patch removes
Sami> this limitation, allowing each import to represent independent
Sami> import source and destination.

Thanks.

Aside from some nits this looks pretty good.

Is this just a "technical" patch?  Or does it enable some new
user-visible functionality?  The former is fine, but if it is the
latter, how about a test case?

Sami> +	* dwarf2read.c (read_import_statement): Properly set import location
Sami> +	and destenation.

Typo, should be "destination".

Sami> +	* cp-support.h (cp_add_using, cp_add_using_directive): Now take char*
Sami> +	inner, char* outer arguments. Updated callers.

I suppose these arguments ought to be renamed, now that you have
renamed the struct fields...

Sami> +	      char outer[outer_len+1];

We can't use VLAs in gdb.  Instead, use alloca.

Also, just FYI, the GNU coding style requires spaces around that "+".

Sami> +	      strncpy(outer, name, outer_len);

Space before open paren.

Sami> -	      cp_add_using_directive (name,
Sami> -				      previous_component == 0
Sami> -				      ? 0 : previous_component - 2,
Sami> -				      next_component);
Sami> +	      cp_add_using_directive (outer, name);

Do we know for sure that NAME is \0-terminated here?
It needs to be due to the change to cp_add_using_directive.

Sami> +  /* Figure out where the statement is being imported to */

Comment should be a sentence.

Sami> +  /*
Sami> +   Figure out what the scope of the imported die is and prepend it
Sami> +   to the name of the imported die
Sami> +   */

Ditto; also the formatting is wrong: no newline after the first * or
before the last *.

Sami> +  if(strlen (imported_name_prefix) > 0){

Wrong brace placement.

Tom



More information about the Gdb-patches mailing list