diff options
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 17a0067..d132be9 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1330,7 +1330,7 @@ warnings_for_convert_and_check (tree type, tree expr, tree result) else if (warn_conversion) conversion_warning (type, expr); } - else if (!int_fits_type_p (expr, c_common_unsigned_type (type))) + else if (!int_fits_type_p (expr, unsigned_type_for (type))) warning (OPT_Woverflow, "overflow in implicit constant conversion"); /* No warning for converting 0x80000000 to int. */ @@ -2025,39 +2025,6 @@ c_common_type_for_mode (enum machine_mode mode, int unsignedp) return 0; } -/* Return an unsigned type the same as TYPE in other respects. */ -tree -c_common_unsigned_type (tree type) -{ - tree type1 = TYPE_MAIN_VARIANT (type); - if (type1 == signed_char_type_node || type1 == char_type_node) - return unsigned_char_type_node; - if (type1 == integer_type_node) - return unsigned_type_node; - if (type1 == short_integer_type_node) - return short_unsigned_type_node; - if (type1 == long_integer_type_node) - return long_unsigned_type_node; - if (type1 == long_long_integer_type_node) - return long_long_unsigned_type_node; - if (type1 == widest_integer_literal_type_node) - return widest_unsigned_literal_type_node; -#if HOST_BITS_PER_WIDE_INT >= 64 - if (type1 == intTI_type_node) - return unsigned_intTI_type_node; -#endif - if (type1 == intDI_type_node) - return unsigned_intDI_type_node; - if (type1 == intSI_type_node) - return unsigned_intSI_type_node; - if (type1 == intHI_type_node) - return unsigned_intHI_type_node; - if (type1 == intQI_type_node) - return unsigned_intQI_type_node; - - return c_common_signed_or_unsigned_type (1, type); -} - /* Return a signed type the same as TYPE in other respects. */ tree @@ -2500,7 +2467,8 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr, default: break; } - type = c_common_unsigned_type (type); + /* unsigned_type_for doesn't support C bit fields */ + type = c_common_signed_or_unsigned_type (1, type); } if (TREE_CODE (primop0) != INTEGER_CST) @@ -3667,7 +3635,7 @@ c_common_nodes_and_builtins (void) else { signed_wchar_type_node = c_common_signed_type (wchar_type_node); - unsigned_wchar_type_node = c_common_unsigned_type (wchar_type_node); + unsigned_wchar_type_node = unsigned_type_for (wchar_type_node); } /* This is for wide string constants. */ @@ -3685,7 +3653,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 = c_common_unsigned_type (ptrdiff_type_node); + unsigned_ptrdiff_type_node = unsigned_type_for (ptrdiff_type_node); lang_hooks.decls.pushdecl (build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"), |