> François Gouget wrote:
> >
> > This is a followup on the previous config.h patch, this
> time tackling
> > the wine/port.h case.
>
> Hmmm, I see it has been applied to CVS already. But I'm
> not too happy
> with it anymore :-/
>
> I found a problem with 'dlls/winsock/async.c' and
> 'dlls/winsock/socket.c' and the DELETE macro.
> * DELETE is defined in winnt.h
> * DELETE is also defined by a socket-related Solaris header
> (arpa/nameser_compat.h, included indirectly)
> * so winnt.h undefs DELETE and then defines our value
Yes. That is a problem.
ERR IIRC is another problem on Solaris. That is why
#include "debugtools.h" is always done after all other includes.
> * 'wine/port.h' includes 'winnt.h'. So if we include it
> first and then
> include the Solaris header we get a redefinition error.
No it doesn't. At least not any longer.
>From "cvs log include/wine.h":
< revision 1.15
< date: 2001/07/26 21:43:29; author: julliard; state: Exp; lines: +1 -1
< Patrik Stridvall <ps(a)leissner.se>
< Removed inclusion of winnt.h because the porting layer shouldn't
< include Windows specific stuff.
Note that as the comment says we shouldn't include Windows specific stuff
in the porting layer.
> One possible solution would be to handle DELETE differently, e.g.
> prefix it in Wine, and not prefix it for Winelib, or something like
> that. But wine/port.h is not the only header that needs to include
> 'config.h'. There is also:
>
> cdrom.h console.h
> ts_shape.h ts_xf86dga.h ts_xf86dga2.h ts_xf86vmode.h ts_xlib.h
> ts_xpm.h ts_xresource.h ts_xshm.h ts_xutil.h ts_xvideo.h
> wine_gl.h
> x11drv.h
>
> I think it would be wrong to move all these #includes so that they
> are first. Plus for the ts_*.h headers I am not sure it would be very
> good. Also #including config.h in these is a bit pointless
> since we know
> that the file including them will need to include config.h too.
Sounds reasonable.
> So I propose the following instead:
> * config.h has no multiple include protection. Add one
> (__WINE_CONFIG_H
> macro).
> * modify the above headers so that they don't include config.h but
> contain the following instead:
> #ifndef __WINE_CONFIG_H
> # error You must include config.h to use this header
> #endif
> This will make sure that no-one forgets to include config.h when
> necessary.
> * modify all files that include the above headers so that
> they include
> config.h as the first header. This actually requires relatively little
> work.
That is probably a good idea.
> * do the same for port.h
> * debugtools.h also uses config.h because it needs NO_DEBUG_MSGS and
> NO_TRACE_MSGS. Modify configure.in so that these are put on
> the command
> line instead. They are not the of the same nature as the other macros
> anyway: they are completely system independent. Also this will make it
> possible to use the Wine debug macros in Winelib applications. Then
> debugtools.h will no longer need to #include config.h. This cuts the
> number of files causing trouble in about half.
That is probably a good idea too.
> * there are 3 other files that #include config.h for no good reason
> that I can see: gdi.h, heap.h and thread.h. Remove the #includes from
> there. Anyway, winapi_check ensures that all the .c files that need
> config.h already include it directly.
Yes. However that algoritm (or rather heuristics) that decide this is not
perfect but it catch most of the cases and the compiler catches a few more
and the linker most (all?) of the rest.
> * maybe modify winapi_check to make sure that no header file includes
> 'config.h' (this would be the frosting on the cake)
This is easy. I will do that if Alexandre accept a patch what requires this.
> Doing this (except for port.h) I have a tree that builds on Solaris
> with no _FILE_OFFSET_BITS warning. So if the above sounds good, I have
> patches that are almost ready.
Ah. Good.