aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2005-12-03 18:58:43 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2005-12-03 18:58:43 +0000
commit4c7a6c1bdb63272d47cbe9aa39b2ee64d3a63fa4 (patch)
tree8a5a86529d5c77ec43f37dd146c1b7272877a41c /gcc/c-common.c
parenta34a91f0b73dad394cd0db44f5702406c09a06c6 (diff)
downloadgcc-4c7a6c1bdb63272d47cbe9aa39b2ee64d3a63fa4.zip
gcc-4c7a6c1bdb63272d47cbe9aa39b2ee64d3a63fa4.tar.gz
gcc-4c7a6c1bdb63272d47cbe9aa39b2ee64d3a63fa4.tar.bz2
c-common.c (c_sizeof_or_alignof_type): Use fold_convert instead of building a NOP_EXPR.
* c-common.c (c_sizeof_or_alignof_type): Use fold_convert instead of building a NOP_EXPR. (c_alignof_expr): Likewise. Handle CONVERT_EXPR the same as NOP_EXPR. * c-convert.c (convert): Use fold_convert instead of building NOP_EXPRs and CONVERT_EXPRs directly. Don't special case c_objc_common_truthvalue_conversion returning a NOP_EXPR. Remove #if 0 code. * c-pretty-print.c (pp_c_cast_expression, pp_c_expression): Handle NOP_EXPR the same as CONVERT_EXPR. * c-typeck.c (build_function_call): Use fold_convert instead of building a NOP_EXPR directly. (build_compound_expr): Handle NOP_EXPR the same as CONVERT_EXPR. testsuite: * gcc.dg/cast-pretty-print-1.c: New test. From-SVN: r108001
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index e617094..898f394 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -2873,7 +2873,7 @@ c_sizeof_or_alignof_type (tree type, bool is_sizeof, int complain)
TYPE_IS_SIZETYPE means that certain things (like overflow) will
never happen. However, this node should really have type
`size_t', which is just a typedef for an ordinary integer type. */
- value = fold_build1 (NOP_EXPR, size_type_node, value);
+ value = fold_convert (size_type_node, value);
gcc_assert (!TYPE_IS_SIZETYPE (TREE_TYPE (value)));
return value;
@@ -2908,7 +2908,7 @@ c_alignof_expr (tree expr)
tree best = t;
int bestalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t)));
- while (TREE_CODE (t) == NOP_EXPR
+ while ((TREE_CODE (t) == NOP_EXPR || TREE_CODE (t) == CONVERT_EXPR)
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == POINTER_TYPE)
{
int thisalign;
@@ -2923,7 +2923,7 @@ c_alignof_expr (tree expr)
else
return c_alignof (TREE_TYPE (expr));
- return fold_build1 (NOP_EXPR, size_type_node, t);
+ return fold_convert (size_type_node, t);
}
/* Handle C and C++ default attributes. */