From: Ramsay Jones <ramsay@ramsay1•demon.co.uk>
To: Marius Storm-Olsen <mstormo@gmail•com>
Cc: Alex Riesen <raa.lkml@gmail•com>,
GIT Mailing-list <git@vger•kernel.org>,
"Shawn O. Pearce" <spearce@spearce•org>
Subject: Re: MSVC build broken (on cygwin)
Date: Sat, 03 Oct 2009 21:06:17 +0100 [thread overview]
Message-ID: <4AC7AEB9.3030404@ramsay1.demon.co.uk> (raw)
In-Reply-To: <4AC5BEA6.5000102@gmail.com>
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
next prev parent reply other threads:[~2009-10-03 20:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-01 17:11 MSVC build broken (on cygwin) Ramsay Jones
2009-10-02 8:07 ` Marius Storm-Olsen
2009-10-02 8:23 ` Alex Riesen
2009-10-02 8:49 ` Marius Storm-Olsen
2009-10-03 20:06 ` Ramsay Jones [this message]
2009-10-03 20:29 ` Marius Storm-Olsen
2009-10-03 19:36 ` Ramsay Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AC7AEB9.3030404@ramsay1.demon.co.uk \
--to=ramsay@ramsay1$(echo .)demon.co.uk \
--cc=git@vger$(echo .)kernel.org \
--cc=mstormo@gmail$(echo .)com \
--cc=raa.lkml@gmail$(echo .)com \
--cc=spearce@spearce$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox