aboutsummaryrefslogtreecommitdiff
path: root/compat/mingw.h
diff options
context:
space:
mode:
authorRamsay Jones <ramsay@ramsay1.demon.co.uk>2010-01-15 21:12:19 +0100
committerJunio C Hamano <gitster@pobox.com>2010-01-16 16:43:55 -0800
commitb6f714f89a2abb591e6d46595f43bc8d4d356a72 (patch)
tree7b812ff4db85c00ee6cf6d39a2d106a7f2c8670b /compat/mingw.h
parent75301f90159a505f3683a5eba10174928dc30fb1 (diff)
downloadgit-b6f714f89a2abb591e6d46595f43bc8d4d356a72.tar.gz
git-b6f714f89a2abb591e6d46595f43bc8d4d356a72.tar.xz
MSVC: Fix an "incompatible pointer types" compiler warning
In particular, the following warning is issued while compiling compat/msvc.c: ...mingw.c(223) : warning C4133: 'function' : incompatible \ types - from '_stati64 *' to '_stat64 *' which relates to a call of _fstati64() in the mingw_fstat() function definition. This is caused by various layers of macro magic and attempts to avoid macro redefinition compiler warnings. For example, the call to _fstati64() mentioned above is actually a call to _fstat64(), and expects a pointer to a struct _stat64 rather than the struct _stati64 which is passed to mingw_fstat(). The definition of struct _stati64 given in compat/msvc.h had the same "shape" as the definition of struct _stat64, so the call to _fstat64() does not actually cause any runtime errors, but the structure types are indeed incompatible. In order to avoid the compiler warning, we add declarations for the mingw_lstat() and mingw_fstat() functions and supporting macros to msvc.h, suppressing the corresponding declarations in mingw.h, so that we can use the appropriate structure type (and function) names from the msvc headers. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/mingw.h')
-rw-r--r--compat/mingw.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/compat/mingw.h b/compat/mingw.h
index a105dc9a2..afe12ea55 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -209,13 +209,15 @@ int mingw_getpagesize(void);
* mingw_fstat() instead of fstat() on Windows.
*/
#define off_t off64_t
-#define stat _stati64
#define lseek _lseeki64
+#ifndef ALREADY_DECLARED_STAT_FUNCS
+#define stat _stati64
int mingw_lstat(const char *file_name, struct stat *buf);
int mingw_fstat(int fd, struct stat *buf);
#define fstat mingw_fstat
#define lstat mingw_lstat
#define _stati64(x,y) mingw_lstat(x,y)
+#endif
int mingw_utime(const char *file_name, const struct utimbuf *times);
#define utime mingw_utime