From 953d0c90a2f0a98b6d860ecfbf1bc5672653a588 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 13 Jul 2011 11:16:36 +0000 Subject: tree.h (categorize_ctor_elements): Remove comment. gcc/ * tree.h (categorize_ctor_elements): Remove comment. Fix long line. (count_type_elements): Delete. (complete_ctor_at_level_p): Declare. * expr.c (flexible_array_member_p): New function, split out from... (count_type_elements): ...here. Make static. Replace allow_flexarr parameter with for_ctor_p. When for_ctor_p is true, return the number of elements that should appear in the top-level constructor, otherwise return an estimate of the number of scalars. (categorize_ctor_elements): Replace p_must_clear with p_complete. (categorize_ctor_elements_1): Likewise. Use complete_ctor_at_level_p. (complete_ctor_at_level_p): New function, borrowing union logic from old categorize_ctor_elements_1. (mostly_zeros_p): Return true if the constructor is not complete. (all_zeros_p): Update call to categorize_ctor_elements. * gimplify.c (gimplify_init_constructor): Update call to categorize_ctor_elements. Don't call count_type_elements. Unconditionally prevent clearing for variable-sized types, otherwise rely on categorize_ctor_elements to detect incomplete initializers. gcc/cp/ * typeck2.c (split_nonconstant_init_1): Pass the initializer directly, rather than a pointer to it. Return true if the whole of the value was initialized by the generated statements. Use complete_ctor_at_level_p instead of count_type_elements. gcc/testsuite/ 2011-07-12 Chung-Lin Tang * gcc.target/arm/pr48183.c: New test. From-SVN: r176228 --- gcc/tree.h | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'gcc/tree.h') diff --git a/gcc/tree.h b/gcc/tree.h index 571a71f..fe76f8f 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4804,21 +4804,10 @@ extern bool initializer_zerop (const_tree); extern VEC(tree,gc) *ctor_to_vec (tree); -/* Examine CTOR to discover: - * how many scalar fields are set to nonzero values, - and place it in *P_NZ_ELTS; - * how many scalar fields in total are in CTOR, - and place it in *P_ELT_COUNT. - * if a type is a union, and the initializer from the constructor - is not the largest element in the union, then set *p_must_clear. +extern bool categorize_ctor_elements (const_tree, HOST_WIDE_INT *, + HOST_WIDE_INT *, bool *); - Return whether or not CTOR is a valid static constant initializer, the same - as "initializer_constant_valid_p (CTOR, TREE_TYPE (CTOR)) != 0". */ - -extern bool categorize_ctor_elements (const_tree, HOST_WIDE_INT *, HOST_WIDE_INT *, - bool *); - -extern HOST_WIDE_INT count_type_elements (const_tree, bool); +extern bool complete_ctor_at_level_p (const_tree, HOST_WIDE_INT, const_tree); /* integer_zerop (tree x) is nonzero if X is an integer constant of value 0. */ -- cgit v1.1