aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cvt.c
diff options
context:
space:
mode:
authorSandra Loosemore <sandra@codesourcery.com>2009-05-20 23:06:12 -0400
committerSandra Loosemore <sandra@gcc.gnu.org>2009-05-20 23:06:12 -0400
commit40449a90d7701eb70b5ccecb0f05290d442983e9 (patch)
tree09231bb5a5f48721cdd7033ca7c944b29771f3cf /gcc/cp/cvt.c
parentd29d4507b20843bca8000bb9ebeeff3637dd31ba (diff)
downloadgcc-40449a90d7701eb70b5ccecb0f05290d442983e9.zip
gcc-40449a90d7701eb70b5ccecb0f05290d442983e9.tar.gz
gcc-40449a90d7701eb70b5ccecb0f05290d442983e9.tar.bz2
tm.texi (Misc): Document TARGET_INVALID_PARAMETER_TYPE...
2009-05-20 Sandra Loosemore <sandra@codesourcery.com> 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
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r--gcc/cp/cvt.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 3fdebd7..daf145f 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -581,6 +581,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
tree e = expr;
enum tree_code code = TREE_CODE (type);
const char *invalid_conv_diag;
+ tree e1;
if (error_operand_p (e) || type == error_mark_node)
return error_mark_node;
@@ -629,6 +630,10 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
}
}
+ e1 = targetm.convert_to_type (type, e);
+ if (e1)
+ return e1;
+
if (code == VOID_TYPE && (convtype & CONV_STATIC))
{
e = convert_to_void (e, /*implicit=*/NULL, tf_warning_or_error);
@@ -1251,11 +1256,18 @@ build_expr_type_conversion (int desires, tree expr, bool complain)
tree
type_promotes_to (tree type)
{
+ tree promoted_type;
+
if (type == error_mark_node)
return error_mark_node;
type = TYPE_MAIN_VARIANT (type);
+ /* Check for promotions of target-defined types first. */
+ promoted_type = targetm.promoted_type (type);
+ if (promoted_type)
+ return promoted_type;
+
/* bool always promotes to int (not unsigned), even if it's the same
size. */
if (type == boolean_type_node)