summaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 0c05b2438b9..2aa018faf58 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -4202,6 +4202,7 @@ grokdeclarator (const struct c_declarator *declarator,
bool bitfield = width != NULL;
tree element_type;
struct c_arg_info *arg_info = 0;
+ const char *errmsg;
tree expr_dummy;
bool expr_const_operands_dummy;
@@ -4835,6 +4836,12 @@ grokdeclarator (const struct c_declarator *declarator,
error ("type name declared as function returning an array");
type = integer_type_node;
}
+ errmsg = targetm.invalid_return_type (type);
+ if (errmsg)
+ {
+ error (errmsg);
+ type = integer_type_node;
+ }
/* Construct the function type and go to the next
inner layer of declarator. */
@@ -5381,6 +5388,7 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
{
tree parm, type, typelt;
unsigned int parmno;
+ const char *errmsg;
/* If there is a parameter of incomplete type in a definition,
this is an error. In a declaration this is valid, and a
@@ -5424,6 +5432,14 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
}
}
+ errmsg = targetm.invalid_parameter_type (type);
+ if (errmsg)
+ {
+ error (errmsg);
+ TREE_VALUE (typelt) = error_mark_node;
+ TREE_TYPE (parm) = error_mark_node;
+ }
+
if (DECL_NAME (parm) && TREE_USED (parm))
warn_if_shadowing (parm);
}