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 1/6] Remove OP_LABELED.


On 11/01/2012 07:46 AM, Yao Qi wrote:
>  
> -/* Used to represent named structure field values in brace
> -   initializers (or tuples as they are called in (the deleted)
> -   Chill).
> -
> -   The gcc C syntax is NAME:VALUE or .NAME=VALUE, the (the
> -   deleted) Chill syntax is .NAME:VALUE.  Multiple labels (as in
> -   the (the deleted) Chill syntax .NAME1,.NAME2:VALUE) is
> -   represented as if it were .NAME1:(.NAME2:VALUE) (though that is
> -   not valid (the deleted) Chill syntax).

I found this mention of C syntax curious, and tried it, to see if
we're implementing that in some other way, perhaps.  It seems to be
talking about designated initializers
(<http://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html>,
at least the .NAME=VALUE variant).  Doesn't work unfortunately:

(debug gdb, and run to main)

(top-gdb) p args
$1 = {argc = 8450672, argv = 0x457990 <_start>, use_windows = -9104, interpreter_p = 0x0}
(top-gdb) p args = {0}
$2 = {argc = 0, argv = 0x0, use_windows = 0, interpreter_p = 0x0}
(top-gdb) p args = {1, 0}
$3 = {argc = 1, argv = 0x0, use_windows = 0, interpreter_p = 0x0}
(top-gdb) p args = {.argc = 1, 0}
A syntax error in expression, near `.argc = 1, 0}'.

Seems like something we should/could support.  I'll file a PR, unless I
missed something.

I have no idea if the OP_LABELED implementation was a good basis for this
or not.

> -
> -   The NAME is represented as for STRUCTOP_STRUCT;  VALUE follows.  */
> -OP (OP_LABELED)
> -


-- 
Pedro Alves


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