Re: [PATCH 10/12] MINGW: compat/poll/poll.c: undef NOGDI
- From
Stepan Kasal <kasal@ucw.cz>
- Date
- May 5, 2014, 07:35 UTC
- Message-ID
- <20140505073547.GB20599@camelia.ucw.cz>
- In-Reply-To
- <20140504205552.GA15590@seldon>
Hello,
On Mon, May 05, 2014 at 12:55:52AM +0400, Marat Radchenko wrote:
Show 6 quoted lines
> On Sun, May 04, 2014 at 08:52:44PM +0200, Stepan Kasal wrote: > > is really a work around: it would be in effect only for MinGW-W64, > > and the comment would explain that this is a hack to work around the > > bug. > > Workarounds do not have to be ugly and full of #ifdef's.
I'm afraid they have to. If you just select one of the reasonable variants, without noting that the other ones would trigger a bug, you are lying a trap for future contributors.
> > If you manage to change the defs for poll.c without changing its > > content, no one could tell you to report to gnulib first. > > v1 does exactly this.
Yes, but it changes the define for other configurations as well (MSVC, mingw 32bit). I would suggest something along the change below.
What do you think?
Stepan
diff --git a/config.mak.uname b/config.mak.uname index 82b8dff..446dd41 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -508,7 +508,11 @@ ifneq (,$(findstring MINGW,$(uname_S))) NO_POSIX_GOODIES = UnfortunatelyYes DEFAULT_HELP_FORMAT = html NO_D_INO_IN_DIRENT = YesPlease - COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32 + COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -Icompat -Icompat/win32 +ifneq ($(uname_M),x86_64) + # MinGW-W64 < x.y headers do not provide MsgWaitForMultipleObjects with NOGDI + COMPAT_CFLAGS += -DNOGDI +endif COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\" COMPAT_OBJS += compat/mingw.o compat/winansi.o \ compat/win32/pthread.o compat/win32/syslog.o \ diff --git a/git-compat-util.h b/git-compat-util.h index e6de32c..29a8afd 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -92,6 +92,9 @@ #define WIN32_LEAN_AND_MEAN /* stops windows.h including winsock.h */ #include <winsock2.h> #include <windows.h> +/* We cannot define NOGDI on MinGW-W64, so we unfortunately include + wingdi.h. It then defines ERROR=0, undef it to avoid conflicts */ +#undef ERROR #define GIT_WINDOWS_NATIVE #endif