Compile fix for MSVC: Do not include sys/resources.h

Do not include header files when compiling with MSVC that do not exist and which are also not included when compiling with MINGW. A direct consequence is that git can be compiled again with MSVC because the missing "sys/resources.h" is no longer included. Instead of current #ifndef mingw32 is the only one that is strange ... everything for systems that is not strange ... #else ... include mingw specific tweaks ... #endif #ifdef msvc is also strange ... include msvc specific tweaks ... #endif it turns things around and says what it wants to achieve in a more direct way, i.e. #if mingw32 #include "compat/mingw.h" #elif msvc #include "compat/msvc.h" #else ... all the others ... #endif which makes it a lot simpler. Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org> Helped-by: Junio C Hamano <gitster@pobox.com> Acked-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Vincent van Ravesteijn committed Oct 31, 2011 at 20:12 UTC cfc755d30e2f9d92f19af10ba2d810281aa94c99
1 file changed +6 -7
git-compat-util.h
+6 -7
@@ -116,7 +116,12 @@
116 #else
117 #include <poll.h>
118 #endif
119 -#ifndef __MINGW32__
119 +#if defined(__MINGW32__)
120 +/* pull in Windows compatibility stuff */
121 +#include "compat/mingw.h"
122 +#elif defined(_MSC_VER)
123 +#include "compat/msvc.h"
124 +#else
125 #include <sys/wait.h>
126 #include <sys/resource.h>
127 #include <sys/socket.h>
@@ -145,12 +150,6 @@
150 #include <grp.h>
151 #define _ALL_SOURCE 1
152 #endif
148 -#else /* __MINGW32__ */
149 -/* pull in Windows compatibility stuff */
150 -#include "compat/mingw.h"
151 -#endif /* __MINGW32__ */
152 -#ifdef _MSC_VER
153 -#include "compat/msvc.h"
153 #endif
154
155 #ifndef NO_LIBGEN_H