diff options
author | Tom Tromey <tromey@redhat.com> | 2012-07-06 14:48:48 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-07-06 14:48:48 +0000 |
commit | a6fb9c08a9ac65df98ca8829f43083feda19a6fe (patch) | |
tree | 6bda910f53fe801f12d20dd438c721c60ad7bd79 /gdb/c-exp.y | |
parent | 71918a863fdc11435a0f47a1b3e49bfdf44f6ef5 (diff) | |
download | binutils-a6fb9c08a9ac65df98ca8829f43083feda19a6fe.zip binutils-a6fb9c08a9ac65df98ca8829f43083feda19a6fe.tar.gz binutils-a6fb9c08a9ac65df98ca8829f43083feda19a6fe.tar.bz2 |
* c-exp.y (DOTDOTDOT): New token.
(func_mod, exp): Use parameter_typelist.
(parameter_typelist): New production.
(tokentab3): Add "..." token.
* eval.c (make_params): Handle varargs.
* gdbtypes.c (lookup_function_type_with_arguments): Handle
varargs.
testsuite
* gdb.base/whatis.exp: Add test.
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r-- | gdb/c-exp.y | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 8890f74..14fd53d 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -170,7 +170,7 @@ static struct stoken operator_stoken (const char *); %type <voidval> exp exp1 type_exp start variable qualified_name lcurly %type <lval> rcurly %type <tval> type typebase -%type <tvec> nonempty_typelist func_mod +%type <tvec> nonempty_typelist func_mod parameter_typelist /* %type <bval> block */ /* Fancy type parsing. */ @@ -254,6 +254,8 @@ static struct stoken operator_stoken (const char *); %type <bval> block %left COLONCOLON +%token DOTDOTDOT + %% @@ -440,7 +442,7 @@ arglist : arglist ',' exp %prec ABOVE_COMMA { arglist_len++; } ; -exp : exp '(' nonempty_typelist ')' const_or_volatile +exp : exp '(' parameter_typelist ')' const_or_volatile { int i; VEC (type_ptr) *type_list = $3; struct type *type_elt; @@ -1025,7 +1027,7 @@ array_mod: '[' ']' func_mod: '(' ')' { $$ = NULL; } - | '(' nonempty_typelist ')' + | '(' parameter_typelist ')' { $$ = $2; } ; @@ -1223,6 +1225,15 @@ typename: TYPENAME } ; +parameter_typelist: + nonempty_typelist + | nonempty_typelist ',' DOTDOTDOT + { + VEC_safe_push (type_ptr, $1, NULL); + $$ = $1; + } + ; + nonempty_typelist : type { @@ -1942,7 +1953,8 @@ static const struct token tokentab3[] = { {">>=", ASSIGN_MODIFY, BINOP_RSH, 0}, {"<<=", ASSIGN_MODIFY, BINOP_LSH, 0}, - {"->*", ARROW_STAR, BINOP_END, 1} + {"->*", ARROW_STAR, BINOP_END, 1}, + {"...", DOTDOTDOT, BINOP_END, 0} }; static const struct token tokentab2[] = |