]> Savannah Git Hosting - gnulib.git/commitdiff
New module 'msvc-nothrow'. Makes _get_osfhandle safe on MSVC 9.
authorBruno Haible <bruno@clisp.org>
Fri, 23 Sep 2011 19:38:44 +0000 (21:38 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 23 Sep 2011 19:38:44 +0000 (21:38 +0200)
* lib/msvc-nothrow.h: New file.
* lib/msvc-nothrow.c: New file.
* m4/msvc-nothrow.m4: New file.
* modules/msvc-nothrow: New file.
* lib/dup2.c: Include msvc-nothrow.h.
(rpl_dup2): No need to protect _get_osfhandle call here.
* lib/accept4.c: Include msvc-nothrow.h.
* lib/error.c: Likewise.
* lib/fcntl.c: Likewise.
* lib/lseek.c: Likewise.
* lib/nonblocking.c: Likewise.
* lib/poll.c: Likewise.
* lib/read.c: Likewise.
* lib/select.c: Likewise.
* lib/sockets.h: Likewise.
* lib/sockets.c: Likewise.
* lib/stdio-read.c: Likewise.
* lib/stdio-write.c: Likewise.
* lib/write.c: Likewise.
* lib/w32sock.h: Likewise.
* lib/w32spawn.h: Likewise.
* lib/flock.c: Include msvc-nothrow.h instead of <io.h>.
* lib/fsync.c: Likewise.
* lib/isapipe.c: Likewise.
* modules/dup2 (Depends-on): Add msvc-nothrow.
* modules/accept4 (Depends-on): Likewise.
* modules/error (Depends-on): Likewise.
* modules/fcntl (Depends-on): Likewise.
* modules/lseek (Depends-on): Likewise.
* modules/nonblocking (Depends-on): Likewise.
* modules/poll (Depends-on): Likewise.
* modules/read (Depends-on): Likewise.
* modules/select (Depends-on): Likewise.
* modules/sockets (Depends-on): Likewise.
* modules/sigpipe (Depends-on): Likewise.
* modules/write (Depends-on): Likewise.
* modules/accept (Depends-on): Likewise.
* modules/bind (Depends-on): Likewise.
* modules/connect (Depends-on): Likewise.
* modules/gethostname (Depends-on): Likewise.
* modules/getpeername (Depends-on): Likewise.
* modules/getsockname (Depends-on): Likewise.
* modules/getsockopt (Depends-on): Likewise.
* modules/ioctl (Depends-on): Likewise.
* modules/listen (Depends-on): Likewise.
* modules/recv (Depends-on): Likewise.
* modules/recvfrom (Depends-on): Likewise.
* modules/send (Depends-on): Likewise.
* modules/sendto (Depends-on): Likewise.
* modules/setsockopt (Depends-on): Likewise.
* modules/shutdown (Depends-on): Likewise.
* modules/socket (Depends-on): Likewise.
* modules/execute (Depends-on): Likewise.
* modules/spawn-pipe (Depends-on): Likewise.
* modules/flock (Depends-on): Likewise.
* modules/fsync (Depends-on): Likewise.
* modules/isapipe (Depends-on): Likewise.
* tests/test-cloexec.c: Include msvc-nothrow.h.
* tests/test-dup-safer.c: Likewise.
* tests/test-dup2.c: Likewise.
* tests/test-dup3.c: Likewise.
* tests/test-fcntl.c: Likewise.
* tests/test-pipe.c: Likewise.
* tests/test-pipe2.c: Likewise.
* modules/cloexec-tests (Depends-on): Add msvc-nothrow.
* modules/unistd-safer-tests (Depends-on): Likewise.
* modules/dup2-tests (Depends-on): Likewise.
* modules/dup3-tests (Depends-on): Likewise.
* modules/fcntl-tests (Depends-on): Likewise.
* modules/pipe-posix-tests (Depends-on): Likewise.
* modules/pipe2-tests (Depends-on): Likewise.

71 files changed:
ChangeLog
lib/accept4.c
lib/dup2.c
lib/error.c
lib/fcntl.c
lib/flock.c
lib/fsync.c
lib/isapipe.c
lib/lseek.c
lib/msvc-nothrow.c [new file with mode: 0644]
lib/msvc-nothrow.h [new file with mode: 0644]
lib/nonblocking.c
lib/poll.c
lib/read.c
lib/select.c
lib/sockets.c
lib/sockets.h
lib/stdio-read.c
lib/stdio-write.c
lib/w32sock.h
lib/w32spawn.h
lib/write.c
m4/msvc-nothrow.m4 [new file with mode: 0644]
modules/accept
modules/accept4
modules/bind
modules/cloexec-tests
modules/connect
modules/dup2
modules/dup2-tests
modules/dup3-tests
modules/error
modules/execute
modules/fcntl
modules/fcntl-tests
modules/flock
modules/fsync
modules/gethostname
modules/getpeername
modules/getsockname
modules/getsockopt
modules/ioctl
modules/isapipe
modules/listen
modules/lseek
modules/msvc-nothrow [new file with mode: 0644]
modules/nonblocking
modules/pipe-posix-tests
modules/pipe2-tests
modules/poll
modules/read
modules/recv
modules/recvfrom
modules/select
modules/send
modules/sendto
modules/setsockopt
modules/shutdown
modules/sigpipe
modules/socket
modules/sockets
modules/spawn-pipe
modules/unistd-safer-tests
modules/write
tests/test-cloexec.c
tests/test-dup-safer.c
tests/test-dup2.c
tests/test-dup3.c
tests/test-fcntl.c
tests/test-pipe.c
tests/test-pipe2.c

index 74677b0a36a1aaeb357e60c1f51ef4e1114d9c80..f6d7f09fb7d2adbb2b85e8a39985affbfbbffd7c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,78 @@
+2011-09-23  Bruno Haible  <bruno@clisp.org>
+
+       New module 'msvc-nothrow'. Makes _get_osfhandle safe on MSVC 9.
+       * lib/msvc-nothrow.h: New file.
+       * lib/msvc-nothrow.c: New file.
+       * m4/msvc-nothrow.m4: New file.
+       * modules/msvc-nothrow: New file.
+       * lib/dup2.c: Include msvc-nothrow.h.
+       (rpl_dup2): No need to protect _get_osfhandle call here.
+       * lib/accept4.c: Include msvc-nothrow.h.
+       * lib/error.c: Likewise.
+       * lib/fcntl.c: Likewise.
+       * lib/lseek.c: Likewise.
+       * lib/nonblocking.c: Likewise.
+       * lib/poll.c: Likewise.
+       * lib/read.c: Likewise.
+       * lib/select.c: Likewise.
+       * lib/sockets.h: Likewise.
+       * lib/sockets.c: Likewise.
+       * lib/stdio-read.c: Likewise.
+       * lib/stdio-write.c: Likewise.
+       * lib/write.c: Likewise.
+       * lib/w32sock.h: Likewise.
+       * lib/w32spawn.h: Likewise.
+       * lib/flock.c: Include msvc-nothrow.h instead of <io.h>.
+       * lib/fsync.c: Likewise.
+       * lib/isapipe.c: Likewise.
+       * modules/dup2 (Depends-on): Add msvc-nothrow.
+       * modules/accept4 (Depends-on): Likewise.
+       * modules/error (Depends-on): Likewise.
+       * modules/fcntl (Depends-on): Likewise.
+       * modules/lseek (Depends-on): Likewise.
+       * modules/nonblocking (Depends-on): Likewise.
+       * modules/poll (Depends-on): Likewise.
+       * modules/read (Depends-on): Likewise.
+       * modules/select (Depends-on): Likewise.
+       * modules/sockets (Depends-on): Likewise.
+       * modules/sigpipe (Depends-on): Likewise.
+       * modules/write (Depends-on): Likewise.
+       * modules/accept (Depends-on): Likewise.
+       * modules/bind (Depends-on): Likewise.
+       * modules/connect (Depends-on): Likewise.
+       * modules/gethostname (Depends-on): Likewise.
+       * modules/getpeername (Depends-on): Likewise.
+       * modules/getsockname (Depends-on): Likewise.
+       * modules/getsockopt (Depends-on): Likewise.
+       * modules/ioctl (Depends-on): Likewise.
+       * modules/listen (Depends-on): Likewise.
+       * modules/recv (Depends-on): Likewise.
+       * modules/recvfrom (Depends-on): Likewise.
+       * modules/send (Depends-on): Likewise.
+       * modules/sendto (Depends-on): Likewise.
+       * modules/setsockopt (Depends-on): Likewise.
+       * modules/shutdown (Depends-on): Likewise.
+       * modules/socket (Depends-on): Likewise.
+       * modules/execute (Depends-on): Likewise.
+       * modules/spawn-pipe (Depends-on): Likewise.
+       * modules/flock (Depends-on): Likewise.
+       * modules/fsync (Depends-on): Likewise.
+       * modules/isapipe (Depends-on): Likewise.
+       * tests/test-cloexec.c: Include msvc-nothrow.h.
+       * tests/test-dup-safer.c: Likewise.
+       * tests/test-dup2.c: Likewise.
+       * tests/test-dup3.c: Likewise.
+       * tests/test-fcntl.c: Likewise.
+       * tests/test-pipe.c: Likewise.
+       * tests/test-pipe2.c: Likewise.
+       * modules/cloexec-tests (Depends-on): Add msvc-nothrow.
+       * modules/unistd-safer-tests (Depends-on): Likewise.
+       * modules/dup2-tests (Depends-on): Likewise.
+       * modules/dup3-tests (Depends-on): Likewise.
+       * modules/fcntl-tests (Depends-on): Likewise.
+       * modules/pipe-posix-tests (Depends-on): Likewise.
+       * modules/pipe2-tests (Depends-on): Likewise.
+
 2011-09-23  Bruno Haible  <bruno@clisp.org>
 
        dup2: Make code more maintainable.
index 1e7e7f4521db224e1d0ec36a3b6aa6be12facd33..4e1ef1a538f4fe3c0abe98c2ffc8fefb58499b5a 100644 (file)
@@ -23,6 +23,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include "binary-io.h"
+#include "msvc-nothrow.h"
 
 #ifndef SOCK_CLOEXEC
 # define SOCK_CLOEXEC 0
index b8798f3f0ac6e709cae557c965aac25af35f6d92..e2a44734e47508a30416f390401f99db8500b87e 100644 (file)
@@ -29,6 +29,8 @@
 /* Get declarations of the Win32 API functions.  */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
+/* Get _get_osfhandle.  */
+# include "msvc-nothrow.h"
 #endif
 
 #include "msvc-inval.h"
@@ -70,19 +72,7 @@ rpl_dup2 (int fd, int desired_fd)
      future dup2 calls will hang.  */
   if (fd == desired_fd)
     {
-      HANDLE handle;
-
-      TRY_MSVC_INVAL
-        {
-          handle = (HANDLE) _get_osfhandle (fd);
-        }
-      CATCH_MSVC_INVAL
-        {
-          handle = INVALID_HANDLE_VALUE;
-        }
-      DONE_MSVC_INVAL;
-
-      if (handle == INVALID_HANDLE_VALUE)
+      if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE)
         {
           errno = EBADF;
           return -1;
index 7482baacfbd4ca7258570cc3dee0383ee94af7b6..5ebe8bff223391eb0d0078898d17fb589b9dec8f 100644 (file)
@@ -92,6 +92,8 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
 /* Get declarations of the Win32 API functions.  */
 #  define WIN32_LEAN_AND_MEAN
 #  include <windows.h>
+/* Get _get_osfhandle.  */
+#  include "msvc-nothrow.h"
 # endif
 
 /* The gnulib override of fcntl is not needed in this file.  */
index d6a328c1c01b409f667a6b020a79404ffdd81b55..92e32eebb982101916c1d4b9a413c92306506f42 100644 (file)
@@ -37,6 +37,9 @@
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 
+/* Get _get_osfhandle.  */
+# include "msvc-nothrow.h"
+
 /* Upper bound on getdtablesize().  See lib/getdtablesize.c.  */
 # define OPEN_MAX_MAX 0x10000
 
index 8f018e50c97253139749f7a79db8e5c9281a1993..439ff434ad846898d1ee762758912308547aacea 100644 (file)
 
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
-/* _get_osfhandle */
-# include <io.h>
-
 /* LockFileEx */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 
 # include <errno.h>
 
+/* _get_osfhandle */
+# include "msvc-nothrow.h"
+
 /* Determine the current size of a file.  Because the other braindead
  * APIs we'll call need lower/upper 32 bit pairs, keep the file size
  * like that too.
index f0fc8e5d38b950a698d9cb7201fee863f39ce5df..325f2167f40cd9c242cb6eea1281ad3a02bf5c83 100644 (file)
 
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
-/* _get_osfhandle */
-# include <io.h>
-
 /* FlushFileBuffers */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 
 # include <errno.h>
 
+/* Get _get_osfhandle.  */
+# include "msvc-nothrow.h"
+
 int
 fsync (int fd)
 {
index a5349b116f4c3ceed16df0b63a2635517bbcfaa5..f6e16d16fe48e9ec25125bd0e167f0a40c6ba5f9 100644 (file)
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 /* Windows platforms.  */
 
-/* Get _get_osfhandle.  */
-# include <io.h>
-
 /* Get GetFileType.  */
 # include <windows.h>
 
+/* Get _get_osfhandle.  */
+# include "msvc-nothrow.h"
+
 int
 isapipe (int fd)
 {
index e6c21369d39aed68f04127b539d87953b930ab88..134e8b7d947f58bf26cdc96828f4427c056bd552 100644 (file)
@@ -24,6 +24,8 @@
 /* Windows platforms.  */
 /* Get GetFileType.  */
 # include <windows.h>
+/* Get _get_osfhandle.  */
+# include "msvc-nothrow.h"
 #else
 # include <sys/stat.h>
 #endif
diff --git a/lib/msvc-nothrow.c b/lib/msvc-nothrow.c
new file mode 100644 (file)
index 0000000..db72631
--- /dev/null
@@ -0,0 +1,50 @@
+/* Wrappers that don't throw invalid parameter notifications
+   with MSVC runtime libraries.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "msvc-nothrow.h"
+
+/* Get declarations of the Win32 API functions.  */
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#include "msvc-inval.h"
+
+#undef _get_osfhandle
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+intptr_t
+_gl_nothrow_get_osfhandle (int fd)
+{
+  intptr_t result;
+
+  TRY_MSVC_INVAL
+    {
+      result = _get_osfhandle (fd);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = INVALID_HANDLE_VALUE;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+#endif
diff --git a/lib/msvc-nothrow.h b/lib/msvc-nothrow.h
new file mode 100644 (file)
index 0000000..1ec2888
--- /dev/null
@@ -0,0 +1,44 @@
+/* Wrappers that don't throw invalid parameter notifications
+   with MSVC runtime libraries.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef _MSVC_NOTHROW_H
+#define _MSVC_NOTHROW_H
+
+/* With MSVC runtime libraries with the "invalid parameter handler" concept,
+   functions like fprintf(), dup2(), or close() crash when the caller passes
+   an invalid argument.  But POSIX wants error codes (such as EINVAL or EBADF)
+   instead.
+   This file defines wrappers that turn such an invalid parameter notification
+   into an error code.  */
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+/* Get original declaration of _get_osfhandle.  */
+# include <io.h>
+
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+
+/* Override _get_osfhandle.  */
+extern intptr_t _gl_nothrow_get_osfhandle (int fd);
+#  define _get_osfhandle _gl_nothrow_get_osfhandle
+
+# endif
+
+#endif
+
+#endif /* _MSVC_NOTHROW_H */
index 9f7bce916f2762f8b54a4ee2a4e67ecddb1af993..c356f36217eaebd2aa921b7531398f7d16596514 100644 (file)
@@ -32,6 +32,8 @@
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 
+# include "msvc-nothrow.h"
+
 int
 get_nonblocking_flag (int desc)
 {
index e06456581b5d8163e320b56e55195182e5ad9bc7..b012ba0350ae94a08d27fbeadf99e73bbb49f541 100644 (file)
@@ -43,6 +43,7 @@
 # include <io.h>
 # include <stdio.h>
 # include <conio.h>
+# include "msvc-nothrow.h"
 #else
 # include <sys/time.h>
 # include <sys/socket.h>
index 21b90db67519f3830038a5cbc9acbe9224f49b71..61675af0ddbfeb9e3a6a7aa62129e5aef4f72617 100644 (file)
@@ -31,6 +31,8 @@
 #  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
 #  include <windows.h>
 
+#  include "msvc-nothrow.h"
+
 ssize_t
 rpl_read (int fd, void *buf, size_t count)
 #undef read
index 4848859c23985aead519072473fcb3a467697c14..aee0ac2cdba2ecfb4c884724a44b3d77c9631543 100644 (file)
@@ -37,6 +37,8 @@
 #include <conio.h>
 #include <time.h>
 
+#include "msvc-nothrow.h"
+
 struct bitset {
   unsigned char in[FD_SETSIZE / CHAR_BIT];
   unsigned char out[FD_SETSIZE / CHAR_BIT];
index 53cb66e4681ee1f3906ce346a415a72a2f4f9c98..39939b0a3eb10516dc9ec36bfae736cc03043db9 100644 (file)
@@ -28,6 +28,7 @@
 # include <sys/socket.h>
 
 # include "fd-hook.h"
+# include "msvc-nothrow.h"
 
 /* Get set_winsock_errno, FD_TO_SOCKET etc. */
 # include "w32sock.h"
index 93ae5d28004aaea3732f4b9bd55a1ece575a4268..323f68cd12c99d9cf4d48a53140540f6e0d04b72 100644 (file)
@@ -36,6 +36,8 @@ int gl_sockets_cleanup (void);
 
 #include <sys/socket.h>
 
+#include "msvc-nothrow.h"
+
 static inline SOCKET
 gl_fd_to_handle (int fd)
 {
index d7901dd676fb757a81da595719573f7a7a4a7ff9..86b1d616db29371951ee52359cb9654d8dfc5d60 100644 (file)
@@ -37,6 +37,8 @@
 #  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
 #  include <windows.h>
 
+#  include "msvc-nothrow.h"
+
 #  define CALL_WITH_ERRNO_FIX(RETTYPE, EXPRESSION, FAILED) \
   if (ferror (stream))                                                        \
     return (EXPRESSION);                                                      \
index a586c35120fb6acaa1edb6aad14f7d1b7ee1e50f..02aed456fb66a164e270930523b37b351f8a8377 100644 (file)
@@ -39,6 +39,8 @@
 #  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
 #  include <windows.h>
 
+#  include "msvc-nothrow.h"
+
 #  if GNULIB_NONBLOCKING
 #   define CLEAR_ERRNO \
       errno = 0;
index 651a76df6cf3653a8d783201438d5737cb25c8f2..55280d6497a6b3224e3de2fae47ad5075b75a201 100644 (file)
 /* Get O_RDWR and O_BINARY.  */
 #include <fcntl.h>
 
-/* Get _get_osfhandle() and _open_osfhandle().  */
+/* Get _open_osfhandle().  */
 #include <io.h>
 
+/* Get _get_osfhandle().  */
+#include "msvc-nothrow.h"
+
 #define FD_TO_SOCKET(fd)   ((SOCKET) _get_osfhandle ((fd)))
 #define SOCKET_TO_FD(fh)   (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY))
 
index 58b0392c42b572b63ccf6f0c9dcdfa65b2f71471..166737032eb4a02aac65e84e9be24499c63e2ec5 100644 (file)
@@ -19,7 +19,7 @@
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
-/* Get _get_osfhandle() and _open_osfhandle().  */
+/* Get _open_osfhandle().  */
 #include <io.h>
 
 #include <stdbool.h>
@@ -27,6 +27,9 @@
 #include <unistd.h>
 #include <errno.h>
 
+/* Get _get_osfhandle().  */
+#include "msvc-nothrow.h"
+
 #include "cloexec.h"
 #include "xalloc.h"
 
index b0ffa94e93145c9929b630b59e0de40f016fcc64..64bc5352ebe02ebda03dbe678004975b510bff68 100644 (file)
@@ -38,6 +38,8 @@
 #  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
 #  include <windows.h>
 
+#  include "msvc-nothrow.h"
+
 ssize_t
 rpl_write (int fd, const void *buf, size_t count)
 #undef write
diff --git a/m4/msvc-nothrow.m4 b/m4/msvc-nothrow.m4
new file mode 100644 (file)
index 0000000..b2f6bb4
--- /dev/null
@@ -0,0 +1,10 @@
+# msvc-nothrow.m4 serial 1
+dnl Copyright (C) 2011 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_DEFUN([gl_MSVC_NOTHROW],
+[
+  AC_REQUIRE([gl_MSVC_INVAL])
+])
index 6421e92d5e074ea0d5fd83f4a46a110c63d796e4..059a56d29945ddc42996ae7be09e686144311c6e 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
+msvc-nothrow    [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index e6b9994152f40698e95045021eef112aa6bced12..e9319763cb431458b041784b040733a8ff3f9cfb 100644 (file)
@@ -12,6 +12,7 @@ accept
 fcntl-h
 binary-io
 extensions
+msvc-nothrow
 
 configure.ac:
 gl_FUNC_ACCEPT4
index dd211d45a1e927dc5129c5dbdfb2c7e1786cd37f..e46bd267a7cbb907c8cf092068f7a27316efbc36 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
+msvc-nothrow    [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 3a76b9e9a3fc3257fe8f56a9784b8251c9fcf671..524716c92eeee9f4eaee6a88a08cbf7603939409 100644 (file)
@@ -4,6 +4,7 @@ tests/macros.h
 
 Depends-on:
 binary-io
+msvc-nothrow
 
 configure.ac:
 
index d5958434e238dcca81dafb2c1e7254d3c71a2417..c77632ca619eb14f6c4f29cee243585e69caec45 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
+msvc-nothrow    [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 2317db3cdf74ca05289e4a79ee5e87564f1e4aa2..2ad65d1dc11b63dc249ea689280722f9bec7b82c 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 unistd
 dup2-obsolete
 msvc-inval      [test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1]
+msvc-nothrow    [test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1]
 
 configure.ac:
 gl_FUNC_DUP2
index a973fd75e53d482de621615cfe4d03dc30f6f19a..8277e3b170c47bbbe9961a41ed12d75244328c60 100644 (file)
@@ -5,6 +5,7 @@ tests/macros.h
 
 Depends-on:
 binary-io
+msvc-nothrow
 open
 
 configure.ac:
index 26dd5d89aa63eb229584ba28b1a96f11eefe9226..02f422e845f206e0f029a300289622e6b19f67a0 100644 (file)
@@ -4,6 +4,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+msvc-nothrow
 open
 
 configure.ac:
index ae12b45ad4ebb48e18bfa00065a0897ceba6f3a7..f8676176b1d0bf397df2fac1e13923afd40410ef 100644 (file)
@@ -14,6 +14,7 @@ m4/error.m4
 Depends-on:
 strerror        [test $ac_cv_lib_error_at_line = no]
 unistd          [test $ac_cv_lib_error_at_line = no]
+msvc-nothrow    [test $ac_cv_lib_error_at_line = no]
 
 configure.ac:
 gl_ERROR
index a65696bb53466981584d6ce5d7112c2b98e59b69..f4584ab1a981b76852e3c64069ff7998299e2525 100644 (file)
@@ -14,6 +14,7 @@ error
 fatal-signal
 wait-process
 gettext-h
+msvc-nothrow
 spawn
 posix_spawnp
 posix_spawn_file_actions_init
index 4c30e9e4ab214304c3a664492443a5b2ddb9bd92..ab7c8ad6b9896ebb11e04feed5523fc490dc052b 100644 (file)
@@ -10,6 +10,7 @@ fcntl-h
 extensions
 dup2            [test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1]
 getdtablesize   [test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1]
+msvc-nothrow    [test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1]
 
 configure.ac:
 gl_FUNC_FCNTL
index 44b040c2514d9de78a16a42c352ce8707b8cd1d8..72705801e536a3d9b1c6c8bbbbe4efa51396b341 100644 (file)
@@ -6,6 +6,7 @@ tests/macros.h
 Depends-on:
 binary-io
 getdtablesize
+msvc-nothrow
 stdbool
 
 configure.ac:
index 56ef9b26457404a20c00a4662d4f3c56b70430e4..73d27c622183bfce55661114ab75d838542e3782 100644 (file)
@@ -7,6 +7,7 @@ m4/flock.m4
 
 Depends-on:
 sys_file
+msvc-nothrow    [test $HAVE_FLOCK = 0]
 
 configure.ac:
 gl_FUNC_FLOCK
index 0f5b3fc793cfca1536645eb6987e9a62eef6e5ee..660eb59bc00955b92d779a298e69289a97d16b5b 100644 (file)
@@ -7,6 +7,7 @@ m4/fsync.m4
 
 Depends-on:
 unistd
+msvc-nothrow    [test $HAVE_FSYNC = 0]
 
 configure.ac:
 gl_FUNC_FSYNC
index 42ee838e0914a6fa52a74f4bd63317aa87906b37..b41dfad9a747dc4cb60fab30e716caf8e0d09e16 100644 (file)
@@ -11,6 +11,7 @@ unistd
 sys_socket      [test $HAVE_GETHOSTNAME = 0]
 errno           [test $HAVE_GETHOSTNAME = 0]
 sockets         [test $HAVE_GETHOSTNAME = 0]
+msvc-nothrow    [test $HAVE_GETHOSTNAME = 0]
 
 configure.ac:
 gl_FUNC_GETHOSTNAME
index b7f04ee28f27f1a92a1b9df88fa96244c53e897c..d1ef822724c0324f40b52773a949cc3bb82aa221 100644 (file)
@@ -10,6 +10,7 @@ Depends-on:
 sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
+msvc-nothrow    [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 033c170820869c984d41ab131a74474165e87f36..15cf490ca791b2910613cd925686a72e65cdec2a 100644 (file)
@@ -10,6 +10,7 @@ Depends-on:
 sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
+msvc-nothrow    [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index d13e064edbf567ae2e445afe3c38933d2f9f95f2..1cd1f2e12bbb5ff9aa9ddc5fe51a57663b486471 100644 (file)
@@ -10,6 +10,7 @@ sys_socket
 socketlib
 sys_time        [test "$ac_cv_header_winsock2_h" = yes]
 errno           [test "$ac_cv_header_winsock2_h" = yes]
+msvc-nothrow    [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 9842a53f97bcfbb29f6bbfc1a0dbf8ee3e9a2610..ba4a85a32e8833f5f5898ee3b4eb4b43c6aae452 100644 (file)
@@ -11,6 +11,7 @@ sys_ioctl
 sys_socket      [test $HAVE_IOCTL = 0 || test $REPLACE_IOCTL = 1]
 errno           [test $HAVE_IOCTL = 0 || test $REPLACE_IOCTL = 1]
 fd-hook         [test $HAVE_IOCTL = 0 || test $REPLACE_IOCTL = 1]
+msvc-nothrow    [test $HAVE_IOCTL = 0 || test $REPLACE_IOCTL = 1]
 
 configure.ac:
 gl_FUNC_IOCTL
index cc62ea8ce71a20aa22e857335e17b942b6836928..945df3ed8a3b19e9b66aec47c1b55e82baa0513d 100644 (file)
@@ -10,6 +10,7 @@ Depends-on:
 stdbool         [test $HAVE_ISAPIPE = 0]
 sys_stat        [test $HAVE_ISAPIPE = 0]
 unistd          [test $HAVE_ISAPIPE = 0]
+msvc-nothrow    [test $HAVE_ISAPIPE = 0]
 
 configure.ac:
 gl_ISAPIPE
index 8aff376c32100478dc3617f020b9e0a6e3111b0b..baaadc21ade2c0cbc6e799831205f4fab52a7ef5 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
+msvc-nothrow    [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 0fc7923f6576d11d2981b2b468e7818919b65a06..c43027354c68d24a87c99592c41d7c498278a6fe 100644 (file)
@@ -8,6 +8,7 @@ m4/lseek.m4
 Depends-on:
 unistd
 largefile
+msvc-nothrow    [test $REPLACE_LSEEK = 1]
 
 configure.ac:
 gl_FUNC_LSEEK
diff --git a/modules/msvc-nothrow b/modules/msvc-nothrow
new file mode 100644 (file)
index 0000000..46d71aa
--- /dev/null
@@ -0,0 +1,28 @@
+Description:
+wrappers that don't throw invalid parameter notifications with MSVC runtime
+libraries
+
+Files:
+lib/msvc-nothrow.h
+lib/msvc-nothrow.c
+m4/msvc-nothrow.m4
+
+Depends-on:
+msvc-inval
+
+configure.ac:
+gl_MSVC_NOTHROW
+if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+  AC_LIBOBJ([msvc-nothrow])
+fi
+
+Makefile.am:
+
+Include:
+"msvc-nothrow.h"
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
index 2d469ebaa47672ceae5f7b0b5436282c8e4a582d..96881f5b585605175ffc02232dbafc80bed48cb7 100644 (file)
@@ -12,6 +12,7 @@ m4/asm-underscore.m4
 Depends-on:
 fcntl-h
 ioctl
+msvc-nothrow
 stdbool
 stdio
 sys_socket
index 7afafdc504cfb3852d9f813642a866d4ec46d2a2..3f428a061388b0bc64bcf85baa91a0bb43dc7126 100644 (file)
@@ -6,6 +6,7 @@ tests/macros.h
 Depends-on:
 stdbool
 binary-io
+msvc-nothrow
 
 configure.ac:
 
index 2e6c3f78a76c4c3d2c94bc5845a97a7c9b0c997c..74f9d5f3e338e05178a9be9df32a2c688c0c5c97 100644 (file)
@@ -5,6 +5,7 @@ tests/macros.h
 
 Depends-on:
 stdbool
+msvc-nothrow
 
 configure.ac:
 
index f1f22bfd814efc5520f08130ab9f7f08a7098206..37143320ea32ce3d5322d77d54344299e2b627d3 100644 (file)
@@ -12,6 +12,7 @@ select          [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
 sys_select      [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
 sys_time        [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
 errno           [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
+msvc-nothrow    [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
 
 configure.ac:
 gl_FUNC_POLL
index 12d97c75fb2976c7e879f948f05c5d5a2b3447a5..d72595583735f6695eb408a5b2e10ac9a9267871 100644 (file)
@@ -7,6 +7,7 @@ m4/read.m4
 
 Depends-on:
 unistd
+msvc-nothrow    [test $REPLACE_READ = 1]
 
 configure.ac:
 gl_FUNC_READ
index 731717bc3af5b170bb9e54e876b42f04528f1b0f..b47d8f532f54c957e8144388081231851c46d689 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
+msvc-nothrow    [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index c4749ae45dc5b4d1a97a42c29b76d5ff5e198ae7..2b051b461dfc846243501d483823fb7640df8d42 100644 (file)
@@ -10,6 +10,7 @@ sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
 getpeername     [test "$ac_cv_header_winsock2_h" = yes]
+msvc-nothrow    [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index f665740b0319fdd1fec64099b06ed31537c1b08c..7b25a8bc9cba8613429eea4172d7780385b2a8a1 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 sys_select
 alloca          [test $REPLACE_SELECT = 1]
 sockets         [test $REPLACE_SELECT = 1]
+msvc-nothrow    [test $REPLACE_SELECT = 1]
 
 configure.ac:
 gl_FUNC_SELECT
index 18d6c0d14f0a11b50adf12de4f165337d418edc8..5e115c3f85565ca9c6403cf4aaa5b2833d287af2 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
+msvc-nothrow    [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 847699de42868396388e7e7ab7efaba366241ff8..924818e313ea66f681ddd6f92280dfcbb440170a 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
+msvc-nothrow    [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 0b4ae49550e84a378d828ff387c390d4f3f85de8..bfe8acdae9dcad3f09e6bcacc43038c95f3c0de8 100644 (file)
@@ -10,6 +10,7 @@ sys_socket
 socketlib
 sys_time        [test "$ac_cv_header_winsock2_h" = yes]
 errno           [test "$ac_cv_header_winsock2_h" = yes]
+msvc-nothrow    [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 7c76ba5319d0d78345adb6bc3c22b32ab0300ea0..32845dbc871382988171c361652989ee17a2237a 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
+msvc-nothrow    [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 4f03c9e14aaf6b3d93c1279cd803b77155b7e9f3..d28a562afe6ba639132211bcbbc8814156508ce9 100644 (file)
@@ -12,6 +12,7 @@ lib/stdio-write.c
 m4/asm-underscore.m4
 
 Depends-on:
+msvc-nothrow
 raise
 signal
 sigprocmask
index 6a056e423c4dbab63c42b8222615cc8703a56c3c..49625494ab13927b741f512f9fdc496139105777 100644 (file)
@@ -10,6 +10,7 @@ sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
 sockets         [test "$ac_cv_header_winsock2_h" = yes]
+msvc-nothrow    [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index fe9292631cca6171de7a869f32c74bfefa7fea32..b6dffabc1de799925f24deec280216c1ac5af134 100644 (file)
@@ -11,6 +11,7 @@ Depends-on:
 socketlib
 sys_socket
 fd-hook
+msvc-nothrow
 
 configure.ac:
 gl_SOCKETS
index 9898b37598f87c69192309e8ddaf5603bec77645..bcb0c9d25357de58abb84b08b0edcd1d7fb03845 100644 (file)
@@ -14,6 +14,7 @@ environ
 error
 fatal-signal
 gettext-h
+msvc-nothrow
 open
 pipe2
 pipe2-safer
index cc4b97ab3b4d1f42c41558c6f95934af4a441a0f..d8519a6562eb6d34ba05c84f9144a8b7aea7a128 100644 (file)
@@ -6,6 +6,7 @@ Depends-on:
 binary-io
 cloexec
 fd-safer-flag
+msvc-nothrow
 stdbool
 
 configure.ac:
index d60b5a7f678307a15706465c3207421c7dc4f768..c19f73b7eda08fbc04f3e442dc2712d83453f541 100644 (file)
@@ -8,6 +8,7 @@ m4/write.m4
 Depends-on:
 unistd
 raise           [test $REPLACE_WRITE = 1]
+msvc-nothrow    [test $REPLACE_WRITE = 1]
 
 configure.ac:
 gl_FUNC_WRITE
index 374de3038672af3ca72599558dff97bc4f41cabf..c1473d515d27cd288e8a39e5ed2fea0653fde49b 100644 (file)
@@ -28,6 +28,8 @@
 /* Get declarations of the Win32 API functions.  */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
+/* Get _get_osfhandle.  */
+# include "msvc-nothrow.h"
 #endif
 
 #include "binary-io.h"
index 14cfafffeaf0794ec67d39fbe9a3cd2e75a4b5df..5cb45f5fd4fb70b3f8fac70fc93a092261741891 100644 (file)
@@ -32,6 +32,8 @@
 /* Get declarations of the Win32 API functions.  */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
+/* Get _get_osfhandle.  */
+# include "msvc-nothrow.h"
 #endif
 
 #if !O_BINARY
index 37454e965cab9f8c5cc041d21ee8761d3467415c..a14807a36ee660061877ee97f5d6965efd86f23e 100644 (file)
@@ -36,6 +36,8 @@ SIGNATURE_CHECK (dup2, int, (int, int));
 /* Get declarations of the Win32 API functions.  */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
+/* Get _get_osfhandle.  */
+# include "msvc-nothrow.h"
 #endif
 
 #include "macros.h"
index ed3a88f41b4fbdbbe0168db6f00402255402fb54..033193df6201fd7e7f88652c1f22325fa234296c 100644 (file)
@@ -32,6 +32,8 @@ SIGNATURE_CHECK (dup3, int, (int, int, int));
 /* Get declarations of the Win32 API functions.  */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
+/* Get _get_osfhandle.  */
+# include "msvc-nothrow.h"
 #endif
 
 #include "binary-io.h"
index 59b00771904155365bf541761cecbff29d5643fa..c6066ead1967a6707bcabdcb017256ff040f7a8b 100644 (file)
@@ -34,6 +34,8 @@ SIGNATURE_CHECK (fcntl, int, (int, int, ...));
 /* Get declarations of the Win32 API functions.  */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
+/* Get _get_osfhandle.  */
+# include "msvc-nothrow.h"
 #endif
 
 #include "binary-io.h"
index 5302c3ececc7f169a5a721ae0ce97033b40fbf01..90f41f9107ed801152ae070abf2a346eb05b6774 100644 (file)
@@ -29,6 +29,8 @@ SIGNATURE_CHECK (pipe, int, (int[2]));
 /* Get declarations of the Win32 API functions.  */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
+/* Get _get_osfhandle.  */
+# include "msvc-nothrow.h"
 #endif
 
 #include "binary-io.h"
index d83162c2f5868b99260215bfa2041833ff5f5197..c278f7aaff9d7fe8756c7427d905710f09076b00 100644 (file)
@@ -29,6 +29,8 @@ SIGNATURE_CHECK (pipe2, int, (int[2], int));
 /* Get declarations of the Win32 API functions.  */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
+/* Get _get_osfhandle.  */
+# include "msvc-nothrow.h"
 #endif
 
 #include "binary-io.h"