]> Savannah Git Hosting - gnulib.git/commitdiff
Implement a way to opt out from MSVC support.
authorBruno Haible <bruno@clisp.org>
Wed, 10 May 2017 19:52:21 +0000 (21:52 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 10 May 2017 20:18:34 +0000 (22:18 +0200)
This is useful for Emacs.

* modules/msvc-nothrow (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/accept4.c: Include <io.h> as an alternative to msvc-nothrow.h.
* lib/error.c: Likewise.
* lib/fcntl.c: Likewise.
* lib/flock.c: Likewise.
* lib/fstat.c: Likewise.
* lib/fsync.c: Likewise.
* lib/ioctl.c: Likewise.
* lib/isapipe.c: Likewise.
* lib/lseek.c: Likewise.
* lib/nonblocking.c: Likewise.
* lib/poll.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/utimens.c: Likewise.
* lib/w32sock.h: Likewise.
* lib/w32spawn.h: Likewise.
* tests/test-cloexec.c: Likewise.
* 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.
* lib/ftruncate.c: Likewise.
(chsize_nothrow): Renamed from chsize.
* lib/msvc-nothrow.c: Don't include msvc-inval.h if
HAVE_MSVC_INVALID_PARAMETER_HANDLER is not defined.
* lib/close.c: Likewise.
* lib/dup.c: Likewise.
* lib/fclose.c: Likewise.
* lib/raise.c: Likewise.
* tests/test-fgetc.c: Likewise.
* tests/test-fputc.c: Likewise.
* tests/test-fread.c: Likewise.
* tests/test-fwrite.c: Likewise.
* lib/getdtablesize.c: Likewise.
(_setmaxstdio_nothrow): Renamed from _setmaxstdio.
* lib/isatty.c: Don't include msvc-inval.h if
HAVE_MSVC_INVALID_PARAMETER_HANDLER is not defined.
Include <io.h> as an alternative to msvc-nothrow.h.
* lib/read.c: Likewise.
* lib/write.c: Likewise.
* lib/dup2.c: Likewise.
(dup2_nothrow): New function.
(ms_windows_dup2): Use it.
* m4/close.m4 (gl_FUNC_CLOSE): Invoke gl_MSVC_INVAL and test
HAVE_MSVC_INVALID_PARAMETER_HANDLER only if gl_MSVC_INVAL is defined.
* m4/dup.m4 (gl_FUNC_DUP): Likewise.
* m4/fdopen.m4 (gl_FUNC_FDOPEN): Likewise.
* m4/raise.m4 (gl_FUNC_RAISE): Likewise.
* m4/read.m4 (gl_FUNC_READ): Likewise.
* m4/write.m4 (gl_FUNC_WRITE): Likewise.
* doc/windows-without-msvc.texi: New file.
* doc/gnulib.texi (Native Windows Support without MSVC Support): New
section.

51 files changed:
ChangeLog
doc/gnulib.texi
doc/windows-without-msvc.texi [new file with mode: 0644]
lib/accept4.c
lib/close.c
lib/dup.c
lib/dup2.c
lib/error.c
lib/fclose.c
lib/fcntl.c
lib/flock.c
lib/fstat.c
lib/fsync.c
lib/ftruncate.c
lib/getdtablesize.c
lib/ioctl.c
lib/isapipe.c
lib/isatty.c
lib/lseek.c
lib/msvc-nothrow.c
lib/nonblocking.c
lib/poll.c
lib/raise.c
lib/read.c
lib/select.c
lib/sockets.c
lib/sockets.h
lib/stdio-read.c
lib/stdio-write.c
lib/utimens.c
lib/w32sock.h
lib/w32spawn.h
lib/write.c
m4/close.m4
m4/dup.m4
m4/fdopen.m4
m4/raise.m4
m4/read.m4
m4/write.m4
modules/msvc-nothrow
tests/test-cloexec.c
tests/test-dup-safer.c
tests/test-dup2.c
tests/test-dup3.c
tests/test-fcntl.c
tests/test-fgetc.c
tests/test-fputc.c
tests/test-fread.c
tests/test-fwrite.c
tests/test-pipe.c
tests/test-pipe2.c

index 1807004a2958107f8d7864663dada64ad4a0b89a..35cd42058f4cee2b166278aeaf06aafc38983928 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,67 @@
+2017-05-10 Bruno Haible  <bruno@clisp.org>
+
+       Implement a way to opt out from MSVC support.
+       This is useful for Emacs.
+       * modules/msvc-nothrow (configure.ac): Invoke gl_MODULE_INDICATOR.
+       * lib/accept4.c: Include <io.h> as an alternative to msvc-nothrow.h.
+       * lib/error.c: Likewise.
+       * lib/fcntl.c: Likewise.
+       * lib/flock.c: Likewise.
+       * lib/fstat.c: Likewise.
+       * lib/fsync.c: Likewise.
+       * lib/ioctl.c: Likewise.
+       * lib/isapipe.c: Likewise.
+       * lib/lseek.c: Likewise.
+       * lib/nonblocking.c: Likewise.
+       * lib/poll.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/utimens.c: Likewise.
+       * lib/w32sock.h: Likewise.
+       * lib/w32spawn.h: Likewise.
+       * tests/test-cloexec.c: Likewise.
+       * 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.
+       * lib/ftruncate.c: Likewise.
+       (chsize_nothrow): Renamed from chsize.
+       * lib/msvc-nothrow.c: Don't include msvc-inval.h if
+       HAVE_MSVC_INVALID_PARAMETER_HANDLER is not defined.
+       * lib/close.c: Likewise.
+       * lib/dup.c: Likewise.
+       * lib/fclose.c: Likewise.
+       * lib/raise.c: Likewise.
+       * tests/test-fgetc.c: Likewise.
+       * tests/test-fputc.c: Likewise.
+       * tests/test-fread.c: Likewise.
+       * tests/test-fwrite.c: Likewise.
+       * lib/getdtablesize.c: Likewise.
+       (_setmaxstdio_nothrow): Renamed from _setmaxstdio.
+       * lib/isatty.c: Don't include msvc-inval.h if
+       HAVE_MSVC_INVALID_PARAMETER_HANDLER is not defined.
+       Include <io.h> as an alternative to msvc-nothrow.h.
+       * lib/read.c: Likewise.
+       * lib/write.c: Likewise.
+       * lib/dup2.c: Likewise.
+       (dup2_nothrow): New function.
+       (ms_windows_dup2): Use it.
+       * m4/close.m4 (gl_FUNC_CLOSE): Invoke gl_MSVC_INVAL and test
+       HAVE_MSVC_INVALID_PARAMETER_HANDLER only if gl_MSVC_INVAL is defined.
+       * m4/dup.m4 (gl_FUNC_DUP): Likewise.
+       * m4/fdopen.m4 (gl_FUNC_FDOPEN): Likewise.
+       * m4/raise.m4 (gl_FUNC_RAISE): Likewise.
+       * m4/read.m4 (gl_FUNC_READ): Likewise.
+       * m4/write.m4 (gl_FUNC_WRITE): Likewise.
+       * doc/windows-without-msvc.texi: New file.
+       * doc/gnulib.texi (Native Windows Support without MSVC Support): New
+       section.
+
 2017-05-10 Bruno Haible  <bruno@clisp.org>
 
        wait-process: Adjust native Windows support.
index 378cee642f14835350d27aca376cb41451cfc2b9..d23ab9c06817c8e91d851138418970b5cd34b873 100644 (file)
@@ -6324,12 +6324,15 @@ to POSIX that it can be treated like any other Unix-like platform.
 @menu
 * Libtool and Windows::
 * Windows sockets::
+* Native Windows Support without MSVC Support::
 @end menu
 
 @include windows-libtool.texi
 
 @include windows-sockets.texi
 
+@include windows-without-msvc.texi
+
 
 @node Particular Modules
 @chapter Particular Modules
diff --git a/doc/windows-without-msvc.texi b/doc/windows-without-msvc.texi
new file mode 100644 (file)
index 0000000..781612b
--- /dev/null
@@ -0,0 +1,8 @@
+@node Native Windows Support without MSVC Support
+@section Native Windows Support without MSVC Support
+
+If your package does not desire to have MSVC support, that is, if MinGW
+shall be the only native Windows platform that you wish to get support
+for from Gnulib, and you wish to minimize the number of files imported
+from Gnulib accordingly, you can do so by passing the options
+@samp{--avoid=msvc-inval --avoid=msvc-nothrow} to @code{gnulib-tool}.
index 040fb9ff6a1971f3b658969d48d6ba11da222709..997f75ad8bfde9d71925c4aef8b90c6cb83a138b 100644 (file)
 #include <errno.h>
 #include <fcntl.h>
 #include "binary-io.h"
-#include "msvc-nothrow.h"
+#if GNULIB_MSVC_NOTHROW
+# include "msvc-nothrow.h"
+#else
+# include <io.h>
+#endif
 
 #ifndef SOCK_CLOEXEC
 # define SOCK_CLOEXEC 0
index 3e451871f5fe0d1a71dc398ef19e5140001b12a7..6a72c322993650488b8d7893fab91fb7a825f10c 100644 (file)
@@ -22,7 +22,9 @@
 #include <errno.h>
 
 #include "fd-hook.h"
-#include "msvc-inval.h"
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
 
 #undef close
 
index 819e9e3780c6ecac5032367ee594b17f39575b3e..69887b0c35c1669d31099140d097687fc6f4cb97 100644 (file)
--- a/lib/dup.c
+++ b/lib/dup.c
@@ -22,7 +22,9 @@
 
 #include <errno.h>
 
-#include "msvc-inval.h"
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
 
 #undef dup
 
index c0c7cadf4a805cc45416f1744e1421a5f550c30a..002dc8c76cba99ef486651a70bd909b17eec2d27 100644 (file)
 #  define WIN32_LEAN_AND_MEAN
 #  include <windows.h>
 
-#  include "msvc-inval.h"
+#  if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+#   include "msvc-inval.h"
+#  endif
 
 /* Get _get_osfhandle.  */
-#  include "msvc-nothrow.h"
+#  if GNULIB_MSVC_NOTHROW
+#   include "msvc-nothrow.h"
+#  else
+#   include <io.h>
+#  endif
+
+#  if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static int
+dup2_nothrow (int fd, int desired_fd)
+{
+  int result;
+
+  TRY_MSVC_INVAL
+    {
+      result = dup2 (fd, desired_fd);
+    }
+  CATCH_MSVC_INVAL
+    {
+      errno = EBADF;
+      result = -1;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+#  else
+#   define dup2_nothrow dup2
+#  endif
 
 static int
 ms_windows_dup2 (int fd, int desired_fd)
@@ -66,16 +95,7 @@ ms_windows_dup2 (int fd, int desired_fd)
       return -1;
     }
 
-  TRY_MSVC_INVAL
-    {
-      result = dup2 (fd, desired_fd);
-    }
-  CATCH_MSVC_INVAL
-    {
-      errno = EBADF;
-      result = -1;
-    }
-  DONE_MSVC_INVAL;
+  result = dup2_nothrow (fd, desired_fd);
 
   if (result == 0)
     result = desired_fd;
index ed9b37a9558867996363e105d160358a9f0fcd5b..418d1ab8dee38fbc983aeecdc6d0338925e5e32e 100644 (file)
@@ -98,7 +98,11 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
 #  define WIN32_LEAN_AND_MEAN
 #  include <windows.h>
 /* Get _get_osfhandle.  */
-#  include "msvc-nothrow.h"
+#  if GNULIB_MSVC_NOTHROW
+#   include "msvc-nothrow.h"
+#  else
+#   include <io.h>
+#  endif
 # endif
 
 /* The gnulib override of fcntl is not needed in this file.  */
index facff2bd852db16b3df578659ae288d10e817e85..fc6f6087b31b1ec2304adb51dfc97f183ef9c858 100644 (file)
@@ -23,7 +23,9 @@
 #include <unistd.h>
 
 #include "freading.h"
-#include "msvc-inval.h"
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
 
 #undef fclose
 
index afe15468ffaffc7b23612cd5783d201bc8a71c5d..d4dd144e05d4f4b3894ecb43081cc06f9224b468 100644 (file)
 # include <windows.h>
 
 /* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 
 /* Upper bound on getdtablesize().  See lib/getdtablesize.c.  */
 # define OPEN_MAX_MAX 0x10000
index 7698e43ffc3304302e026a017ab6728868f38d12..0c55d521cf951f8a898050da7a69df6b9c870c15 100644 (file)
 # include <errno.h>
 
 /* _get_osfhandle */
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 
 /* 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
index a4896e3a7717efc46b6c252f2200d76d4f7536ae..605ac7d85ec63a5c122745d497fb8793a5bb12d2 100644 (file)
@@ -56,7 +56,11 @@ orig_fstat (int fd, struct stat *buf)
 #ifdef WINDOWS_NATIVE
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 # include "stat-w32.h"
 #endif
 
index d7de6d8b19278b2f81b776e89f4363f983ab2386..846f308720d57aceb2002f7c0ecca0fa54b89c90 100644 (file)
 # include <errno.h>
 
 /* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 
 int
 fsync (int fd)
index 913df19cbc5a9eb7c080ebfbfd5a5432eba40411..f0ecae27b4bd5068f6e589d8529f670b2611900e 100644 (file)
 #  include <windows.h>
 
 /* Get _get_osfhandle.  */
-#  include "msvc-nothrow.h"
+#  if GNULIB_MSVC_NOTHROW
+#   include "msvc-nothrow.h"
+#  else
+#   include <io.h>
+#  endif
 
 static BOOL
 SetFileSize (HANDLE h, LONGLONG size)
@@ -175,13 +179,14 @@ chsize_nothrow (int fd, long length)
 
   return result;
 }
-#   define chsize chsize_nothrow
+#  else
+#   define chsize_nothrow chsize
 #  endif
 
 int
 ftruncate (int fd, off_t length)
 {
-  return chsize (fd, length);
+  return chsize_nothrow (fd, length);
 }
 
 # endif
index 7fabb51e2c67e1d2b5fba0a48437895d6e23db99..c356cf4aa979c1c03f3ed968dc429d9c63f3cebd 100644 (file)
@@ -24,7 +24,9 @@
 
 # include <stdio.h>
 
-# include "msvc-inval.h"
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+#  include "msvc-inval.h"
+# endif
 
 # if HAVE_MSVC_INVALID_PARAMETER_HANDLER
 static int
@@ -44,7 +46,8 @@ _setmaxstdio_nothrow (int newmax)
 
   return result;
 }
-#  define _setmaxstdio _setmaxstdio_nothrow
+# else
+#  define _setmaxstdio_nothrow _setmaxstdio
 # endif
 
 /* Cache for the previous getdtablesize () result.  Safe to cache because
@@ -76,9 +79,9 @@ getdtablesize (void)
          freed when we call _setmaxstdio with the original value.  */
       int orig_max_stdio = _getmaxstdio ();
       unsigned int bound;
-      for (bound = 0x10000; _setmaxstdio (bound) < 0; bound = bound / 2)
+      for (bound = 0x10000; _setmaxstdio_nothrow (bound) < 0; bound = bound / 2)
         ;
-      _setmaxstdio (orig_max_stdio);
+      _setmaxstdio_nothrow (orig_max_stdio);
       dtablesize = bound;
     }
   return dtablesize;
