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
This commit is contained in:
parent
c7a39ea995
commit
ceef8ce4b4
@ -1,3 +1,28 @@
|
|||||||
|
2002-04-01 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
objc:
|
||||||
|
* objc-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
|
||||||
|
LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
|
||||||
|
|
||||||
2002-03-31 Richard Henderson <rth@redhat.com>
|
2002-03-31 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
* config/ia64/unwind-ia64.c (alloc_spill_area): Fix offset.
|
* config/ia64/unwind-ia64.c (alloc_spill_area): Fix offset.
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
2002-04-01 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2002-03-31 Neil Booth <neil@daikokuya.demon.co.uk>
|
2002-03-31 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||||
|
|
||||||
* gigi.h (finish_incomplete_decl): Rename.
|
* gigi.h (finish_incomplete_decl): Rename.
|
||||||
|
@ -430,14 +430,14 @@ extern tree gnat_type_for_size PARAMS ((unsigned, int));
|
|||||||
extern tree gnat_type_for_mode PARAMS ((enum machine_mode, int));
|
extern tree gnat_type_for_mode PARAMS ((enum machine_mode, int));
|
||||||
|
|
||||||
/* Return the unsigned version of a TYPE_NODE, a scalar type. */
|
/* Return the unsigned version of a TYPE_NODE, a scalar type. */
|
||||||
extern tree unsigned_type PARAMS ((tree));
|
extern tree gnat_unsigned_type PARAMS ((tree));
|
||||||
|
|
||||||
/* Return the signed version of a TYPE_NODE, a scalar type. */
|
/* Return the signed version of a TYPE_NODE, a scalar type. */
|
||||||
extern tree signed_type PARAMS ((tree));
|
extern tree gnat_signed_type PARAMS ((tree));
|
||||||
|
|
||||||
/* Return a type the same as TYPE except unsigned or signed according to
|
/* Return a type the same as TYPE except unsigned or signed according to
|
||||||
UNSIGNEDP. */
|
UNSIGNEDP. */
|
||||||
extern tree signed_or_unsigned_type PARAMS ((int, tree));
|
extern tree gnat_signed_or_unsigned_type PARAMS ((int, tree));
|
||||||
|
|
||||||
/* This routine is called in tree.c to print an error message for invalid use
|
/* This routine is called in tree.c to print an error message for invalid use
|
||||||
of an incomplete type. */
|
of an incomplete type. */
|
||||||
|
@ -124,6 +124,12 @@ static rtx gnat_expand_expr PARAMS ((tree, rtx, enum machine_mode,
|
|||||||
#define LANG_HOOKS_TYPE_FOR_MODE gnat_type_for_mode
|
#define LANG_HOOKS_TYPE_FOR_MODE gnat_type_for_mode
|
||||||
#undef LANG_HOOKS_TYPE_FOR_SIZE
|
#undef LANG_HOOKS_TYPE_FOR_SIZE
|
||||||
#define LANG_HOOKS_TYPE_FOR_SIZE gnat_type_for_size
|
#define LANG_HOOKS_TYPE_FOR_SIZE gnat_type_for_size
|
||||||
|
#undef LANG_HOOKS_SIGNED_TYPE
|
||||||
|
#define LANG_HOOKS_SIGNED_TYPE gnat_signed_type
|
||||||
|
#undef LANG_HOOKS_UNSIGNED_TYPE
|
||||||
|
#define LANG_HOOKS_UNSIGNED_TYPE gnat_unsigned_type
|
||||||
|
#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
|
||||||
|
#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE gnat_signed_or_unsigned_type
|
||||||
|
|
||||||
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
|
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
|
||||||
|
|
||||||
|
@ -1348,7 +1348,7 @@ tree_transform (gnat_node)
|
|||||||
/* 'Length or 'Range_Length. */
|
/* 'Length or 'Range_Length. */
|
||||||
{
|
{
|
||||||
tree gnu_compute_type
|
tree gnu_compute_type
|
||||||
= signed_or_unsigned_type
|
= gnat_signed_or_unsigned_type
|
||||||
(0, get_base_type (gnu_result_type));
|
(0, get_base_type (gnu_result_type));
|
||||||
|
|
||||||
gnu_result
|
gnu_result
|
||||||
@ -1867,10 +1867,10 @@ tree_transform (gnat_node)
|
|||||||
so we may need to choose a different type. */
|
so we may need to choose a different type. */
|
||||||
if (Nkind (gnat_node) == N_Op_Shift_Right
|
if (Nkind (gnat_node) == N_Op_Shift_Right
|
||||||
&& ! TREE_UNSIGNED (gnu_type))
|
&& ! TREE_UNSIGNED (gnu_type))
|
||||||
gnu_type = unsigned_type (gnu_type);
|
gnu_type = gnat_unsigned_type (gnu_type);
|
||||||
else if (Nkind (gnat_node) == N_Op_Shift_Right_Arithmetic
|
else if (Nkind (gnat_node) == N_Op_Shift_Right_Arithmetic
|
||||||
&& TREE_UNSIGNED (gnu_type))
|
&& TREE_UNSIGNED (gnu_type))
|
||||||
gnu_type = signed_type (gnu_type);
|
gnu_type = gnat_signed_type (gnu_type);
|
||||||
|
|
||||||
if (gnu_type != gnu_result_type)
|
if (gnu_type != gnu_result_type)
|
||||||
{
|
{
|
||||||
@ -4674,17 +4674,17 @@ convert_with_check (gnat_type, gnu_expr, overflow_p, range_p, truncate_p)
|
|||||||
comparing them properly. Likewise, convert the upper bounds
|
comparing them properly. Likewise, convert the upper bounds
|
||||||
to unsigned types. */
|
to unsigned types. */
|
||||||
if (INTEGRAL_TYPE_P (gnu_in_basetype) && TREE_UNSIGNED (gnu_in_basetype))
|
if (INTEGRAL_TYPE_P (gnu_in_basetype) && TREE_UNSIGNED (gnu_in_basetype))
|
||||||
gnu_in_lb = convert (signed_type (gnu_in_basetype), gnu_in_lb);
|
gnu_in_lb = convert (gnat_signed_type (gnu_in_basetype), gnu_in_lb);
|
||||||
|
|
||||||
if (INTEGRAL_TYPE_P (gnu_in_basetype)
|
if (INTEGRAL_TYPE_P (gnu_in_basetype)
|
||||||
&& ! TREE_UNSIGNED (gnu_in_basetype))
|
&& ! TREE_UNSIGNED (gnu_in_basetype))
|
||||||
gnu_in_ub = convert (unsigned_type (gnu_in_basetype), gnu_in_ub);
|
gnu_in_ub = convert (gnat_unsigned_type (gnu_in_basetype), gnu_in_ub);
|
||||||
|
|
||||||
if (INTEGRAL_TYPE_P (gnu_base_type) && TREE_UNSIGNED (gnu_base_type))
|
if (INTEGRAL_TYPE_P (gnu_base_type) && TREE_UNSIGNED (gnu_base_type))
|
||||||
gnu_out_lb = convert (signed_type (gnu_base_type), gnu_out_lb);
|
gnu_out_lb = convert (gnat_signed_type (gnu_base_type), gnu_out_lb);
|
||||||
|
|
||||||
if (INTEGRAL_TYPE_P (gnu_base_type) && ! TREE_UNSIGNED (gnu_base_type))
|
if (INTEGRAL_TYPE_P (gnu_base_type) && ! TREE_UNSIGNED (gnu_base_type))
|
||||||
gnu_out_ub = convert (unsigned_type (gnu_base_type), gnu_out_ub);
|
gnu_out_ub = convert (gnat_unsigned_type (gnu_base_type), gnu_out_ub);
|
||||||
|
|
||||||
/* Check each bound separately and only if the result bound
|
/* Check each bound separately and only if the result bound
|
||||||
is tighter than the bound on the input type. Note that all the
|
is tighter than the bound on the input type. Note that all the
|
||||||
|
@ -2022,7 +2022,7 @@ gnat_type_for_mode (mode, unsignedp)
|
|||||||
/* Return the unsigned version of a TYPE_NODE, a scalar type. */
|
/* Return the unsigned version of a TYPE_NODE, a scalar type. */
|
||||||
|
|
||||||
tree
|
tree
|
||||||
unsigned_type (type_node)
|
gnat_unsigned_type (type_node)
|
||||||
tree type_node;
|
tree type_node;
|
||||||
{
|
{
|
||||||
tree type = gnat_type_for_size (TYPE_PRECISION (type_node), 1);
|
tree type = gnat_type_for_size (TYPE_PRECISION (type_node), 1);
|
||||||
@ -2046,7 +2046,7 @@ unsigned_type (type_node)
|
|||||||
/* Return the signed version of a TYPE_NODE, a scalar type. */
|
/* Return the signed version of a TYPE_NODE, a scalar type. */
|
||||||
|
|
||||||
tree
|
tree
|
||||||
signed_type (type_node)
|
gnat_signed_type (type_node)
|
||||||
tree type_node;
|
tree type_node;
|
||||||
{
|
{
|
||||||
tree type = gnat_type_for_size (TYPE_PRECISION (type_node), 0);
|
tree type = gnat_type_for_size (TYPE_PRECISION (type_node), 0);
|
||||||
@ -2071,7 +2071,7 @@ signed_type (type_node)
|
|||||||
UNSIGNEDP. */
|
UNSIGNEDP. */
|
||||||
|
|
||||||
tree
|
tree
|
||||||
signed_or_unsigned_type (unsignedp, type)
|
gnat_signed_or_unsigned_type (unsignedp, type)
|
||||||
int unsignedp;
|
int unsignedp;
|
||||||
tree type;
|
tree type;
|
||||||
{
|
{
|
||||||
|
@ -757,13 +757,15 @@ void
|
|||||||
unsigned_conversion_warning (result, operand)
|
unsigned_conversion_warning (result, operand)
|
||||||
tree result, operand;
|
tree result, operand;
|
||||||
{
|
{
|
||||||
|
tree type = TREE_TYPE (result);
|
||||||
|
|
||||||
if (TREE_CODE (operand) == INTEGER_CST
|
if (TREE_CODE (operand) == INTEGER_CST
|
||||||
&& TREE_CODE (TREE_TYPE (result)) == INTEGER_TYPE
|
&& TREE_CODE (type) == INTEGER_TYPE
|
||||||
&& TREE_UNSIGNED (TREE_TYPE (result))
|
&& TREE_UNSIGNED (type)
|
||||||
&& skip_evaluation == 0
|
&& skip_evaluation == 0
|
||||||
&& !int_fits_type_p (operand, TREE_TYPE (result)))
|
&& !int_fits_type_p (operand, type))
|
||||||
{
|
{
|
||||||
if (!int_fits_type_p (operand, signed_type (TREE_TYPE (result))))
|
if (!int_fits_type_p (operand, c_common_signed_type (type)))
|
||||||
/* This detects cases like converting -129 or 256 to unsigned char. */
|
/* This detects cases like converting -129 or 256 to unsigned char. */
|
||||||
warning ("large integer implicitly truncated to unsigned type");
|
warning ("large integer implicitly truncated to unsigned type");
|
||||||
else if (warn_conversion)
|
else if (warn_conversion)
|
||||||
@ -812,7 +814,8 @@ convert_and_check (type, expr)
|
|||||||
don't warn unless pedantic. */
|
don't warn unless pedantic. */
|
||||||
if ((pedantic
|
if ((pedantic
|
||||||
|| TREE_UNSIGNED (type)
|
|| TREE_UNSIGNED (type)
|
||||||
|| ! constant_fits_type_p (expr, unsigned_type (type)))
|
|| ! constant_fits_type_p (expr,
|
||||||
|
c_common_unsigned_type (type)))
|
||||||
&& skip_evaluation == 0)
|
&& skip_evaluation == 0)
|
||||||
warning ("overflow in implicit constant conversion");
|
warning ("overflow in implicit constant conversion");
|
||||||
}
|
}
|
||||||
@ -1435,7 +1438,7 @@ c_common_type_for_mode (mode, unsignedp)
|
|||||||
|
|
||||||
/* Return an unsigned type the same as TYPE in other respects. */
|
/* Return an unsigned type the same as TYPE in other respects. */
|
||||||
tree
|
tree
|
||||||
unsigned_type (type)
|
c_common_unsigned_type (type)
|
||||||
tree type;
|
tree type;
|
||||||
{
|
{
|
||||||
tree type1 = TYPE_MAIN_VARIANT (type);
|
tree type1 = TYPE_MAIN_VARIANT (type);
|
||||||
@ -1464,13 +1467,13 @@ unsigned_type (type)
|
|||||||
if (type1 == intQI_type_node)
|
if (type1 == intQI_type_node)
|
||||||
return unsigned_intQI_type_node;
|
return unsigned_intQI_type_node;
|
||||||
|
|
||||||
return signed_or_unsigned_type (1, type);
|
return c_common_signed_or_unsigned_type (1, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a signed type the same as TYPE in other respects. */
|
/* Return a signed type the same as TYPE in other respects. */
|
||||||
|
|
||||||
tree
|
tree
|
||||||
signed_type (type)
|
c_common_signed_type (type)
|
||||||
tree type;
|
tree type;
|
||||||
{
|
{
|
||||||
tree type1 = TYPE_MAIN_VARIANT (type);
|
tree type1 = TYPE_MAIN_VARIANT (type);
|
||||||
@ -1499,14 +1502,14 @@ signed_type (type)
|
|||||||
if (type1 == unsigned_intQI_type_node)
|
if (type1 == unsigned_intQI_type_node)
|
||||||
return intQI_type_node;
|
return intQI_type_node;
|
||||||
|
|
||||||
return signed_or_unsigned_type (0, type);
|
return c_common_signed_or_unsigned_type (0, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a type the same as TYPE except unsigned or
|
/* Return a type the same as TYPE except unsigned or
|
||||||
signed according to UNSIGNEDP. */
|
signed according to UNSIGNEDP. */
|
||||||
|
|
||||||
tree
|
tree
|
||||||
signed_or_unsigned_type (unsignedp, type)
|
c_common_signed_or_unsigned_type (unsignedp, type)
|
||||||
int unsignedp;
|
int unsignedp;
|
||||||
tree type;
|
tree type;
|
||||||
{
|
{
|
||||||
@ -1755,7 +1758,8 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr)
|
|||||||
int unsignedp = TREE_UNSIGNED (*restype_ptr);
|
int unsignedp = TREE_UNSIGNED (*restype_ptr);
|
||||||
tree val;
|
tree val;
|
||||||
|
|
||||||
type = signed_or_unsigned_type (unsignedp0, TREE_TYPE (primop0));
|
type = c_common_signed_or_unsigned_type (unsignedp0,
|
||||||
|
TREE_TYPE (primop0));
|
||||||
|
|
||||||
/* If TYPE is an enumeration, then we need to get its min/max
|
/* If TYPE is an enumeration, then we need to get its min/max
|
||||||
values from it's underlying integral type, not the enumerated
|
values from it's underlying integral type, not the enumerated
|
||||||
@ -1767,7 +1771,7 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr)
|
|||||||
minval = TYPE_MIN_VALUE (type);
|
minval = TYPE_MIN_VALUE (type);
|
||||||
|
|
||||||
if (unsignedp && !unsignedp0)
|
if (unsignedp && !unsignedp0)
|
||||||
*restype_ptr = signed_type (*restype_ptr);
|
*restype_ptr = c_common_signed_type (*restype_ptr);
|
||||||
|
|
||||||
if (TREE_TYPE (primop1) != *restype_ptr)
|
if (TREE_TYPE (primop1) != *restype_ptr)
|
||||||
primop1 = convert (*restype_ptr, primop1);
|
primop1 = convert (*restype_ptr, primop1);
|
||||||
@ -1864,7 +1868,7 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
type = unsigned_type (type);
|
type = c_common_unsigned_type (type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!max_gt && !unsignedp0 && TREE_CODE (primop0) != INTEGER_CST)
|
if (!max_gt && !unsignedp0 && TREE_CODE (primop0) != INTEGER_CST)
|
||||||
@ -1916,15 +1920,19 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr)
|
|||||||
&& TYPE_PRECISION (TREE_TYPE (primop1)) < TYPE_PRECISION (*restype_ptr))
|
&& TYPE_PRECISION (TREE_TYPE (primop1)) < TYPE_PRECISION (*restype_ptr))
|
||||||
{
|
{
|
||||||
type = common_type (TREE_TYPE (primop0), TREE_TYPE (primop1));
|
type = common_type (TREE_TYPE (primop0), TREE_TYPE (primop1));
|
||||||
type = signed_or_unsigned_type (unsignedp0
|
type = c_common_signed_or_unsigned_type (unsignedp0
|
||||||
|| TREE_UNSIGNED (*restype_ptr),
|
|| TREE_UNSIGNED (*restype_ptr),
|
||||||
type);
|
type);
|
||||||
/* Make sure shorter operand is extended the right way
|
/* Make sure shorter operand is extended the right way
|
||||||
to match the longer operand. */
|
to match the longer operand. */
|
||||||
primop0 = convert (signed_or_unsigned_type (unsignedp0, TREE_TYPE (primop0)),
|
primop0
|
||||||
primop0);
|
= convert (c_common_signed_or_unsigned_type (unsignedp0,
|
||||||
primop1 = convert (signed_or_unsigned_type (unsignedp1, TREE_TYPE (primop1)),
|
TREE_TYPE (primop0)),
|
||||||
primop1);
|
primop0);
|
||||||
|
primop1
|
||||||
|
= convert (c_common_signed_or_unsigned_type (unsignedp1,
|
||||||
|
TREE_TYPE (primop1)),
|
||||||
|
primop1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1947,7 +1955,7 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr)
|
|||||||
so suppress the warning. */
|
so suppress the warning. */
|
||||||
if (extra_warnings && !in_system_header
|
if (extra_warnings && !in_system_header
|
||||||
&& ! (TREE_CODE (primop0) == INTEGER_CST
|
&& ! (TREE_CODE (primop0) == INTEGER_CST
|
||||||
&& ! TREE_OVERFLOW (convert (signed_type (type),
|
&& ! TREE_OVERFLOW (convert (c_common_signed_type (type),
|
||||||
primop0))))
|
primop0))))
|
||||||
warning ("comparison of unsigned expression >= 0 is always true");
|
warning ("comparison of unsigned expression >= 0 is always true");
|
||||||
value = boolean_true_node;
|
value = boolean_true_node;
|
||||||
@ -1956,7 +1964,7 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr)
|
|||||||
case LT_EXPR:
|
case LT_EXPR:
|
||||||
if (extra_warnings && !in_system_header
|
if (extra_warnings && !in_system_header
|
||||||
&& ! (TREE_CODE (primop0) == INTEGER_CST
|
&& ! (TREE_CODE (primop0) == INTEGER_CST
|
||||||
&& ! TREE_OVERFLOW (convert (signed_type (type),
|
&& ! TREE_OVERFLOW (convert (c_common_signed_type (type),
|
||||||
primop0))))
|
primop0))))
|
||||||
warning ("comparison of unsigned expression < 0 is always false");
|
warning ("comparison of unsigned expression < 0 is always false");
|
||||||
value = boolean_false_node;
|
value = boolean_false_node;
|
||||||
@ -2365,7 +2373,7 @@ c_common_get_alias_set (t)
|
|||||||
variant as canonical. */
|
variant as canonical. */
|
||||||
if (TREE_CODE (t) == INTEGER_TYPE && TREE_UNSIGNED (t))
|
if (TREE_CODE (t) == INTEGER_TYPE && TREE_UNSIGNED (t))
|
||||||
{
|
{
|
||||||
tree t1 = signed_type (t);
|
tree t1 = c_common_signed_type (t);
|
||||||
|
|
||||||
/* t1 == t can happen for boolean nodes which are always unsigned. */
|
/* t1 == t can happen for boolean nodes which are always unsigned. */
|
||||||
if (t1 != t)
|
if (t1 != t)
|
||||||
@ -2621,7 +2629,7 @@ c_common_nodes_and_builtins ()
|
|||||||
and this must agree, even if long and int are the same size. */
|
and this must agree, even if long and int are the same size. */
|
||||||
c_size_type_node =
|
c_size_type_node =
|
||||||
TREE_TYPE (identifier_global_value (get_identifier (SIZE_TYPE)));
|
TREE_TYPE (identifier_global_value (get_identifier (SIZE_TYPE)));
|
||||||
signed_size_type_node = signed_type (c_size_type_node);
|
signed_size_type_node = c_common_signed_type (c_size_type_node);
|
||||||
set_sizetype (c_size_type_node);
|
set_sizetype (c_size_type_node);
|
||||||
|
|
||||||
build_common_tree_nodes_2 (flag_short_double);
|
build_common_tree_nodes_2 (flag_short_double);
|
||||||
@ -2690,8 +2698,8 @@ c_common_nodes_and_builtins ()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
signed_wchar_type_node = signed_type (wchar_type_node);
|
signed_wchar_type_node = c_common_signed_type (wchar_type_node);
|
||||||
unsigned_wchar_type_node = unsigned_type (wchar_type_node);
|
unsigned_wchar_type_node = c_common_unsigned_type (wchar_type_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is for wide string constants. */
|
/* This is for wide string constants. */
|
||||||
@ -2709,7 +2717,7 @@ c_common_nodes_and_builtins ()
|
|||||||
default_function_type = build_function_type (integer_type_node, NULL_TREE);
|
default_function_type = build_function_type (integer_type_node, NULL_TREE);
|
||||||
ptrdiff_type_node
|
ptrdiff_type_node
|
||||||
= TREE_TYPE (identifier_global_value (get_identifier (PTRDIFF_TYPE)));
|
= TREE_TYPE (identifier_global_value (get_identifier (PTRDIFF_TYPE)));
|
||||||
unsigned_ptrdiff_type_node = unsigned_type (ptrdiff_type_node);
|
unsigned_ptrdiff_type_node = c_common_unsigned_type (ptrdiff_type_node);
|
||||||
|
|
||||||
(*lang_hooks.decls.pushdecl)
|
(*lang_hooks.decls.pushdecl)
|
||||||
(build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"),
|
(build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"),
|
||||||
|
@ -510,6 +510,9 @@ extern void c_common_insert_default_attributes PARAMS ((tree));
|
|||||||
extern tree c_common_type_for_mode PARAMS ((enum machine_mode,
|
extern tree c_common_type_for_mode PARAMS ((enum machine_mode,
|
||||||
int));
|
int));
|
||||||
extern tree c_common_type_for_size PARAMS ((unsigned int, int));
|
extern tree c_common_type_for_size PARAMS ((unsigned int, int));
|
||||||
|
extern tree c_common_unsigned_type PARAMS ((tree));
|
||||||
|
extern tree c_common_signed_type PARAMS ((tree));
|
||||||
|
extern tree c_common_signed_or_unsigned_type PARAMS ((int, tree));
|
||||||
extern void c_apply_type_quals_to_decl PARAMS ((int, tree));
|
extern void c_apply_type_quals_to_decl PARAMS ((int, tree));
|
||||||
extern tree c_sizeof PARAMS ((tree));
|
extern tree c_sizeof PARAMS ((tree));
|
||||||
extern tree c_alignof PARAMS ((tree));
|
extern tree c_alignof PARAMS ((tree));
|
||||||
|
@ -4160,7 +4160,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
|
|||||||
else if (type == char_type_node)
|
else if (type == char_type_node)
|
||||||
type = unsigned_char_type_node;
|
type = unsigned_char_type_node;
|
||||||
else if (typedef_decl)
|
else if (typedef_decl)
|
||||||
type = unsigned_type (type);
|
type = c_common_unsigned_type (type);
|
||||||
else
|
else
|
||||||
type = unsigned_type_node;
|
type = unsigned_type_node;
|
||||||
}
|
}
|
||||||
@ -4370,7 +4370,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
|
|||||||
tree itype = NULL_TREE;
|
tree itype = NULL_TREE;
|
||||||
tree size = TREE_OPERAND (declarator, 1);
|
tree size = TREE_OPERAND (declarator, 1);
|
||||||
/* The index is a signed object `sizetype' bits wide. */
|
/* The index is a signed object `sizetype' bits wide. */
|
||||||
tree index_type = signed_type (sizetype);
|
tree index_type = c_common_signed_type (sizetype);
|
||||||
|
|
||||||
array_ptr_quals = TREE_TYPE (declarator);
|
array_ptr_quals = TREE_TYPE (declarator);
|
||||||
array_parm_static = TREE_STATIC (declarator);
|
array_parm_static = TREE_STATIC (declarator);
|
||||||
|
@ -2386,8 +2386,8 @@ check_format_types (status, types)
|
|||||||
&& TREE_CODE (cur_type) == INTEGER_TYPE
|
&& TREE_CODE (cur_type) == INTEGER_TYPE
|
||||||
&& (! pedantic || i == 0 || (i == 1 && char_type_flag))
|
&& (! pedantic || i == 0 || (i == 1 && char_type_flag))
|
||||||
&& (TREE_UNSIGNED (wanted_type)
|
&& (TREE_UNSIGNED (wanted_type)
|
||||||
? wanted_type == unsigned_type (cur_type)
|
? wanted_type == c_common_unsigned_type (cur_type)
|
||||||
: wanted_type == signed_type (cur_type)))
|
: wanted_type == c_common_signed_type (cur_type)))
|
||||||
continue;
|
continue;
|
||||||
/* Likewise, "signed char", "unsigned char" and "char" are
|
/* Likewise, "signed char", "unsigned char" and "char" are
|
||||||
equivalent but the above test won't consider them equivalent. */
|
equivalent but the above test won't consider them equivalent. */
|
||||||
|
@ -88,6 +88,12 @@ static void c_post_options PARAMS ((void));
|
|||||||
#define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
|
#define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
|
||||||
#undef LANG_HOOKS_TYPE_FOR_SIZE
|
#undef LANG_HOOKS_TYPE_FOR_SIZE
|
||||||
#define LANG_HOOKS_TYPE_FOR_SIZE c_common_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
|
||||||
|
|
||||||
/* ### When changing hooks, consider if ObjC needs changing too!! ### */
|
/* ### When changing hooks, consider if ObjC needs changing too!! ### */
|
||||||
|
|
||||||
|
@ -2385,22 +2385,24 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
|
|||||||
&& unsigned0 == unsigned1
|
&& unsigned0 == unsigned1
|
||||||
&& (unsigned0 || !uns))
|
&& (unsigned0 || !uns))
|
||||||
result_type
|
result_type
|
||||||
= signed_or_unsigned_type (unsigned0,
|
= c_common_signed_or_unsigned_type
|
||||||
common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)));
|
(unsigned0, common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)));
|
||||||
else if (TREE_CODE (arg0) == INTEGER_CST
|
else if (TREE_CODE (arg0) == INTEGER_CST
|
||||||
&& (unsigned1 || !uns)
|
&& (unsigned1 || !uns)
|
||||||
&& (TYPE_PRECISION (TREE_TYPE (arg1))
|
&& (TYPE_PRECISION (TREE_TYPE (arg1))
|
||||||
< TYPE_PRECISION (result_type))
|
< TYPE_PRECISION (result_type))
|
||||||
&& (type = signed_or_unsigned_type (unsigned1,
|
&& (type
|
||||||
TREE_TYPE (arg1)),
|
= c_common_signed_or_unsigned_type (unsigned1,
|
||||||
|
TREE_TYPE (arg1)),
|
||||||
int_fits_type_p (arg0, type)))
|
int_fits_type_p (arg0, type)))
|
||||||
result_type = type;
|
result_type = type;
|
||||||
else if (TREE_CODE (arg1) == INTEGER_CST
|
else if (TREE_CODE (arg1) == INTEGER_CST
|
||||||
&& (unsigned0 || !uns)
|
&& (unsigned0 || !uns)
|
||||||
&& (TYPE_PRECISION (TREE_TYPE (arg0))
|
&& (TYPE_PRECISION (TREE_TYPE (arg0))
|
||||||
< TYPE_PRECISION (result_type))
|
< TYPE_PRECISION (result_type))
|
||||||
&& (type = signed_or_unsigned_type (unsigned0,
|
&& (type
|
||||||
TREE_TYPE (arg0)),
|
= c_common_signed_or_unsigned_type (unsigned0,
|
||||||
|
TREE_TYPE (arg0)),
|
||||||
int_fits_type_p (arg1, type)))
|
int_fits_type_p (arg1, type)))
|
||||||
result_type = type;
|
result_type = type;
|
||||||
}
|
}
|
||||||
@ -2426,7 +2428,8 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
|
|||||||
{
|
{
|
||||||
/* Do an unsigned shift if the operand was zero-extended. */
|
/* Do an unsigned shift if the operand was zero-extended. */
|
||||||
result_type
|
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. */
|
/* Convert value-to-be-shifted to that type. */
|
||||||
if (TREE_TYPE (op0) != result_type)
|
if (TREE_TYPE (op0) != result_type)
|
||||||
op0 = convert (result_type, op0);
|
op0 = convert (result_type, op0);
|
||||||
@ -2504,15 +2507,17 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
|
|||||||
would fit in the result if the result were signed. */
|
would fit in the result if the result were signed. */
|
||||||
else if (TREE_CODE (uop) == INTEGER_CST
|
else if (TREE_CODE (uop) == INTEGER_CST
|
||||||
&& (resultcode == EQ_EXPR || resultcode == NE_EXPR)
|
&& (resultcode == EQ_EXPR || resultcode == NE_EXPR)
|
||||||
&& int_fits_type_p (uop, signed_type (result_type)))
|
&& int_fits_type_p
|
||||||
|
(uop, c_common_signed_type (result_type)))
|
||||||
/* OK */;
|
/* OK */;
|
||||||
/* Do not warn if the unsigned quantity is an enumeration
|
/* Do not warn if the unsigned quantity is an enumeration
|
||||||
constant and its maximum value would fit in the result
|
constant and its maximum value would fit in the result
|
||||||
if the result were signed. */
|
if the result were signed. */
|
||||||
else if (TREE_CODE (uop) == INTEGER_CST
|
else if (TREE_CODE (uop) == INTEGER_CST
|
||||||
&& TREE_CODE (TREE_TYPE (uop)) == ENUMERAL_TYPE
|
&& TREE_CODE (TREE_TYPE (uop)) == ENUMERAL_TYPE
|
||||||
&& int_fits_type_p (TYPE_MAX_VALUE (TREE_TYPE(uop)),
|
&& int_fits_type_p
|
||||||
signed_type (result_type)))
|
(TYPE_MAX_VALUE (TREE_TYPE(uop)),
|
||||||
|
c_common_signed_type (result_type)))
|
||||||
/* OK */;
|
/* OK */;
|
||||||
else
|
else
|
||||||
warning ("comparison between signed and unsigned");
|
warning ("comparison between signed and unsigned");
|
||||||
@ -4161,8 +4166,8 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
|
|||||||
Meanwhile, the lhs target must have all the qualifiers of the rhs. */
|
Meanwhile, the lhs target must have all the qualifiers of the rhs. */
|
||||||
if (VOID_TYPE_P (ttl) || VOID_TYPE_P (ttr)
|
if (VOID_TYPE_P (ttl) || VOID_TYPE_P (ttr)
|
||||||
|| comp_target_types (type, rhstype)
|
|| comp_target_types (type, rhstype)
|
||||||
|| (unsigned_type (TYPE_MAIN_VARIANT (ttl))
|
|| (c_common_unsigned_type (TYPE_MAIN_VARIANT (ttl))
|
||||||
== unsigned_type (TYPE_MAIN_VARIANT (ttr))))
|
== c_common_unsigned_type (TYPE_MAIN_VARIANT (ttr))))
|
||||||
{
|
{
|
||||||
if (pedantic
|
if (pedantic
|
||||||
&& ((VOID_TYPE_P (ttl) && TREE_CODE (ttr) == FUNCTION_TYPE)
|
&& ((VOID_TYPE_P (ttl) && TREE_CODE (ttr) == FUNCTION_TYPE)
|
||||||
|
@ -316,10 +316,12 @@ convert_to_integer (type, expr)
|
|||||||
unsigned then can safely do the work as unsigned.
|
unsigned then can safely do the work as unsigned.
|
||||||
And we may need to do it as unsigned
|
And we may need to do it as unsigned
|
||||||
if we truncate to the original size. */
|
if we truncate to the original size. */
|
||||||
typex = ((TREE_UNSIGNED (TREE_TYPE (expr))
|
if (TREE_UNSIGNED (TREE_TYPE (expr))
|
||||||
|| (TREE_UNSIGNED (TREE_TYPE (arg0))
|
|| (TREE_UNSIGNED (TREE_TYPE (arg0))
|
||||||
&& TREE_UNSIGNED (TREE_TYPE (arg1))))
|
&& TREE_UNSIGNED (TREE_TYPE (arg1))))
|
||||||
? unsigned_type (typex) : signed_type (typex));
|
typex = (*lang_hooks.types.unsigned_type) (typex);
|
||||||
|
else
|
||||||
|
typex = (*lang_hooks.types.signed_type) (typex);
|
||||||
return convert (type,
|
return convert (type,
|
||||||
fold (build (ex_form, typex,
|
fold (build (ex_form, typex,
|
||||||
convert (typex, arg0),
|
convert (typex, arg0),
|
||||||
@ -350,8 +352,10 @@ convert_to_integer (type, expr)
|
|||||||
{
|
{
|
||||||
/* Don't do unsigned arithmetic where signed was wanted,
|
/* Don't do unsigned arithmetic where signed was wanted,
|
||||||
or vice versa. */
|
or vice versa. */
|
||||||
typex = (TREE_UNSIGNED (TREE_TYPE (expr))
|
if (TREE_UNSIGNED (TREE_TYPE (expr)))
|
||||||
? unsigned_type (typex) : signed_type (typex));
|
typex = (*lang_hooks.types.unsigned_type) (typex);
|
||||||
|
else
|
||||||
|
typex = (*lang_hooks.types.signed_type) (typex);
|
||||||
return convert (type,
|
return convert (type,
|
||||||
fold (build1 (ex_form, typex,
|
fold (build1 (ex_form, typex,
|
||||||
convert (typex,
|
convert (typex,
|
||||||
|
@ -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>
|
2002-03-31 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||||
|
|
||||||
* cp-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Redefine.
|
* cp-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Redefine.
|
||||||
|
@ -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
|
#define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
|
||||||
#undef LANG_HOOKS_TYPE_FOR_SIZE
|
#undef LANG_HOOKS_TYPE_FOR_SIZE
|
||||||
#define LANG_HOOKS_TYPE_FOR_SIZE c_common_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. */
|
/* Each front end provides its own hooks, for toplev.c. */
|
||||||
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
|
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
|
||||||
|
@ -10325,7 +10325,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
|
|||||||
else if (type == char_type_node)
|
else if (type == char_type_node)
|
||||||
type = unsigned_char_type_node;
|
type = unsigned_char_type_node;
|
||||||
else if (typedef_decl)
|
else if (typedef_decl)
|
||||||
type = unsigned_type (type);
|
type = c_common_unsigned_type (type);
|
||||||
else
|
else
|
||||||
type = unsigned_type_node;
|
type = unsigned_type_node;
|
||||||
}
|
}
|
||||||
|
@ -1111,7 +1111,7 @@ write_integer_cst (cst)
|
|||||||
chunk *= chunk;
|
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);
|
base = build_int_2 (chunk, 0);
|
||||||
n = build_int_2 (TREE_INT_CST_LOW (cst), TREE_INT_CST_HIGH (cst));
|
n = build_int_2 (TREE_INT_CST_LOW (cst), TREE_INT_CST_HIGH (cst));
|
||||||
TREE_TYPE (n) = TREE_TYPE (base) = type;
|
TREE_TYPE (n) = TREE_TYPE (base) = type;
|
||||||
|
@ -3782,24 +3782,22 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
|
|||||||
== TYPE_PRECISION (TREE_TYPE (arg0)))
|
== TYPE_PRECISION (TREE_TYPE (arg0)))
|
||||||
&& unsigned0 == unsigned1
|
&& unsigned0 == unsigned1
|
||||||
&& (unsigned0 || !uns))
|
&& (unsigned0 || !uns))
|
||||||
result_type
|
result_type = c_common_signed_or_unsigned_type
|
||||||
= signed_or_unsigned_type (unsigned0,
|
(unsigned0, common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)));
|
||||||
common_type (TREE_TYPE (arg0),
|
|
||||||
TREE_TYPE (arg1)));
|
|
||||||
else if (TREE_CODE (arg0) == INTEGER_CST
|
else if (TREE_CODE (arg0) == INTEGER_CST
|
||||||
&& (unsigned1 || !uns)
|
&& (unsigned1 || !uns)
|
||||||
&& (TYPE_PRECISION (TREE_TYPE (arg1))
|
&& (TYPE_PRECISION (TREE_TYPE (arg1))
|
||||||
< TYPE_PRECISION (result_type))
|
< TYPE_PRECISION (result_type))
|
||||||
&& (type = signed_or_unsigned_type (unsigned1,
|
&& (type = c_common_signed_or_unsigned_type
|
||||||
TREE_TYPE (arg1)),
|
(unsigned1, TREE_TYPE (arg1)),
|
||||||
int_fits_type_p (arg0, type)))
|
int_fits_type_p (arg0, type)))
|
||||||
result_type = type;
|
result_type = type;
|
||||||
else if (TREE_CODE (arg1) == INTEGER_CST
|
else if (TREE_CODE (arg1) == INTEGER_CST
|
||||||
&& (unsigned0 || !uns)
|
&& (unsigned0 || !uns)
|
||||||
&& (TYPE_PRECISION (TREE_TYPE (arg0))
|
&& (TYPE_PRECISION (TREE_TYPE (arg0))
|
||||||
< TYPE_PRECISION (result_type))
|
< TYPE_PRECISION (result_type))
|
||||||
&& (type = signed_or_unsigned_type (unsigned0,
|
&& (type = c_common_signed_or_unsigned_type
|
||||||
TREE_TYPE (arg0)),
|
(unsigned0, TREE_TYPE (arg0)),
|
||||||
int_fits_type_p (arg1, type)))
|
int_fits_type_p (arg1, type)))
|
||||||
result_type = 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. */
|
/* Do an unsigned shift if the operand was zero-extended. */
|
||||||
result_type
|
result_type
|
||||||
= signed_or_unsigned_type (unsigned_arg,
|
= c_common_signed_or_unsigned_type (unsigned_arg,
|
||||||
TREE_TYPE (arg0));
|
TREE_TYPE (arg0));
|
||||||
/* Convert value-to-be-shifted to that type. */
|
/* Convert value-to-be-shifted to that type. */
|
||||||
if (TREE_TYPE (op0) != result_type)
|
if (TREE_TYPE (op0) != result_type)
|
||||||
op0 = cp_convert (result_type, op0);
|
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. */
|
not use the most significant bit of result_type. */
|
||||||
else if ((resultcode == EQ_EXPR || resultcode == NE_EXPR)
|
else if ((resultcode == EQ_EXPR || resultcode == NE_EXPR)
|
||||||
&& ((op0_signed && TREE_CODE (orig_op1) == INTEGER_CST
|
&& ((op0_signed && TREE_CODE (orig_op1) == INTEGER_CST
|
||||||
&& int_fits_type_p (orig_op1,
|
&& int_fits_type_p (orig_op1, c_common_signed_type
|
||||||
signed_type (result_type)))
|
(result_type)))
|
||||||
|| (op1_signed && TREE_CODE (orig_op0) == INTEGER_CST
|
|| (op1_signed && TREE_CODE (orig_op0) == INTEGER_CST
|
||||||
&& int_fits_type_p (orig_op0,
|
&& int_fits_type_p (orig_op0, c_common_signed_type
|
||||||
signed_type (result_type)))))
|
(result_type)))))
|
||||||
/* OK */;
|
/* OK */;
|
||||||
else
|
else
|
||||||
warning ("comparison between signed and unsigned integer expressions");
|
warning ("comparison between signed and unsigned integer expressions");
|
||||||
|
15
gcc/expmed.c
15
gcc/expmed.c
@ -4108,21 +4108,22 @@ make_tree (type, x)
|
|||||||
make_tree (type, XEXP (x, 1))));
|
make_tree (type, XEXP (x, 1))));
|
||||||
|
|
||||||
case LSHIFTRT:
|
case LSHIFTRT:
|
||||||
|
t = (*lang_hooks.types.unsigned_type) (type);
|
||||||
return fold (convert (type,
|
return fold (convert (type,
|
||||||
build (RSHIFT_EXPR, unsigned_type (type),
|
build (RSHIFT_EXPR, t,
|
||||||
make_tree (unsigned_type (type),
|
make_tree (t, XEXP (x, 0)),
|
||||||
XEXP (x, 0)),
|
|
||||||
make_tree (type, XEXP (x, 1)))));
|
make_tree (type, XEXP (x, 1)))));
|
||||||
|
|
||||||
case ASHIFTRT:
|
case ASHIFTRT:
|
||||||
|
t = (*lang_hooks.types.signed_type) (type);
|
||||||
return fold (convert (type,
|
return fold (convert (type,
|
||||||
build (RSHIFT_EXPR, signed_type (type),
|
build (RSHIFT_EXPR, t,
|
||||||
make_tree (signed_type (type), XEXP (x, 0)),
|
make_tree (t, XEXP (x, 0)),
|
||||||
make_tree (type, XEXP (x, 1)))));
|
make_tree (type, XEXP (x, 1)))));
|
||||||
|
|
||||||
case DIV:
|
case DIV:
|
||||||
if (TREE_CODE (type) != REAL_TYPE)
|
if (TREE_CODE (type) != REAL_TYPE)
|
||||||
t = signed_type (type);
|
t = (*lang_hooks.types.signed_type) (type);
|
||||||
else
|
else
|
||||||
t = type;
|
t = type;
|
||||||
|
|
||||||
@ -4131,7 +4132,7 @@ make_tree (type, x)
|
|||||||
make_tree (t, XEXP (x, 0)),
|
make_tree (t, XEXP (x, 0)),
|
||||||
make_tree (t, XEXP (x, 1)))));
|
make_tree (t, XEXP (x, 1)))));
|
||||||
case UDIV:
|
case UDIV:
|
||||||
t = unsigned_type (type);
|
t = (*lang_hooks.types.unsigned_type) (type);
|
||||||
return fold (convert (type,
|
return fold (convert (type,
|
||||||
build (TRUNC_DIV_EXPR, t,
|
build (TRUNC_DIV_EXPR, t,
|
||||||
make_tree (t, XEXP (x, 0)),
|
make_tree (t, XEXP (x, 0)),
|
||||||
|
@ -4021,11 +4021,9 @@ store_expr (exp, target, want_value)
|
|||||||
{
|
{
|
||||||
if (TREE_UNSIGNED (TREE_TYPE (exp))
|
if (TREE_UNSIGNED (TREE_TYPE (exp))
|
||||||
!= SUBREG_PROMOTED_UNSIGNED_P (target))
|
!= SUBREG_PROMOTED_UNSIGNED_P (target))
|
||||||
exp
|
exp = convert
|
||||||
= convert
|
((*lang_hooks.types.signed_or_unsigned_type)
|
||||||
(signed_or_unsigned_type (SUBREG_PROMOTED_UNSIGNED_P (target),
|
(SUBREG_PROMOTED_UNSIGNED_P (target), TREE_TYPE (exp)), exp);
|
||||||
TREE_TYPE (exp)),
|
|
||||||
exp);
|
|
||||||
|
|
||||||
exp = convert ((*lang_hooks.types.type_for_mode)
|
exp = convert ((*lang_hooks.types.type_for_mode)
|
||||||
(GET_MODE (SUBREG_REG (target)),
|
(GET_MODE (SUBREG_REG (target)),
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Mon Apr 1 09:59:53 2002 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
Sun Mar 31 23:50:22 2002 Neil Booth <neil@daikokuya.demon.co.uk>
|
Sun Mar 31 23:50:22 2002 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||||
|
|
||||||
* com.c (lang_print_error_function): Rename.
|
* com.c (lang_print_error_function): Rename.
|
||||||
|
22
gcc/f/com.c
22
gcc/f/com.c
@ -263,6 +263,9 @@ struct _ffecom_concat_list_
|
|||||||
|
|
||||||
static tree ffe_type_for_mode PARAMS ((enum machine_mode, int));
|
static tree ffe_type_for_mode PARAMS ((enum machine_mode, int));
|
||||||
static tree ffe_type_for_size PARAMS ((unsigned int, int));
|
static tree ffe_type_for_size PARAMS ((unsigned int, int));
|
||||||
|
static tree ffe_unsigned_type PARAMS ((tree));
|
||||||
|
static tree ffe_signed_type PARAMS ((tree));
|
||||||
|
static tree ffe_signed_or_unsigned_type PARAMS ((int, tree));
|
||||||
static void ffecom_init_decl_processing PARAMS ((void));
|
static void ffecom_init_decl_processing PARAMS ((void));
|
||||||
static tree ffecom_arglist_expr_ (const char *argstring, ffebld args);
|
static tree ffecom_arglist_expr_ (const char *argstring, ffebld args);
|
||||||
static tree ffecom_widest_expr_type_ (ffebld list);
|
static tree ffecom_widest_expr_type_ (ffebld list);
|
||||||
@ -14230,10 +14233,17 @@ static void ffe_mark_tree (tree);
|
|||||||
#define LANG_HOOKS_DECL_PRINTABLE_NAME ffe_printable_name
|
#define LANG_HOOKS_DECL_PRINTABLE_NAME ffe_printable_name
|
||||||
#undef LANG_HOOKS_PRINT_ERROR_FUNCTION
|
#undef LANG_HOOKS_PRINT_ERROR_FUNCTION
|
||||||
#define LANG_HOOKS_PRINT_ERROR_FUNCTION ffe_print_error_function
|
#define LANG_HOOKS_PRINT_ERROR_FUNCTION ffe_print_error_function
|
||||||
|
|
||||||
#undef LANG_HOOKS_TYPE_FOR_MODE
|
#undef LANG_HOOKS_TYPE_FOR_MODE
|
||||||
#define LANG_HOOKS_TYPE_FOR_MODE ffe_type_for_mode
|
#define LANG_HOOKS_TYPE_FOR_MODE ffe_type_for_mode
|
||||||
#undef LANG_HOOKS_TYPE_FOR_SIZE
|
#undef LANG_HOOKS_TYPE_FOR_SIZE
|
||||||
#define LANG_HOOKS_TYPE_FOR_SIZE ffe_type_for_size
|
#define LANG_HOOKS_TYPE_FOR_SIZE ffe_type_for_size
|
||||||
|
#undef LANG_HOOKS_SIGNED_TYPE
|
||||||
|
#define LANG_HOOKS_SIGNED_TYPE ffe_signed_type
|
||||||
|
#undef LANG_HOOKS_UNSIGNED_TYPE
|
||||||
|
#define LANG_HOOKS_UNSIGNED_TYPE ffe_unsigned_type
|
||||||
|
#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
|
||||||
|
#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE ffe_signed_or_unsigned_type
|
||||||
|
|
||||||
/* We do not wish to use alias-set based aliasing at all. Used in the
|
/* We do not wish to use alias-set based aliasing at all. Used in the
|
||||||
extreme (every object with its own set, with equivalences recorded) it
|
extreme (every object with its own set, with equivalences recorded) it
|
||||||
@ -14745,8 +14755,8 @@ set_block (block)
|
|||||||
BLOCK_SUBBLOCKS (block));
|
BLOCK_SUBBLOCKS (block));
|
||||||
}
|
}
|
||||||
|
|
||||||
tree
|
static tree
|
||||||
signed_or_unsigned_type (unsignedp, type)
|
ffe_signed_or_unsigned_type (unsignedp, type)
|
||||||
int unsignedp;
|
int unsignedp;
|
||||||
tree type;
|
tree type;
|
||||||
{
|
{
|
||||||
@ -14773,8 +14783,8 @@ signed_or_unsigned_type (unsignedp, type)
|
|||||||
return type2;
|
return type2;
|
||||||
}
|
}
|
||||||
|
|
||||||
tree
|
static tree
|
||||||
signed_type (type)
|
ffe_signed_type (type)
|
||||||
tree type;
|
tree type;
|
||||||
{
|
{
|
||||||
tree type1 = TYPE_MAIN_VARIANT (type);
|
tree type1 = TYPE_MAIN_VARIANT (type);
|
||||||
@ -15093,8 +15103,8 @@ ffe_type_for_size (bits, unsignedp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
tree
|
static tree
|
||||||
unsigned_type (type)
|
ffe_unsigned_type (type)
|
||||||
tree type;
|
tree type;
|
||||||
{
|
{
|
||||||
tree type1 = TYPE_MAIN_VARIANT (type);
|
tree type1 = TYPE_MAIN_VARIANT (type);
|
||||||
|
@ -1937,9 +1937,8 @@ operand_equal_for_comparison_p (arg0, arg1, other)
|
|||||||
|
|
||||||
/* Make sure shorter operand is extended the right way
|
/* Make sure shorter operand is extended the right way
|
||||||
to match the longer operand. */
|
to match the longer operand. */
|
||||||
primarg1 = convert (signed_or_unsigned_type (unsignedp1,
|
primarg1 = convert ((*lang_hooks.types.signed_or_unsigned_type)
|
||||||
TREE_TYPE (primarg1)),
|
(unsignedp1, TREE_TYPE (primarg1)), primarg1);
|
||||||
primarg1);
|
|
||||||
|
|
||||||
if (operand_equal_p (arg0, convert (type, primarg1), 0))
|
if (operand_equal_p (arg0, convert (type, primarg1), 0))
|
||||||
return 1;
|
return 1;
|
||||||
@ -2622,7 +2621,7 @@ all_ones_mask_p (mask, size)
|
|||||||
tree tmask;
|
tree tmask;
|
||||||
|
|
||||||
tmask = build_int_2 (~0, ~0);
|
tmask = build_int_2 (~0, ~0);
|
||||||
TREE_TYPE (tmask) = signed_type (type);
|
TREE_TYPE (tmask) = (*lang_hooks.types.signed_type) (type);
|
||||||
force_fit_type (tmask, 0);
|
force_fit_type (tmask, 0);
|
||||||
return
|
return
|
||||||
tree_int_cst_equal (mask,
|
tree_int_cst_equal (mask,
|
||||||
@ -3063,7 +3062,7 @@ build_range_check (type, exp, in_p, low, high)
|
|||||||
|
|
||||||
else if (integer_zerop (low))
|
else if (integer_zerop (low))
|
||||||
{
|
{
|
||||||
utype = unsigned_type (etype);
|
utype = (*lang_hooks.types.unsigned_type) (etype);
|
||||||
return build_range_check (type, convert (utype, exp), 1, 0,
|
return build_range_check (type, convert (utype, exp), 1, 0,
|
||||||
convert (utype, high));
|
convert (utype, high));
|
||||||
}
|
}
|
||||||
@ -3316,7 +3315,7 @@ unextend (c, p, unsignedp, mask)
|
|||||||
zero or one, and the conversion to a signed type can never overflow.
|
zero or one, and the conversion to a signed type can never overflow.
|
||||||
We could get an overflow if this conversion is done anywhere else. */
|
We could get an overflow if this conversion is done anywhere else. */
|
||||||
if (TREE_UNSIGNED (type))
|
if (TREE_UNSIGNED (type))
|
||||||
temp = convert (signed_type (type), temp);
|
temp = convert ((*lang_hooks.types.signed_type) (type), temp);
|
||||||
|
|
||||||
temp = const_binop (LSHIFT_EXPR, temp, size_int (modesize - 1), 0);
|
temp = const_binop (LSHIFT_EXPR, temp, size_int (modesize - 1), 0);
|
||||||
temp = const_binop (RSHIFT_EXPR, temp, size_int (modesize - p - 1), 0);
|
temp = const_binop (RSHIFT_EXPR, temp, size_int (modesize - p - 1), 0);
|
||||||
@ -5939,7 +5938,7 @@ fold (expr)
|
|||||||
|| TREE_CODE (arg0) == ROUND_MOD_EXPR)
|
|| TREE_CODE (arg0) == ROUND_MOD_EXPR)
|
||||||
&& integer_pow2p (TREE_OPERAND (arg0, 1)))
|
&& integer_pow2p (TREE_OPERAND (arg0, 1)))
|
||||||
{
|
{
|
||||||
tree newtype = unsigned_type (TREE_TYPE (arg0));
|
tree newtype = (*lang_hooks.types.unsigned_type) (TREE_TYPE (arg0));
|
||||||
tree newmod = build (TREE_CODE (arg0), newtype,
|
tree newmod = build (TREE_CODE (arg0), newtype,
|
||||||
convert (newtype, TREE_OPERAND (arg0, 0)),
|
convert (newtype, TREE_OPERAND (arg0, 0)),
|
||||||
convert (newtype, TREE_OPERAND (arg0, 1)));
|
convert (newtype, TREE_OPERAND (arg0, 1)));
|
||||||
@ -6114,25 +6113,18 @@ fold (expr)
|
|||||||
&& TREE_UNSIGNED (TREE_TYPE (arg1))
|
&& TREE_UNSIGNED (TREE_TYPE (arg1))
|
||||||
/* signed_type does not work on pointer types. */
|
/* signed_type does not work on pointer types. */
|
||||||
&& INTEGRAL_TYPE_P (TREE_TYPE (arg1)))
|
&& INTEGRAL_TYPE_P (TREE_TYPE (arg1)))
|
||||||
switch (TREE_CODE (t))
|
{
|
||||||
{
|
if (TREE_CODE (t) == LE_EXPR || TREE_CODE (t) == GT_EXPR)
|
||||||
case LE_EXPR:
|
{
|
||||||
return fold (build (GE_EXPR, type,
|
tree st0, st1;
|
||||||
convert (signed_type (TREE_TYPE (arg0)),
|
st0 = (*lang_hooks.types.signed_type) (TREE_TYPE (arg0));
|
||||||
arg0),
|
st1 = (*lang_hooks.types.signed_type) (TREE_TYPE (arg1));
|
||||||
convert (signed_type (TREE_TYPE (arg1)),
|
return fold
|
||||||
integer_zero_node)));
|
(build (TREE_CODE (t) == LE_EXPR ? GE_EXPR: LT_EXPR,
|
||||||
case GT_EXPR:
|
type, convert (st0, arg0),
|
||||||
return fold (build (LT_EXPR, type,
|
convert (st1, integer_zero_node)));
|
||||||
convert (signed_type (TREE_TYPE (arg0)),
|
}
|
||||||
arg0),
|
}
|
||||||
convert (signed_type (TREE_TYPE (arg1)),
|
|
||||||
integer_zero_node)));
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (TREE_INT_CST_HIGH (arg1) == 0
|
else if (TREE_INT_CST_HIGH (arg1) == 0
|
||||||
&& (TREE_INT_CST_LOW (arg1)
|
&& (TREE_INT_CST_LOW (arg1)
|
||||||
== ((unsigned HOST_WIDE_INT) 2 << (width - 1)) - 1)
|
== ((unsigned HOST_WIDE_INT) 2 << (width - 1)) - 1)
|
||||||
@ -6506,14 +6498,16 @@ fold (expr)
|
|||||||
case GE_EXPR:
|
case GE_EXPR:
|
||||||
case GT_EXPR:
|
case GT_EXPR:
|
||||||
if (TREE_UNSIGNED (TREE_TYPE (arg1)))
|
if (TREE_UNSIGNED (TREE_TYPE (arg1)))
|
||||||
arg1 = convert (signed_type (TREE_TYPE (arg1)), arg1);
|
arg1 = convert ((*lang_hooks.types.signed_type)
|
||||||
|
(TREE_TYPE (arg1)), arg1);
|
||||||
return pedantic_non_lvalue
|
return pedantic_non_lvalue
|
||||||
(convert (type, fold (build1 (ABS_EXPR,
|
(convert (type, fold (build1 (ABS_EXPR,
|
||||||
TREE_TYPE (arg1), arg1))));
|
TREE_TYPE (arg1), arg1))));
|
||||||
case LE_EXPR:
|
case LE_EXPR:
|
||||||
case LT_EXPR:
|
case LT_EXPR:
|
||||||
if (TREE_UNSIGNED (TREE_TYPE (arg1)))
|
if (TREE_UNSIGNED (TREE_TYPE (arg1)))
|
||||||
arg1 = convert (signed_type (TREE_TYPE (arg1)), arg1);
|
arg1 = convert ((lang_hooks.types.signed_type)
|
||||||
|
(TREE_TYPE (arg1)), arg1);
|
||||||
return pedantic_non_lvalue
|
return pedantic_non_lvalue
|
||||||
(negate_expr (convert (type,
|
(negate_expr (convert (type,
|
||||||
fold (build1 (ABS_EXPR,
|
fold (build1 (ABS_EXPR,
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
2002-04-01 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2002-03-31 Neil Booth <neil@daikokuya.demon.co.uk>
|
2002-03-31 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||||
|
|
||||||
* lang.c (LANG_HOOKS_PRINT_ERROR_FUNCTION): Redefine.
|
* lang.c (LANG_HOOKS_PRINT_ERROR_FUNCTION): Redefine.
|
||||||
|
@ -1395,7 +1395,7 @@ build_java_binop (op, type, arg1, arg2)
|
|||||||
{
|
{
|
||||||
case URSHIFT_EXPR:
|
case URSHIFT_EXPR:
|
||||||
{
|
{
|
||||||
tree u_type = unsigned_type (type);
|
tree u_type = java_unsigned_type (type);
|
||||||
arg1 = convert (u_type, arg1);
|
arg1 = convert (u_type, arg1);
|
||||||
arg1 = build_java_binop (RSHIFT_EXPR, u_type, arg1, arg2);
|
arg1 = build_java_binop (RSHIFT_EXPR, u_type, arg1, arg2);
|
||||||
return convert (type, arg1);
|
return convert (type, arg1);
|
||||||
|
@ -1041,6 +1041,9 @@ extern void java_parse_file PARAMS ((void));
|
|||||||
extern void java_mark_tree PARAMS ((tree));
|
extern void java_mark_tree PARAMS ((tree));
|
||||||
extern tree java_type_for_mode PARAMS ((enum machine_mode, int));
|
extern tree java_type_for_mode PARAMS ((enum machine_mode, int));
|
||||||
extern tree java_type_for_size PARAMS ((unsigned int, int));
|
extern tree java_type_for_size PARAMS ((unsigned int, int));
|
||||||
|
extern tree java_unsigned_type PARAMS ((tree));
|
||||||
|
extern tree java_signed_type PARAMS ((tree));
|
||||||
|
extern tree java_signed_or_unsigned_type PARAMS ((int, tree));
|
||||||
extern void add_assume_compiled PARAMS ((const char *, int));
|
extern void add_assume_compiled PARAMS ((const char *, int));
|
||||||
extern tree lookup_class PARAMS ((tree));
|
extern tree lookup_class PARAMS ((tree));
|
||||||
extern tree lookup_java_constructor PARAMS ((tree, tree));
|
extern tree lookup_java_constructor PARAMS ((tree, tree));
|
||||||
|
@ -237,10 +237,17 @@ static int dependency_tracking = 0;
|
|||||||
#define LANG_HOOKS_DECL_PRINTABLE_NAME lang_printable_name
|
#define LANG_HOOKS_DECL_PRINTABLE_NAME lang_printable_name
|
||||||
#undef LANG_HOOKS_PRINT_ERROR_FUNCTION
|
#undef LANG_HOOKS_PRINT_ERROR_FUNCTION
|
||||||
#define LANG_HOOKS_PRINT_ERROR_FUNCTION java_print_error_function
|
#define LANG_HOOKS_PRINT_ERROR_FUNCTION java_print_error_function
|
||||||
|
|
||||||
#undef LANG_HOOKS_TYPE_FOR_MODE
|
#undef LANG_HOOKS_TYPE_FOR_MODE
|
||||||
#define LANG_HOOKS_TYPE_FOR_MODE java_type_for_mode
|
#define LANG_HOOKS_TYPE_FOR_MODE java_type_for_mode
|
||||||
#undef LANG_HOOKS_TYPE_FOR_SIZE
|
#undef LANG_HOOKS_TYPE_FOR_SIZE
|
||||||
#define LANG_HOOKS_TYPE_FOR_SIZE java_type_for_size
|
#define LANG_HOOKS_TYPE_FOR_SIZE java_type_for_size
|
||||||
|
#undef LANG_HOOKS_SIGNED_TYPE
|
||||||
|
#define LANG_HOOKS_SIGNED_TYPE java_signed_type
|
||||||
|
#undef LANG_HOOKS_UNSIGNED_TYPE
|
||||||
|
#define LANG_HOOKS_UNSIGNED_TYPE java_unsigned_type
|
||||||
|
#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
|
||||||
|
#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE java_signed_or_unsigned_type
|
||||||
|
|
||||||
/* Each front end provides its own. */
|
/* Each front end provides its own. */
|
||||||
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
|
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
|
||||||
|
@ -13402,7 +13402,7 @@ patch_binop (node, wfl_op1, wfl_op2)
|
|||||||
if (code == URSHIFT_EXPR && ! flag_emit_class_files)
|
if (code == URSHIFT_EXPR && ! flag_emit_class_files)
|
||||||
{
|
{
|
||||||
tree to_return;
|
tree to_return;
|
||||||
tree utype = unsigned_type (prom_type);
|
tree utype = java_unsigned_type (prom_type);
|
||||||
op1 = convert (utype, op1);
|
op1 = convert (utype, op1);
|
||||||
TREE_SET_CODE (node, RSHIFT_EXPR);
|
TREE_SET_CODE (node, RSHIFT_EXPR);
|
||||||
TREE_OPERAND (node, 0) = op1;
|
TREE_OPERAND (node, 0) = op1;
|
||||||
|
@ -226,7 +226,7 @@ java_type_for_size (bits, unsignedp)
|
|||||||
signed according to UNSIGNEDP. */
|
signed according to UNSIGNEDP. */
|
||||||
|
|
||||||
tree
|
tree
|
||||||
signed_or_unsigned_type (unsignedp, type)
|
java_signed_or_unsigned_type (unsignedp, type)
|
||||||
int unsignedp;
|
int unsignedp;
|
||||||
tree type;
|
tree type;
|
||||||
{
|
{
|
||||||
@ -246,20 +246,19 @@ signed_or_unsigned_type (unsignedp, type)
|
|||||||
/* Return a signed type the same as TYPE in other respects. */
|
/* Return a signed type the same as TYPE in other respects. */
|
||||||
|
|
||||||
tree
|
tree
|
||||||
signed_type (type)
|
java_signed_type (type)
|
||||||
tree type;
|
tree type;
|
||||||
{
|
{
|
||||||
return signed_or_unsigned_type (0, type);
|
return java_signed_or_unsigned_type (0, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return an unsigned type the same as TYPE in other respects. */
|
/* Return an unsigned type the same as TYPE in other respects. */
|
||||||
|
|
||||||
tree
|
tree
|
||||||
unsigned_type (type)
|
java_unsigned_type (type)
|
||||||
tree type;
|
tree type;
|
||||||
{
|
{
|
||||||
return signed_or_unsigned_type (1, type);
|
return java_signed_or_unsigned_type (1, type);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark EXP saying that we need to be able to take the
|
/* Mark EXP saying that we need to be able to take the
|
||||||
|
@ -160,7 +160,10 @@ int lhd_tree_dump_type_quals PARAMS ((tree));
|
|||||||
#define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
|
#define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
|
||||||
LANG_HOOKS_MAKE_TYPE, \
|
LANG_HOOKS_MAKE_TYPE, \
|
||||||
LANG_HOOKS_TYPE_FOR_MODE, \
|
LANG_HOOKS_TYPE_FOR_MODE, \
|
||||||
LANG_HOOKS_TYPE_FOR_SIZE \
|
LANG_HOOKS_TYPE_FOR_SIZE, \
|
||||||
|
LANG_HOOKS_UNSIGNED_TYPE, \
|
||||||
|
LANG_HOOKS_SIGNED_TYPE, \
|
||||||
|
LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Declaration hooks. */
|
/* Declaration hooks. */
|
||||||
|
@ -84,6 +84,18 @@ struct lang_hooks_for_types
|
|||||||
/* Given PRECISION and UNSIGNEDP, return a suitable type-tree for an
|
/* Given PRECISION and UNSIGNEDP, return a suitable type-tree for an
|
||||||
integer type with at least that precision. */
|
integer type with at least that precision. */
|
||||||
tree (*type_for_size) PARAMS ((unsigned, int));
|
tree (*type_for_size) PARAMS ((unsigned, int));
|
||||||
|
|
||||||
|
/* Given an integer type T, return a type like T but unsigned.
|
||||||
|
If T is unsigned, the value is T. */
|
||||||
|
tree (*unsigned_type) PARAMS ((tree));
|
||||||
|
|
||||||
|
/* Given an integer type T, return a type like T but signed.
|
||||||
|
If T is signed, the value is T. */
|
||||||
|
tree (*signed_type) PARAMS ((tree));
|
||||||
|
|
||||||
|
/* Return a type the same as TYPE except unsigned or signed
|
||||||
|
according to UNSIGNEDP. */
|
||||||
|
tree (*signed_or_unsigned_type) PARAMS ((int, tree));
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Language hooks related to decls and the symbol table. */
|
/* Language hooks related to decls and the symbol table. */
|
||||||
|
@ -84,6 +84,12 @@ static void objc_post_options PARAMS ((void));
|
|||||||
#define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
|
#define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
|
||||||
#undef LANG_HOOKS_TYPE_FOR_SIZE
|
#undef LANG_HOOKS_TYPE_FOR_SIZE
|
||||||
#define LANG_HOOKS_TYPE_FOR_SIZE c_common_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. */
|
/* Each front end provides its own hooks, for toplev.c. */
|
||||||
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
|
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
|
||||||
|
15
gcc/tree.h
15
gcc/tree.h
@ -2125,7 +2125,6 @@ extern tree make_signed_type PARAMS ((int));
|
|||||||
extern tree make_unsigned_type PARAMS ((int));
|
extern tree make_unsigned_type PARAMS ((int));
|
||||||
extern void initialize_sizetypes PARAMS ((void));
|
extern void initialize_sizetypes PARAMS ((void));
|
||||||
extern void set_sizetype PARAMS ((tree));
|
extern void set_sizetype PARAMS ((tree));
|
||||||
extern tree signed_or_unsigned_type PARAMS ((int, tree));
|
|
||||||
extern void fixup_unsigned_type PARAMS ((tree));
|
extern void fixup_unsigned_type PARAMS ((tree));
|
||||||
extern tree build_pointer_type PARAMS ((tree));
|
extern tree build_pointer_type PARAMS ((tree));
|
||||||
extern tree build_reference_type PARAMS ((tree));
|
extern tree build_reference_type PARAMS ((tree));
|
||||||
@ -2607,20 +2606,6 @@ extern tree get_unwidened PARAMS ((tree, tree));
|
|||||||
|
|
||||||
extern tree get_narrower PARAMS ((tree, int *));
|
extern tree get_narrower PARAMS ((tree, int *));
|
||||||
|
|
||||||
/* Given an integer type T, return a type like T but unsigned.
|
|
||||||
If T is unsigned, the value is T.
|
|
||||||
The definition of this resides in language-specific code
|
|
||||||
as the repertoire of available types may vary. */
|
|
||||||
|
|
||||||
extern tree unsigned_type PARAMS ((tree));
|
|
||||||
|
|
||||||
/* Given an integer type T, return a type like T but signed.
|
|
||||||
If T is signed, the value is T.
|
|
||||||
The definition of this resides in language-specific code
|
|
||||||
as the repertoire of available types may vary. */
|
|
||||||
|
|
||||||
extern tree signed_type PARAMS ((tree));
|
|
||||||
|
|
||||||
/* Given an expression EXP that may be a COMPONENT_REF or an ARRAY_REF,
|
/* Given an expression EXP that may be a COMPONENT_REF or an ARRAY_REF,
|
||||||
look for nested component-refs or array-refs at constant positions
|
look for nested component-refs or array-refs at constant positions
|
||||||
and find the ultimate containing object, which is returned. */
|
and find the ultimate containing object, which is returned. */
|
||||||
|
Loading…
Reference in New Issue
Block a user