+2009-10-27 Eric Blake <ebb9@byu.net>
+
+ fseek: avoid compilation failure when fflush is replaced
+ * m4/fseek.m4 (gl_REPLACE_FSEEK): New macro.
+ * m4/fseeko.m4 (gl_REPLACE_FSEEKO): Also replace fseek, if fseek
+ module is in use.
+ * lib/stdio.in.h (GNULIB_FSEEKO): Only poison fseek if fseek
+ module is not in use; since REPLACE_FSEEK worked otherwise.
+ (GNULIB_FTELLO): Likewise for ftell.
+ Reported by Ian Beckwith and others.
+
2009-10-27 Bruno Haible <bruno@clisp.org>
* lib/isnan.c (rpl_isnan[fdl]): Repeat the specification declaration.
Reported by Jim Meyering.
2009-10-27 Jim Meyering <jim@meyering.net>
- Bruno Haible <bruno@clisp.org>
+ Bruno Haible <bruno@clisp.org>
Avoid warning despite dropping the return value of fwrite.
* lib/unicodeio.c: Include ignore-value.h.
fflush(), and which detect pipes. */
# define fseeko rpl_fseeko
extern int fseeko (FILE *fp, off_t offset, int whence);
-# define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
+# if !@GNULIB_FSEEK@
+# undef fseek
+# define fseek(f,o,w) \
+ (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
+ "on 32-bit platforms - " \
+ "use fseeko function for handling of large files"), \
+ fseeko (f, o, w))
+# endif
# endif
#elif defined GNULIB_POSIXCHECK
# undef fseeko
# if @REPLACE_FTELLO@
# define ftello rpl_ftello
extern off_t ftello (FILE *fp);
-# define ftell(fp) ftello (fp)
+# if !@GNULIB_FTELL@
+# undef ftell
+# define ftell(f) \
+ (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
+ "on 32-bit platforms - " \
+ "use ftello function for handling of large files"), \
+ ftello (f))
+# endif
# endif
#elif defined GNULIB_POSIXCHECK
# undef ftello
-# fseek.m4 serial 1
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# fseek.m4 serial 2
+dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_FSEEKO])
dnl When fseeko needs fixes, fseek needs them too.
- if test $REPLACE_FSEEKO != 0; then
- AC_LIBOBJ([fseek])
- REPLACE_FSEEK=1
- fi
+ dnl gl_FUNC_FSEEKO takes care of calling gl_REPLACE_FSEEK
+])
+
+AC_DEFUN([gl_REPLACE_FSEEK],
+[
+ AC_LIBOBJ([fseek])
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+ REPLACE_FSEEK=1
])
-# fseeko.m4 serial 4
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# fseeko.m4 serial 5
+dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko],
[
- AC_TRY_LINK([#include <stdio.h>], [fseeko (stdin, 0, 0);],
+ AC_TRY_LINK([[#include <stdio.h>]], [fseeko (stdin, 0, 0);],
[gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
])
if test $gl_cv_func_fseeko = no; then
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])
])