Commit db376f45 by Eric Botcazou Committed by Eric Botcazou

c-parser.c (c_parser_declaration_or_fndef): Set DECL_ARGUMENTS of a…

c-parser.c (c_parser_declaration_or_fndef): Set DECL_ARGUMENTS of a FUNCTION_DECL to the right value in the presence of...

	* c-parser.c (c_parser_declaration_or_fndef): Set DECL_ARGUMENTS of a
	FUNCTION_DECL to the right value in the presence of nested declarators.

From-SVN: r274828
parent 943766d3
2019-08-22 Eric Botcazou <ebotcazou@adacore.com>
* c-parser.c (c_parser_declaration_or_fndef): Set DECL_ARGUMENTS of a
FUNCTION_DECL to the right value in the presence of nested declarators.
2019-08-13 Richard Sandiford <richard.sandiford@arm.com> 2019-08-13 Richard Sandiford <richard.sandiford@arm.com>
PR middle-end/91421 PR middle-end/91421
......
...@@ -2161,10 +2161,41 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, ...@@ -2161,10 +2161,41 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
all_prefix_attrs)); all_prefix_attrs));
if (d if (d
&& TREE_CODE (d) == FUNCTION_DECL && TREE_CODE (d) == FUNCTION_DECL
&& declarator->kind == cdk_function
&& DECL_ARGUMENTS (d) == NULL_TREE && DECL_ARGUMENTS (d) == NULL_TREE
&& DECL_INITIAL (d) == NULL_TREE) && DECL_INITIAL (d) == NULL_TREE)
DECL_ARGUMENTS (d) = declarator->u.arg_info->parms; {
/* Find the innermost declarator that is neither cdk_id
nor cdk_attrs. */
const struct c_declarator *decl = declarator;
const struct c_declarator *last_non_id_attrs = NULL;
while (decl)
switch (decl->kind)
{
case cdk_array:
case cdk_function:
case cdk_pointer:
last_non_id_attrs = decl;
decl = decl->declarator;
break;
case cdk_attrs:
decl = decl->declarator;
break;
case cdk_id:
decl = 0;
break;
default:
gcc_unreachable ();
}
/* If it exists and is cdk_function, use its parameters. */
if (last_non_id_attrs
&& last_non_id_attrs->kind == cdk_function)
DECL_ARGUMENTS (d) = last_non_id_attrs->u.arg_info->parms;
}
if (omp_declare_simd_clauses.exists ()) if (omp_declare_simd_clauses.exists ())
{ {
tree parms = NULL_TREE; tree parms = NULL_TREE;
......
2019-08-22 Eric Botcazou <ebotcazou@adacore.com>
* c-c++-common/dump-ada-spec-15.c: Check that the parameters are named.
2019-08-22 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2019-08-22 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.target/arm/acle/crc_hf_1.c: New test. * gcc.target/arm/acle/crc_hf_1.c: New test.
......
...@@ -3,4 +3,6 @@ ...@@ -3,4 +3,6 @@
extern void (*signal (int __sig, void (*__handler)(int)))(int); extern void (*signal (int __sig, void (*__handler)(int)))(int);
/* { dg-final { scan-ada-spec "uu_sig" } } */
/* { dg-final { scan-ada-spec "uu_handler" } } */
/* { dg-final { cleanup-ada-spec } } */ /* { dg-final { cleanup-ada-spec } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment