[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compile warning with mingw ("__stat64" redefined)
From: |
Bruno Haible |
Subject: |
Re: Compile warning with mingw ("__stat64" redefined) |
Date: |
Tue, 17 Dec 2019 09:54:36 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-166-generic; KDE/5.18.0; x86_64; ; ) |
Hello Christian,
> this is pretty minor, but I did notice this warning during the compile
> of gnulib:
> ../../../gnulib/import/glob.c:75: warning: "__stat64" redefined
> # define __stat64(fname, buf) stat (fname, buf)
>
> In file included from /usr/share/mingw-w64/include/sys/stat.h:58,
> from ./sys/stat.h:47,
> from ./glob.h:551,
> from ../../../gnulib/import/glob.c:28:
> /usr/share/mingw-w64/include/_mingw_stat64.h:97: note: this is the
> location of the previous definition
> #define __stat64 _stat64
>
> This is using 8.3-win32 20190406 (GCC) as a crosscompiler from Debian to
> mingw.
>
> May be good to fix, should require just an #undef, I would think.
Done through this patch. The #undef shouldn't be unconditional, because
symbols that start with '__' are in the platform's namespace, and the symbol
might be used (by the platform's header files) in some way that we don't
expect. I checked the header files of mingw-w64; so on this platform it
should be safe.
2019-12-17 Bruno Haible <address@hidden>
glob: Avoid warning on mingw.
Reported by Christian Biesinger <address@hidden> in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-12/msg00122.html>.
* lib/glob.c (__stat64): Undefine first.
diff --git a/lib/glob.c b/lib/glob.c
index 9ecc515..fae6e61 100644
--- a/lib/glob.c
+++ b/lib/glob.c
@@ -72,6 +72,10 @@
# define __glob glob
# define __getlogin_r(buf, len) getlogin_r (buf, len)
# define __lstat64(fname, buf) lstat (fname, buf)
+# ifdef __MINGW32__
+ /* Avoid GCC warning. mingw has an unused __stat64 macro. */
+# undef __stat64
+# endif
# define __stat64(fname, buf) stat (fname, buf)
# define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag)
# define struct_stat64 struct stat