From 40449a90d7701eb70b5ccecb0f05290d442983e9 Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Wed, 20 May 2009 23:06:12 -0400 Subject: tm.texi (Misc): Document TARGET_INVALID_PARAMETER_TYPE... 2009-05-20 Sandra Loosemore gcc/ * doc/tm.texi (Misc): Document TARGET_INVALID_PARAMETER_TYPE, TARGET_INVALID_RETURN_TYPE, TARGET_PROMOTED_TYPE, and TARGET_CONVERT_TO_TYPE. * hooks.c (hook_tree_const_tree_null): Define. * hooks.h (hook_tree_const_tree_null): Declare. * target.h (struct gcc_target): Add invalid_parameter_type, invalid_return_type, promoted_type, and convert_to_type fields. * target-def.h: (TARGET_INVALID_PARAMETER_TYPE): Define. (TARGET_INVALID_RETURN_TYPE): Define. (TARGET_PROMOTED_TYPE): Define. (TARGET_CONVERT_TO_TYPE): Define. (TARGET_INITIALIZER): Update for new fields. * c-decl.c (grokdeclarator): Check targetm.invalid_return_type. (grokparms): Check targetm.invalid_parameter_type. * c-typeck.c (default_conversion): Check targetm.promoted_type. * c-convert.c (convert): Check targetm.convert_to_type. gcc/cp/ * typeck.c (default_conversion): Check targetm.promoted_type. * decl.c (grokdeclarator): Check targetm.invalid_return_type. (grokparms): Check targetm.invalid_parameter_type. * cvt.c (ocp_convert): Check targetm.convert_to_type. (build_expr_type_conversion): Check targetm.promoted_type. From-SVN: r147758 --- gcc/cp/decl.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gcc/cp/decl.c') diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e9ff87b..433d089 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7606,6 +7606,7 @@ grokdeclarator (const cp_declarator *declarator, bool parameter_pack_p = declarator? declarator->parameter_pack_p : false; bool set_no_warning = false; bool template_type_arg = false; + const char *errmsg; signed_p = declspecs->specs[(int)ds_signed]; unsigned_p = declspecs->specs[(int)ds_unsigned]; @@ -8285,6 +8286,12 @@ grokdeclarator (const cp_declarator *declarator, type_quals = TYPE_UNQUALIFIED; set_no_warning = true; } + errmsg = targetm.invalid_return_type (type); + if (errmsg) + { + error (errmsg); + type = integer_type_node; + } /* Error about some types functions can't return. */ @@ -9677,6 +9684,7 @@ grokparms (tree parmlist, tree *parms) tree type = NULL_TREE; tree init = TREE_PURPOSE (parm); tree decl = TREE_VALUE (parm); + const char *errmsg; if (parm == void_list_node) break; @@ -9710,6 +9718,14 @@ grokparms (tree parmlist, tree *parms) init = NULL_TREE; } + if (type != error_mark_node + && (errmsg = targetm.invalid_parameter_type (type))) + { + error (errmsg); + type = error_mark_node; + TREE_TYPE (decl) = error_mark_node; + } + if (type != error_mark_node) { if (deprecated_state != DEPRECATED_SUPPRESS) -- cgit v1.1