aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2002-04-01 08:46:10 +0000
committerNeil Booth <neil@gcc.gnu.org>2002-04-01 08:46:10 +0000
commitceef8ce4b43a36a75e3c7df8a8696866fc398a56 (patch)
treea06146fa6279ee4373ef4b809f8c3aedca99fb3f /gcc/cp
parentc7a39ea995852db80b150e9b24c68f56461aff6d (diff)
downloadgcc-ceef8ce4b43a36a75e3c7df8a8696866fc398a56.zip
gcc-ceef8ce4b43a36a75e3c7df8a8696866fc398a56.tar.gz
gcc-ceef8ce4b43a36a75e3c7df8a8696866fc398a56.tar.bz2
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
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/cp-lang.c6
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/cp/mangle.c2
-rw-r--r--gcc/cp/typeck.c26
5 files changed, 28 insertions, 16 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3f81db3..024176e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2002-04-01 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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.
+
2002-03-31 Neil Booth <neil@daikokuya.demon.co.uk>
* cp-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Redefine.
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index 28d3add..b330fd1 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -119,6 +119,12 @@ static bool ok_to_generate_alias_set_for_type PARAMS ((tree));
#define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
#undef LANG_HOOKS_TYPE_FOR_SIZE
#define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size
+#undef LANG_HOOKS_SIGNED_TYPE
+#define LANG_HOOKS_SIGNED_TYPE c_common_signed_type
+#undef LANG_HOOKS_UNSIGNED_TYPE
+#define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type
+#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
+#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type
/* Each front end provides its own hooks, for toplev.c. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 8ba011e..e708a6d 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10325,7 +10325,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
else if (type == char_type_node)
type = unsigned_char_type_node;
else if (typedef_decl)
- type = unsigned_type (type);
+ type = c_common_unsigned_type (type);
else
type = unsigned_type_node;
}
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 1a1c995..88461e2 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1111,7 +1111,7 @@ write_integer_cst (cst)
chunk *= chunk;
}
- type = signed_or_unsigned_type (1, TREE_TYPE (cst));
+ type = c_common_signed_or_unsigned_type (1, TREE_TYPE (cst));
base = build_int_2 (chunk, 0);
n = build_int_2 (TREE_INT_CST_LOW (cst), TREE_INT_CST_HIGH (cst));
TREE_TYPE (n) = TREE_TYPE (base) = type;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 1a575f2..a68f4a2 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -3782,24 +3782,22 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
== TYPE_PRECISION (TREE_TYPE (arg0)))
&& unsigned0 == unsigned1
&& (unsigned0 || !uns))
- result_type
- = signed_or_unsigned_type (unsigned0,
- common_type (TREE_TYPE (arg0),
- TREE_TYPE (arg1)));
+ result_type = c_common_signed_or_unsigned_type
+ (unsigned0, common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)));
else if (TREE_CODE (arg0) == INTEGER_CST
&& (unsigned1 || !uns)
&& (TYPE_PRECISION (TREE_TYPE (arg1))
< TYPE_PRECISION (result_type))
- && (type = signed_or_unsigned_type (unsigned1,
- TREE_TYPE (arg1)),
+ && (type = c_common_signed_or_unsigned_type
+ (unsigned1, TREE_TYPE (arg1)),
int_fits_type_p (arg0, type)))
result_type = type;
else if (TREE_CODE (arg1) == INTEGER_CST
&& (unsigned0 || !uns)
&& (TYPE_PRECISION (TREE_TYPE (arg0))
< TYPE_PRECISION (result_type))
- && (type = signed_or_unsigned_type (unsigned0,
- TREE_TYPE (arg0)),
+ && (type = c_common_signed_or_unsigned_type
+ (unsigned0, TREE_TYPE (arg0)),
int_fits_type_p (arg1, type)))
result_type = type;
}
@@ -3834,8 +3832,8 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
{
/* Do an unsigned shift if the operand was zero-extended. */
result_type
- = signed_or_unsigned_type (unsigned_arg,
- TREE_TYPE (arg0));
+ = c_common_signed_or_unsigned_type (unsigned_arg,
+ TREE_TYPE (arg0));
/* Convert value-to-be-shifted to that type. */
if (TREE_TYPE (op0) != result_type)
op0 = cp_convert (result_type, op0);
@@ -3908,11 +3906,11 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
not use the most significant bit of result_type. */
else if ((resultcode == EQ_EXPR || resultcode == NE_EXPR)
&& ((op0_signed && TREE_CODE (orig_op1) == INTEGER_CST
- && int_fits_type_p (orig_op1,
- signed_type (result_type)))
+ && int_fits_type_p (orig_op1, c_common_signed_type
+ (result_type)))
|| (op1_signed && TREE_CODE (orig_op0) == INTEGER_CST
- && int_fits_type_p (orig_op0,
- signed_type (result_type)))))
+ && int_fits_type_p (orig_op0, c_common_signed_type
+ (result_type)))))
/* OK */;
else
warning ("comparison between signed and unsigned integer expressions");