Re: [PATCH 09/14] Avoid including windows.h in winansi.c for MSVC build
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 21, 2009, 21:02 UTC
- Message-ID
- <7vmy5sdgoc.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <74ca14c3a691cc9844a0dd806f5db47977317bdb.1250860247.git.mstormo@gmail.com>
Marius Storm-Olsen <mstormo@gmail.com> writes:
> From: Frank Li <lznuaa@gmail.com> > > compat/msvc.h includes winsock2.h which conflicts with windows.h. > msvc.h also defines the oldest Windows API version required.
The first sentence sort-of makes sense; compat/msvc.h will be included by git-compat-util.h and including <windows.h> here will bring conflicting definitions, so we avoid doing so when on MSC.
The second sentence does not make any sense to me. It may be correctly stating a fact (i.e. "defines required WAPI version"), but it is unclear what relevance it has to this change to stop including <windows.h>.
Having said that, the first sentence hints me that perhaps you guys should include (conditionally only on windows but not with MSC) <windows.h> not from this file, but from git-compat-util.h?
Show 22 quoted lines
> Signed-off-by: Frank Li <lznuaa@gmail.com> > Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com> > --- > compat/winansi.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/compat/winansi.c b/compat/winansi.c > index 9217c24..0d79845 100644 > --- a/compat/winansi.c > +++ b/compat/winansi.c > @@ -2,7 +2,9 @@ > * Copyright 2008 Peter Harris <git@peter.is-a-geek.org> > */ > > +#ifndef _MSC_VER > #include <windows.h> > +#endif > #include "../git-compat-util.h" > > /* > -- > 1.6.3.msysgit.0.18.gef407