aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRafael Espindola <espindola@gcc.gnu.org>2007-06-11 15:40:55 +0000
committerRafael Espindola <espindola@gcc.gnu.org>2007-06-11 15:40:55 +0000
commit12753674ec3e75275eca8b704c36d6dc3762ade6 (patch)
tree09e966f66888827cc56e0e29aacd33c5d45e7819 /gcc/tree.c
parent73fd4ad6cd12dbb4ba0fbcf4e7fa11d22fd05ea3 (diff)
downloadgcc-12753674ec3e75275eca8b704c36d6dc3762ade6.zip
gcc-12753674ec3e75275eca8b704c36d6dc3762ade6.tar.gz
gcc-12753674ec3e75275eca8b704c36d6dc3762ade6.tar.bz2
really remove signed(_or_unsigned)?_type langhooks
From-SVN: r125621
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 2d96bd7..2560c8f 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -7730,13 +7730,21 @@ int_cst_value (tree x)
return val;
}
+/* If TYPE is an integral type, return an equivalent type which is
+ unsigned iff UNSIGNEDP is true. If TYPE is not an integral type,
+ return TYPE itself. */
-/* Return an unsigned type the same as TYPE in other respects. */
-
-static tree
-get_unsigned_type (tree type)
+tree
+signed_or_unsigned_type_for (int unsignedp, tree type)
{
- return get_signed_or_unsigned_type (1, type);
+ tree t = type;
+ if (POINTER_TYPE_P (type))
+ t = size_type_node;
+
+ if (!INTEGRAL_TYPE_P (t) || TYPE_UNSIGNED (t) == unsignedp)
+ return t;
+
+ return lang_hooks.types.type_for_size (TYPE_PRECISION (t), unsignedp);
}
/* Returns unsigned variant of TYPE. */
@@ -7744,9 +7752,7 @@ get_unsigned_type (tree type)
tree
unsigned_type_for (tree type)
{
- if (POINTER_TYPE_P (type))
- return get_unsigned_type (size_type_node);
- return get_unsigned_type (type);
+ return signed_or_unsigned_type_for (1, type);
}
/* Returns signed variant of TYPE. */
@@ -7754,9 +7760,7 @@ unsigned_type_for (tree type)
tree
signed_type_for (tree type)
{
- if (POINTER_TYPE_P (type))
- return lang_hooks.types.signed_type (size_type_node);
- return lang_hooks.types.signed_type (type);
+ return signed_or_unsigned_type_for (0, type);
}
/* Returns the largest value obtainable by casting something in INNER type to