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] [RFC] python: gdb.Type: strip typedefs past pointers too


> 1) I drafted a patch (pasted below this message) that works around this
> limitation:

Personally, I think that the current behavior is correct.  But I did
not participate in the design of the API, so others will probably
have a more informed opinion.

If we want to support the behavior you are looking for, I think it
should be done either through the control of a parameter (defaulted
to current behavior), or another method (recursive_strip_typedef).

> +  while (TYPE_CODE (real_type) == TYPE_CODE_PTR ||
> +	 TYPE_CODE (real_type) == TYPE_CODE_TYPEDEF)

Small nit on the coding style: the `||' should be at the beginning
of the next line:

        while (TYPE_CODE (real_type) == TYPE_CODE_PTR
               || TYPE_CODE (real_type) == TYPE_CODE_TYPEDEF)

(how about references?)

> +      if (TYPE_CODE (real_type) == TYPE_CODE_TYPEDEF)
> +	{
> +	  CHECK_TYPEDEF (real_type);
> +	}

When there is only one statement in the block, the prefered style
in GDB is to omit the curly braces:

      if (TYPE_CODE (real_type) == TYPE_CODE_TYPEDEF)
	CHECK_TYPEDEF (real_type);

-- 
Joel


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