On 11.09.2013 01:23, Karsten Blees wrote: > In msvc.h, there's a couple of stat related functions defined diffently > from mingw.h. When we remove these definitions, the only problem we get is > "warning C4005: '_stati64' : macro redefinition" for this line in mingw.h: > > #define _stati64(x,y) mingw_stat(x,y) I have a similar patch at [1] to fix similar compilation issues with MinGW runtime version 4.0, which was recently released. I like your patch better, so I've rebased mine on top of yours: [PATCH] MinGW: Fix stat definitions to work with MinGW runtime version 4.0 For an overview of changes in mingwrt-4.0 see: http://sourceforge.net/p/mingw/mingw-org-wsl/ci/4.0.0/tree/NEWS Signed-off-by: Sebastian Schuberth <sschuberth@xxxxxxxxx> --- compat/mingw.c | 1 - compat/mingw.h | 9 +++++++++ config.mak.uname | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/compat/mingw.c b/compat/mingw.c index 96d9ac4..29c051f 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -616,7 +616,6 @@ int mingw_stat(const char *file_name, struct stat *buf) return do_stat_internal(1, file_name, buf); } -#undef fstat int mingw_fstat(int fd, struct stat *buf) { HANDLE fh = (HANDLE)_get_osfhandle(fd); diff --git a/compat/mingw.h b/compat/mingw.h index b521900..0d2faac 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -278,11 +278,20 @@ static inline int getrlimit(int resource, struct rlimit *rlp) #define lseek _lseeki64 /* use struct stat with 64 bit st_size */ +#ifdef stat +#undef stat +#endif #define stat _stati64 int mingw_lstat(const char *file_name, struct stat *buf); int mingw_stat(const char *file_name, struct stat *buf); int mingw_fstat(int fd, struct stat *buf); +#ifdef fstat +#undef fstat +#endif #define fstat mingw_fstat +#ifdef lstat +#undef lstat +#endif #define lstat mingw_lstat #ifndef _stati64 diff --git a/config.mak.uname b/config.mak.uname index 9249ee3..983ecc1 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -499,7 +499,7 @@ 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 -DNOGDI -Icompat -Icompat/win32 + COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\" COMPAT_OBJS += compat/mingw.o compat/winansi.o \ compat/win32/pthread.o compat/win32/syslog.o \ -- 1.8.3.mingw.1.2.g56240b5.dirty I don't think we should squash this patch to yours, however, because yours addressed MSVC compilation issues, and mine address MinGW compilation issues. But my patch could go to your branch. [1] https://github.com/sschuberth/git/commit/841cdf60faa134eef031a7cf6d6692473a18cb65 -- Sebastian Schuberth -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html