aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-typeck.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2005-03-20 22:36:42 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2005-03-20 22:36:42 +0000
commited248cf7644668ecbad4a1a333fca6d0f7bba55a (patch)
tree6afbe1d7fd19b5b59a51a04e48abe01c100bcb59 /gcc/c-typeck.c
parent749053f5e22e146b0fa53134a1d3bff912ca5840 (diff)
downloadgcc-ed248cf7644668ecbad4a1a333fca6d0f7bba55a.zip
gcc-ed248cf7644668ecbad4a1a333fca6d0f7bba55a.tar.gz
gcc-ed248cf7644668ecbad4a1a333fca6d0f7bba55a.tar.bz2
c-common.c (check_case_value): Adjust comment about stripping NOPs.
* c-common.c (check_case_value): Adjust comment about stripping NOPs. (handle_vector_size_attribute): Don't strip NON_LVALUE_EXPR. * c-typeck.c (default_conversion, convert_arguments, build_modify_expr, convert_for_assignment, store_init_value, digest_init): Use STRIP_TYPE_NOPS instead of stripping nops manually. Remove inaccurate comments. From-SVN: r96770
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r--gcc/c-typeck.c38
1 files changed, 7 insertions, 31 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 3b35acf..0595b88 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -1378,16 +1378,9 @@ default_conversion (tree exp)
type = TREE_TYPE (exp);
}
- /* Strip NON_LVALUE_EXPRs and no-op conversions, since we aren't using as
- an lvalue.
-
- Do not use STRIP_NOPS here! It will remove conversions from pointer
- to integer and cause infinite recursion. */
+ /* Strip no-op conversions. */
orig_exp = exp;
- while (TREE_CODE (exp) == NON_LVALUE_EXPR
- || (TREE_CODE (exp) == NOP_EXPR
- && TREE_TYPE (TREE_OPERAND (exp, 0)) == TREE_TYPE (exp)))
- exp = TREE_OPERAND (exp, 0);
+ STRIP_TYPE_NOPS (exp);
if (TREE_NO_WARNING (orig_exp))
TREE_NO_WARNING (exp) = 1;
@@ -2133,11 +2126,7 @@ convert_arguments (tree typelist, tree values, tree function, tree fundecl)
argnum -= 2;
}
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- /* Do not use STRIP_NOPS here! We do not want an enumerator with value 0
- to convert automatically to a pointer. */
- if (TREE_CODE (val) == NON_LVALUE_EXPR)
- val = TREE_OPERAND (val, 0);
+ STRIP_TYPE_NOPS (val);
val = default_function_array_conversion (val);
@@ -3349,11 +3338,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
if (TREE_CODE (lhs) == ERROR_MARK || TREE_CODE (rhs) == ERROR_MARK)
return error_mark_node;
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- /* Do not use STRIP_NOPS here. We do not want an enumerator
- whose value is 0 to count as a null pointer constant. */
- if (TREE_CODE (rhs) == NON_LVALUE_EXPR)
- rhs = TREE_OPERAND (rhs, 0);
+ STRIP_TYPE_NOPS (rhs);
newrhs = rhs;
@@ -3487,11 +3472,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
} \
} while (0)
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- /* Do not use STRIP_NOPS here. We do not want an enumerator
- whose value is 0 to count as a null pointer constant. */
- if (TREE_CODE (rhs) == NON_LVALUE_EXPR)
- rhs = TREE_OPERAND (rhs, 0);
+ STRIP_TYPE_NOPS (rhs);
if (TREE_CODE (TREE_TYPE (rhs)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (rhs)) == FUNCTION_TYPE)
@@ -3933,8 +3914,7 @@ store_init_value (tree decl, tree init)
{
tree inside_init = init;
- if (TREE_CODE (init) == NON_LVALUE_EXPR)
- inside_init = TREE_OPERAND (init, 0);
+ STRIP_TYPE_NOPS (inside_init);
inside_init = fold (inside_init);
if (TREE_CODE (inside_init) == COMPOUND_LITERAL_EXPR)
@@ -4154,11 +4134,7 @@ digest_init (tree type, tree init, bool strict_string, int require_constant)
|| TREE_TYPE (init) == error_mark_node)
return error_mark_node;
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- /* Do not use STRIP_NOPS here. We do not want an enumerator
- whose value is 0 to count as a null pointer constant. */
- if (TREE_CODE (init) == NON_LVALUE_EXPR)
- inside_init = TREE_OPERAND (init, 0);
+ STRIP_TYPE_NOPS (inside_init);
inside_init = fold (inside_init);