]> Savannah Git Hosting - gnulib.git/commitdiff
nonblocking: Avoid compilation error on mingw64.
authorBruno Haible <bruno@clisp.org>
Thu, 21 Jun 2012 10:39:37 +0000 (12:39 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 21 Jun 2012 10:39:37 +0000 (12:39 +0200)
* m4/stdio_h.m4 (gl_STDIO_H): Invoke gl_MODULE_INDICATOR for scanf,
fscanf.
* modules/vscanf (configure.ac): Invoke gl_MODULE_INDICATOR.
* modules/vfscanf (configure.ac): Likewise.
* lib/stdio-read.c (scanf, fscanf, vscanf, vfscanf): Enable function
definition only if stdio.h has prepared it.
Reported by Daniel P. Berrange <berrange@redhat.com>.

ChangeLog
lib/stdio-read.c
m4/stdio_h.m4
modules/vfscanf
modules/vscanf

index 442c4ec65202120555db4e0e8f9b50816a208db3..e65218a0963e9be9f9061ff1bfb8cfbc77ac8cad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-06-21  Bruno Haible  <bruno@clisp.org>
+
+       nonblocking: Avoid compilation error on mingw64.
+       * m4/stdio_h.m4 (gl_STDIO_H): Invoke gl_MODULE_INDICATOR for scanf,
+       fscanf.
+       * modules/vscanf (configure.ac): Invoke gl_MODULE_INDICATOR.
+       * modules/vfscanf (configure.ac): Likewise.
+       * lib/stdio-read.c (scanf, fscanf, vscanf, vfscanf): Enable function
+       definition only if stdio.h has prepared it.
+       Reported by Daniel P. Berrange <berrange@redhat.com>.
+
 2012-06-20  Bernd Jendrissek  <bernd.jendrissek@gmail.com>  (tiny change)
 
        gnulib-tool: Use readlink if it is available.
index 358d8cd9df2ad17e1fa010dd5b1563e5abb67f86..8f3e94529f2077c8a5b971ac6a8c2ba85ef1bda0 100644 (file)
@@ -72,6 +72,9 @@
       return ret;                                                             \
     }
 
+/* Enable this function definition only of gnulib's <stdio.h> has prepared it.
+   Otherwise we get a function definition conflict with mingw64's <stdio.h>.  */
+#  if GNULIB_SCANF
 int
 scanf (const char *format, ...)
 {
@@ -84,7 +87,11 @@ scanf (const char *format, ...)
 
   return retval;
 }
+#  endif
 
+/* Enable this function definition only of gnulib's <stdio.h> has prepared it.
+   Otherwise we get a function definition conflict with mingw64's <stdio.h>.  */
+#  if GNULIB_FSCANF
 int
 fscanf (FILE *stream, const char *format, ...)
 {
@@ -97,19 +104,28 @@ fscanf (FILE *stream, const char *format, ...)
 
   return retval;
 }
+#  endif
 
+/* Enable this function definition only of gnulib's <stdio.h> has prepared it.
+   Otherwise we get a function definition conflict with mingw64's <stdio.h>.  */
+#  if GNULIB_VSCANF
 int
 vscanf (const char *format, va_list args)
 {
   return vfscanf (stdin, format, args);
 }
+#  endif
 
+/* Enable this function definition only of gnulib's <stdio.h> has prepared it.
+   Otherwise we get a function definition conflict with mingw64's <stdio.h>.  */
+#  if GNULIB_VFSCANF
 int
 vfscanf (FILE *stream, const char *format, va_list args)
 #undef vfscanf
 {
   CALL_WITH_ERRNO_FIX (int, vfscanf (stream, format, args), ret == EOF)
 }
+#  endif
 
 int
 getchar (void)
index b03393b957b51c023204587495c83825e9770242..5298dd6d9d5e491e4fc40fff4f0bea509d69ff03 100644 (file)
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 41
+# stdio_h.m4 serial 42
 dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,9 @@ AC_DEFUN([gl_STDIO_H],
   dnl No need to create extra modules for these functions. Everyone who uses
   dnl <stdio.h> likely needs them.
   GNULIB_FSCANF=1
+  gl_MODULE_INDICATOR([fscanf])
   GNULIB_SCANF=1
+  gl_MODULE_INDICATOR([scanf])
   GNULIB_FGETC=1
   GNULIB_GETC=1
   GNULIB_GETCHAR=1
index c2d6a8d35de8e3169ad4b807417752ac126f4c3a..06bb78a436ee6fd924e1630d19c6fb48ef8196e4 100644 (file)
@@ -8,6 +8,7 @@ stdio
 
 configure.ac:
 gl_STDIO_MODULE_INDICATOR([vfscanf])
+gl_MODULE_INDICATOR([vfscanf])
 
 Makefile.am:
 
index cf1d8c2405877134cb79ff91ad910bb57074e388..882d259bf864483f4726a009de61832c7f474057 100644 (file)
@@ -8,6 +8,7 @@ stdio
 
 configure.ac:
 gl_STDIO_MODULE_INDICATOR([vscanf])
+gl_MODULE_INDICATOR([vscanf])
 
 Makefile.am: