mirror of
https://https.git.savannah.gnu.org/git/gnulib.git
synced 2026-09-01 02:34:55 +00:00
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}.
|
||||
+5
-1
@@ -22,7 +22,11 @@
|
||||
#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
|
||||
|
||||
+3
-1
@@ -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
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "msvc-inval.h"
|
||||
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
|
||||
# include "msvc-inval.h"
|
||||
#endif
|
||||
|
||||
#undef dup
|
||||
|
||||
|
||||
+32
-12
@@ -35,10 +35,39 @@
|
||||
# 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;
|
||||
|
||||
+5
-1
@@ -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. */
|
||||
|
||||
+3
-1
@@ -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
|
||||
|
||||
|
||||
+5
-1
@@ -38,7 +38,11 @@
|
||||
# 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
|
||||
|
||||
+5
-1
@@ -33,7 +33,11 @@
|
||||
# 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
|
||||
|
||||
+5
-1
@@ -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
|
||||
|
||||
|
||||
+5
-1
@@ -34,7 +34,11 @@
|
||||
# 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)
|
||||
|
||||
+8
-3
@@ -38,7 +38,11 @@
|
||||
# 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
|
||||
|
||||
+7
-4
@@ -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;
|
||||
|
||||
+5
-1
@@ -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)
|
||||
|
||||
+5
-1
@@ -30,7 +30,11 @@
|
||||
# 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)
|
||||
|
||||
+8
-2
@@ -27,10 +27,16 @@
|
||||
#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)
|
||||
{
|
||||
|
||||
+5
-1
@@ -24,7 +24,11 @@
|
||||
/* 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
|
||||
|
||||
+3
-1
@@ -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
|
||||
|
||||
|
||||
+5
-1
@@ -32,7 +32,11 @@
|
||||
# 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)
|
||||
|
||||
+5
-1
@@ -41,7 +41,11 @@
|
||||
# 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>
|
||||
|
||||
+3
-1
@@ -27,7 +27,9 @@
|
||||
|
||||
# include <errno.h>
|
||||
|
||||
# include "msvc-inval.h"
|
||||
# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
|
||||
# include "msvc-inval.h"
|
||||
# endif
|
||||
|
||||
# undef raise
|
||||
|
||||
|
||||
+8
-2
@@ -28,8 +28,14 @@
|
||||
# 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
|
||||
|
||||
|
||||
+5
-1
@@ -39,7 +39,11 @@
|
||||
/* 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
|
||||
|
||||
|
||||
+5
-1
@@ -28,7 +28,11 @@
|
||||
# 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"
|
||||
|
||||
+8
-4
@@ -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 */
|
||||
|
||||
|
||||
+5
-1
@@ -37,7 +37,11 @@
|
||||
# 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)) \
|
||||
|
||||
+5
-1
@@ -39,7 +39,11 @@
|
||||
# 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 \
|
||||
|
||||
+5
-1
@@ -44,7 +44,11 @@
|
||||
# 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. */
|
||||
|
||||
+5
-1
@@ -26,7 +26,11 @@
|
||||
#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))
|
||||
|
||||
+5
-1
@@ -30,7 +30,11 @@
|
||||
#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"
|
||||
|
||||
+8
-2
@@ -34,8 +34,14 @@
|
||||
# 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
|
||||
|
||||
|
||||
+7
-5
@@ -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
|
||||
|
||||
@@ -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], [
|
||||
|
||||
+8
-5
@@ -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],
|
||||
[
|
||||
|
||||
+7
-5
@@ -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
|
||||
|
||||
+7
-5
@@ -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.
|
||||
|
||||
+7
-5
@@ -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.
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -29,7 +29,11 @@
|
||||
# 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"
|
||||
|
||||
@@ -34,7 +34,11 @@
|
||||
# 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
|
||||
|
||||
+5
-1
@@ -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"
|
||||
|
||||
+5
-1
@@ -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"
|
||||
|
||||
+5
-1
@@ -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"
|
||||
|
||||
+3
-1
@@ -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"
|
||||
|
||||
|
||||
+3
-1
@@ -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"
|
||||
|
||||
|
||||
+3
-1
@@ -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"
|
||||
|
||||
|
||||
+3
-1
@@ -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"
|
||||
|
||||
|
||||
+5
-1
@@ -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"
|
||||
|
||||
+5
-1
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user