Bruno Haible [Fri, 30 Sep 2011 10:10:27 +0000 (12:10 +0200)]
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>.
Bruno Haible [Fri, 30 Sep 2011 09:54:58 +0000 (11:54 +0200)]
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.
Bruno Haible [Fri, 30 Sep 2011 01:56:26 +0000 (03:56 +0200)]
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>.
Bruno Haible [Tue, 27 Sep 2011 22:49:04 +0000 (00:49 +0200)]
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>.
Paul Eggert [Mon, 26 Sep 2011 19:58:27 +0000 (12:58 -0700)]
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.
Bruno Haible [Sun, 25 Sep 2011 21:08:45 +0000 (23:08 +0200)]
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.
Bruno Haible [Sun, 25 Sep 2011 20:02:18 +0000 (22:02 +0200)]
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().
Bruno Haible [Sun, 25 Sep 2011 19:05:20 +0000 (21:05 +0200)]
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.
Bruno Haible [Sun, 25 Sep 2011 10:10:10 +0000 (12:10 +0200)]
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.
Paul Eggert [Sun, 25 Sep 2011 05:49:14 +0000 (22:49 -0700)]
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".
Bruno Haible [Sat, 24 Sep 2011 14:46:51 +0000 (16:46 +0200)]
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.
Paul Eggert [Sat, 24 Sep 2011 05:04:20 +0000 (22:04 -0700)]
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.
Bruno Haible [Sat, 24 Sep 2011 02:07:12 +0000 (04:07 +0200)]
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.
Bruno Haible [Sat, 24 Sep 2011 00:48:19 +0000 (02:48 +0200)]
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.
Bruno Haible [Sat, 24 Sep 2011 00:08:13 +0000 (02:08 +0200)]
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.
Bruno Haible [Fri, 23 Sep 2011 23:07:22 +0000 (01:07 +0200)]
sigprocmask: Avoid crashes through signal() on MSVC 9.
* lib/sigprocmask.c: Include msvc-inval.h.
(signal_nothrow): New function.
(signal): Redefine it.
* m4/signalblocking.m4 (gl_PREREQ_SIGPROCMASK): Require AC_C_INLINE.
* modules/sigprocmask (Depends-on): Add msvc-inval.
* doc/posix-functions/signal.texi: Mention the problem on MSVC.
Bruno Haible [Fri, 23 Sep 2011 18:55:00 +0000 (20:55 +0200)]
dup2: Make code more maintainable.
* lib/dup2.c (dup2_nothrow): New function, extracted from rpl_dup2.
(rpl_dup2): Use it.
* m4/dup2.m4 (gl_PREREQ_DUP2): New macro.
* modules/dup2 (configure.ac): Invoke it.
Reported by Paul Eggert.
Bruno Haible [Thu, 22 Sep 2011 12:16:31 +0000 (14:16 +0200)]
ftruncate: Un-deprecate, concentrate on Win32 support.
* modules/ftruncate (Status, Notice): Remove sections.
(Depends-on): Add largefile.
* m4/ftruncate.m4 (gl_FUNC_FTRUNCATE): Drop failure message on
non-mingw platforms.
* lib/ftruncate.c: Remove code for the older platforms. For Win32,
include <io.h>.
* modules/perror-tests (Depends-on): Add ftruncate.
* doc/posix-functions/ftruncate.texi: Mention the MSVC problem and the
'ftruncate' module.
Bruno Haible [Tue, 20 Sep 2011 23:10:05 +0000 (01:10 +0200)]
time tests: Don't require pid_t.
* doc/posix-headers/time.texi: Revert last change.
* m4/time_h.m4 (gl_HEADER_TIME_H_BODY): Revert last change.
* tests/test-time.c: Comment out the check for pid_t.
Bruno Haible [Tue, 20 Sep 2011 21:09:06 +0000 (23:09 +0200)]
ftello tests: EBADF tests.
* tests/test-ftello4.sh: New file.
* tests/test-ftello4.c: New file.
* modules/ftello-tests (Files): Add them.
(Makefile.am): Arrange to compile test-ftello4 and run test-ftello4.sh.
Bruno Haible [Tue, 20 Sep 2011 21:07:31 +0000 (23:07 +0200)]
fseeko tests: EBADF tests.
* tests/test-fseeko4.sh: New file.
* tests/test-fseeko4.c: New file.
* modules/fseeko-tests (Files): Add them.
(Makefile.am): Arrange to compile test-fseeko4 and run test-fseeko4.sh.