From cfc755d30e2f9d92f19af10ba2d810281aa94c99 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Mon, 31 Oct 2011 20:12:42 +0100 Subject: [PATCH 1/3] 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 Helped-by: Junio C Hamano Acked-by: Erik Faye-Lund Signed-off-by: Junio C Hamano --- git-compat-util.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/git-compat-util.h b/git-compat-util.h index 5ef8ff76f6..53186dacbb 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -116,7 +116,12 @@ #else #include #endif -#ifndef __MINGW32__ +#if defined(__MINGW32__) +/* pull in Windows compatibility stuff */ +#include "compat/mingw.h" +#elif defined(_MSC_VER) +#include "compat/msvc.h" +#else #include #include #include @@ -145,12 +150,6 @@ #include #define _ALL_SOURCE 1 #endif -#else /* __MINGW32__ */ -/* pull in Windows compatibility stuff */ -#include "compat/mingw.h" -#endif /* __MINGW32__ */ -#ifdef _MSC_VER -#include "compat/msvc.h" #endif #ifndef NO_LIBGEN_H From 7b05949be007952c5f7708aac50e731534740574 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Mon, 31 Oct 2011 20:12:43 +0100 Subject: [PATCH 2/3] Compile fix for MSVC: Include This include is needed for _commit(..) which is used in mingw.h. Signed-off-by: Vincent van Ravesteijn Acked-by: Erik Faye-Lund Signed-off-by: Junio C Hamano --- compat/msvc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/compat/msvc.h b/compat/msvc.h index a33b01c032..aa4b56315a 100644 --- a/compat/msvc.h +++ b/compat/msvc.h @@ -4,6 +4,7 @@ #include #include #include +#include /* porting function */ #define inline __inline From 439fbb807259ad52f1af86ca5e5c98b5f189a246 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Mon, 31 Oct 2011 20:12:44 +0100 Subject: [PATCH 3/3] MSVC: Remove unneeded header stubs These headers are no longer needed since they are no longer unnecessarily included in git-compat-util.h. Signed-off-by: Vincent van Ravesteijn Acked-by: Erik Faye-Lund Signed-off-by: Junio C Hamano --- compat/vcbuild/include/arpa/inet.h | 1 - compat/vcbuild/include/grp.h | 1 - compat/vcbuild/include/inttypes.h | 1 - compat/vcbuild/include/netdb.h | 1 - compat/vcbuild/include/netinet/in.h | 1 - compat/vcbuild/include/netinet/tcp.h | 1 - compat/vcbuild/include/pwd.h | 1 - compat/vcbuild/include/sys/ioctl.h | 1 - compat/vcbuild/include/sys/select.h | 1 - compat/vcbuild/include/sys/socket.h | 1 - compat/vcbuild/include/sys/wait.h | 1 - compat/vcbuild/include/termios.h | 1 - 12 files changed, 12 deletions(-) delete mode 100644 compat/vcbuild/include/arpa/inet.h delete mode 100644 compat/vcbuild/include/grp.h delete mode 100644 compat/vcbuild/include/inttypes.h delete mode 100644 compat/vcbuild/include/netdb.h delete mode 100644 compat/vcbuild/include/netinet/in.h delete mode 100644 compat/vcbuild/include/netinet/tcp.h delete mode 100644 compat/vcbuild/include/pwd.h delete mode 100644 compat/vcbuild/include/sys/ioctl.h delete mode 100644 compat/vcbuild/include/sys/select.h delete mode 100644 compat/vcbuild/include/sys/socket.h delete mode 100644 compat/vcbuild/include/sys/wait.h delete mode 100644 compat/vcbuild/include/termios.h diff --git a/compat/vcbuild/include/arpa/inet.h b/compat/vcbuild/include/arpa/inet.h deleted file mode 100644 index 0d8552a2c6..0000000000 --- a/compat/vcbuild/include/arpa/inet.h +++ /dev/null @@ -1 +0,0 @@ -/* Intentionally empty file to support building git with MSVC */ diff --git a/compat/vcbuild/include/grp.h b/compat/vcbuild/include/grp.h deleted file mode 100644 index 0d8552a2c6..0000000000 --- a/compat/vcbuild/include/grp.h +++ /dev/null @@ -1 +0,0 @@ -/* Intentionally empty file to support building git with MSVC */ diff --git a/compat/vcbuild/include/inttypes.h b/compat/vcbuild/include/inttypes.h deleted file mode 100644 index 0d8552a2c6..0000000000 --- a/compat/vcbuild/include/inttypes.h +++ /dev/null @@ -1 +0,0 @@ -/* Intentionally empty file to support building git with MSVC */ diff --git a/compat/vcbuild/include/netdb.h b/compat/vcbuild/include/netdb.h deleted file mode 100644 index 0d8552a2c6..0000000000 --- a/compat/vcbuild/include/netdb.h +++ /dev/null @@ -1 +0,0 @@ -/* Intentionally empty file to support building git with MSVC */ diff --git a/compat/vcbuild/include/netinet/in.h b/compat/vcbuild/include/netinet/in.h deleted file mode 100644 index 0d8552a2c6..0000000000 --- a/compat/vcbuild/include/netinet/in.h +++ /dev/null @@ -1 +0,0 @@ -/* Intentionally empty file to support building git with MSVC */ diff --git a/compat/vcbuild/include/netinet/tcp.h b/compat/vcbuild/include/netinet/tcp.h deleted file mode 100644 index 0d8552a2c6..0000000000 --- a/compat/vcbuild/include/netinet/tcp.h +++ /dev/null @@ -1 +0,0 @@ -/* Intentionally empty file to support building git with MSVC */ diff --git a/compat/vcbuild/include/pwd.h b/compat/vcbuild/include/pwd.h deleted file mode 100644 index 0d8552a2c6..0000000000 --- a/compat/vcbuild/include/pwd.h +++ /dev/null @@ -1 +0,0 @@ -/* Intentionally empty file to support building git with MSVC */ diff --git a/compat/vcbuild/include/sys/ioctl.h b/compat/vcbuild/include/sys/ioctl.h deleted file mode 100644 index 0d8552a2c6..0000000000 --- a/compat/vcbuild/include/sys/ioctl.h +++ /dev/null @@ -1 +0,0 @@ -/* Intentionally empty file to support building git with MSVC */ diff --git a/compat/vcbuild/include/sys/select.h b/compat/vcbuild/include/sys/select.h deleted file mode 100644 index 0d8552a2c6..0000000000 --- a/compat/vcbuild/include/sys/select.h +++ /dev/null @@ -1 +0,0 @@ -/* Intentionally empty file to support building git with MSVC */ diff --git a/compat/vcbuild/include/sys/socket.h b/compat/vcbuild/include/sys/socket.h deleted file mode 100644 index 0d8552a2c6..0000000000 --- a/compat/vcbuild/include/sys/socket.h +++ /dev/null @@ -1 +0,0 @@ -/* Intentionally empty file to support building git with MSVC */ diff --git a/compat/vcbuild/include/sys/wait.h b/compat/vcbuild/include/sys/wait.h deleted file mode 100644 index 0d8552a2c6..0000000000 --- a/compat/vcbuild/include/sys/wait.h +++ /dev/null @@ -1 +0,0 @@ -/* Intentionally empty file to support building git with MSVC */ diff --git a/compat/vcbuild/include/termios.h b/compat/vcbuild/include/termios.h deleted file mode 100644 index 0d8552a2c6..0000000000 --- a/compat/vcbuild/include/termios.h +++ /dev/null @@ -1 +0,0 @@ -/* Intentionally empty file to support building git with MSVC */