On Mon, 2008-03-10 at 18:59 +1300, Amos Jeffries wrote:
> Alex Rousskov wrote:
> > IMO, at the end of the cleanup, "squid.h" should be the file that all
> > sources are guaranteed to include first simply because it is called
> > squid.h. Config.h has, by name, a much narrower scope.
> > 
> > I realize that this is subjective and that very few people care about
> > things like that in Squid so if, for whatever reason, Amos wants to
> > remove squid.h from most files and leave config.h instead, I am not
> > going to object since I am not the person doing the cleanup leg work,
> > and since the functional effect will be the same.
> > 
> > The little tweaks that are not global in nature should be moved out to
> > specific headers and wrappers, of course. The
> > guaranteed-to-be-included-first.h file should eventually be almost
> > empty. Its primary value is the guarantee itself, which becomes a useful
> > tool for [usually temporary] hacks.
> 
> With the testheaders.sh every .h now has 
> guaranteed-to-be-included-at-earliest-actual-need.

Yes, that is great(*), but to-be-included-first guarantee is a little
different (and much easier to support/test).

> The hacks should be localized to the object(s) they are hacking anyway 
> and not affect the entire Squid + sub-programs + linked-programs + 
> helpers + unit-tests + tools.
> 
> If they do you would be:
>    - hacking a system include
>         (which requires config.h for the wrapping!)
>    - hacking an objects behaviour
>         (which gets linked/included everywhere its used anyway!)

The guaranteed-to-be-included-first.h file is needed for exceptional
hacks that defy "normal" rules. For example, it is 3:00 in the morning
and you must make Squid to compile on some remote box, but some internal
system header is broken and needs a special _BSD_API #define to compile.
Many system headers include that header conditionally so you cannot just
quickly wrap a system include file to #define that constant. If only you
could define it before any system header is included!

Such hacks are usually temporary.

Again, I am just sharing my experience here. No significant pressure to
implement guaranteed-to-be-included-first.h file idea...

Thank you,

Alex.
P.S.  Can a script reliably test an included-at-earliest-actual-need
guarantee? I think I can write a header that compiles fine without
config.h but still needs it to enable an optional API. How would a
script detect such a need?


Reply via email to