/* Handle types for the GNU compiler for the Java(TM) language.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
Free Software Foundation, Inc.
This file is part of GCC.
tree result;
expr = save_expr (expr);
- result = build (COND_EXPR, type,
- build (NE_EXPR, boolean_type_node, expr, expr),
- convert (type, integer_zero_node),
- convert_to_integer (type, expr));
+ result = build3 (COND_EXPR, type,
+ build2 (NE_EXPR, boolean_type_node, expr, expr),
+ convert (type, integer_zero_node),
+ convert_to_integer (type, expr));
- result = build (COND_EXPR, type,
- build (LE_EXPR, boolean_type_node, expr,
- convert (TREE_TYPE (expr), TYPE_MIN_VALUE (type))),
- TYPE_MIN_VALUE (type),
- result);
-
- result = build (COND_EXPR, type,
- build (GE_EXPR, boolean_type_node, expr,
- convert (TREE_TYPE (expr), TYPE_MAX_VALUE (type))),
- TYPE_MAX_VALUE (type),
- result);
+ result = build3 (COND_EXPR, type,
+ build2 (LE_EXPR, boolean_type_node, expr,
+ convert (TREE_TYPE (expr), TYPE_MIN_VALUE (type))),
+ TYPE_MIN_VALUE (type),
+ result);
+
+ result = build3 (COND_EXPR, type,
+ build2 (GE_EXPR, boolean_type_node, expr,
+ convert (TREE_TYPE (expr), TYPE_MAX_VALUE (type))),
+ TYPE_MAX_VALUE (type),
+ result);
return result;
}
&& TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)
return fold (convert_ieee_real_to_integer (type, expr));
else
- return fold (convert_to_integer (type, expr));
+ {
+ /* fold very helpfully sets the overflow status if a type
+ overflows in a narrowing integer conversion, but Java
+ doesn't care. */
+ tree tmp = fold (convert_to_integer (type, expr));
+ TREE_OVERFLOW (tmp) = 0;
+ return tmp;
+ }
}
if (code == REAL_TYPE)
return fold (convert_to_real (type, expr));
method_signature, build_java_signature);
}
-/* Return true iff CLASS (or its ancestors) has a method METHOD_NAME. */
+/* Return true iff CLASS (or its ancestors) has a method METHOD_NAME. */
int
has_method (tree class, tree method_name)
{
lookup_do. */
static tree
find_method_in_superclasses (tree searched_class, int flags,
- tree method_name,
- tree signature, tree (*signature_builder) (tree))
+ tree method_name, tree signature,
+ tree (*signature_builder) (tree))
{
tree klass;
for (klass = CLASSTYPE_SUPER (searched_class); klass != NULL_TREE;
for a method matching METHOD_NAME and signature SIGNATURE. A
private helper for lookup_do. */
static tree
-find_method_in_interfaces (tree searched_class, int flags, tree method_name,
- tree signature, tree (*signature_builder) (tree))
+find_method_in_interfaces (tree searched_class, int flags, tree method_name,
+ tree signature, tree (*signature_builder) (tree))
{
int i;
- int interface_len =
- TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (searched_class)) - 1;
+ tree binfo, base_binfo;
- for (i = interface_len; i > 0; i--)
+ for (binfo = TYPE_BINFO (searched_class), i = 1;
+ BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
{
- tree child =
- TREE_VEC_ELT (TYPE_BINFO_BASETYPES (searched_class), i);
- tree iclass = BINFO_TYPE (child);
+ tree iclass = BINFO_TYPE (base_binfo);
tree method;
/* If the superinterface hasn't been loaded yet, do so now. */
/* First, we look in ICLASS. If that doesn't work we'll
recursively look through all its superinterfaces. */
method = shallow_find_method (iclass, flags, method_name,
- signature, signature_builder);
+ signature, signature_builder);
if (method != NULL_TREE)
return method;