This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] PR 11530: Fix and test case
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 30 Apr 2010 10:19:59 +0200
- Subject: Re: [RFA] PR 11530: Fix and test case
- References: <001b01cae7e5$f46d47d0$dd47d770$@muller@ics-cnrs.unistra.fr>
On Thu, 29 Apr 2010 23:50:15 +0200, Pierre Muller wrote:
> --- src/gdb/gdbtypes.c 21 Apr 2010 23:21:03 -0000 1.189
> +++ src/gdb/gdbtypes.c 29 Apr 2010 21:23:35 -0000
> @@ -1246,6 +1246,13 @@ lookup_struct_elt_type (struct type *typ
> {
> return TYPE_FIELD_TYPE (type, i);
> }
> + else if (!t_field_name || *t_field_name == '\0')
> + {
> + struct type *subtype = lookup_struct_elt_type (
> + TYPE_FIELD_TYPE (type, i), name, 1);
IMO
struct type *subtype;
subtype = lookup_struct_elt_type TYPE_FIELD_TYPE (type, i), name, 1);
> + if (subtype != NULL)
> + return subtype;
> + }
> }
I was now thinking about a possible name clash. As these anonymous
structs/unions are a GNU extension there is no offical standard for it but the
GCC texinfo file describes it as an error which GCC currently does not report.
I have not found a GCC PR for it.
------------------------------------------------------------------------------
(gcc)Unnamed Fields
You must never create such structures that cause ambiguous field
definitions. For example, this structure:
struct {
int a;
struct {
int a;
};
} foo;
It is ambiguous which `a' is being referred to with `foo.a'. Such
constructs are not supported and must be avoided. In the future, such
constructs may be detected and treated as compilation errors.
------------------------------------------------------------------------------
> +struct a
> + {
> + union
> + {
> + int i;
> + };
> + } a;
Possibly to test also `struct' there to get better test coverage.
> +if { ![runto main] } then {
runto_main
But I do not understand how those embedded remote stubs work.
Thanks,
Jan