summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--lib/fseeko.c5
-rw-r--r--lib/stdio.in.h33
-rw-r--r--m4/fseeko.m414
-rw-r--r--m4/stdio_h.m43
-rw-r--r--modules/stdio1
6 files changed, 46 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 88fffb876d..e4f9426101 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2010-04-03 Bruno Haible <bruno@clisp.org>
+ fseeko: Fix C++ test error on mingw.
+ * lib/stdio.in.h (fseeko): Use modern idiom.
+ * lib/fseeko.c (fseeko): Renamed from rpl_fseeko.
+ * m4/fseeko.m4 (gl_FUNC_FSEEKO): Distinguish the case that the function
+ is missing and that it needs to be replaced.
+ (gl_REPLACE_FSEEKO): Don't set REPLACE_FSEEKO here.
+ * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Initialize HAVE_FSEEKO.
+ * modules/stdio (Makefile.am): Substitute HAVE_FSEEKO.
+
+2010-04-03 Bruno Haible <bruno@clisp.org>
+
mkstemp: Fix C++ test error on mingw.
* lib/stdlib.in.h (mkstemp): Use modern idiom.
* m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Distinguish the case that the
diff --git a/lib/fseeko.c b/lib/fseeko.c
index 7c0fd0e876..1fd1266bfe 100644
--- a/lib/fseeko.c
+++ b/lib/fseeko.c
@@ -25,14 +25,13 @@
#include "stdio-impl.h"
+int
+fseeko (FILE *fp, off_t offset, int whence)
#undef fseeko
#if !HAVE_FSEEKO
# undef fseek
# define fseeko fseek
#endif
-
-int
-rpl_fseeko (FILE *fp, off_t offset, int whence)
{
#if LSEEK_PIPE_BROKEN
/* mingw gives bogus answers rather than failure on non-seekable files. */
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 7647d48a3d..25e8bddb9a 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -322,30 +322,39 @@ _GL_CXXALIASWARN (fseek);
# undef fseek
# endif
# if @REPLACE_FSEEKO@
-/* Provide fseek, fseeko functions that are aware of a preceding
- fflush(), and which detect pipes. */
+/* Provide an fseeko function that is aware of a preceding fflush(), and which
+ detects pipes. */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fseeko
# define fseeko rpl_fseeko
# endif
_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
_GL_ARG_NONNULL ((1)));
-# if !@GNULIB_FSEEK@
- /* In order to avoid that fseek gets defined as a macro here, the
- developer can request the 'fseek' module. */
-# undef fseek
-# define fseek rpl_fseek
+_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
+# else
+# if ! @HAVE_FSEEKO@
+_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
+ _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
+# endif
+_GL_CXXALIASWARN (fseeko);
+# if (@REPLACE_FSEEKO@ || !@HAVE_FSEEKO@) && !@GNULIB_FSEEK@
+ /* Provide an fseek function that is consistent with fseeko. */
+ /* In order to avoid that fseek gets defined as a macro here, the
+ developer can request the 'fseek' module. */
+# undef fseek
+# define fseek rpl_fseek
static inline int _GL_ARG_NONNULL ((1))
rpl_fseek (FILE *fp, long offset, int whence)
{
+# if @REPLACE_FSEEKO@
+ return rpl_fseeko (fp, offset, whence);
+# else
return fseeko (fp, offset, whence);
-}
# endif
-_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
-# else
-_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
+}
# endif
-_GL_CXXALIASWARN (fseeko);
#elif defined GNULIB_POSIXCHECK
# define _GL_FSEEK_WARN /* Category 1, above. */
# undef fseek
diff --git a/m4/fseeko.m4 b/m4/fseeko.m4
index 5f7f97729c..eff09b1e2e 100644
--- a/m4/fseeko.m4
+++ b/m4/fseeko.m4
@@ -1,4 +1,4 @@
-# fseeko.m4 serial 7
+# fseeko.m4 serial 8
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -19,8 +19,14 @@ AC_DEFUN([gl_FUNC_FSEEKO],
]], [fseeko (stdin, 0, 0);])],
[gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
])
- if test $gl_cv_func_fseeko = no \
- || test $gl_cv_var_stdin_large_offset = no; then
+ if test $gl_cv_func_fseeko = no; then
+ HAVE_FSEEKO=0
+ else
+ if test $gl_cv_var_stdin_large_offset = no; then
+ REPLACE_FSEEKO=1
+ fi
+ fi
+ if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then
gl_REPLACE_FSEEKO
fi
])
@@ -28,8 +34,6 @@ AC_DEFUN([gl_FUNC_FSEEKO],
AC_DEFUN([gl_REPLACE_FSEEKO],
[
AC_LIBOBJ([fseeko])
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
- REPLACE_FSEEKO=1
dnl If we are also using the fseek module, then fseek needs replacing, too.
m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK])
])
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index af56b1f9da..5b36f8b04a 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 27
+# stdio_h.m4 serial 28
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -99,6 +99,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF])
HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF])
HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF])
+ HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT])
HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF])
diff --git a/modules/stdio b/modules/stdio
index 59a29bd6a1..50eae5087f 100644
--- a/modules/stdio
+++ b/modules/stdio
@@ -76,6 +76,7 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
-e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
-e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \
+ -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \
-e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \
-e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
-e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \