From: Erik Faye-Lund Date: Mon, 28 Apr 2014 14:56:45 GMT Subject: Re: [PATCH 09/12] MINGW: config.mak.uname: drop -DNOGDI Message-ID: In-Reply-To: <1398693097-24651-10-git-send-email-marat@slonopotamus.org> On Mon, Apr 28, 2014 at 3:51 PM, Marat Radchenko wrote: > On MinGW-W64, MsgWaitForMultipleObjects is guarded with #ifndef NOGDI. > > Unfortunately, including wingdi.h brings in #define ERROR 0 which > conflicts with several Git internal enums. So, #undef ERROR. > > Signed-off-by: Marat Radchenko > --- > config.mak.uname | 4 ++-- > git-compat-util.h | 2 ++ > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/config.mak.uname b/config.mak.uname > index a376b32..4883fd5 100644 > --- a/config.mak.uname > +++ b/config.mak.uname > @@ -363,7 +363,7 @@ ifeq ($(uname_S),Windows) > COMPAT_OBJS = compat/msvc.o compat/winansi.o \ > compat/win32/pthread.o compat/win32/syslog.o \ > compat/win32/dirent.o > - COMPAT_CFLAGS = -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\" > + COMPAT_CFLAGS = -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\" > BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib > EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj > PTHREAD_LIBS = > @@ -503,7 +503,7 @@ ifneq (,$(findstring MINGW,$(uname_S))) > NO_INET_NTOP = YesPlease > NO_POSIX_GOODIES = UnfortunatelyYes > DEFAULT_HELP_FORMAT = html > - COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32 > + COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -Icompat -Icompat/win32 > 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 aa57a04..48bf0f7 100644 > --- a/git-compat-util.h > +++ b/git-compat-util.h > @@ -98,6 +98,8 @@ > #define WIN32_LEAN_AND_MEAN /* stops windows.h including winsock.h */ > #include > #include > +/* wingdi.h defines ERROR=0, undef it to avoid conflicts */ > +#undef ERROR > #define GIT_WINDOWS_NATIVE > #endif Perhaps it would be cleaner to just undef NOGDI in compat/poll/poll.c? That way we don't end up pulling in all kinds of unrelated GUI-stuff into places where they're not needed...?