Re: confoig.h squid.h design

From: Amos Jeffries <squid3@dont-contact.us>
Date: Mon, 28 Apr 2008 23:24:29 +1200

Guido Serassio wrote:
> Hi,
>
> At 03:18 28/04/2008, Alex Rousskov wrote:
>> On Mon, 2008-04-28 at 11:17 +1200, Amos Jeffries wrote:
>> > > 1) config.h includes the autogenerated configuration file and does
>> > > virtually nothing else
>> > >
>> > > 2) squid.h includes config.h and does virtually nothing else.
>> > >
>> >
>> > Right. To be blunt and as simple as possible.
>> >
>> > Where does "squid_types.h" get included when every file in squid needs
>> > "uint32_t" ??
>>
>> squid.h
>>
>> and only if every source file in squid really needs it.
>>
>> > THEN, where does "squid_mswin.h" get included for the same type
>> > definition in windows?
>>
>> squid_types.h
>>
>> because the code should be platform-independent to the extent possible
>> and should not care which platform it is being compiled on. OS-specific
>> hacks should be pushed as deep down as possible so that almost nobody
>> has to care about them.
>>
>> > (NP: mswin (rightly!) setups more than types...)
>>
>> Not sure what you mean, but we should have one .h file per type (or
>> "concept" or related group of types).
>>
>> > Methinks squid_mswin.h goes in config.h and squid_types.h goes in
>> > squid_mswin.h (and other OS-specifics)
>>
>> I think that would be wrong (but not a big deal). Universal type or
>> concept trumps OS-specific hacks. The main code that needs that
>> universal type should include the corresponding "universal" header (like
>> squid_types.h). That header may include OS-specific hacks as needed.
>
> squid_mswin.h is really an acrobatic trick .....
> It's used only for native port, when building with MSYS+MinGW and
> Microsoft Visual Studio.
>
> For the Microsoft Visual Studio environment there is also a static
> autoconf.h manually generated in the port/win32/include directory.
>
> basically it does:
> - defines some POSIX types not checked into configure

This is also done in squid_types.h. If the types are generic POSIX types
that just happen to be missing in windows, then I think they should be
moved from squid_mswin.h to squid_types.h. I will leave this for you
though when you check the result.

The os/* files seems to be falling out of cleanup as files that override
OS-specific settings for the rest of squid. I'm not sure how to describe
it accurately.

> - defines some emulated POSIX functions
> - provides the FD - Sockets equivalence on Windows

Exactly what the os/* files should be doing.

>
> Please note that because the type detection in squid3 and squid2 are
> different, the squid_mswin.h in squid2 is cleaner on the types side.
>
> Maybe that some revision in squid3 type detection could help here.

If you think it would help. Let us know what the important pieces of -2
that could be built in -3 are.

For the mswin stuff, at present, I'm just adding it the same as the rest
of the OS-portability pieces. It will still be global and at the top of
everything when I'm done. Just having some company now as other hacks
for other OS move in next door.

Amos

-- 
Please use Squid 2.6.STABLE19 or 3.0.STABLE4
Received on Mon Apr 28 2008 - 11:23:58 MDT

This archive was generated by hypermail 2.2.0 : Wed Apr 30 2008 - 12:00:07 MDT