This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH to implement initializer lists proposal (n2672)
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 2 Jul 2008 17:54:57 +0200
- Subject: Re: C++ PATCH to implement initializer lists proposal (n2672)
- References: <486BA0D1.8070501@redhat.com>
+ ctor_to_list (tree ctor)
+ {
+ tree list = NULL_TREE;
+ tree *p = &list;
+ unsigned ix;
+ constructor_elt *ce;
+
+ for (ix = 0;
+ VEC_iterate (constructor_elt, CONSTRUCTOR_ELTS (ctor), ix, ce);
+ ++ix)
+ {
+ *p = build_tree_list (ce->index, ce->value);
+ p = &TREE_CHAIN (*p);
+ }
+
+ return list;
The canonical idiom would be to use FOR_EACH_CONSTRUCTOR_ELT here.
--
Eric Botcazou