This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: PR middle-end/20303: Can't push more than 16 nested visibility
H. J. Lu wrote:
+/* FIXME: This is to make gengtype happy. */
+#define def_vec_o(T) DEF_VEC_O (T)
+typedef enum symbol_visibility visibility;
+def_vec_o (visibility);
+#undef def_vec_o
+DEF_VEC_ALLOC_O (visibility, heap);
good grief, no.
If you need to make a vector of scalar, you either have to wrap the thing in a
struct (which has to be gty'd even if that is a NOP), or you can use the
DEF_VEC_P series of macros, which although originally designed for just
pointers, actually has just the right interface for scalars too. This has been
used elsewhere in the compiler.
vec.h
Because of the different behavior of objects and of pointers to
objects, there are two flavors. One to deal with a vector of
pointers to objects, and one to deal with a vector of objects
themselves. Both of these pass pointers to objects around -- in
the former case the pointers are stored into the vector and in the
latter case the pointers are dereferenced and the objects copied
into the vector. Therefore, when using a vector of pointers, the
objects pointed to must be long lived, but when dealing with a
vector of objects, the source objects need not be. The vector of
pointers API is also appropriate for small register sized objects
like integers.
Perhaps this should be made more explicit by having a DEF_VEC_<scalar> series.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk