From: Sebastian Schuberth <sschuberth@gmail.com>
To: Karsten Blees <karsten.blees@gmail.com>
Cc: Git List <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 3/3] MSVC: fix stat definition hell
Date: Wed, 11 Sep 2013 18:02:09 +0200 [thread overview]
Message-ID: <52309401.7000508@gmail.com> (raw)
In-Reply-To: <522FA9E1.7010705@gmail.com>
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@gmail.com>
---
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
next prev parent reply other threads:[~2013-09-11 16:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-10 23:20 [PATCH 0/3] Fix MSVC compile errors and cleanup stat definitions Karsten Blees
2013-09-10 23:21 ` [PATCH 1/3] MSVC: fix compile errors due to missing libintl.h Karsten Blees
2013-09-10 23:22 ` [PATCH 2/3] MSVC: fix compile errors due to macro redefinitions Karsten Blees
2013-09-10 23:23 ` [PATCH 3/3] MSVC: fix stat definition hell Karsten Blees
2013-09-11 0:35 ` Eric Sunshine
2013-09-11 16:02 ` Sebastian Schuberth [this message]
2013-09-11 16:09 ` [PATCH 0/3] Fix MSVC compile errors and cleanup stat definitions Junio C Hamano
2013-09-11 16:16 ` Sebastian Schuberth
2013-09-11 18:11 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52309401.7000508@gmail.com \
--to=sschuberth@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=karsten.blees@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.