index a28a3ae437e19222bfc848cf77cbcad574142d91..f1425589cfd0ad0fe06910f508a7f4daf627efa8 100644 (file)
@@ -52,7 +52,11 @@ rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */)
 
 # include "fd-hook.h"
 /* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 
 static int
 primary_ioctl (int fd, int request, void *arg)
index dbc63b5f495644f7bcb241677837a623d348b4d9..535ece933b346c7a32083537c4e89567972b2547 100644 (file)
 # include <windows.h>
 
 /* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 
 int
 isapipe (int fd)
index f050426c5f441ba6e4af36ea0776ea5f7f7c26b7..dba43805615610d457536c564cd2eb09b87e9f18 100644 (file)
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
-#include "msvc-inval.h"
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
 
 /* Get _get_osfhandle().  */
-#include "msvc-nothrow.h"
+#if GNULIB_MSVC_NOTHROW
+# include "msvc-nothrow.h"
+#else
+# include <io.h>
+#endif
 
 static BOOL IsConsoleHandle (HANDLE h)
 {
index e603539b36c9ce6ac1fef18128e968b02904a9b3..9c991a3d30b6ade1141777bd781124477282b2f5 100644 (file)
 /* Get GetFileType.  */
 # include <windows.h>
 /* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 #else
 # include <sys/stat.h>
 #endif
index 300ed41aaf0dfd50646bbd5f77895cd3b42c9671..86a88082ff7d357b25f67cb7c6b10488041b9e07 100644 (file)
@@ -24,7 +24,9 @@
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
-#include "msvc-inval.h"
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
 
 #undef _get_osfhandle
 
index 3d031aa834c4849539597af0ab8700a7d8f42e57..b9ed86a8ba976a24dcd30a450eea65bafe1fc7ec 100644 (file)
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 
 int
 get_nonblocking_flag (int desc)
index 078b1bab41511891fb775a7ad77d5ec37b594589..9115bcd4a9ea39933025f14f7b90fba6c9fc5f66 100644 (file)
 # include <io.h>
 # include <stdio.h>
 # include <conio.h>
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 #else
 # include <sys/time.h>
 # include <unistd.h>
index d3325a630e2eb6d0fc8dd947328f773371d9888a..0a6d8ca9d8764d2b8cbe8868fcd7f9f5cd0ebdaf 100644 (file)
@@ -27,7 +27,9 @@
 
 # include <errno.h>
 
-# include "msvc-inval.h"
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+#  include "msvc-inval.h"
+# endif
 
 # undef raise
 
index 08108f7f7bc1347f5b0ee9d1c65e7fb6795efc96..a9b943ff90bb175e67fb4b9ee8044ac0fc8a7010 100644 (file)
 # define WIN32_LEAN_AND_MEAN  /* avoid including junk */
 # include <windows.h>
 
-# include "msvc-inval.h"
-# include "msvc-nothrow.h"
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+#  include "msvc-inval.h"
+# endif
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 
 # undef read
 
index ac86c499d4a3e9116e07e4058ae8619663e4797b..01b19823fbd68a92fd669999250cf777b052b646 100644 (file)
 /* Get the overridden 'struct timeval'.  */
 #include <sys/time.h>
 
-#include "msvc-nothrow.h"
+#if GNULIB_MSVC_NOTHROW
+# include "msvc-nothrow.h"
+#else
+# include <io.h>
+#endif
 
 #undef select
 
index 9333ee4dd8665ab4632ee640c30ba2d4adad756d..028e20ec0eb0b6e7fae75280d2697d3c7dac2054 100644 (file)
 # include <sys/socket.h>
 
 # include "fd-hook.h"
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 
 /* Get set_winsock_errno, FD_TO_SOCKET etc. */
 # include "w32sock.h"
index 8392e575668aa0f843977a163f2c58c9ed220a5b..23ad74d2fa6fcf4dfcc2e0ff671ae661d64e54bd 100644 (file)
@@ -18,7 +18,7 @@
 /* Written by Simon Josefsson */
 
 #ifndef SOCKETS_H
-# define SOCKETS_H 1
+#define SOCKETS_H 1
 
 #define SOCKETS_1_0 0x0001
 #define SOCKETS_1_1 0x0101
@@ -43,9 +43,13 @@ int gl_sockets_cleanup (void)
    other library that only accepts sockets. */
 #ifdef WINDOWS_SOCKETS
 
-#include <sys/socket.h>
+# include <sys/socket.h>
 
-#include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 
 static inline SOCKET
 gl_fd_to_handle (int fd)
@@ -55,7 +59,7 @@ gl_fd_to_handle (int fd)
 
 #else
 
-#define gl_fd_to_handle(x) (x)
+# define gl_fd_to_handle(x) (x)
 
 #endif /* WINDOWS_SOCKETS */
 
index 8caf2f003c96321c59bf446dd0494e0c90db409c..98db74966e263a0529f6fa0a75b92049a63291f2 100644 (file)
 #  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
 #  include <windows.h>
 
-#  include "msvc-nothrow.h"
+#  if GNULIB_MSVC_NOTHROW
+#   include "msvc-nothrow.h"
+#  else
+#   include <io.h>
+#  endif
 
 #  define CALL_WITH_ERRNO_FIX(RETTYPE, EXPRESSION, FAILED) \
   if (ferror (stream))                                                        \
index 8ad693bc620df02c0c5e22ba887697d68a7e69c1..34b22f50ac456be73684cb252eb268d8ac1b01db 100644 (file)
 #  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
 #  include <windows.h>
 
-#  include "msvc-nothrow.h"
+#  if GNULIB_MSVC_NOTHROW
+#   include "msvc-nothrow.h"
+#  else
+#   include <io.h>
+#  endif
 
 #  if GNULIB_NONBLOCKING
 #   define CLEAR_ERRNO \
index b4bfa8e3222ab9758de3f0494313a77b9af76711..ff4eab073c121e4df0b351fb3aca6e4fe5ea1bcc 100644 (file)
 # define USE_SETFILETIME
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 #endif
 
 /* Avoid recursion with rpl_futimens or rpl_utimensat.  */
index 8ac8ab7751fc3b94c586bf54973b87fda47e9b66..2f753fb4c9d8e602cdbd3ad14e47dc8f69938aa8 100644 (file)
 #include <io.h>
 
 /* Get _get_osfhandle().  */
-#include "msvc-nothrow.h"
+#if GNULIB_MSVC_NOTHROW
+# include "msvc-nothrow.h"
+#else
+# include <io.h>
+#endif
 
 #define FD_TO_SOCKET(fd)   ((SOCKET) _get_osfhandle ((fd)))
 #define SOCKET_TO_FD(fh)   (_open_osfhandle ((intptr_t) (fh), O_RDWR | O_BINARY))
index 79326627002f7aa67b1462605c602c5672585fc6..26ff658aa2b7e428ffedaa1bbbf83d6119df2ca2 100644 (file)
 #include <errno.h>
 
 /* Get _get_osfhandle().  */
-#include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 
 #include "cloexec.h"
 #include "xalloc.h"
index 6a3b623e68c8e8a205d4dc82413449b4d3feb6f3..b81db620819d58441479ba342d04e5bb8fe6823d 100644 (file)
 # define WIN32_LEAN_AND_MEAN  /* avoid including junk */
 # include <windows.h>
 
-# include "msvc-inval.h"
-# include "msvc-nothrow.h"
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+#  include "msvc-inval.h"
+# endif
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 
 # undef write
 
index 005a43ae1e184994370856d9fdf58b8e8ddbe7a0..ed357ab92490b278674e40cbd967831add3804c4 100644 (file)
@@ -1,4 +1,4 @@
-# close.m4 serial 8
+# close.m4 serial 9
 dnl Copyright (C) 2008-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,10 +7,12 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_CLOSE],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  AC_REQUIRE([gl_MSVC_INVAL])
