summaryrefslogtreecommitdiff
path: root/gdb/c-exp.y
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-07-06 14:48:47 +0000
committerTom Tromey <tromey@redhat.com>2012-07-06 14:48:47 +0000
commitd479bbcb47a1dacba22919cfdb47db696e95f932 (patch)
treee9f368fff99394ed52fd0cccd83633913f6cd850 /gdb/c-exp.y
parent484118c3151e97ad0207fe6a6f35438e64d3c65a (diff)
downloadgdb-d479bbcb47a1dacba22919cfdb47db696e95f932.tar.gz
* 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.y20
1 files changed, 16 insertions, 4 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 8890f74555f..14fd53d232b 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[] =