tree result;
expr = save_expr (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 = 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);
+ result = fold (build3 (COND_EXPR, type,
+ fold (build2 (NE_EXPR, boolean_type_node, expr, expr)),
+ convert (type, integer_zero_node),
+ convert_to_integer (type, expr)));
+
+ result = fold (build3 (COND_EXPR, type,
+ fold (build2 (LE_EXPR, boolean_type_node, expr,
+ convert (TREE_TYPE (expr),
+ TYPE_MIN_VALUE (type)))),
+ TYPE_MIN_VALUE (type),
+ result));
+
+ result = fold (build3 (COND_EXPR, type,
+ fold (build2 (GE_EXPR, boolean_type_node, expr,
+ convert (TREE_TYPE (expr),
+ TYPE_MAX_VALUE (type)))),
+ TYPE_MAX_VALUE (type),
+ result));
return result;
}
return error_mark_node;
if (code == VOID_TYPE)
return build1 (CONVERT_EXPR, type, expr);
- if (code == BOOLEAN_TYPE)
- return fold (convert_to_boolean (type, expr));
+ if (code == BOOLEAN_TYPE || code == CHAR_TYPE)
+ return fold_convert (type, expr);
if (code == INTEGER_TYPE)
{
- if (! flag_unsafe_math_optimizations
- && ! flag_emit_class_files
+ if ((really_constant_p (expr)
+ || (! flag_unsafe_math_optimizations
+ && ! flag_emit_class_files))
&& TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
&& TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)
return fold (convert_ieee_real_to_integer (type, expr));
}
if (code == REAL_TYPE)
return fold (convert_to_real (type, expr));
- if (code == CHAR_TYPE)
- return fold (convert_to_char (type, expr));
if (code == POINTER_TYPE)
return fold (convert_to_pointer (type, expr));
error ("conversion to non-scalar type requested");
}
-tree
-convert_to_char (tree type, tree expr)
-{
- return build1 (NOP_EXPR, type, expr);
-}
-
-tree
-convert_to_boolean (tree type, tree expr)
-{
- return build1 (NOP_EXPR, type, expr);
-}
-
/* Return a data type that has machine mode MODE.
If the mode is an integer,
then UNSIGNEDP selects between signed and unsigned types. */
if (length != -1)
{
- tree max_index = build_int_2 (length - 1, (0 == length ? -1 : 0));
- TREE_TYPE (max_index) = sizetype;
+ tree max_index = build_int_cst (sizetype, length - 1);
index = build_index_type (max_index);
}
return build_array_type (element_type, index);
break;
}
*ptr = str+1;
- type = lookup_class (unmangle_classname (start, str - start));
+ type = lookup_class (unmangle_classname ((const char *) start, str - start));
break;
}
default:
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)
{