[Libreoffice] per-library types headers ...

Stephan Bergmann sbergman at redhat.com
Tue Sep 27 05:05:44 PDT 2011


On 09/27/2011 10:55 AM, Michael Meeks wrote:
> 	I'm still a tad annoyed by our compile times, and was wondering - has a
> footypes.hxx header approach been tried in the past. This would add a
> near complete set of forward declarations of classes, templates, etc.
> necessary to use that library.
>
> 	I suspect (at the moment) that people tend to simply include the header
> that creates whatever definition they care about in their headers
> chaining them together into bulky masses of pulled in headers, rather
> than whacking things like:
>
> namespace com { namespace sun { namespace star { namespace uno {
> 	class Any;
> 	class Exception;
> 	template<  typename>  class Reference;
> 	template<  typename>  class Sequence;
> 	class XInterface;
> } } } }
> namespace rtl { class OUString; }
>
> 	into their headers to cut such chains (and who can blame them - that
> seems much more readable). Though of course the base Reference class is
> prolly something that we should have ~everywhere - with fwd. decls for
> the interface classes themselves.
>
> 	Potentially, by switching to lazily including just the svxtypes.hxx (or
> whatever) header ~everywhere, we could have a smaller, quicker to parse
> code-base (pwrt. no in-lines that get actually compiled) as well as a
> rather more bearable dependency tree.
>
> 	Did anyone research this sort of thing in the past ?

Sometimes forward declarations suffice, sometimes the true definition is 
needed, so I guess you would end up in each header with a mix of 
footypes.hxx plus a list of whatever, and that list would start to grow 
again quite quickly (and hardly ever shrink during maintenance).

So, I'm more in favour of tools like those that Noel pointed out, that 
can be run once every while over the code base to find unnecessary 
includes (could actually become an easy hack then).  Should be 
interesting to look into such tools, whether they work fine for our code 
base...

-Stephan


More information about the LibreOffice mailing list