-  if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
-    REPLACE_CLOSE=1
-  fi
+  m4_ifdef([gl_MSVC_INVAL], [
+    AC_REQUIRE([gl_MSVC_INVAL])
+    if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+      REPLACE_CLOSE=1
+    fi
+  ])
   m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [
     gl_PREREQ_SYS_H_WINSOCK2
     if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then
index 74fa9bd3dcad119b72f4bbbdf11f030ce549338d..75307cbb89f557ca6d4c056073589decfbb93558 100644 (file)
--- a/m4/dup.m4
+++ b/m4/dup.m4
@@ -1,4 +1,4 @@
-# dup.m4 serial 4
+# dup.m4 serial 5
 dnl Copyright (C) 2011-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,10 +7,12 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_DUP],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  AC_REQUIRE([gl_MSVC_INVAL])
-  if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
-    REPLACE_DUP=1
-  fi
+  m4_ifdef([gl_MSVC_INVAL], [
+    AC_REQUIRE([gl_MSVC_INVAL])
+    if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+      REPLACE_DUP=1
+    fi
+  ])
   dnl Replace dup() for supporting the gnulib-defined fchdir() function,
   dnl to keep fchdir's bookkeeping up-to-date.
   m4_ifdef([gl_FUNC_FCHDIR], [
index 8e8619cc8dd1fe26e47e8fe908bd88ae14f1699a..42f928efd0aa77d6d7abe537aa649e7288516735 100644 (file)
@@ -1,4 +1,4 @@
-# fdopen.m4 serial 3
+# fdopen.m4 serial 4
 dnl Copyright (C) 2011-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,10 +8,13 @@ AC_DEFUN([gl_FUNC_FDOPEN],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-  AC_REQUIRE([gl_MSVC_INVAL])
-  if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
-    REPLACE_FDOPEN=1
-  else
+  m4_ifdef([gl_MSVC_INVAL], [
+    AC_REQUIRE([gl_MSVC_INVAL])
+    if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+      REPLACE_FDOPEN=1
+    fi
+  ])
+  if test $REPLACE_FDOPEN = 0; then
     dnl Test whether fdopen() sets errno when it fails due to a bad fd argument.
     AC_CACHE_CHECK([whether fdopen sets errno], [gl_cv_func_fdopen_works],
       [
index 28c2e0b5ce3914da6a8c4e91c948ced74b550a97..fe6e06858e76617148fe4c1eb4cc49ef5a76e132 100644 (file)
@@ -1,4 +1,4 @@
-# raise.m4 serial 3
+# raise.m4 serial 4
 dnl Copyright (C) 2011-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,14 +8,16 @@ AC_DEFUN([gl_FUNC_RAISE],
 [
   AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
   AC_REQUIRE([AC_CANONICAL_HOST])
-  AC_REQUIRE([gl_MSVC_INVAL])
   AC_CHECK_FUNCS([raise])
   if test $ac_cv_func_raise = no; then
     HAVE_RAISE=0
   else
-    if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
-      REPLACE_RAISE=1
-    fi
+    m4_ifdef([gl_MSVC_INVAL], [
+      AC_REQUIRE([gl_MSVC_INVAL])
+      if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+        REPLACE_RAISE=1
+      fi
+    ])
     m4_ifdef([gl_SIGNALBLOCKING], [
       gl_SIGNALBLOCKING
       if test $HAVE_POSIX_SIGNALBLOCKING = 0; then
index 36249abdcdfa5ea9a014a8419416a9012981b584..24668028ea1567580f98dd7b8e9ebd254fb2404c 100644 (file)
@@ -1,4 +1,4 @@
-# read.m4 serial 4
+# read.m4 serial 5
 dnl Copyright (C) 2011-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,10 +7,12 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_READ],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  AC_REQUIRE([gl_MSVC_INVAL])
-  if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
-    REPLACE_READ=1
-  fi
+  m4_ifdef([gl_MSVC_INVAL], [
+    AC_REQUIRE([gl_MSVC_INVAL])
+    if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+      REPLACE_READ=1
+    fi
+  ])
   dnl This ifdef is just an optimization, to avoid performing a configure
   dnl check whose result is not used. It does not make the test of
   dnl GNULIB_UNISTD_H_NONBLOCKING or GNULIB_NONBLOCKING redundant.
index fd46acc1b07a3d26dc511e7444f1776bbd37a0b2..2f4a23538edd38db6b106bf64b131e2109af399c 100644 (file)
@@ -1,4 +1,4 @@
-# write.m4 serial 5
+# write.m4 serial 6
 dnl Copyright (C) 2008-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,10 +7,12 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_WRITE],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  AC_REQUIRE([gl_MSVC_INVAL])
-  if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
-    REPLACE_WRITE=1
-  fi
+  m4_ifdef([gl_MSVC_INVAL], [
+    AC_REQUIRE([gl_MSVC_INVAL])
+    if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+      REPLACE_WRITE=1
+    fi
+  ])
   dnl This ifdef is just an optimization, to avoid performing a configure
   dnl check whose result is not used. It does not make the test of
   dnl GNULIB_UNISTD_H_SIGPIPE or GNULIB_SIGPIPE redundant.
index 2e670f9aab4dca646b9b240ae518b457e17bece1..d187eea03368d3cdd4c96ce92030967446258318 100644 (file)
@@ -15,6 +15,7 @@ AC_REQUIRE([gl_MSVC_NOTHROW])
 if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
   AC_LIBOBJ([msvc-nothrow])
 fi
+gl_MODULE_INDICATOR([msvc-nothrow])
 
 Makefile.am:
 
index e30e1302f183f7f5d9c2254246911c182badd0a5..cbfded125248c0c2baf9639fd5322e122b8a73e1 100644 (file)
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 /* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 #endif
 
 #include "binary-io.h"
index a41950a0199ddf54a5478d9d45176cd859199017..936e4847be4afec28a693a84162562bfd306f5a9 100644 (file)
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 /* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 #endif
 
 #if !O_BINARY
index 8f7df3a1953c2e57bbb8cc942b91d4cfd7df6166..f98486a8106433b877cf01fa1c150f65f76417b2 100644 (file)
@@ -41,7 +41,11 @@ SIGNATURE_CHECK (dup2, int, (int, int));
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 /* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 #endif
 
 #include "macros.h"
index 8b0eef45310980f1cac231eaa0afbd55cfb6a990..85f32567ce3d472d5b72bf458069505045005cd4 100644 (file)
@@ -33,7 +33,11 @@ SIGNATURE_CHECK (dup3, int, (int, int, int));
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 /* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 #endif
 
 #include "binary-io.h"
index 5df90279d7e73942ba50af39a172eb8b64de4d98..a249f9ab0102a13058ce0d0333311f546753b3ab 100644 (file)
@@ -35,7 +35,11 @@ SIGNATURE_CHECK (fcntl, int, (int, int, ...));
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 /* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 #endif
 
 #include "binary-io.h"
index f1a3188903752fbacc36473240e6a603ceeaad3f..17edf13759bfbac72f8aaa12a6b762532e68935d 100644 (file)
@@ -25,7 +25,9 @@ SIGNATURE_CHECK (fgetc, int, (FILE *));
 #include <fcntl.h>
 #include <unistd.h>
 
-#include "msvc-inval.h"
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
 
 #include "macros.h"
 
index dd6993ea9e69ce45b1fa4e00958e16f91559d1dc..448e5f2989576c6348938b60c4a0a2d2740f7c45 100644 (file)
@@ -25,7 +25,9 @@ SIGNATURE_CHECK (fputc, int, (int, FILE *));
 #include <fcntl.h>
 #include <unistd.h>
 
-#include "msvc-inval.h"
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
 
 #include "macros.h"
 
index 1b7c42abec48c97dce8a6658c018cabd5daa9a09..751774daa6fdb1e7da92e0d8a9322d8837f773ae 100644 (file)
@@ -25,7 +25,9 @@ SIGNATURE_CHECK (fread, size_t, (void *, size_t, size_t, FILE *));
 #include <fcntl.h>
 #include <unistd.h>
 
-#include "msvc-inval.h"
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
 
 #include "macros.h"
 
index f50bbfca396981a79bf62ee849401959f85912f9..0dfb15b8954e270cccdcb2d48b26589c458980ae 100644 (file)
@@ -25,7 +25,9 @@ SIGNATURE_CHECK (fwrite, size_t, (const void *, size_t, size_t, FILE *));
 #include <fcntl.h>
 #include <unistd.h>
 
-#include "msvc-inval.h"
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
 
 #include "macros.h"
 
index d6dc26733404a59073e71eacbdf7cd1e3fce37ae..08cfe92e4424c5ed8fbd80c7ae5acc3adba077e2 100644 (file)
@@ -29,7 +29,11 @@ SIGNATURE_CHECK (pipe, int, (int[2]));
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 /* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 #endif
 
 #include "binary-io.h"
index 6cebd33e12e71ca740f3304d4644ad17dc6b609c..b50ea99ba1c8c383d71cad39c825ee05f2a3d98f 100644 (file)
@@ -29,7 +29,11 @@ SIGNATURE_CHECK (pipe2, int, (int[2], int));
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 /* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
 #endif
 
 #include "binary-io.h"