aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.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/c-common.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/c-common.c')
-rw-r--r--gcc/c-common.c45
1 files changed, 12 insertions, 33 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index f17bb7f..ccbc479 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1342,7 +1342,7 @@ warnings_for_convert_and_check (tree type, tree expr, tree result)
else
conversion_warning (type, expr);
}
- else if (!int_fits_type_p (expr, unsigned_type_for (type)))
+ else if (!int_fits_type_p (expr, c_common_unsigned_type (type)))
warning (OPT_Woverflow,
"overflow in implicit constant conversion");
/* No warning for converting 0x80000000 to int. */
@@ -2037,37 +2037,17 @@ c_common_type_for_mode (enum machine_mode mode, int unsignedp)
return 0;
}
+tree
+c_common_unsigned_type (tree type)
+{
+ return c_common_signed_or_unsigned_type (1, type);
+}
+
/* Return a signed type the same as TYPE in other respects. */
tree
c_common_signed_type (tree type)
{
- tree type1 = TYPE_MAIN_VARIANT (type);
- if (type1 == unsigned_char_type_node || type1 == char_type_node)
- return signed_char_type_node;
- if (type1 == unsigned_type_node)
- return integer_type_node;
- if (type1 == short_unsigned_type_node)
- return short_integer_type_node;
- if (type1 == long_unsigned_type_node)
- return long_integer_type_node;
- if (type1 == long_long_unsigned_type_node)
- return long_long_integer_type_node;
- if (type1 == widest_unsigned_literal_type_node)
- return widest_integer_literal_type_node;
-#if HOST_BITS_PER_WIDE_INT >= 64
- if (type1 == unsigned_intTI_type_node)
- return intTI_type_node;
-#endif
- if (type1 == unsigned_intDI_type_node)
- return intDI_type_node;
- if (type1 == unsigned_intSI_type_node)
- return intSI_type_node;
- if (type1 == unsigned_intHI_type_node)
- return intHI_type_node;
- if (type1 == unsigned_intQI_type_node)
- return intQI_type_node;
-
return c_common_signed_or_unsigned_type (0, type);
}
@@ -2514,8 +2494,7 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr,
default:
break;
}
- /* unsigned_type_for doesn't support C bit fields */
- type = c_common_signed_or_unsigned_type (1, type);
+ type = c_common_unsigned_type (type);
}
if (TREE_CODE (primop0) != INTEGER_CST)
@@ -3685,7 +3664,7 @@ c_common_nodes_and_builtins (void)
else
{
signed_wchar_type_node = c_common_signed_type (wchar_type_node);
- unsigned_wchar_type_node = unsigned_type_for (wchar_type_node);
+ unsigned_wchar_type_node = c_common_unsigned_type (wchar_type_node);
}
/* This is for wide string constants. */
@@ -3703,7 +3682,7 @@ c_common_nodes_and_builtins (void)
default_function_type = build_function_type (integer_type_node, NULL_TREE);
ptrdiff_type_node
= TREE_TYPE (identifier_global_value (get_identifier (PTRDIFF_TYPE)));
- unsigned_ptrdiff_type_node = unsigned_type_for (ptrdiff_type_node);
+ unsigned_ptrdiff_type_node = c_common_unsigned_type (ptrdiff_type_node);
lang_hooks.decls.pushdecl
(build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"),
@@ -6918,8 +6897,8 @@ same_scalar_type_ignoring_signedness (tree t1, tree t2)
/* Equality works here because c_common_signed_type uses
TYPE_MAIN_VARIANT. */
- return lang_hooks.types.signed_type (t1)
- == lang_hooks.types.signed_type (t2);
+ return c_common_signed_type (t1)
+ == c_common_signed_type (t2);
}
/* Check for missing format attributes on function pointers. LTYPE is