List:Internals« Previous MessageNext Message »
From:Mats Kindahl Date:September 16 2010 9:46am
Subject:Re: [STYLE] Self-sufficient header files
View as plain text  
Hmmm... the list handler doesn't like text/x-vcard attachments, so I'm
resending...

On 09/16/2010 11:22 AM, Konstantin Osipov wrote:
> * Michael Widenius <michael.widenius@stripped> [10/09/16 12:42]:
>> Konstantin> * Mats Kindahl <mats.kindahl@stripped> [10/08/27 18:06]:
>>>> Proposal
>>>> Every header file should be self-sufficient in the sense that for a
>>>> header file my_header.h, the following should compile without errors:
>>>>
>>>> #include "my_header.h"
>>>>
>>>> An exception is made for generated files, for example, those generated
>>>> by Yacc and Lex, since it is not possible to re-write the generators to
>>>> produce "correct" files.
>>
>> Please consider compilation time!
>>
>> I just compiled MySQL on a solaris sparc box and even now it takes >
>> 40 minutes.  Adding self-sufficient headers will probably make this > 60
>> minutes without adding any measure benefit to MySQL development.
> 
> We have already made a decision to move to the header guards
> approach, and I believe that was done in 2009,
> with Mats work that split and removed mysql_priv.h.
> I think the patch was pushed in what is now 5.5 code tree in March
> 2010.

Yes it is. I don't have the latest figures, but at some point I did a
measurement of the cumulative include dependencies and it was reduced
by something like 25% after the patch was applied.

> The current proposal is only suggesting, basically, that in
> table.cc table.h is included first, before other headers, so that 
> table.h includes everything that is needed to declare table.h
> classes and structures.

Correct.

> I think it won't increase the compilation time significantly.

I don't think so either. The biggest cycle-eater while compiling is
usually optimization, not file handling nor parsing.

Just my few cents,
Mats Kindahl

Thread
[STYLE] Self-sufficient header filesMats Kindahl27 Aug
  • Re: [STYLE] Self-sufficient header filesKonstantin Osipov8 Sep
    • Re: [STYLE] Self-sufficient header filesMichael Widenius16 Sep
      • Re: [STYLE] Self-sufficient header filesTor Didriksen16 Sep
      • Re: [STYLE] Self-sufficient header filesKonstantin Osipov16 Sep
        • Re: [STYLE] Self-sufficient header filesMats Kindahl16 Sep