/* Subroutines shared by all languages that are variants of C.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GCC.
if (TREE_CODE (expr) == FUNCTION_DECL)
expr = build_unary_op (ADDR_EXPR, expr, 0);
-#if 0 /* This appears to be wrong for C++. */
- /* These really should return error_mark_node after 2.4 is stable.
- But not all callers handle ERROR_MARK properly. */
- switch (TREE_CODE (TREE_TYPE (expr)))
- {
- case RECORD_TYPE:
- error ("struct type value used where scalar is required");
- return truthvalue_false_node;
-
- case UNION_TYPE:
- error ("union type value used where scalar is required");
- return truthvalue_false_node;
-
- case ARRAY_TYPE:
- error ("array type value used where scalar is required");
- return truthvalue_false_node;
-
- default:
- break;
- }
-#endif /* 0 */
-
switch (TREE_CODE (expr))
{
case EQ_EXPR:
case COMPLEX_EXPR:
return build_binary_op ((TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 1))
? TRUTH_OR_EXPR : TRUTH_ORIF_EXPR),
- c_common_truthvalue_conversion (TREE_OPERAND (expr, 0)),
- c_common_truthvalue_conversion (TREE_OPERAND (expr, 1)),
+ (*lang_hooks.truthvalue_conversion) (TREE_OPERAND (expr, 0)),
+ (*lang_hooks.truthvalue_conversion) (TREE_OPERAND (expr, 1)),
0);
case NEGATE_EXPR:
case ABS_EXPR:
case FLOAT_EXPR:
/* These don't change whether an object is nonzero or zero. */
- return c_common_truthvalue_conversion (TREE_OPERAND (expr, 0));
+ return (*lang_hooks.truthvalue_conversion) (TREE_OPERAND (expr, 0));
case LROTATE_EXPR:
case RROTATE_EXPR:
we can't ignore them if their second arg has side-effects. */
if (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 1)))
return build (COMPOUND_EXPR, truthvalue_type_node, TREE_OPERAND (expr, 1),
- c_common_truthvalue_conversion (TREE_OPERAND (expr, 0)));
+ (*lang_hooks.truthvalue_conversion) (TREE_OPERAND (expr, 0)));
else
- return c_common_truthvalue_conversion (TREE_OPERAND (expr, 0));
+ return (*lang_hooks.truthvalue_conversion) (TREE_OPERAND (expr, 0));
case COND_EXPR:
/* Distribute the conversion into the arms of a COND_EXPR. */
return fold (build (COND_EXPR, truthvalue_type_node, TREE_OPERAND (expr, 0),
- c_common_truthvalue_conversion (TREE_OPERAND (expr, 1)),
- c_common_truthvalue_conversion (TREE_OPERAND (expr, 2))));
+ (*lang_hooks.truthvalue_conversion) (TREE_OPERAND (expr, 1)),
+ (*lang_hooks.truthvalue_conversion) (TREE_OPERAND (expr, 2))));
case CONVERT_EXPR:
/* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE,
/* If this is widening the argument, we can ignore it. */
if (TYPE_PRECISION (TREE_TYPE (expr))
>= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (expr, 0))))
- return c_common_truthvalue_conversion (TREE_OPERAND (expr, 0));
+ return (*lang_hooks.truthvalue_conversion) (TREE_OPERAND (expr, 0));
break;
case MINUS_EXPR:
return (build_binary_op
((TREE_SIDE_EFFECTS (expr)
? TRUTH_OR_EXPR : TRUTH_ORIF_EXPR),
- c_common_truthvalue_conversion (build_unary_op (REALPART_EXPR, t, 0)),
- c_common_truthvalue_conversion (build_unary_op (IMAGPART_EXPR, t, 0)),
+ (*lang_hooks.truthvalue_conversion) (build_unary_op (REALPART_EXPR, t, 0)),
+ (*lang_hooks.truthvalue_conversion) (build_unary_op (IMAGPART_EXPR, t, 0)),
0));
}
int *ip;
int **ipp = &ip;
- const int* const* cipp = &ipp;
+ const int* const* cipp = ipp;
And, it doesn't make sense for that to be legal unless you
can dereference IPP and CIPP. So, we ignore cv-qualifiers on
expand_stmt (STMT_EXPR_STMT (exp));
expand_end_stmt_expr (rtl_expr);
- result = expand_expr (rtl_expr, target, tmode, modifier);
+ result = expand_expr_real (rtl_expr, target, tmode, modifier, alt_rtl);
if (preserve_result && GET_CODE (result) == MEM)
{
if (GET_MODE (result) != BLKmode)
#undef DEF_ATTR_TREE_LIST
}
-/* Output a -Wshadow warning MSGCODE about NAME, and give the location
- of the previous declaration DECL. */
-void
-shadow_warning (enum sw_kind msgcode, const char *name, tree decl)
-{
- static const char *const msgs[] = {
- /* SW_PARAM */ N_("declaration of \"%s\" shadows a parameter"),
- /* SW_LOCAL */ N_("declaration of \"%s\" shadows a previous local"),
- /* SW_GLOBAL */ N_("declaration of \"%s\" shadows a global declaration")
- };
-
- warning (msgs[msgcode], name);
- warning ("%Jshadowed declaration is here", decl);
-}
-
/* Attribute handlers common to C front ends. */
/* Handle a "packed" attribute; arguments as in
case MODIFY_EXPR:
case CONSTRUCTOR:
{
- int size = int_size_in_bytes (TREE_TYPE (x));
+ HOST_WIDE_INT size;
- if (!size || size > MOVE_MAX_PIECES)
+ size = int_size_in_bytes (TREE_TYPE (x));
+
+ if (size < 0 || size > MOVE_MAX_PIECES * MOVE_RATIO)
*count += 10;
else
- *count += 2 * (size + MOVE_MAX - 1) / MOVE_MAX;
- return NULL;
+ *count += ((size + MOVE_MAX_PIECES - 1) / MOVE_MAX_PIECES);
}
break;
+ case CALL_EXPR:
+ {
+ tree decl = get_callee_fndecl (x);
+
+ if (decl && DECL_BUILT_IN (decl))
+ switch (DECL_FUNCTION_CODE (decl))
+ {
+ case BUILT_IN_CONSTANT_P:
+ *walk_subtrees = 0;
+ return NULL_TREE;
+ case BUILT_IN_EXPECT:
+ return NULL_TREE;
+ default:
+ break;
+ }
+ *count += 10;
+ break;
+ }
/* Few special cases of expensive operations. This is usefull
to avoid inlining on functions having too many of these. */
case TRUNC_DIV_EXPR:
case FLOOR_MOD_EXPR:
case ROUND_MOD_EXPR:
case RDIV_EXPR:
- case CALL_EXPR:
*count += 10;
break;
/* Various containers that will produce no code themselves. */