+2011-09-30 Bruno Haible <bruno@clisp.org>
+
+ nonblocking tests: Fix test failure on Linux/SPARC (32-bit and 64-bit).
+ * tests/test-nonblocking-pipe.h (PIPE_DATA_BLOCK_SIZE) [Linux/SPARC]:
+ Set to 140000.
+
+2011-09-30 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Improve suggestion where to put gl_EARLY invocation.
+ * gnulib-tool (func_import): If the configure.ac has an AC_PROG_CC_STDC
+ invocation, say "right after AC_PROG_CC_STDC", not "right after
+ AC_PROG_CC".
+ Reported by Gary V. Vaughan <gary@gnu.org>.
+
+2011-09-30 Bruno Haible <bruno@clisp.org>
+
+ Centralize C99 requirement.
+ * m4/gnulib-common.m4 (gl_PROG_CC_C99): New macro.
+ * modules/stdarg (configure.ac-early): Invoke it instead of
+ AC_PROG_CC_STDC.
+ Reported by Gary V. Vaughan and Paul Eggert.
+
+2011-09-29 Bruno Haible <bruno@clisp.org>
+
+ float: Fix LDBL_MAX value on Linux/PowerPC.
+ * m4/float_h.m4 (gl_FLOAT_H): Set FLOAT_H and REPLACE_FLOAT_LDBL also
+ on Linux/PowerPC.
+ * lib/float.in.h (LDBL_MAX): Redefine also on Linux/PowerPC.
+ * lib/float.c (gl_LDBL_MAX): Also define on Linux/PowerPC.
+ * doc/posix-headers/float.texi: Mention Linux/PowerPC as an affected
+ platform.
+ Reported by Andreas Metzler <ametzler@downhill.at.eu.org>.
+
+2011-09-29 Bruno Haible <bruno@clisp.org>
+
+ doc: Improve doc about gl_EARLY.
+ * doc/gnulib-tool.texi (Initial import): Mention where to place an
+ AC_PROG_CC_STDC invocation.
+ Reported by Gary V. Vaughan <gary@gnu.org>.
+
+2011-09-28 Bruno Haible <bruno@clisp.org>
+
+ fgetc, fputc, fread, fwrite tests: Fix link error.
+ * tests/test-fgetc.c (main): Don't invoke gl_msvc_inval_ensure_handler
+ on non-MSVC platforms.
+ * tests/test-fputc.c (main): Likewise.
+ * tests/test-fread.c (main): Likewise.
+ * tests/test-fwrite.c (main): Likewise.
+ Reported by Jim Meyering.
+
+2011-09-27 Bruno Haible <bruno@clisp.org>
+
+ fputc, fwrite tests: Avoid test failure on MSVC.
+ * tests/test-fgetc.c: Include msvc-inval.h.
+ (main): Invoke gl_msvc_inval_ensure_handler.
+ * tests/test-fputc.c: Include msvc-inval.h.
+ (main): Invoke gl_msvc_inval_ensure_handler.
+ * tests/test-fread.c: Include msvc-inval.h.
+ (main): Invoke gl_msvc_inval_ensure_handler.
+ * tests/test-fwrite.c: Include msvc-inval.h.
+ (main): Invoke gl_msvc_inval_ensure_handler.
+ * modules/fgetc-tests (Depends-on): Add msvc-inval.
+ * modules/fputc-tests (Depends-on): Likewise.
+ * modules/fread-tests (Depends-on): Likewise.
+ * modules/fwrite-tests (Depends-on): Likewise.
+
+2011-09-27 Bruno Haible <bruno@clisp.org>
+
+ raise: Fix double declaration with modules 'sigprocmask' and 'sigpipe'.
+ * lib/signal.in.h (GNULIB_defined_signal_blocking): New macro.
+ (raise): Remove older, duplicated declaration.
+ (_gl_raise_SIGPIPE): New declaration.
+ * lib/sigprocmask.c (_gl_raise_SIGPIPE): New function.
+ (rpl_raise): Remove function.
+ * lib/raise.c (rpl_raise, raise): Merge into a single function. Handle
+ a gnulib-defined SIGPIPE here.
+ * m4/raise.m4 (gl_FUNC_RAISE): Set REPLACE_RAISE also if the module
+ 'sigprocmask' has detected missing signal-blocking and the module
+ 'sigpipe' is enabled.
+ Reported by Tatsuro MATSUOKA <tmacchant5@yahoo.co.jp>.
+
+2011-09-26 Gijs van Tulder <gvtulder@gmail.com>
+
+ base64-tests: avoid memory leak
+ * tests/test-base64.c (main): Plug memory leak.
+
+ base32: new module
+ * modules/base32: New module.
+ * lib/base32.c: New file.
+ * lib/base32.h: Likewise.
+ * m4/base32.m4: Likewise.
+ * modules/base32-tests: New test.
+ * tests/test-base32.c: Likewise.
+ * MODULES.html.sh (Misc): Mention it.
+
+2011-09-26 Paul Eggert <eggert@cs.ucla.edu>
+
+ gnulib: use more-standard license notice wording
+ * gnulib-tool (func_emit_copyright_notice): When emitting a
+ license notice into a file, use the standard wording as suggested
+ by the current information for GNU maintainers, except say "file"
+ rather than "program". The new wording gives a license version
+ number, which addresses an issue raised by Glenn Morris in
+ <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00397.html>.
+ * m4/onceonly.m4: Use that same wording here, too.
+
+ dup2: minor simplification
+ * m4/dup2.m4 (gl_PREREQ_DUP2): Don't require AC_C_INLINE,
+ as lib/dup2.c no longer uses 'inline'.
+
+2011-09-25 Bruno Haible <bruno@clisp.org>
+
+ strings: Fix compilation error on MSVC.
+ * lib/strings.in.h: Include <stddef.h> for size_t.
+
+2011-09-25 Bruno Haible <bruno@clisp.org>
+
+ fflush et al.: Document limitation on MSVC.
+ * doc/posix-functions/fflush.texi: Document possible crash in handling
+ mode other than DEFAULT_HANDLING.
+ * doc/posix-functions/fgetc.texi: Likewise.
+ * doc/posix-functions/fputc.texi: Likewise.
+ * doc/posix-functions/fread.texi: Likewise.
+ * doc/posix-functions/fwrite.texi: Likewise.
+
+2011-09-25 Bruno Haible <bruno@clisp.org>
+
+ msvc-inval: Allow three invalid parameter handling modes.
+ * lib/msvc-inval.h: Don't include <stdlib.h> here.
+ (DEFAULT_HANDLING, HAIRY_LIBRARY_HANDLING, SANE_LIBRARY_HANDLING): New
+ macros.
+ (gl_msvc_inval_ensure_handler, TRY_MSVC_INVAL, CATCH_MSVC_INVAL,
+ DONE_MSVC_INVAL): Implement DEFAULT_HANDLING. Treat
+ SANE_LIBRARY_HANDLING as a no-op.
+ * lib/msvc-inval.c: Treat SANE_LIBRARY_HANDLING as a no-op. Include
+ <stdlib.h>.
+ (gl_msvc_invalid_parameter_handler): Implement DEFAULT_HANDLING.
+
+2011-09-25 Bruno Haible <bruno@clisp.org>
+
+ msvc-inval: Make handler multithread-safe.
+ * lib/msvc-inval.h (struct gl_msvc_inval_per_thread): New type.
+ (gl_msvc_inval_restart, gl_msvc_inval_restart_valid): Remove
+ declarations.
+ (gl_msvc_inval_current): New declaration.
+ (TRY_MSVC_INVAL, CATCH_MSVC_INVAL, DONE_MSVC_INVAL) [!_MSC_VER]:
+ Operate on the structure returned by gl_msvc_inval_current().
+ * lib/msvc-inval.c (gl_msvc_inval_restart, gl_msvc_inval_restart_valid):
+ Remove varaiables.
+ (tls_index, tls_initialized): New variables.
+ (not_per_thread): New variable.
+ (gl_msvc_inval_current): New function.
+ (gl_msvc_invalid_parameter_handler) [!_MSC_VER]: Use the structure
+ returned by gl_msvc_inval_current().
+
+2011-09-25 Bruno Haible <bruno@clisp.org>
+
+ msvc-inval: Install handler globally.
+ * lib/msvc-inval.h (STATUS_GNULIB_INVALID_PARAMETER): Define also for
+ !_MSC_VER.
+ (gl_msvc_invalid_parameter_handler): Remove declaration.
+ (gl_msvc_inval_restart_valid, gl_msvc_inval_ensure_handler): New
+ declarations.
+ (TRY_MSVC_INVAL, CATCH_MSVC_INVAL, DONE_MSVC_INVAL) [!_MSC_VER]:
+ Install the handler globally, don't uninstall it.
+ * lib/msvc-inval.c (gl_msvc_inval_restart_valid): New variable.
+ (gl_msvc_invalid_parameter_handler): Make static. If the restart is not
+ currently valid, call RaiseException instead.
+ (gl_msvc_inval_initialized, gl_msvc_inval_ensure_handler): Define also
+ for !_MSC_VER.
+
+2011-09-25 Bruno Haible <bruno@clisp.org>
+
+ strerror_r-posix: Fix for MSVC 9.
+ * lib/strerror_r.c (local_snprintf): New function.
+ (snprintf): Define to local_snprintf, not to _snprintf.
+
+2011-09-25 Bruno Haible <bruno@clisp.org>
+
+ ftruncate: Support for MSVC 9.
+ * lib/ftruncate.c: Include errno.h, msvc-inval.h.
+ (chsize_nothrow): New function.
+ (chsize): Redefine as a macro.
+ * m4/ftruncate.m4 (gl_PREREQ_FTRUNCATE): Require AC_C_INLINE.
+ * modules/ftruncate (Depends-on): Add msvc-inval.
+
+2011-09-25 Bruno Haible <bruno@clisp.org>
+
+ New module 'fstat'.
+ * lib/sys_stat.in.h (fstat): Declare only if GNULIB_FSTAT is set.
+ * lib/fstat.c: New file, based on a piece of lib/fchdir.c.
+ * lib/fchdir.c (rpl_fstat): Remove function.
+ * m4/fstat.m4: New file.
+ * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't set REPLACE_FSTAT.
+ * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Test whether fstat is
+ declared.
+ (gl_SYS_STAT_H_DEFAULTS): Initialize GNULIB_FSTAT.
+ * modules/sys_stat (Makefile.am): Substitute GNULIB_FSTAT.
+ * modules/fstat: New file.
+ * modules/sys_stat-tests (Depends-on): Remove fstat-tests.
+ * tests/test-sys_stat-c++.cc (fstat): Check only if GNULIB_TEST_FSTAT
+ is set.
+ * doc/posix-functions/fstat.texi: Mention the new module and the
+ problem on MSVC.
+ * NEWS: Mention the change.
+ * modules/acl (Depends-on): Add fstat.
+ * modules/chdir-safer (Depends-on): Likewise.
+ * modules/chown (Depends-on): Likewise.
+ * modules/copy-file (Depends-on): Likewise.
+ * modules/fchdir (Depends-on): Likewise.
+ * modules/fdopendir (Depends-on): Likewise.
+ * modules/fopen (Depends-on): Likewise.
+ * modules/fts (Depends-on): Likewise.
+ * modules/getcwd (Depends-on): Likewise.
+ * modules/isapipe (Depends-on): Likewise.
+ * modules/linkat (Depends-on): Likewise.
+ * modules/lseek (Depends-on): Likewise.
+ * modules/mkdir-p (Depends-on): Likewise.
+ * modules/open (Depends-on): Likewise.
+ * modules/openat (Depends-on): Likewise.
+ * modules/read-file (Depends-on): Likewise.
+ * modules/renameat (Depends-on): Likewise.
+ * modules/utimens (Depends-on): Likewise.
+
+2011-09-25 Bruno Haible <bruno@clisp.org>
+
+ linkat: Fix compilation on MSVC 9.
+ * lib/linkat.c: Don't include <stdint.h>.
+
+2011-09-25 Bruno Haible <bruno@clisp.org>
+
+ fclose: Support for MSVC 9.
+ * lib/fclose.c: Include msvc-inval.h.
+ (fclose_nothrow): New function.
+ (rpl_fclose): Use it.
+ * modules/fclose (Depends-on): Add msvc-inval.
+ * doc/posix-functions/fclose.texi: Mention the problem on MSVC.
+
+2011-09-24 Paul Eggert <eggert@cs.ucla.edu>
+
+ dup2: minor simplifications
+ * lib/dup2.c (ms_windows_dup2): Omit 'inline' as it's not clear
+ that it's a performance win.
+ (rpl_dup2): Change "if !((defined _WIN32 || defined __WIN32__) &&
+ ! defined __CYGWIN__)" to "ifdef F_GETFL".
+
+2011-09-24 Jim Meyering <meyering@redhat.com>
+
+ test-futimens: avoid a warning from gcc -Wshadow
+ * tests/test-futimens.h (test_futimens): Rename inner local, s/fd/fd0/
+ to avoid a shadowing warning.
+
+2011-09-24 Bruno Haible <bruno@clisp.org>
+
+ fdopen: Support for MSVC 9.
+ * m4/fdopen.m4 (gl_FUNC_FDOPEN): Set REPLACE_FDOPEN also if
+ HAVE_MSVC_INVALID_PARAMETER_HANDLER is 1.
+ * lib/fdopen.c: Include msvc-inval.h.
+ (fdopen_nothrow): New function.
+ (rpl_fdopen): Use it.
+ * modules/fdopen (Depends-on): Add msvc-inval.
+ * modules/fclose-tests (Depends-on): Add fdopen.
+ * modules/fflush-tests (Depends-on): Likewise.
+ * modules/fgetc-tests (Depends-on): Likewise.
+ * modules/fputc-tests (Depends-on): Likewise.
+ * modules/fread-tests (Depends-on): Likewise.
+ * modules/freopen-tests (Depends-on): Likewise.
+ * modules/fseeko-tests (Depends-on): Likewise.
+ * modules/ftello-tests (Depends-on): Likewise.
+ * modules/fwrite-tests (Depends-on): Likewise.
+ * doc/posix-functions/fdopen.texi: Mention the problem on MSVC.
+
+2011-09-24 Bruno Haible <bruno@clisp.org>
+
+ fgetc, fputc, fread, fwrite tests: Avoid compilation error on MSVC.
+ * modules/fgetc-tests (Depends-on): Add unistd.
+ * modules/fputc-tests (Depends-on): Likewise.
+ * modules/fread-tests (Depends-on): Likewise.
+ * modules/fwrite-tests (Depends-on): Likewise.
+
+2011-09-24 Bruno Haible <bruno@clisp.org>
+
+ dup: Simplify autoconf test.
+ * m4/dup.m4 (gl_FUNC_DUP): Don't run a test program. Instead, just rely
+ on gl_MSVC_INVAL's result.
+
+2011-09-24 Bruno Haible <bruno@clisp.org>
+
+ Tests for function fwrite().
+ * modules/fwrite-tests: New file.
+ * tests/test-fwrite.c: New file.
+ * modules/stdio-tests (Depends-on): Add fwrite-tests.
+
+ Tests for function fread().
+ * modules/fread-tests: New file.
+ * tests/test-fread.c: New file.
+ * modules/stdio-tests (Depends-on): Add fread-tests.
+
+ Activate fputc tests.
+ * modules/stdio-tests (Depends-on): Add fputc-tests.
+
+ Enhance fgetc, fputc tests.
+ * tests/test-fgetc.c (main): Also test the stream's error indicator.
+ * tests/test-fputc.c (main): Likewise.
+
+2011-09-24 Bruno Haible <bruno@clisp.org>
+
+ write: Support for MSVC 9.
+ * lib/unistd.in.h (write): Replace also when GNULIB_UNISTD_H_NONBLOCKING
+ is not 1.
+ * lib/write.c (write_nothrow): New function.
+ (rpl_write): Define also when GNULIB_NONBLOCKING or GNULIB_SIGPIPE is
+ not 1. Use write_nothrow.
+ * m4/write.m4 (gl_FUNC_WRITE): Replace read if the platform has an
+ invalid parameter handler.
+ (gl_PREREQ_WRITE): New macro.
+ * modules/write (Depends-on): Add msvc-inval.
+ (configure.ac): Invoke gl_PREREQ_WRITE.
+ * doc/posix-functions/write.texi: Mention the problem on MSVC.
+
+2011-09-24 Bruno Haible <bruno@clisp.org>
+
+ read: Fix last commit.
+ * lib/read.c (read_nothrow): Change return type to 'ssize_t'.
+
+2011-09-24 Bruno Haible <bruno@clisp.org>
+
+ dup2: Fix last commit.
+ * lib/dup2.c: Restore comments. Treat Cygwin like Unix.
+ (rpl_dup2): Disable fcntl workaround on native Windows.
+
+ sigprocmask: Make code safer.
+ * lib/sigprocmask.c: Move '#include "msvc-inval.h"' before the code
+ section that changes macro definitions for this compilation unit.
+
+2011-09-23 Paul Eggert <eggert@cs.ucla.edu>
+
+ dup2: clarify by coalescing Windows-specific material
+ * lib/dup2.c: Move '#include "msvc-inval.h"' and '#include
+ "msvc-nothrow.h"' to the Windows-specific section, so that the
+ Emacs source need not contain these include files.
+ (ms_windows_dup2): Rename from dup2_nothrow, and move all the
+ Windows-specific fixes into this function rather than just the
+ nothrow fix, as this shortens and clarifies the code. Always
+ define as a function, as that's a bit cleaner than having it be
+ sometimes a function and sometimes a macro.
+ (rpl_dup2): Move the Windows-specific stuff out of here and into
+ ms_windows_dup2. Don't protect the Haiku-related fix with
+ "#if !defined __linux__", as the same code also works around
+ a Linux kernel bug, and it doesn't add any system calls on any
+ platform. Add comment about FreeBSD 6.1.
+
+ sigprocmask: move #include directive
+ * lib/sigprocmask.c: Move '#include "msvc-inval.h"' to the
+ Windows-specific section, so that the Emacs source need not
+ contain msvc-inval.h.
+
+2011-09-23 Bruno Haible <bruno@clisp.org>
+
+ read: Support for MSVC 9.
+ * lib/unistd.in.h (read): Replace also when GNULIB_UNISTD_H_NONBLOCKING
+ is not 1.
+ * lib/read.c (read_nothrow): New function.
+ (rpl_read): Define also when GNULIB_NONBLOCKING is not 1. Use
+ read_nothrow.
+ * m4/read.m4 (gl_FUNC_READ): Replace read if the platform has an
+ invalid parameter handler.
+ (gl_PREREQ_READ): New macro.
+ * modules/read (Depends-on): Add msvc-inval.
+ (configure.ac): Invoke gl_PREREQ_READ.
+ * doc/posix-functions/read.texi: Mention the problem on MSVC.
+
+2011-09-23 Bruno Haible <bruno@clisp.org>
+
+ close: Support for MSVC 9.
+ * lib/close.c: Include <errno.h>, msvc-inval.h.
+ (close_nothrow): New function.
+ (rpl_close): Use it.
+ * m4/close.m4 (gl_FUNC_CLOSE): Replace close if the platform has an
+ invalid parameter handler.
+ * modules/close (Depends-on): Add msvc-inval.
+ * modules/dup2-tests (Depends-on): Add close.
+ * modules/dup3-tests (Depends-on): Likewise.
+ * modules/fcntl-tests (Depends-on): Likewise.
+ * modules/spawn-pipe-tests (Depends-on): Likewise.
+ * modules/unistd-safer-tests (Depends-on): Likewise.
+ * doc/posix-functions/close.texi: Mention the problem on MSVC.
+
+2011-09-23 Bruno Haible <bruno@clisp.org>
+
+ New module 'dup'.
+ * lib/unistd.in.h (dup): Declare only if the 'dup' module is in use.
+ Allow replacement.
+ * lib/dup.c: New file.
+ * lib/fchdir.c (rpl_dup): Remove function.
+ * m4/dup.m4: New file.
+ * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't set REPLACE_DUP here.
+ * m4/unistd_h.m4 (gl_UNISTD_H): Test whether 'dup' is declared.
+ (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_DUP.
+ * modules/unistd (Makefile.am): Substitute GNULIB_DUP.
+ * modules/dup: New file.
+ * tests/test-unistd-c++.cc: Check the signature of 'dup' only if the
+ 'dup' module is in use.
+ * modules/fdopendir (Depends-on): Add dup.
+ * modules/fdutimensat-tests (Depends-on): Likewise.
+ * modules/fts (Depends-on): Likewise.
+ * modules/futimens-tests (Depends-on): Likewise.
+ * modules/posix_spawnp-tests (Depends-on): Likewise.
+ * modules/unistd-safer-tests (Depends-on): Likewise.
+ * modules/utimens-tests (Depends-on): Likewise.
+ * doc/posix-functions/dup.texi: Mention the new module and the problem
+ on MSVC.
+
2011-09-23 Bruno Haible <bruno@clisp.org>
getdtablesize: Support for MSVC 9.