wine/port.h #include fixes
fgouget at codeweavers.com
Mon Oct 15 00:59:51 CDT 2001
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
* 'wine/port.h' includes 'winnt.h'. So if we include it first and then
include the Solaris header we get a redefinition error.
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:
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
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.
So I propose the following instead:
* config.h has no multiple include protection. Add one (__WINE_CONFIG_H
* modify the above headers so that they don't include config.h but
contain the following instead:
# error You must include config.h to use this header
This will make sure that no-one forgets to include config.h when
* modify all files that include the above headers so that they include
config.h as the first header. This actually requires relatively little
* 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.
* 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.
* maybe modify winapi_check to make sure that no header file includes
'config.h' (this would be the frosting on the cake)
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.
fgouget at codeweavers.com
More information about the wine-devel