[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH gnulib 4/4] RFC stat: x86_64 mingw64 #define stat as _stat64.
From: |
Bruno Haible |
Subject: |
Re: [PATCH gnulib 4/4] RFC stat: x86_64 mingw64 #define stat as _stat64. |
Date: |
Mon, 30 Jan 2012 01:02 +0100 |
User-agent: |
KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; ) |
Marc-André Lureau wrote:
> > What is the problem in the first place? Which warning or error did you
> > get? Please also show snippets from the .h files with relevant information.
>
> stat.c: In function 'rpl_stat':
> stat.c:67:3: warning: passing argument 2 of 'orig_stat' from
> incompatible pointer type [enabled by default]
> stat.c:31:1: note: expected 'struct _stat64 *' but argument is of type
> 'struct stat *'
> stat.c:113:11: warning: passing argument 2 of 'orig_stat' from
> incompatible pointer type [enabled by default]
> stat.c:31:1: note: expected 'struct _stat64 *' but argument is of type
> 'struct stat *'
Thanks. Can you please try this patch?
--- lib/sys_stat.in.h.orig Mon Jan 30 01:00:23 2012
+++ lib/sys_stat.in.h Mon Jan 30 00:59:44 2012
@@ -616,14 +616,35 @@
/* We can't use the object-like #define stat rpl_stat, because of
struct stat. This means that rpl_stat will not be used if the user
does (stat)(a,b). Oh well. */
-# undef stat
# ifdef _LARGE_FILES
/* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
so we have to replace stat64() instead of stat(). */
+# undef stat
# define stat stat64
# undef stat64
# define stat64(name, st) rpl_stat (name, st)
-# else /* !_LARGE_FILES */
+# elif defined __MINGW32__ && defined stat
+# ifdef _USE_32BIT_TIME_T
+ /* The system headers define stat to _stat32i64. */
+# undef _stat32i64
+# define _stat32i64(name, st) rpl_stat (name, st)
+# else
+ /* The system headers define stat to _stat64. */
+# undef _stat64
+# define _stat64(name, st) rpl_stat (name, st)
+# endif
+# elif defined _MSC_VER && defined stat
+# ifdef _USE_32BIT_TIME_T
+ /* The system headers define stat to _stat32. */
+# undef _stat32
+# define _stat32(name, st) rpl_stat (name, st)
+# else
+ /* The system headers define stat to _stat64i32. */
+# undef _stat64i32
+# define _stat64i32(name, st) rpl_stat (name, st)
+# endif
+# else /* !(_LARGE_FILES ||__MINGW32__ || _MSC_VER) */
+# undef stat
# define stat(name, st) rpl_stat (name, st)
# endif /* !_LARGE_FILES */
_GL_EXTERN_C int stat (const char *name, struct stat *buf)
- [PATCH gnulib 0/4] some mingw64 warnings fixes, Marc-André Lureau, 2012/01/25
- [PATCH gnulib 1/4] malloca: Avoid warnings on x86_64 mingw64., Marc-André Lureau, 2012/01/25
- [PATCH gnulib 3/4] select, poll, isatty: Avoid warnings on x86_64 mingw64., Marc-André Lureau, 2012/01/25
- [PATCH gnulib 2/4] accept4, fcntl, w32sock: Avoid warnings on x86_64 mingw64., Marc-André Lureau, 2012/01/25
- [PATCH gnulib 4/4] RFC stat: x86_64 mingw64 #define stat as _stat64., Marc-André Lureau, 2012/01/25