[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: |
Marc-André Lureau |
Subject: |
Re: [PATCH gnulib 4/4] RFC stat: x86_64 mingw64 #define stat as _stat64. |
Date: |
Sun, 29 Jan 2012 21:27:47 +0100 |
On Sat, Jan 28, 2012 at 12:49 PM, Bruno Haible <address@hidden> wrote:
> If you have to make such a change to lib/tempname.c, the chances are high
> that gnulib users also will have to adapt their programs. Which would be
> against the spirit of gnulib: Packages that use gnulib should use the
> POSIX or glibc API.
Indeed, I am not satisifed with the proposed solution, but I feel like
there is a limitation, and we can't easily replace both stat() and
struct stat.
> 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 *'
And the ./m4/sys_stat_h.m4 included between orig_stat() and rpl_stat():
/* 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(). */
# define stat stat64
# undef stat64
# define stat64(name, st) rpl_stat (name, st)
# else /* !_LARGE_FILES */
# define stat(name, st) rpl_stat (name, st)
# endif /* !_LARGE_FILES */
Apparently, gnulib would like to replace stat() with rpl_stat()
because of some incompatibilites, but it has to give up on previous
#define stat _stat64 on mingw64. This is the cause of the warnings.
Tbh, I have no idea how we can achieve to replace both struct "stat"
and "stat()" without introducing new struct or function name.
>> #define stat as _stat64
>
> I don't see such a #define in my copy of mingw64. Where do you see it?
https://mingw-w64.svn.sourceforge.net/svnroot/mingw-w64/trunk/mingw-w64-headers/crt/sys/stat.h
--
Marc-André Lureau
- [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