From 27e647a5cc7f53f55408c0013e009accd0add5e5 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Sat, 19 May 2001 20:19:24 +0000 Subject: [PATCH] * c-parse.in (parm_declarator): Split into parm_declarator_starttypename and parm_declarator_nostarttypename. (parm_declarator_starttypename, parm_declarator_nostarttypename): New. Allow parenthesised sub-declarators which don't begin with a TYPENAME. Fixes PR c/166. testsuite: * gcc.c-torture/compile/20010114-1.x: Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42315 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 +++++ gcc/c-parse.in | 44 +++++++++++++++++++----- gcc/testsuite/ChangeLog | 4 +++ gcc/testsuite/gcc.c-torture/compile/20010114-1.x | 2 -- 4 files changed, 48 insertions(+), 10 deletions(-) delete mode 100644 gcc/testsuite/gcc.c-torture/compile/20010114-1.x diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 64a0c14..b55e0e7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2001-05-19 Joseph S. Myers + + * c-parse.in (parm_declarator): Split into + parm_declarator_starttypename and parm_declarator_nostarttypename. + (parm_declarator_starttypename, parm_declarator_nostarttypename): + New. Allow parenthesised sub-declarators which don't begin with a + TYPENAME. Fixes PR c/166. + 2001-05-19 Mark Mitchell * defaults.h (TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER): New diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 3eda45c..3a1c17e 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -197,6 +197,7 @@ end ifc %type declarator %type notype_declarator after_type_declarator %type parm_declarator +%type parm_declarator_starttypename parm_declarator_nostarttypename %type structsp_attr structsp_nonattr %type component_decl_list component_decl_list2 @@ -1683,29 +1684,56 @@ end ifobjc in addition to notype_declarator. This is like after_type_declarator but does not allow a typedef name in parentheses as an identifier (because it would conflict with a function with that typedef as arg). */ - parm_declarator: - parm_declarator '(' parmlist_or_identifiers %prec '.' + parm_declarator_starttypename + | parm_declarator_nostarttypename + ; + +parm_declarator_starttypename: + parm_declarator_starttypename '(' parmlist_or_identifiers %prec '.' { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); } -/* | parm_declarator '(' error ')' %prec '.' +/* | parm_declarator_starttypename '(' error ')' %prec '.' { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE); poplevel (0, 0, 0); } */ ifc - | parm_declarator '[' '*' ']' %prec '.' + | parm_declarator_starttypename '[' '*' ']' %prec '.' { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); if (! flag_isoc99) error ("`[*]' in parameter declaration only allowed in ISO C 99"); } end ifc - | parm_declarator '[' expr ']' %prec '.' + | parm_declarator_starttypename '[' expr ']' %prec '.' { $$ = build_nt (ARRAY_REF, $1, $3); } - | parm_declarator '[' ']' %prec '.' + | parm_declarator_starttypename '[' ']' %prec '.' { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); } - | '*' maybe_type_quals_setattrs parm_declarator %prec UNARY - { $$ = make_pointer_declarator ($2, $3); } | TYPENAME ; +parm_declarator_nostarttypename: + parm_declarator_nostarttypename '(' parmlist_or_identifiers %prec '.' + { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); } +/* | parm_declarator_nostarttypename '(' error ')' %prec '.' + { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE); + poplevel (0, 0, 0); } */ +ifc + | parm_declarator_nostarttypename '[' '*' ']' %prec '.' + { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); + if (! flag_isoc99) + error ("`[*]' in parameter declaration only allowed in ISO C 99"); + } +end ifc + | parm_declarator_nostarttypename '[' expr ']' %prec '.' + { $$ = build_nt (ARRAY_REF, $1, $3); } + | parm_declarator_nostarttypename '[' ']' %prec '.' + { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); } + | '*' maybe_type_quals_setattrs parm_declarator_starttypename %prec UNARY + { $$ = make_pointer_declarator ($2, $3); } + | '*' maybe_type_quals_setattrs parm_declarator_nostarttypename %prec UNARY + { $$ = make_pointer_declarator ($2, $3); } + | '(' maybe_setattrs parm_declarator_nostarttypename ')' + { $$ = $3; } + ; + /* A declarator allowed whether or not there has been an explicit typespec. These cannot redeclare a typedef-name. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fabd9e6..ac40b14 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-05-19 Joseph S. Myers + + * gcc.c-torture/compile/20010114-1.x: Remove. + 2001-05-18 Stan Shebs * gcc.c-torture/compile/20010518-1.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/20010114-1.x b/gcc/testsuite/gcc.c-torture/compile/20010114-1.x deleted file mode 100644 index f41cdc2..0000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010114-1.x +++ /dev/null @@ -1,2 +0,0 @@ -set torture_compile_xfail "*-*-*" -return 0 -- 2.7.4