aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorOlivier Hainque <hainque@adacore.com>2006-07-18 13:07:28 +0000
committerOlivier Hainque <hainque@gcc.gnu.org>2006-07-18 13:07:28 +0000
commitfe24d4852ee6dd41dbf9c5daa68f1a51903aa105 (patch)
tree4065694fdb2ca6a3a4f7e10356db5f8774473035 /gcc/tree.h
parent57255173dac51b82ac40d272a3b8dc82fd452413 (diff)
downloadgcc-fe24d4852ee6dd41dbf9c5daa68f1a51903aa105.zip
gcc-fe24d4852ee6dd41dbf9c5daa68f1a51903aa105.tar.gz
gcc-fe24d4852ee6dd41dbf9c5daa68f1a51903aa105.tar.bz2
tree.h (categorize_ctor_elements): Adjust prototype and add descriptive comment...
* tree.h (categorize_ctor_elements): Adjust prototype and add descriptive comment, both in accordance with the interface change described below. * varasm.c (constructor_static_from_elts_p): New function. Whether a constructor node is a valid static constant initializer if all its elements are. (initializer_constant_valid_p) <CONSTRUCTOR value>: Use it. * output.h: Declare it. * expr.c (categorize_ctor_elements_1): Return whether the constructor is a valid constant initializer instead of computing the number of non-constant elements. Use constructor_static_from_elts_p for this purpose. Replace the head comment with an indication that this is a helper for categorize_ctor_elements. (categorize_ctor_elements): Same interface change as for the _1 helper. Former head comment from this helper moved here, adjusted to account for the interface changes. (mostly_zeros_p): Adjust call to categorize_ctor_elements. (all_zeros_p): Likewise. * gimplify.c (gimplify_init_constructor): Decide whether we can make static versions of the constructor from the categorize_ctor_elements return value instead of the formerly computed number of non-constant elements. * gnat.dg/outer_agg_bitfield_constructor.adb: New test. * gnat.dg/nested_agg_bitfield_constructor.adb: New test. From-SVN: r115553
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index 12e2f59..dfea92a 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3924,8 +3924,20 @@ extern int fields_length (tree);
extern bool initializer_zerop (tree);
-extern void categorize_ctor_elements (tree, HOST_WIDE_INT *, HOST_WIDE_INT *,
- HOST_WIDE_INT *, bool *);
+/* 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.
+
+ 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 (tree, HOST_WIDE_INT *, HOST_WIDE_INT *,
+ bool *);
+
extern HOST_WIDE_INT count_type_elements (tree, bool);
/* integer_zerop (tree x) is nonzero if X is an integer constant of value 0. */