[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] Libvirt / GNULIB failures using Mingw64 toolchain



Daniel P. Berrange wrote:
> Attaching the stdio.h & sys/stat.h that I have

Thanks.

> > >   CC     fstat.lo
> > > ../../../gnulib/lib/fstat.c:27:0: warning: "stat" redefined [enabled by default]
> > > In file included from ./sys/stat.h:32:0,
> > >                  from ../../../gnulib/lib/fstat.c:25:
> > > /usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/stat.h:258:0: note: this is the location of the previous definition
> > > ../../../gnulib/lib/fstat.c:28:0: warning: "fstat" redefined [enabled by default]
> > > In file included from ./sys/stat.h:32:0,
> > >                  from ../../../gnulib/lib/fstat.c:25:
> > > /usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/stat.h:259:0: note: this is the location of the previous definition

mingw64's <sys/stat.h> and <_mingw_stat64.h> do

#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
#ifdef _USE_32BIT_TIME_T
#define stat _stat32i64    = _stati64
#define fstat _fstat32i64  = _fstati64
#else
#define stat _stat64       = _stati64
#define fstat _fstat64     = _fstati64
#endif
#endif

therefore what gnulib does in stat.c and fstat.c is equivalent to it.
We lose nothing by silencing the warning. I'm applying this:


2012-06-19  Bruno Haible  <bruno clisp org>

	stat, fstat: Avoid warnings on mingw64.
	* lib/stat.c (stat) [_GL_WINDOWS_64_BIT_ST_SIZE]: Undefine before
	redefining.
	* lib/fstat.c (stat, fstat) [_GL_WINDOWS_64_BIT_ST_SIZE]: Likewise.
	Reported by Daniel P. Berrange <berrange redhat com>.

--- lib/fstat.c.orig	Wed Jun 20 01:58:30 2012
+++ lib/fstat.c	Wed Jun 20 01:58:17 2012
@@ -24,7 +24,9 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #if _GL_WINDOWS_64_BIT_ST_SIZE
+# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
 # define stat _stati64
+# undef fstat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
 # define fstat _fstati64
 #endif
 #undef __need_system_sys_stat_h
--- lib/stat.c.orig	Wed Jun 20 01:58:30 2012
+++ lib/stat.c	Wed Jun 20 01:58:16 2012
@@ -29,6 +29,7 @@
 
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 # if _GL_WINDOWS_64_BIT_ST_SIZE
+#  undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
 #  define stat _stati64
 #  define REPLACE_FUNC_STAT_DIR 1
 #  undef REPLACE_FUNC_STAT_FILE


> > >   CC     stdio-read.lo
> > > ../../../gnulib/lib/stdio-read.c:102:1: error: redefinition of 'vscanf'
> > > In file included from ./stdio.h:43:0,
> > >                  from ../../../gnulib/lib/stdio-read.c:21:
> > > /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:397:7: note: previous definition of 'vscanf' was here

Their <stdio.h> file now *defines* many functions:
  sscanf
  scanf
  fscanf
  vsscanf
  vscanf
  vfscanf
  fprintf
  printf
  sprintf
  vfprintf
  vprintf
  vsprintf
  asprintf
  vasprintf
  snprintf
  vsnprintf
  swscanf
  wscanf
  fwscanf
  vswscanf
  vwscanf
  vfwscanf
  fwprintf
  wprintf
  swprintf
  vfwprintf
  vwprintf
  vswprintf
  snwprintf
  vsnwprintf

But the situation is not clear to me. What are the results of
  $ grep -i vscanf config.status
  $ grep STDIO config.status
?

Bruno


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]