>
> On Sun, 2008-03-09 at 11:23 -0600, Alex Rousskov wrote:
>
>> IMO, virtually all Squid sources should include (directly or indirectly)
>> squid.h as the first include file. In my experience, this design is very
>> useful for portability and other hacks.
>
> We have two such files
>
> include/config.h   project global tweaks
>
> src/squid.h        specific to the squid binary
>
> with src being split up a lot of the tweaking we have in squid.h either
> goes to config.h or into it's specific module.
>
>> I would rather see squid.h cleaned up (which is trivial) and
>> SquidDirty.h file temporary introduced for those source files that need
>> the current dirty include-everything squid.h. This way, virtually all
>> sources, including test cases, can continue to include squid.h. Some
>> will also include SquidDirty.h. Uses of SquidDirty.h will be slowly
>> weeded out.
>
> Good idea.
>
> Or we could consider squid.h the dirty one, moving out the little tweaks
> which is there to config.h or better places.

Exactly what I'm currently doing with the cleanup patch.

 The patch is linking a lot of files previously unlinked to the 'clean'
config.h which they need.
Also moving a few 'unclean' items which sould not be directly in a global
include out of squid.h so other objects no longer depend on the 'dirty'
squid.h

>
> But it's a little tricky with some of the tweaks which depends heavily
> on system.headers...

Thats fine, as long as they are limited to tweaking system headers.
They can even go in their own tweak file if very messy and be included by
config.h instead of inline to keep it relatively clean. Same way the
current squid.h include defines.h and typedefs.h.

config.h (as future squid.h) should NEVER directly include any classes
squid custom defines (like: #include "HttpHeader.h").
At worst they might be in a libX.la specific group header _if such group
.h is needed at all_ (thinking src/squid-common.h + src/libsquid-common.la
etc).
In most cases you will find the object has few enough depends that its
easy to just include the minimal .h files directly into its .cc.


HTH
Amos


Reply via email to