From ceef8ce4b43a36a75e3c7df8a8696866fc398a56 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Mon, 1 Apr 2002 08:46:10 +0000 Subject: c-common.c (unsigned_conversion_warning, [...]): Use new hooks. * c-common.c (unsigned_conversion_warning, convert_and_check, unsigned_type, signed_type, shorten_compare, c_common_get_alias_set, c_common_nodes_and_builtins): Use new hooks. (unsigned_type, signed_type, signed_or_unsigned_type): Rename. * c-common.h (unsigned_type, signed_type, signed_or_unsigned_type): New. * c-decl.c (grokdeclarator): Update. * c-format.c (check_format_types): Update. * c-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New. * c-typeck.c (build_binary_op, convert_for_assignment): Update. * convert.c (convert_to_integer): Use new hooks. * expmed.c (make_tree): Use new hooks. * expr.c (store_expr): Use new hooks. * fold-const.c (operand_equal_for_comparison_p, build_range_check, all_ones_mask_p, unextend, fold): Use new hooks. * langhooks.h (struct lang_hooks_for_types): New hooks. * tree.h (signed_or_unsigned_type, signed_type, unsigned_type): Remove. ada: * gigi.h (unsigned_type, signed_type, signed_or_unsigned_type): Rename. * misc.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New. * trans.c (tree_transform, convert_with_check): Update. * utils.c (unsigned_type, signed_type, signed_or_unsigned_type): Rename. cp: * cp-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New. * decl.c (grokdeclarator): Update. * mangle.c (write_integer_cst): Update. * typeck.c (build_binary_op): Update. f: * com.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New. (unsigned_type, signed_type, signed_or_unsigned_type): Rename. java: * expr.c (build_java_binop): Update. * java-tree.h (java_signed_type, java_unsigned_type, java_signed_or_unsigned_type): Update. * lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New. * parse.y (patch_binop): Update. * typeck.c (signed_or_unsigned_type, unsigned_type, signed_type): Update. objc: * objc-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New. From-SVN: r51684 --- gcc/convert.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'gcc/convert.c') diff --git a/gcc/convert.c b/gcc/convert.c index 25aae57..970b05c 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -316,10 +316,12 @@ convert_to_integer (type, expr) unsigned then can safely do the work as unsigned. And we may need to do it as unsigned if we truncate to the original size. */ - typex = ((TREE_UNSIGNED (TREE_TYPE (expr)) - || (TREE_UNSIGNED (TREE_TYPE (arg0)) - && TREE_UNSIGNED (TREE_TYPE (arg1)))) - ? unsigned_type (typex) : signed_type (typex)); + if (TREE_UNSIGNED (TREE_TYPE (expr)) + || (TREE_UNSIGNED (TREE_TYPE (arg0)) + && TREE_UNSIGNED (TREE_TYPE (arg1)))) + typex = (*lang_hooks.types.unsigned_type) (typex); + else + typex = (*lang_hooks.types.signed_type) (typex); return convert (type, fold (build (ex_form, typex, convert (typex, arg0), @@ -350,8 +352,10 @@ convert_to_integer (type, expr) { /* Don't do unsigned arithmetic where signed was wanted, or vice versa. */ - typex = (TREE_UNSIGNED (TREE_TYPE (expr)) - ? unsigned_type (typex) : signed_type (typex)); + if (TREE_UNSIGNED (TREE_TYPE (expr))) + typex = (*lang_hooks.types.unsigned_type) (typex); + else + typex = (*lang_hooks.types.signed_type) (typex); return convert (type, fold (build1 (ex_form, typex, convert (typex, -- cgit v1.1