diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-20 22:36:42 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-20 22:36:42 +0000 |
commit | a97c952ca6abfccfd82641acc186bbd9e83f1dd8 (patch) | |
tree | 6afbe1d7fd19b5b59a51a04e48abe01c100bcb59 | |
parent | 40d475ee1460e9ab2caaf7eda84a2242adab0f1d (diff) | |
download | gcc-a97c952ca6abfccfd82641acc186bbd9e83f1dd8.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96770 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/c-common.c | 7 | ||||
-rw-r--r-- | gcc/c-typeck.c | 38 |
3 files changed, 19 insertions, 36 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dae1e9070d0..9527b129594 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2005-03-20 Joseph S. Myers <joseph@codesourcery.com> + + * 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. + 2005-03-20 Roger Sayle <roger@eyesopen.com> Joseph S. Myers <joseph@codesourcery.com> diff --git a/gcc/c-common.c b/gcc/c-common.c index f8162fc64af..1851836e9df 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1411,7 +1411,8 @@ check_case_value (tree value) if (value == NULL_TREE) return value; - /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ + /* ??? Can we ever get nops here for a valid case value? We + shouldn't for C. */ STRIP_TYPE_NOPS (value); /* In C++, the following is allowed: @@ -4934,11 +4935,7 @@ handle_vector_size_attribute (tree *node, tree name, tree args, *no_add_attrs = true; - /* Stripping NON_LVALUE_EXPR allows declarations such as - typedef short v4si __attribute__((vector_size (4 * sizeof(short)))). */ size = TREE_VALUE (args); - if (TREE_CODE (size) == NON_LVALUE_EXPR) - size = TREE_OPERAND (size, 0); if (!host_integerp (size, 1)) { diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 3b35acf9280..0595b88b877 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); |