From 67409385de6e36bd5b6bd23d81adbf06b3cd12ad Mon Sep 17 00:00:00 2001 From: jsm28 Date: Sun, 20 Mar 2005 15:23:50 +0000 Subject: * c-common.c (handle_aligned_attribute, check_function_sentinel, get_nonnull_operand, handle_sentinel_attribute, check_function_arguments_recurse): Do not strip NOPS from INTEGER_CSTs. * c-decl.c (check_bitfield_type_and_width, build_enumerator): Likewise. * c-format.c (get_constant): Likewise. * c-parser.c (c_parser_postfix_expression): Likewise. * c-typeck.c (set_init_index): Likewise. (convert_arguments): Don't check for NOP_EXPR containing integer constant. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96760 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 14 ++++++++++++++ gcc/c-common.c | 20 +------------------- gcc/c-decl.c | 7 ------- gcc/c-format.c | 9 ++------- gcc/c-parser.c | 1 - gcc/c-typeck.c | 20 -------------------- 6 files changed, 17 insertions(+), 54 deletions(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cc0a972c874..171eeefc5f3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2005-03-20 Joseph S. Myers + + * c-common.c (handle_aligned_attribute, check_function_sentinel, + get_nonnull_operand, handle_sentinel_attribute, + check_function_arguments_recurse): Do not strip NOPS from + INTEGER_CSTs. + * c-decl.c (check_bitfield_type_and_width, build_enumerator): + Likewise. + * c-format.c (get_constant): Likewise. + * c-parser.c (c_parser_postfix_expression): Likewise. + * c-typeck.c (set_init_index): Likewise. + (convert_arguments): Don't check for NOP_EXPR containing integer + constant. + 2005-03-20 Kazu Hirata * builtins.c (fold_fixed_mathfn, fold_builtin_trunc, diff --git a/gcc/c-common.c b/gcc/c-common.c index 65172861635..f8162fc64af 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -4481,12 +4481,6 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args, else if (TYPE_P (*node)) type = node, is_type = 1; - /* Strip any NOPs of any kind. */ - while (TREE_CODE (align_expr) == NOP_EXPR - || TREE_CODE (align_expr) == CONVERT_EXPR - || TREE_CODE (align_expr) == NON_LVALUE_EXPR) - align_expr = TREE_OPERAND (align_expr, 0); - if (TREE_CODE (align_expr) != INTEGER_CST) { error ("requested alignment is not a constant"); @@ -5119,7 +5113,6 @@ check_function_sentinel (tree attrs, tree params) if (TREE_VALUE (attr)) { tree p = TREE_VALUE (TREE_VALUE (attr)); - STRIP_NOPS (p); pos = TREE_INT_CST_LOW (p); } @@ -5199,13 +5192,7 @@ check_nonnull_arg (void * ARG_UNUSED (ctx), tree param, static bool get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp) { - /* Strip any conversions from the arg number and verify they - are constants. */ - while (TREE_CODE (arg_num_expr) == NOP_EXPR - || TREE_CODE (arg_num_expr) == CONVERT_EXPR - || TREE_CODE (arg_num_expr) == NON_LVALUE_EXPR) - arg_num_expr = TREE_OPERAND (arg_num_expr, 0); - + /* Verify the arg number is a constant. */ if (TREE_CODE (arg_num_expr) != INTEGER_CST || TREE_INT_CST_HIGH (arg_num_expr) != 0) return false; @@ -5324,7 +5311,6 @@ handle_sentinel_attribute (tree *node, tree name, tree args, { tree position = TREE_VALUE (args); - STRIP_NOPS (position); if (TREE_CODE (position) != INTEGER_CST) { warning ("requested position is not an integer constant"); @@ -5402,10 +5388,6 @@ check_function_arguments_recurse (void (*callback) /* Extract the argument number, which was previously checked to be valid. */ format_num_expr = TREE_VALUE (TREE_VALUE (attrs)); - while (TREE_CODE (format_num_expr) == NOP_EXPR - || TREE_CODE (format_num_expr) == CONVERT_EXPR - || TREE_CODE (format_num_expr) == NON_LVALUE_EXPR) - format_num_expr = TREE_OPERAND (format_num_expr, 0); gcc_assert (TREE_CODE (format_num_expr) == INTEGER_CST && !TREE_INT_CST_HIGH (format_num_expr)); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 42f6561e498..0b86086992e 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3637,9 +3637,6 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name) unsigned HOST_WIDE_INT w; const char *name = orig_name ? orig_name: _(""); - /* Necessary? */ - STRIP_NOPS (*width); - /* Detect and ignore out of range field width and process valid field widths. */ if (!INTEGRAL_TYPE_P (TREE_TYPE (*width)) @@ -5624,10 +5621,6 @@ build_enumerator (tree name, tree value) /* Validate and default VALUE. */ - /* Remove no-op casts from the value. */ - if (value) - STRIP_TYPE_NOPS (value); - if (value != 0) { /* Don't issue more errors for error_mark_node (i.e. an diff --git a/gcc/c-format.c b/gcc/c-format.c index 914d6cc9792..a228b4b886f 100644 --- a/gcc/c-format.c +++ b/gcc/c-format.c @@ -147,17 +147,12 @@ check_format_string (tree argument, unsigned HOST_WIDE_INT format_num, return true; } -/* Strip any conversions from the expression, verify it is a constant, - and store its value. If validated_p is true, abort on errors. +/* Verify EXPR is a constant, and store its value. + If validated_p is true, abort on errors. Returns true on success, false otherwise. */ static bool get_constant (tree expr, unsigned HOST_WIDE_INT *value, int validated_p) { - while (TREE_CODE (expr) == NOP_EXPR - || TREE_CODE (expr) == CONVERT_EXPR - || TREE_CODE (expr) == NON_LVALUE_EXPR) - expr = TREE_OPERAND (expr, 0); - if (TREE_CODE (expr) != INTEGER_CST || TREE_INT_CST_HIGH (expr) != 0) { gcc_assert (!validated_p); diff --git a/gcc/c-parser.c b/gcc/c-parser.c index fa62475e943..99b6e090492 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -5019,7 +5019,6 @@ c_parser_postfix_expression (c_parser *parser) tree c; c = fold (e1.value); - STRIP_NOPS (c); if (TREE_CODE (c) != INTEGER_CST) error ("first argument to %<__builtin_choose_expr%> not" " a constant"); diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 6f2a6bcb238..3b35acf9280 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2234,11 +2234,6 @@ convert_arguments (tree typelist, tree values, tree function, tree fundecl) /* Change in signedness doesn't matter if a constant value is unaffected. */ ; - /* Likewise for a constant in a NOP_EXPR. */ - else if (TREE_CODE (val) == NOP_EXPR - && TREE_CODE (TREE_OPERAND (val, 0)) == INTEGER_CST - && int_fits_type_p (TREE_OPERAND (val, 0), type)) - ; /* If the value is extended from a narrower unsigned type, it doesn't matter whether we pass it as signed or unsigned; the value @@ -5205,21 +5200,6 @@ set_init_index (tree first, tree last) return; } - while ((TREE_CODE (first) == NOP_EXPR - || TREE_CODE (first) == CONVERT_EXPR - || TREE_CODE (first) == NON_LVALUE_EXPR) - && (TYPE_MODE (TREE_TYPE (first)) - == TYPE_MODE (TREE_TYPE (TREE_OPERAND (first, 0))))) - first = TREE_OPERAND (first, 0); - - if (last) - while ((TREE_CODE (last) == NOP_EXPR - || TREE_CODE (last) == CONVERT_EXPR - || TREE_CODE (last) == NON_LVALUE_EXPR) - && (TYPE_MODE (TREE_TYPE (last)) - == TYPE_MODE (TREE_TYPE (TREE_OPERAND (last, 0))))) - last = TREE_OPERAND (last, 0); - if (TREE_CODE (first) != INTEGER_CST) error_init ("nonconstant array index in initializer"); else if (last != 0 && TREE_CODE (last) != INTEGER_CST) -- cgit v1.2.1