[Development] Announcing moc_combine
Marc Mutz
marc.mutz at kdab.com
Mon May 30 17:53:48 CEST 2016
On Monday 30 May 2016 16:24:38 Jędrzej Nowacki wrote:
> On Monday 30 of May 2016 10:19:38 Marc Mutz wrote:
> > On Sunday 29 May 2016 18:05:07 Thiago Macieira wrote:
> > > I've just pushed a feature[1] to moc that makes it process multiple
> > > headers
> > > at the same time, producing only one output file
> >
> > Separate compilation is not how I would recommend to use moc-generated
> > files. I'd recommend to always include the moc file in the corresponding
> > cpp file. That gives the compiler the whole picture and enables better
> > optimisation[1] and error checking[2,3].
>
> If moc has full picture it also can apply some nice optimizations, like for
> example here https://codereview.qt-project.org/#/c/75151/.
This is orthogonal.
Obviously, I have nothing against running moc only once per
library/executable, and applying optimisations such as string and sub-string
sharing across classes. I also have nothing against a single output file for
the tables. On the contrary. I applaud such changes.
But I don't want QObject subclass member functions compiled into separate TUs
anymore, for the reasons cited.
So this would meet everyones requirements: a single moc run on all headers
(and cpps) of a library, generating one output file with one large data table,
and one file per class (or file), to be included in the class' .cpp file.
This would even preserve Q_PRIVATE_SLOT, leading to less churn (unless that
transition is desireable for other reasons than "doesn't work with
moc_combine").
Thanks,
Marc
--
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - Qt, C++ and OpenGL Experts
More information about the Development
mailing list