> -----Original Message----- > From: [email protected] [mailto:[email protected]] On Behalf Of Marc Mutz > Sent: Monday, 27 July 2015 3:29 PM > To: Curtis Mitch <[email protected]> > Cc: [email protected] > Subject: Re: Q_DECLARE_TYPEINFO compile time checks > > On Monday 27 July 2015 14:02:59 Curtis Mitch wrote: > > You mentioned that you have some kind of enforcement of the > > Q_DECLARE_TYPEINFO stuff - can you please share this so that others > can > > run it on their modules? > > It currently conflicts with Thiago's changes to add Q_RELOCATABLE_TYPE. > I'll > upstream parts of it that can be upstreamed once his stuff has merged, > but the > basic trick is: > > - add isSpecialized = false to the primary QTypeInfo template > ( = Q_IS_ENUM when Q_RELOCATABLE_TYPE lands) > - add isSpecialized = true to all specialisations > - static_assert that QTypeInfo<T>::isSpecialized in various places: > * inside QVector::append > * QList::node_construct > * Q_DECLARE_METATPYE > * whereever else it makes sense (I have the above three) > > That doesn't catch all cases, of course, and it will not compile as long > as > QtCore hasn't been fully fixed (which requires Q_RELOCATABLE_TYPE), but > we > don't have a central macro that declares a type as a value type, so the > three > places above are the best I have come up with so far. > > I'll upstream the addition of isSpecialized once Thiago's stuff is in. > We > should probably also change the Q_DECLARE_SHARED to be > Q_DECLARE_VALUE_TYPE > and _WITH_SWAP(). Then we have a central macro to put these checks, > maybe just > for headerscheck. > > Thanks, > Marc > > -- > Marc Mutz <[email protected]> | Senior Software Engineer > KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company > Tel: +49-30-521325470 > KDAB - The Qt Experts
Hmmm, I don't think that helps with https://codereview.qt-project.org/#/c/122268/, for example. Oh well. _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
