Marius Storm-Olsen wrote: > Apparently, nothing is broken in neither Cygwin, MinGW or MSVC after > Ramsays whitespace fix, but I'm sure it might get hairy later, if/when > we get more Windows contributions. Keeping the guards right could get > tricky. > Right! Thus my earlier nervousness. :P > So, something like this maybe, in git-compat-util.h: > > #if defined(__MINGW32__) || defined(_MSC_VER) > # defined API_WIN32 > # defined OS_WINDOWS > #elif defined(__CYGWIN__) > # defined API_POSIX > # defined OS_WINDOWS > #else > # defined API_POSIX > #endif > This is a much better idea. Note that I also have Digital-Mars C/C++ 8.50, Open Watcom C/C++ 1.8 and lcc 4.2 installed. So, lets add to our previous tests: Digital-Mars: $ dmc hello.c link hello,,,user32+kernel32/noi; $ ./hello.exe _WIN32 WIN32 Hello world $ $ dmc -DIW_H hello.c link hello,,,user32+kernel32/noi; $ ./hello.exe _WIN32 WIN32 Hello world $ $ dmc -DWIN32-D_CONSOLE hello.c Command line error: bad -D switch, need '=' after macro name--- errorlevel 1 $ Open Watcom: $ wcl386 hello.c [...compiler output snipped...] $ ./hello.exe _WIN32 Hello world $ $ wcl386 -DIW_H hello.c [...compiler output snipped...] $ ./hello.exe _WIN32 Hello world $ $ wcl386 -DWIN32-D_CONSOLE hello.c Open Watcom C/C++32 Compile and Link Utility Version 1.8 Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. See http://www.openwatcom.org/ for details. wcc386 hello.c -DWIN32 -D_CONSOLE Open Watcom C32 Optimizing Compiler Version 1.8 Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. See http://www.openwatcom.org/ for details. hello.c: 25 lines, included 757, 0 warnings, 0 errors Code size: 52 wlink @__wcl__.lnk Open Watcom Linker Version 1.8 Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. See http://www.openwatcom.org/ for details. loading object files searching libraries creating a Windows NT character-mode executable $ ./hello.exe _WIN32 WIN32 Hello world $ [Note: I didn't snip the compiler output here so that you could see that the Watcom driver program had "fixed" the malformed -Define and passed it as two separate parameters to the compiler proper!] Also note that Open Watcom is currently being ported to Linux, I *think* Digital-Mars already has a Linux version and lcc does have a Linux version. However, I think it's reasonably safe to assume we won't see a Linux version of msvc. So, I think something like this in git-compat-util.h: #if defined(_WIN32) && !defined(__CYGWIN__) # define WIN32_API # define WIN32_LEAN_AND_MEAN # include <winsock2.h> # include <windows.h> #endif and replace all #if(n)def WIN32|_WIN32 with #if(n)def WIN32_API. The only use of the <windows.h> header by cygwin can be moved into compat/cygwin.c. (I don't much like cygwin using the Win32 API anyway!) > So, then we can use #ifdef API_WIN32 when using the Win32 API is the > only option/preferred for MinGW or MSVC; and use #ifdef OS_WINDOWS > when there are things that affect all the Windows builds. > > Opinions? see above. I don't think OS_WINDOWS is necessary. Anyway, *something* like this would be an improvement. ATB, Ramsay Jones -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html