From aaa1b10f5419420ef419b6f74299e516f19e5877 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 23 Sep 2016 09:34:43 +0200 Subject: [PATCH] * hsa-gen.c (hsa_op_immed::hsa_op_immed Use CONSTRUCTOR_NELTS (...) instead of vec_safe_length (CONSTRUCTOR_ELTS (...)). (gen_hsa_ctor_assignment): Likewise. * print-tree.c (print_node): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-sra.c (sra_modify_constructor_assign): Likewise. * expr.c (store_constructor): Likewise. * fold-const.c (operand_equal_p): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * hsa-brig.c (hsa_op_immed::emit_to_buffer): Likewise. * ipa-icf-gimple.c (func_checker::compare_operand): Likewise. cp/ * typeck2.c (process_init_constructor_record): Use CONSTRUCTOR_NELTS (...) instead of vec_safe_length (CONSTRUCTOR_ELTS (...)). * decl.c (reshape_init_r): Likewise. (check_initializer): Likewise. ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Use CONSTRUCTOR_NELTS (...) instead of vec_safe_length (CONSTRUCTOR_ELTS (...)). From-SVN: r240390 --- gcc/ChangeLog | 14 ++++++++++++++ gcc/ada/ChangeLog | 6 ++++++ gcc/ada/gcc-interface/decl.c | 2 +- gcc/cp/ChangeLog | 8 ++++++++ gcc/cp/decl.c | 4 ++-- gcc/cp/typeck2.c | 4 ++-- gcc/expr.c | 3 +-- gcc/fold-const.c | 3 +-- gcc/hsa-brig.c | 2 +- gcc/hsa-gen.c | 5 ++--- gcc/ipa-icf-gimple.c | 4 ++-- gcc/print-tree.c | 2 +- gcc/tree-dump.c | 2 +- gcc/tree-pretty-print.c | 2 +- gcc/tree-sra.c | 2 +- 15 files changed, 44 insertions(+), 19 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 313e390b4c3..453413be338 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2016-09-23 Jakub Jelinek + + * hsa-gen.c (hsa_op_immed::hsa_op_immed Use CONSTRUCTOR_NELTS (...) + instead of vec_safe_length (CONSTRUCTOR_ELTS (...)). + (gen_hsa_ctor_assignment): Likewise. + * print-tree.c (print_node): Likewise. + * tree-dump.c (dequeue_and_dump): Likewise. + * tree-sra.c (sra_modify_constructor_assign): Likewise. + * expr.c (store_constructor): Likewise. + * fold-const.c (operand_equal_p): Likewise. + * tree-pretty-print.c (dump_generic_node): Likewise. + * hsa-brig.c (hsa_op_immed::emit_to_buffer): Likewise. + * ipa-icf-gimple.c (func_checker::compare_operand): Likewise. + 2016-09-23 Richard Biener * hooks.h (hook_uint_uintp_false): Declare. diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 54cd2dc6dda..9dc0d97b865 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2016-09-23 Jakub Jelinek + + * gcc-interface/decl.c (gnat_to_gnu_entity): Use + CONSTRUCTOR_NELTS (...) instead of + vec_safe_length (CONSTRUCTOR_ELTS (...)). + 2016-07-14 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity) : Also use diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 3f468b6f5e8..f820f8452bf 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -1339,7 +1339,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) = TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (gnu_alloc_type))); if (TREE_CODE (gnu_expr) == CONSTRUCTOR - && vec_safe_length (CONSTRUCTOR_ELTS (gnu_expr)) == 1) + && CONSTRUCTOR_NELTS (gnu_expr) == 1) gnu_expr = NULL_TREE; else gnu_expr diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3a4d1f45f8c..ae5934301c9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2016-09-23 Jakub Jelinek + + * typeck2.c (process_init_constructor_record): Use + CONSTRUCTOR_NELTS (...) instead of + vec_safe_length (CONSTRUCTOR_ELTS (...)). + * decl.c (reshape_init_r): Likewise. + (check_initializer): Likewise. + 2016-09-22 Paolo Carlini PR c++/71979 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 921f8d5ffb5..24f71ce4f72 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5933,7 +5933,7 @@ reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p, element (as allowed by [dcl.init.string]). */ if (!first_initializer_p && TREE_CODE (str_init) == CONSTRUCTOR - && vec_safe_length (CONSTRUCTOR_ELTS (str_init)) == 1) + && CONSTRUCTOR_NELTS (str_init) == 1) { str_init = (*CONSTRUCTOR_ELTS (str_init))[0].value; } @@ -6136,7 +6136,7 @@ check_initializer (tree decl, tree init, int flags, vec **cleanups) if (init && BRACE_ENCLOSED_INITIALIZER_P (init)) { - int init_len = vec_safe_length (CONSTRUCTOR_ELTS (init)); + int init_len = CONSTRUCTOR_NELTS (init); if (SCALAR_TYPE_P (type)) { if (init_len == 0) diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index b9dc56d01c3..6e226856edc 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1379,7 +1379,7 @@ process_init_constructor_record (tree type, tree init, if (type == error_mark_node) return PICFLAG_ERRONEOUS; - if (idx < vec_safe_length (CONSTRUCTOR_ELTS (init))) + if (idx < CONSTRUCTOR_NELTS (init)) { constructor_elt *ce = &(*CONSTRUCTOR_ELTS (init))[idx]; if (ce->index) @@ -1476,7 +1476,7 @@ process_init_constructor_record (tree type, tree init, CONSTRUCTOR_APPEND_ELT (v, field, next); } - if (idx < vec_safe_length (CONSTRUCTOR_ELTS (init))) + if (idx < CONSTRUCTOR_NELTS (init)) { if (complain & tf_error) error ("too many initializers for %qT", type); diff --git a/gcc/expr.c b/gcc/expr.c index 2e97030c5b8..d15e98bdfe8 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -6187,8 +6187,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size, register whose mode size isn't equal to SIZE since clear_storage can't handle this case. */ else if (size > 0 - && (((int)vec_safe_length (CONSTRUCTOR_ELTS (exp)) - != fields_length (type)) + && (((int) CONSTRUCTOR_NELTS (exp) != fields_length (type)) || mostly_zeros_p (exp)) && (!REG_P (target) || ((HOST_WIDE_INT) GET_MODE_SIZE (GET_MODE (target)) diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e040b2a279b..a6b7ec7dfec 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2954,8 +2954,7 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) case CONSTRUCTOR: /* In GIMPLE empty constructors are allowed in initializers of aggregates. */ - return (!vec_safe_length (CONSTRUCTOR_ELTS (arg0)) - && !vec_safe_length (CONSTRUCTOR_ELTS (arg1))); + return !CONSTRUCTOR_NELTS (arg0) && !CONSTRUCTOR_NELTS (arg1); default: break; } diff --git a/gcc/hsa-brig.c b/gcc/hsa-brig.c index 9c74b9aa071..4dc568c54e4 100644 --- a/gcc/hsa-brig.c +++ b/gcc/hsa-brig.c @@ -985,7 +985,7 @@ hsa_op_immed::emit_to_buffer (unsigned *brig_repr_size) } else if (TREE_CODE (m_tree_value) == CONSTRUCTOR) { - unsigned len = vec_safe_length (CONSTRUCTOR_ELTS (m_tree_value)); + unsigned len = CONSTRUCTOR_NELTS (m_tree_value); for (unsigned i = 0; i < len; i++) { tree v = CONSTRUCTOR_ELT (m_tree_value, i)->value; diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c index 4d1b2767441..2c8ec1d9505 100644 --- a/gcc/hsa-gen.c +++ b/gcc/hsa-gen.c @@ -1100,8 +1100,7 @@ hsa_op_immed::hsa_op_immed (tree tree_val, bool min32int) /* Verify that all elements of a constructor are constants. */ if (TREE_CODE (m_tree_value) == CONSTRUCTOR) - for (unsigned i = 0; - i < vec_safe_length (CONSTRUCTOR_ELTS (m_tree_value)); i++) + for (unsigned i = 0; i < CONSTRUCTOR_NELTS (m_tree_value); i++) { tree v = CONSTRUCTOR_ELT (m_tree_value, i)->value; if (!CONSTANT_CLASS_P (v)) @@ -2845,7 +2844,7 @@ void gen_hsa_ctor_assignment (hsa_op_address *addr_lhs, tree rhs, hsa_bb *hbb, BrigAlignment8_t align) { - if (vec_safe_length (CONSTRUCTOR_ELTS (rhs))) + if (CONSTRUCTOR_NELTS (rhs)) { HSA_SORRY_AT (EXPR_LOCATION (rhs), "support for HSA does not implement load from constructor"); diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c index 9e3c862339b..683df315779 100644 --- a/gcc/ipa-icf-gimple.c +++ b/gcc/ipa-icf-gimple.c @@ -406,8 +406,8 @@ func_checker::compare_operand (tree t1, tree t2) { case CONSTRUCTOR: { - unsigned length1 = vec_safe_length (CONSTRUCTOR_ELTS (t1)); - unsigned length2 = vec_safe_length (CONSTRUCTOR_ELTS (t2)); + unsigned length1 = CONSTRUCTOR_NELTS (t1); + unsigned length2 = CONSTRUCTOR_NELTS (t2); if (length1 != length2) return return_false (); diff --git a/gcc/print-tree.c b/gcc/print-tree.c index 60957f95259..8c63cb8ee23 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -841,7 +841,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent) { unsigned HOST_WIDE_INT cnt; tree index, value; - len = vec_safe_length (CONSTRUCTOR_ELTS (node)); + len = CONSTRUCTOR_NELTS (node); fprintf (file, " lngt %d", len); FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node), cnt, index, value) diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c index 05228a0afe1..ed60e6d3cd5 100644 --- a/gcc/tree-dump.c +++ b/gcc/tree-dump.c @@ -646,7 +646,7 @@ dequeue_and_dump (dump_info_p di) { unsigned HOST_WIDE_INT cnt; tree index, value; - dump_int (di, "lngt", vec_safe_length (CONSTRUCTOR_ELTS (t))); + dump_int (di, "lngt", CONSTRUCTOR_NELTS (t)); FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (t), cnt, index, value) { dump_child ("idx", index); diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 0915fd4243e..3449f266bea 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -1983,7 +1983,7 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, int flags, dump_decl_name (pp, val, flags); else dump_generic_node (pp, val, spc, flags, false); - if (ix != vec_safe_length (CONSTRUCTOR_ELTS (node)) - 1) + if (ix != CONSTRUCTOR_NELTS (node) - 1) { pp_comma (pp); pp_space (pp); diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 4a2ff0d174c..5565743af0a 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -3224,7 +3224,7 @@ sra_modify_constructor_assign (gimple *stmt, gimple_stmt_iterator *gsi) return SRA_AM_MODIFIED; } - if (vec_safe_length (CONSTRUCTOR_ELTS (gimple_assign_rhs1 (stmt))) > 0) + if (CONSTRUCTOR_NELTS (gimple_assign_rhs1 (stmt)) > 0) { /* I have never seen this code path trigger but if it can happen the following should handle it gracefully. */ -- 2.30.2