emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 846657a 1/2: Update from Gnulib


From: Paul Eggert
Subject: master 846657a 1/2: Update from Gnulib
Date: Sun, 16 Aug 2020 17:30:35 -0400 (EDT)

branch: master
commit 846657afaf021e8a796335d740ac4a34056abbeb
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    Update from Gnulib
    
    This incorporates:
    2020-08-16 time_rz: remove unused functions
    2020-08-16 time_rz: fix issues with mktime_z failures
    2020-08-16 nstrftime: Guide inlining also on clang
    2020-08-16 intprops: Avoid bogus warning on clang
    2020-08-16 libc-config: Enable __REDIRECT macro also on clang
    2020-08-16 regex: Use initializer shorthand syntax also with clang
    2020-08-16 regex: Use space optimization also with clang
    2020-08-16 Use _Static_assert and static_assert when present on clang
    2020-08-16 Use 'throw ()' for optimization in C++ mode also on clang
    2020-08-16 stdio: Don't break attribute 'scanf' on clang
    2020-08-16 Fix "warning: 'format' attribute ...: rpl_printf"
    2020-08-16 Fix "warning: attribute declaration must precede definition"
    2020-08-16 Fix undesired warnings
    2020-08-16 Don't use Autoconf quadrigraphsxo
    2020-08-16 Fix quoting of AC_LANG_PROGRAM arguments
    2020-08-16 Assume autoconf >= 2.64
    2020-08-15 nstrftime: be more predictable about errno
    2020-08-15 canonicalize: Fix autoconf test on MSVC/clang
    2020-08-15 Support compiling without -loldnames on native Windows
    2020-08-14 mktime, mktime-internal: Remove obsolete code
    2020-08-14 Assume tzset exists
    * lib/c++defs.h, lib/canonicalize-lgpl.c, lib/cdefs.h, lib/dup2.c:
    * lib/fcntl.in.h, lib/getopt-cdefs.in.h, lib/intprops.h, lib/md5.h:
    * lib/mktime.c, lib/nstrftime.c, lib/open.c, lib/regcomp.c:
    * lib/regex_internal.h, lib/stdio.in.h, lib/stdlib.in.h:
    * lib/strftime.h, lib/string.in.h, lib/sys_select.in.h:
    * lib/sys_stat.in.h, lib/sys_time.in.h, lib/time.in.h, lib/time_rz.c:
    * lib/unistd.in.h, lib/verify.h, m4/00gnulib.m4:
    * m4/absolute-header.m4, m4/alloca.m4, m4/canonicalize.m4, m4/dup2.m4:
    * m4/fchmodat.m4, m4/fcntl.m4, m4/fdopendir.m4, m4/fpending.m4:
    * m4/futimens.m4, m4/getdtablesize.m4, m4/getloadavg.m4:
    * m4/gnulib-common.m4, m4/include_next.m4, m4/largefile.m4:
    * m4/manywarnings.m4, m4/mktime.m4, m4/nstrftime.m4, m4/open-slash.m4:
    * m4/pselect.m4, m4/pthread_sigmask.m4, m4/time_h.m4, m4/utimens.m4:
    * m4/utimensat.m4, m4/utimes.m4, m4/warnings.m4:
    Copy from Gnulib.
    * lib/gnulib.mk.in: Regenerate.
---
 lib/c++defs.h           |  10 +++
 lib/canonicalize-lgpl.c |   4 +-
 lib/cdefs.h             |   7 ++-
 lib/dup2.c              |   4 +-
 lib/fcntl.in.h          |  18 ++++++
 lib/getopt-cdefs.in.h   |   2 +-
 lib/gnulib.mk.in        |   4 +-
 lib/intprops.h          |   2 +-
 lib/md5.h               |   2 +-
 lib/mktime.c            |   2 +-
 lib/nstrftime.c         |  22 +++++--
 lib/open.c              |   4 ++
 lib/regcomp.c           |   2 +-
 lib/regex_internal.h    |   2 +-
 lib/stdio.in.h          |  46 +++++++++++++-
 lib/stdlib.in.h         |  29 +++++++++
 lib/strftime.h          |   7 ++-
 lib/string.in.h         |  15 +++++
 lib/sys_select.in.h     |   6 +-
 lib/sys_stat.in.h       |  14 +++++
 lib/sys_time.in.h       |   2 +-
 lib/time.in.h           |  12 +++-
 lib/time_rz.c           |  51 ++++++----------
 lib/unistd.in.h         | 159 ++++++++++++++++++++++++++++++++++++++++++++++++
 lib/verify.h            |  23 +++++--
 m4/00gnulib.m4          |  38 +-----------
 m4/absolute-header.m4   |  10 ++-
 m4/alloca.m4            |   4 +-
 m4/canonicalize.m4      |  14 ++++-
 m4/dup2.m4              |   3 +-
 m4/fchmodat.m4          |   4 +-
 m4/fcntl.m4             |   3 +-
 m4/fdopendir.m4         |  20 +++---
 m4/fpending.m4          |   4 +-
 m4/futimens.m4          |   5 +-
 m4/getdtablesize.m4     |  19 +++---
 m4/getloadavg.m4        |   4 +-
 m4/gnulib-common.m4     |  82 +++++++++++++++++++++----
 m4/include_next.m4      |  18 +++---
 m4/largefile.m4         |   6 +-
 m4/manywarnings.m4      |   8 +--
 m4/mktime.m4            |   8 +--
 m4/nstrftime.m4         |   4 +-
 m4/open-slash.m4        |   3 +-
 m4/pselect.m4           |   5 +-
 m4/pthread_sigmask.m4   |   3 +-
 m4/time_h.m4            |   1 -
 m4/utimens.m4           |   5 +-
 m4/utimensat.m4         |   5 +-
 m4/utimes.m4            |   3 +-
 m4/warnings.m4          |  21 +++----
 51 files changed, 547 insertions(+), 202 deletions(-)

diff --git a/lib/c++defs.h b/lib/c++defs.h
index 90e6fd6..6a9bf29 100644
--- a/lib/c++defs.h
+++ b/lib/c++defs.h
@@ -146,6 +146,16 @@
     _GL_EXTERN_C int _gl_cxxalias_dummy
 #endif
 
+/* _GL_CXXALIAS_MDA (func, rettype, parameters);
+   is to be used when func is a Microsoft deprecated alias, on native Windows.
+   It declares a C++ alias called GNULIB_NAMESPACE::func
+   that redirects to _func, if GNULIB_NAMESPACE is defined.
+   Example:
+     _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
+ */
+#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
+  _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
+
 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
    except that the C function rpl_func may have a slightly different
diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
index 9f99098..0b89d2a 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -52,7 +52,9 @@
 # include "pathmax.h"
 # include "malloca.h"
 # include "filename.h"
-# if HAVE_GETCWD
+# if defined _WIN32 && !defined __CYGWIN__
+#  define __getcwd _getcwd
+# elif HAVE_GETCWD
 #  if IN_RELOCWRAPPER
     /* When building the relocatable program wrapper, use the system's getcwd
        function, not the gnulib override, otherwise we would get a link error.
diff --git a/lib/cdefs.h b/lib/cdefs.h
index 4f89f4e..0cc2780 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -85,7 +85,7 @@
 #  define __NTH(fct)   __attribute__ ((__nothrow__ __LEAF)) fct
 #  define __NTHNL(fct)  __attribute__ ((__nothrow__)) fct
 # else
-#  if defined __cplusplus && __GNUC_PREREQ (2,8)
+#  if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4)
 #   define __THROW     throw ()
 #   define __THROWNL   throw ()
 #   define __NTH(fct)  __LEAF_ATTR fct throw ()
@@ -194,7 +194,7 @@
    Example:
    int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
 
-#if defined __GNUC__ && __GNUC__ >= 2
+#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
 
 # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
 # ifdef __cplusplus
@@ -465,7 +465,8 @@
 
 #if (!defined _Static_assert && !defined __cplusplus \
      && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
-     && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__))
+     && (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \
+         || defined __STRICT_ANSI__))
 # define _Static_assert(expr, diagnostic) \
     extern int (*__Static_assert_function (void)) \
       [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
diff --git a/lib/dup2.c b/lib/dup2.c
index 9bc3951..323e19b 100644
--- a/lib/dup2.c
+++ b/lib/dup2.c
@@ -52,7 +52,7 @@ dup2_nothrow (int fd, int desired_fd)
 
   TRY_MSVC_INVAL
     {
-      result = dup2 (fd, desired_fd);
+      result = _dup2 (fd, desired_fd);
     }
   CATCH_MSVC_INVAL
     {
@@ -64,7 +64,7 @@ dup2_nothrow (int fd, int desired_fd)
   return result;
 }
 # else
-#  define dup2_nothrow dup2
+#  define dup2_nothrow _dup2
 # endif
 
 static int
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 0a21c95..6f16bc6 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -97,6 +97,12 @@
 _GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode)
                              _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef creat
+#   define creat _creat
+#  endif
+_GL_CXXALIAS_MDA (creat, int, (const char *filename, mode_t mode));
 # else
 _GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode));
 # endif
@@ -106,6 +112,9 @@ _GL_CXXALIASWARN (creat);
 /* Assume creat is always declared.  */
 _GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - "
                  "use gnulib module creat for portability");
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef creat
+# define creat _creat
 #endif
 
 #if @GNULIB_FCNTL@
@@ -146,6 +155,12 @@ _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX 
compliant - "
 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
                              _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef open
+#   define open _open
+#  endif
+_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
 # else
 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
 # endif
@@ -159,6 +174,9 @@ _GL_CXXALIASWARN (open);
 /* Assume open is always declared.  */
 _GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
                  "use gnulib module open for portability");
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef open
+# define open _open
 #endif
 
 #if @GNULIB_OPENAT@
diff --git a/lib/getopt-cdefs.in.h b/lib/getopt-cdefs.in.h
index c510ab1..674838c 100644
--- a/lib/getopt-cdefs.in.h
+++ b/lib/getopt-cdefs.in.h
@@ -57,7 +57,7 @@
 #endif
 
 #ifndef __THROW
-# if defined __cplusplus && __GNUC_PREREQ (2,8)
+# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
 #  define __THROW       throw ()
 # else
 #  define __THROW
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 92d0621..7b4fc74 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -682,7 +682,6 @@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_TIMEGM = @HAVE_TIMEGM@
 HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@
 HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
-HAVE_TZSET = @HAVE_TZSET@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
 HAVE_UNLINKAT = @HAVE_UNLINKAT@
 HAVE_UNLOCKPT = @HAVE_UNLOCKPT@
@@ -1159,7 +1158,7 @@ ifeq (,$(OMIT_GNULIB_MODULE_absolute-header))
 # Use this preprocessor expression to decide whether #include_next works.
 # Do not rely on a 'configure'-time test for this, since the expression
 # might appear in an installed header, which is used by some other compiler.
-HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER)
+HAVE_INCLUDE_NEXT = (__GNUC__ || __clang__ || 60000000 <= __DECC_VER)
 
 endif
 ## end   gnulib module absolute-header
@@ -3185,7 +3184,6 @@ time.h: time.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
              -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \
              -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \
-             -e 's|@''HAVE_TZSET''@|$(HAVE_TZSET)|g' \
              -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \
              -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \
              -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \
diff --git a/lib/intprops.h b/lib/intprops.h
index 220f532..f2f70b3 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -396,7 +396,7 @@
    For now, assume all versions of GCC-like compilers generate bogus
    warnings for _Generic.  This matters only for compilers that
    lack relevant builtins.  */
-#if __GNUC__
+#if __GNUC__ || defined __clang__
 # define _GL__GENERIC_BOGUS 1
 #else
 # define _GL__GENERIC_BOGUS 0
diff --git a/lib/md5.h b/lib/md5.h
index 3c60482..c728ba1 100644
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -40,7 +40,7 @@
 #endif
 
 #ifndef __THROW
-# if defined __cplusplus && __GNUC_PREREQ (2,8)
+# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
 #  define __THROW       throw ()
 # else
 #  define __THROW
diff --git a/lib/mktime.c b/lib/mktime.c
index 92c00b2..5b4c144 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -94,7 +94,7 @@ my_tzset (void)
   const char *tz = getenv ("TZ");
   if (tz != NULL && strchr (tz, '/') != NULL)
     _putenv ("TZ=");
-# elif HAVE_TZSET
+# else
   tzset ();
 # endif
 }
diff --git a/lib/nstrftime.c b/lib/nstrftime.c
index 2816cf4..7d5a97f 100644
--- a/lib/nstrftime.c
+++ b/lib/nstrftime.c
@@ -21,7 +21,6 @@
 # define HAVE_TM_GMTOFF 1
 # define HAVE_TM_ZONE 1
 # define HAVE_TZNAME 1
-# define HAVE_TZSET 1
 # include "../locale/localeinfo.h"
 #else
 # include <config.h>
@@ -34,6 +33,7 @@
 #endif
 
 #include <ctype.h>
+#include <errno.h>
 #include <time.h>
 
 #if HAVE_TZNAME && !HAVE_DECL_TZNAME
@@ -163,7 +163,10 @@ extern char *tzname[];
       size_t _w = pad == L_('-') || width < 0 ? 0 : width;                    \
       size_t _incr = _n < _w ? _w : _n;                                       \
       if (_incr >= maxsize - i)                                               \
-        return 0;                                                             \
+        {                                                                     \
+          errno = ERANGE;                                                     \
+          return 0;                                                           \
+        }                                                                     \
       if (p)                                                                  \
         {                                                                     \
           if (_n < _w)                                                        \
@@ -365,7 +368,7 @@ tm_diff (const struct tm *a, const struct tm *b)
 #define ISO_WEEK1_WDAY 4 /* Thursday */
 #define YDAY_MINIMUM (-366)
 static int iso_week_days (int, int);
-#ifdef __GNUC__
+#if defined __GNUC__ || defined __clang__
 __inline__
 #endif
 static int
@@ -389,7 +392,6 @@ iso_week_days (int yday, int wday)
 #endif
 
 #ifdef my_strftime
-# undef HAVE_TZSET
 # define extra_args , tz, ns
 # define extra_args_spec , timezone_t tz, int ns
 #else
@@ -449,6 +451,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
   size_t maxsize = (size_t) -1;
 #endif
 
+  int saved_errno = errno;
   int hour12 = tp->tm_hour;
 #ifdef _NL_CURRENT
   /* We cannot make the following values variables since we must delay
@@ -523,7 +526,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
     {
       /* POSIX.1 requires that local time zone information be used as
          though strftime called tzset.  */
-# if HAVE_TZSET
+# ifndef my_strftime
       if (!*tzset_called)
         {
           tzset ();
@@ -1188,7 +1191,13 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
             time_t t;
 
             ltm = *tp;
+            ltm.tm_yday = -1;
             t = mktime_z (tz, &ltm);
+            if (ltm.tm_yday < 0)
+              {
+                errno = EOVERFLOW;
+                return 0;
+              }
 
             /* Generate string value for T using time_t arithmetic;
                this works even if sizeof (long) < sizeof (time_t).  */
@@ -1417,7 +1426,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
 
                 /* POSIX.1 requires that local time zone information be used as
                    though strftime called tzset.  */
-# if HAVE_TZSET
+# ifndef my_strftime
                 if (!*tzset_called)
                   {
                     tzset ();
@@ -1486,5 +1495,6 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
     *p = L_('\0');
 #endif
 
+  errno = saved_errno;
   return i;
 }
diff --git a/lib/open.c b/lib/open.c
index 751b42d..0f7c6e9 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -30,7 +30,11 @@
 static int
 orig_open (const char *filename, int flags, mode_t mode)
 {
+#if defined _WIN32 && !defined __CYGWIN__
+  return _open (filename, flags, mode);
+#else
   return open (filename, flags, mode);
+#endif
 }
 
 /* Specification.  */
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 84044be..a4b95b0 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -558,7 +558,7 @@ weak_alias (__regerror, regerror)
 static const bitset_t utf8_sb_map =
 {
   /* Set the first 128 bits.  */
-# if defined __GNUC__ && !defined __STRICT_ANSI__
+# if (defined __GNUC__ || __clang_major__ >= 4) && !defined __STRICT_ANSI__
   [0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX
 # else
 #  if 4 * BITSET_WORD_BITS < ASCII_CHARS
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index 9a0c2ed..0c72e3f 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -335,7 +335,7 @@ typedef struct
     Idx idx;                   /* for BACK_REF */
     re_context_type ctx_type;  /* for ANCHOR */
   } opr;
-#if __GNUC__ >= 2 && !defined __STRICT_ANSI__
+#if (__GNUC__ >= 2 || defined __clang__) && !defined __STRICT_ANSI__
   re_token_type_t type : 8;
 #else
   re_token_type_t type;
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index cbebc84..6d12cd8 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -215,6 +215,11 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX 
compliant - "
                  "use gnulib module fclose for portable POSIX compliance");
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef fcloseall
+# define fcloseall _fcloseall
+#endif
+
 #if @GNULIB_FDOPEN@
 # if @REPLACE_FDOPEN@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -224,6 +229,12 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX 
compliant - "
 _GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode)
                                   _GL_ARG_NONNULL ((2)));
 _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fdopen
+#   define fdopen _fdopen
+#  endif
+_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
 # else
 _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
 # endif
@@ -233,6 +244,9 @@ _GL_CXXALIASWARN (fdopen);
 /* Assume fdopen is always declared.  */
 _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX 
compliant - "
                  "use gnulib module fdopen for portability");
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef fdopen
+# define fdopen _fdopen
 #endif
 
 #if @GNULIB_FFLUSH@
@@ -297,6 +311,11 @@ _GL_CXXALIASWARN (fgets);
 # endif
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef fileno
+# define fileno _fileno
+#endif
+
 #if @GNULIB_FOPEN@
 # if @REPLACE_FOPEN@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -824,6 +843,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef getw
+# define getw _getw
+#endif
+
 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
 struct obstack;
 /* Grow an obstack with formatted output.  Return the number of
@@ -940,7 +964,7 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - 
"
 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
 # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
      || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
(@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
-#  if defined __GNUC__
+#  if defined __GNUC__ || defined __clang__
 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 /* Don't break __attribute__((format(printf,M,N))).  */
 #    define printf __printf__
@@ -1037,6 +1061,11 @@ _GL_CXXALIASWARN (puts);
 # endif
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef putw
+# define putw _putw
+#endif
+
 #if @GNULIB_REMOVE@
 # if @REPLACE_REMOVE@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1114,7 +1143,7 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - "
 
 #if @GNULIB_SCANF@
 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-#  if defined __GNUC__
+#  if defined __GNUC__ || defined __clang__
 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #    undef scanf
 /* Don't break __attribute__((format(scanf,M,N))).  */
@@ -1170,7 +1199,9 @@ _GL_CXXALIAS_SYS (snprintf, int,
                   (char *restrict str, size_t size,
                    const char *restrict format, ...));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (snprintf);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef snprintf
 # if HAVE_RAW_DECL_SNPRINTF
@@ -1214,6 +1245,11 @@ _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX 
compliant - "
                  "POSIX compliance");
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef tempnam
+# define tempnam _tempnam
+#endif
+
 #if @GNULIB_TMPFILE@
 # if @REPLACE_TMPFILE@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1382,7 +1418,9 @@ _GL_CXXALIAS_SYS (vfscanf, int,
                   (FILE *restrict stream,
                    const char *restrict format, va_list args));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (vfscanf);
+# endif
 #endif
 
 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
@@ -1436,7 +1474,9 @@ _GL_CXXALIAS_RPL (vscanf, int, (const char *restrict 
format, va_list args));
 # else
 _GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (vscanf);
+# endif
 #endif
 
 #if @GNULIB_VSNPRINTF@
@@ -1464,7 +1504,9 @@ _GL_CXXALIAS_SYS (vsnprintf, int,
                   (char *restrict str, size_t size,
                    const char *restrict format, va_list args));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (vsnprintf);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef vsnprintf
 # if HAVE_RAW_DECL_VSNPRINTF
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 5c598a2..47a1309 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -217,6 +217,21 @@ _GL_WARN_ON_USE (canonicalize_file_name,
 # endif
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef ecvt
+# define ecvt _ecvt
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef fcvt
+# define fcvt _fcvt
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef gcvt
+# define gcvt _gcvt
+#endif
+
 #if @GNULIB_GETLOADAVG@
 /* Store max(NELEM,3) load average numbers in LOADAVG[].
    The three numbers are the load average of the last 1 minute, the last 5
@@ -468,6 +483,11 @@ _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
 # endif
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef mktemp
+# define mktemp _mktemp
+#endif
+
 #if @GNULIB_POSIX_OPENPT@
 /* Return an FD open to the master side of a pseudo-terminal.  Flags should
    include O_RDWR, and may also include O_NOCTTY.  */
@@ -546,10 +566,19 @@ _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
 #  endif
 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (putenv, int, (char *string));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef putenv
+#   define putenv _putenv
+#  endif
+_GL_CXXALIAS_MDA (putenv, int, (char *string));
 # else
 _GL_CXXALIAS_SYS (putenv, int, (char *string));
 # endif
 _GL_CXXALIASWARN (putenv);
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef putenv
+# define putenv _putenv
 #endif
 
 #if @GNULIB_QSORT_R@
diff --git a/lib/strftime.h b/lib/strftime.h
index e850163..fe0c419 100644
--- a/lib/strftime.h
+++ b/lib/strftime.h
@@ -24,7 +24,12 @@ extern "C" {
 /* Just like strftime, but with two more arguments:
    POSIX requires that strftime use the local timezone information.
    Use the timezone __TZ instead.  Use __NS as the number of
-   nanoseconds in the %N directive.  */
+   nanoseconds in the %N directive.
+
+   On error, set errno and return 0.  Otherwise, return the number of
+   bytes generated (not counting the trailing NUL), preserving errno
+   if the number is 0.  This errno behavior is in draft POSIX 202x
+   plus some requested changes to POSIX.  */
 size_t nstrftime (char *restrict, size_t, char const *, struct tm const *,
                   timezone_t __tz, int __ns);
 
diff --git a/lib/string.in.h b/lib/string.in.h
index c0c1a54..7d83668 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -123,6 +123,12 @@ _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the 
ffsll module");
 #endif
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef memccpy
+# define memccpy _memccpy
+#endif
+
+
 /* Return the first instance of C within N bytes of S, or NULL.  */
 #if @GNULIB_MEMCHR@
 # if @REPLACE_MEMCHR@
@@ -384,6 +390,12 @@ _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
 #  endif
 _GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strdup
+#   define strdup _strdup
+#  endif
+_GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
 # else
 #  if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
     /* strdup exists as a function and as a macro.  Get rid of the macro.  */
@@ -401,6 +413,9 @@ _GL_CXXALIASWARN (strdup);
 _GL_WARN_ON_USE (strdup, "strdup is unportable - "
                  "use gnulib module strdup for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef strdup
+# define strdup _strdup
 #endif
 
 /* Append no more than N characters from SRC onto DEST.  */
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index 7a7b157..72cb9ba 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -177,14 +177,14 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef close
 #   define close close_used_without_including_unistd_h
-#  else
+#  elif !defined __clang__
     _GL_WARN_ON_USE (close,
                      "close() used without including <unistd.h>");
 #  endif
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef gethostname
 #   define gethostname gethostname_used_without_including_unistd_h
-#  else
+#  elif !defined __clang__
     _GL_WARN_ON_USE (gethostname,
                      "gethostname() used without including <unistd.h>");
 #  endif
@@ -219,7 +219,7 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
 #   define setsockopt          setsockopt_used_without_including_sys_socket_h
 #   undef shutdown
 #   define shutdown            shutdown_used_without_including_sys_socket_h
-#  else
+#  elif !defined __clang__
     _GL_WARN_ON_USE (socket,
                      "socket() used without including <sys/socket.h>");
     _GL_WARN_ON_USE (connect,
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 89e167f..3e0e4b2 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -391,6 +391,12 @@ struct stat
 #endif
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef chmod
+# define chmod _chmod
+#endif
+
+
 #if @GNULIB_FCHMODAT@
 # if @REPLACE_FCHMODAT@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -432,7 +438,9 @@ _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
 # else
 _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (fstat);
+# endif
 #elif @GNULIB_OVERRIDES_STRUCT_STAT@
 # undef fstat
 # define fstat fstat_used_without_requesting_gnulib_module_fstat
@@ -800,6 +808,12 @@ _GL_WARN_ON_USE (stat, "stat is unportable - "
 #endif
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef umask
+# define umask _umask
+#endif
+
+
 #if @GNULIB_UTIMENSAT@
 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
    implementation relies on futimesat, which on Solaris 10 makes an invocation
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
index d30b267..1c12d5f 100644
--- a/lib/sys_time.in.h
+++ b/lib/sys_time.in.h
@@ -135,7 +135,7 @@ _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable 
- "
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef close
 #   define close close_used_without_including_unistd_h
-#  else
+#  elif !defined __clang__
      _GL_WARN_ON_USE (close,
                       "close() used without including <unistd.h>");
 #  endif
diff --git a/lib/time.in.h b/lib/time.in.h
index 1d11650..32e6ec0 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -135,13 +135,19 @@ _GL_CXXALIASWARN (nanosleep);
 #   endif
 _GL_FUNCDECL_RPL (tzset, void, (void));
 _GL_CXXALIAS_RPL (tzset, void, (void));
-#  else
-#   if ! @HAVE_TZSET@
-_GL_FUNCDECL_SYS (tzset, void, (void));
+#  elif defined _WIN32 && !defined __CYGWIN__
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef tzset
+#    define tzset _tzset
 #   endif
+_GL_CXXALIAS_MDA (tzset, void, (void));
+#  else
 _GL_CXXALIAS_SYS (tzset, void, (void));
 #  endif
 _GL_CXXALIASWARN (tzset);
+# elif defined _WIN32 && !defined __CYGWIN__
+#  undef tzset
+#  define tzset _tzset
 # endif
 
 /* Return the 'time_t' representation of TP and normalize TP.  */
diff --git a/lib/time_rz.c b/lib/time_rz.c
index 5d85963..95438cf 100644
--- a/lib/time_rz.c
+++ b/lib/time_rz.c
@@ -54,31 +54,6 @@ enum { ABBR_SIZE_MIN = DEFAULT_MXFAST - offsetof (struct 
tm_zone, abbrs) };
    matters; the pointer is never dereferenced.  */
 static timezone_t const local_tz = (timezone_t) 1;
 
-#if HAVE_TM_ZONE || HAVE_TZNAME
-
-/* Return true if the values A and B differ according to the rules for
-   tm_isdst: A and B differ if one is zero and the other positive.  */
-static bool
-isdst_differ (int a, int b)
-{
-  return !a != !b && 0 <= a && 0 <= b;
-}
-
-/* Return true if A and B are equal.  */
-static int
-equal_tm (const struct tm *a, const struct tm *b)
-{
-  return ! ((a->tm_sec ^ b->tm_sec)
-            | (a->tm_min ^ b->tm_min)
-            | (a->tm_hour ^ b->tm_hour)
-            | (a->tm_mday ^ b->tm_mday)
-            | (a->tm_mon ^ b->tm_mon)
-            | (a->tm_year ^ b->tm_year)
-            | isdst_differ (a->tm_isdst, b->tm_isdst));
-}
-
-#endif
-
 /* Copy to ABBRS the abbreviation at ABBR with size ABBR_SIZE (this
    includes its trailing null byte).  Append an extra null byte to
    mark the end of ABBRS.  */
@@ -327,17 +302,25 @@ mktime_z (timezone_t tz, struct tm *tm)
       timezone_t old_tz = set_tz (tz);
       if (old_tz)
         {
-          time_t t = mktime (tm);
-#if HAVE_TM_ZONE || HAVE_TZNAME
-          time_t badtime = -1;
           struct tm tm_1;
-          if ((t != badtime
-               || (localtime_r (&t, &tm_1) && equal_tm (tm, &tm_1)))
-              && !save_abbr (tz, tm))
-            t = badtime;
+          tm_1.tm_sec = tm->tm_sec;
+          tm_1.tm_min = tm->tm_min;
+          tm_1.tm_hour = tm->tm_hour;
+          tm_1.tm_mday = tm->tm_mday;
+          tm_1.tm_mon = tm->tm_mon;
+          tm_1.tm_year = tm->tm_year;
+          tm_1.tm_yday = -1;
+          tm_1.tm_isdst = tm->tm_isdst;
+          time_t t = mktime (&tm_1);
+          bool ok = 0 <= tm_1.tm_yday;
+#if HAVE_TM_ZONE || HAVE_TZNAME
+          ok = ok && save_abbr (tz, &tm_1);
 #endif
-          if (revert_tz (old_tz))
-            return t;
+          if (revert_tz (old_tz) && ok)
+            {
+              *tm = tm_1;
+              return t;
+            }
         }
       return -1;
     }
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index a81a14f..357a35e 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -273,6 +273,12 @@ _GL_INLINE_HEADER_BEGIN
 _GL_FUNCDECL_RPL (access, int, (const char *file, int mode)
                                _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef access
+#   define access _access
+#  endif
+_GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
 # else
 _GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
 # endif
@@ -286,11 +292,22 @@ _GL_WARN_ON_USE (access, "access does not always support 
X_OK - "
                  "also, this function is a security risk - "
                  "use the gnulib module faccessat instead");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef access
+# define access _access
 #endif
 
 
 #if @GNULIB_CHDIR@
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef chdir
+#   define chdir _chdir
+#  endif
+_GL_CXXALIAS_MDA (chdir, int, (const char *file));
+# else
 _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
+# endif
 _GL_CXXALIASWARN (chdir);
 #elif defined GNULIB_POSIXCHECK
 # undef chdir
@@ -298,6 +315,9 @@ _GL_CXXALIASWARN (chdir);
 _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
                  "use gnulib module chdir for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef chdir
+# define chdir _chdir
 #endif
 
 
@@ -342,6 +362,12 @@ _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on 
some systems and "
 #  endif
 _GL_FUNCDECL_RPL (close, int, (int fd));
 _GL_CXXALIAS_RPL (close, int, (int fd));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef close
+#   define close _close
+#  endif
+_GL_CXXALIAS_MDA (close, int, (int fd));
 # else
 _GL_CXXALIAS_SYS (close, int, (int fd));
 # endif
@@ -354,6 +380,9 @@ _GL_CXXALIASWARN (close);
 /* Assume close is always declared.  */
 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
                  "use gnulib module close for portability");
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef close
+# define close _close
 #endif
 
 
@@ -382,6 +411,12 @@ _GL_WARN_ON_USE (copy_file_range,
 #  endif
 _GL_FUNCDECL_RPL (dup, int, (int oldfd));
 _GL_CXXALIAS_RPL (dup, int, (int oldfd));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef dup
+#   define dup _dup
+#  endif
+_GL_CXXALIAS_MDA (dup, int, (int oldfd));
 # else
 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
 # endif
@@ -392,6 +427,9 @@ _GL_CXXALIASWARN (dup);
 _GL_WARN_ON_USE (dup, "dup is unportable - "
                  "use gnulib module dup for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef dup
+# define dup _dup
 #endif
 
 
@@ -407,6 +445,12 @@ _GL_WARN_ON_USE (dup, "dup is unportable - "
 #  endif
 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef dup2
+#   define dup2 _dup2
+#  endif
+_GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
 # else
 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
 # endif
@@ -417,6 +461,9 @@ _GL_CXXALIASWARN (dup2);
 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
                  "use gnulib module dup2 for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef dup2
+# define dup2 _dup2
 #endif
 
 
@@ -517,6 +564,43 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
 #endif
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef execl
+# define execl _execl
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef execle
+# define execle _execle
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef execlp
+# define execlp _execlp
+#endif
+
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef execv
+# define execv _execv
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef execve
+# define execve _execve
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef execvp
+# define execvp _execvp
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef execvpe
+# define execvpe _execvpe
+#endif
+
+
 #if @GNULIB_FACCESSAT@
 # if @REPLACE_FACCESSAT@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -692,6 +776,12 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
 #  endif
 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getcwd
+#   define getcwd _getcwd
+#  endif
+_GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size));
 # else
 /* Need to cast, because on mingw, the second parameter is
                                                    int size.  */
@@ -704,6 +794,9 @@ _GL_CXXALIASWARN (getcwd);
 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
                  "use gnulib module getcwd for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef getcwd
+# define getcwd _getcwd
 #endif
 
 
@@ -1038,6 +1131,12 @@ _GL_WARN_ON_USE (getpass, "getpass is unportable - "
 #endif
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef getpid
+# define getpid _getpid
+#endif
+
+
 #if @GNULIB_GETUSERSHELL@
 /* Return the next valid login shell on the system, or NULL when the end of
    the list has been reached.  */
@@ -1110,6 +1209,12 @@ _GL_WARN_ON_USE (group_member, "group_member is 
unportable - "
 #  endif
 _GL_FUNCDECL_RPL (isatty, int, (int fd));
 _GL_CXXALIAS_RPL (isatty, int, (int fd));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef isatty
+#   define isatty _isatty
+#  endif
+_GL_CXXALIAS_MDA (isatty, int, (int fd));
 # else
 _GL_CXXALIAS_SYS (isatty, int, (int fd));
 # endif
@@ -1120,6 +1225,9 @@ _GL_CXXALIASWARN (isatty);
 _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
                  "use gnulib module isatty for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef isatty
+# define isatty _isatty
 #endif
 
 
@@ -1231,6 +1339,12 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - "
 #  endif
 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef lseek
+#   define lseek _lseek
+#  endif
+_GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence));
 # else
 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
 # endif
@@ -1241,6 +1355,9 @@ _GL_CXXALIASWARN (lseek);
 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
                  "systems - use gnulib module lseek for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef lseek
+# define lseek _lseek
 #endif
 
 
@@ -1373,6 +1490,12 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
 _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
                                  _GL_ARG_NONNULL ((2)));
 _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef read
+#   define read _read
+#  endif
+_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count));
 # else
 /* Need to cast, because on mingw, the third parameter is
                                                           unsigned int count
@@ -1380,6 +1503,9 @@ _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, 
size_t count));
 _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
 # endif
 _GL_CXXALIASWARN (read);
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef read
+# define read _read
 #endif
 
 
@@ -1462,6 +1588,12 @@ _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable 
- "
 #  endif
 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef rmdir
+#   define rmdir _rmdir
+#  endif
+_GL_CXXALIAS_MDA (rmdir, int, (char const *name));
 # else
 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
 # endif
@@ -1472,6 +1604,9 @@ _GL_CXXALIASWARN (rmdir);
 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
                  "use gnulib module rmdir for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef rmdir
+# define rmdir _rmdir
 #endif
 
 
@@ -1530,6 +1665,12 @@ _GL_WARN_ON_USE (sleep, "sleep is unportable - "
 #endif
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef swab
+# define swab _swab
+#endif
+
+
 #if @GNULIB_SYMLINK@
 # if @REPLACE_SYMLINK@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1654,6 +1795,12 @@ _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - 
"
 #  endif
 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (unlink, int, (char const *file));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef unlink
+#   define unlink _unlink
+#  endif
+_GL_CXXALIAS_MDA (unlink, int, (char const *file));
 # else
 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
 # endif
@@ -1664,6 +1811,9 @@ _GL_CXXALIASWARN (unlink);
 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
                  "use gnulib module unlink for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef unlink
+# define unlink _unlink
 #endif
 
 
@@ -1735,6 +1885,12 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
                                   _GL_ARG_NONNULL ((2)));
 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef write
+#   define write _write
+#  endif
+_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count));
 # else
 /* Need to cast, because on mingw, the third parameter is
                                                              unsigned int count
@@ -1742,6 +1898,9 @@ _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void 
*buf, size_t count));
 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t 
count));
 # endif
 _GL_CXXALIASWARN (write);
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef write
+# define write _write
 #endif
 
 _GL_INLINE_HEADER_END
diff --git a/lib/verify.h b/lib/verify.h
index 58172f3..0ba8d57 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -23,11 +23,15 @@
 
 /* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert (R, DIAGNOSTIC)
    works as per C11.  This is supported by GCC 4.6.0 and later, in C
-   mode.
+   mode, and by clang (also in C++ mode).
 
    Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as
-   per C2X, and define _GL_HAVE_STATIC_ASSERT1 if static_assert (R)
-   works as per C++17.  This is supported by GCC 9.1 and later.
+   per C2X.  This is supported by GCC 9.1 and later, and by clang in
+   C++1z mode.
+
+   Define _GL_HAVE_STATIC_ASSERT1 if static_assert (R) works as per
+   C++17.  This is supported by GCC 9.1 and later, and by clang in
+   C++1z mode.
 
    Support compilers claiming conformance to the relevant standard,
    and also support GCC when not pedantic.  If we were willing to slow
@@ -35,7 +39,8 @@
    since this affects only the quality of diagnostics, why bother?  */
 #ifndef __cplusplus
 # if (201112L <= __STDC_VERSION__ \
-      || (!defined __STRICT_ANSI__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)))
+      || (!defined __STRICT_ANSI__ \
+          && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 4 <= __clang_major__)))
 #  define _GL_HAVE__STATIC_ASSERT 1
 # endif
 # if (202000L <= __STDC_VERSION__ \
@@ -43,7 +48,15 @@
 #  define _GL_HAVE__STATIC_ASSERT1 1
 # endif
 #else
-# if 201703L <= __cplusplus || 9 <= __GNUC__
+# if 4 <= __clang_major__
+#  define _GL_HAVE__STATIC_ASSERT 1
+# endif
+# if 4 <= __clang_major__ && 201411 <= __cpp_static_assert
+#  define _GL_HAVE__STATIC_ASSERT1 1
+# endif
+# if 201703L <= __cplusplus \
+     || 9 <= __GNUC__ \
+     || (4 <= __clang_major__ && 201411 <= __cpp_static_assert)
 #  define _GL_HAVE_STATIC_ASSERT1 1
 # endif
 #endif
diff --git a/m4/00gnulib.m4 b/m4/00gnulib.m4
index 06eff4f..14628c3 100644
--- a/m4/00gnulib.m4
+++ b/m4/00gnulib.m4
@@ -1,44 +1,12 @@
-# 00gnulib.m4 serial 7
+# 00gnulib.m4 serial 8
 dnl Copyright (C) 2009-2020 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.
 
 dnl This file must be named something that sorts before all other
-dnl gnulib-provided .m4 files.  The first part is needed until such time
-dnl as we can assume Autoconf 2.64, with its improved AC_DEFUN_ONCE and
-dnl m4_divert semantics.  The second part is needed until the clang fix
-dnl has been included in Autoconf.
-
-# Until autoconf 2.63, handling of the diversion stack required m4_init
-# to be called first; but this does not happen with aclocal.  Wrapping
-# the entire execution in another layer of the diversion stack fixes this.
-# Worse, prior to autoconf 2.62, m4_wrap depended on the underlying m4
-# for whether it was FIFO or LIFO; in order to properly balance with
-# m4_init, we need to undo our push just before anything wrapped within
-# the m4_init body.  The way to ensure this is to wrap both sides of
-# m4_init with a one-shot macro that does the pop at the right time.
-m4_ifndef([_m4_divert_diversion],
-[m4_divert_push([KILL])
-m4_define([gl_divert_fixup], [m4_divert_pop()m4_define([$0])])
-m4_define([m4_init],
-  [gl_divert_fixup()]m4_defn([m4_init])[gl_divert_fixup()])])
-
-
-# AC_DEFUN_ONCE([NAME], VALUE)
-# ----------------------------
-# Define NAME to expand to VALUE on the first use (whether by direct
-# expansion, or by AC_REQUIRE), and to nothing on all subsequent uses.
-# Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier.  This
-# definition is slower than the version in Autoconf 2.64, because it
-# can only use interfaces that existed since 2.59; but it achieves the
-# same effect.  Quoting is necessary to avoid confusing Automake.
-m4_version_prereq([2.63.263], [],
-[m4_define([AC][_DEFUN_ONCE],
-  [AC][_DEFUN([$1],
-    [AC_REQUIRE([_gl_DEFUN_ONCE([$1])],
-      [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl
-[AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])])
+dnl gnulib-provided .m4 files.  It is needed until the clang fix has
+dnl been included in Autoconf.
 
 # The following definitions arrange to use a compiler option
 # -Werror=implicit-function-declaration in AC_CHECK_DECL, when the
diff --git a/m4/absolute-header.m4 b/m4/absolute-header.m4
index 39726ba..c043233 100644
--- a/m4/absolute-header.m4
+++ b/m4/absolute-header.m4
@@ -1,4 +1,4 @@
-# absolute-header.m4 serial 16
+# absolute-header.m4 serial 17
 dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,23 +22,21 @@ dnl From Derek Price.
 AC_DEFUN([gl_ABSOLUTE_HEADER],
 [AC_REQUIRE([AC_CANONICAL_HOST])
 AC_LANG_PREPROC_REQUIRE()dnl
-dnl FIXME: gl_absolute_header and ac_header_exists must be used unquoted
-dnl until we can assume autoconf 2.64 or newer.
 m4_foreach_w([gl_HEADER_NAME], [$1],
   [AS_VAR_PUSHDEF([gl_absolute_header],
                   [gl_cv_absolute_]m4_defn([gl_HEADER_NAME]))dnl
   AC_CACHE_CHECK([absolute name of <]m4_defn([gl_HEADER_NAME])[>],
-    m4_defn([gl_absolute_header]),
+    [gl_absolute_header],
     [AS_VAR_PUSHDEF([ac_header_exists],
                     [ac_cv_header_]m4_defn([gl_HEADER_NAME]))dnl
     AC_CHECK_HEADERS_ONCE(m4_defn([gl_HEADER_NAME]))dnl
-    if test AS_VAR_GET(ac_header_exists) = yes; then
+    if test AS_VAR_GET([ac_header_exists]) = yes; then
       gl_ABSOLUTE_HEADER_ONE(m4_defn([gl_HEADER_NAME]))
     fi
     AS_VAR_POPDEF([ac_header_exists])dnl
     ])dnl
   AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_defn([gl_HEADER_NAME])),
-                     ["AS_VAR_GET(gl_absolute_header)"],
+                     ["AS_VAR_GET([gl_absolute_header])"],
                      [Define this to an absolute name of 
<]m4_defn([gl_HEADER_NAME])[>.])
   AS_VAR_POPDEF([gl_absolute_header])dnl
 ])dnl
diff --git a/m4/alloca.m4 b/m4/alloca.m4
index b777f84..d841489 100644
--- a/m4/alloca.m4
+++ b/m4/alloca.m4
@@ -1,4 +1,4 @@
-# alloca.m4 serial 17
+# alloca.m4 serial 18
 dnl Copyright (C) 2002-2004, 2006-2007, 2009-2020 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -102,7 +102,7 @@ AH_VERBATIM([STACK_DIRECTION],
         STACK_DIRECTION > 0 => grows toward higher addresses
         STACK_DIRECTION < 0 => grows toward lower addresses
         STACK_DIRECTION = 0 => direction of growth unknown */
-@%:@undef STACK_DIRECTION])dnl
+#undef STACK_DIRECTION])dnl
 AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
 ])
 ])
diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4
index bdc5c8f..14ea3e1 100644
--- a/m4/canonicalize.m4
+++ b/m4/canonicalize.m4
@@ -1,4 +1,4 @@
-# canonicalize.m4 serial 31
+# canonicalize.m4 serial 33
 
 dnl Copyright (C) 2003-2007, 2009-2020 Free Software Foundation, Inc.
 
@@ -56,7 +56,16 @@ AC_DEFUN([gl_CANONICALIZE_LGPL],
 AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE],
 [
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-  AC_CHECK_FUNCS_ONCE([canonicalize_file_name getcwd readlink])
+  AC_CHECK_FUNCS_ONCE([canonicalize_file_name readlink])
+
+  dnl On native Windows, we use _getcwd(), regardless whether getcwd() is
+  dnl available through the linker option '-loldnames'.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw*) ;;
+    *)      AC_CHECK_FUNCS([getcwd]) ;;
+  esac
+
   AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
   AC_REQUIRE([gl_FUNC_REALPATH_WORKS])
   AC_CHECK_HEADERS_ONCE([sys/param.h])
@@ -70,6 +79,7 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS],
   AC_CHECK_FUNCS_ONCE([realpath])
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CACHE_CHECK([whether realpath works], [gl_cv_func_realpath_works], [
+    rm -rf conftest.a conftest.d
     touch conftest.a
     mkdir conftest.d
     AC_RUN_IFELSE([
diff --git a/m4/dup2.m4 b/m4/dup2.m4
index 462bfd0..a82798d 100644
--- a/m4/dup2.m4
+++ b/m4/dup2.m4
@@ -1,4 +1,4 @@
-#serial 26
+#serial 27
 dnl Copyright (C) 2002, 2005, 2007, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -16,6 +16,7 @@ AC_DEFUN([gl_FUNC_DUP2],
            #include <limits.h>
            #include <sys/resource.h>
            #include <unistd.h>
+           ]GL_MDA_DEFINES[
            #ifndef RLIM_SAVED_CUR
            # define RLIM_SAVED_CUR RLIM_INFINITY
            #endif
diff --git a/m4/fchmodat.m4 b/m4/fchmodat.m4
index e3f2f04..cf5c879 100644
--- a/m4/fchmodat.m4
+++ b/m4/fchmodat.m4
@@ -1,4 +1,4 @@
-# fchmodat.m4 serial 4
+# fchmodat.m4 serial 5
 dnl Copyright (C) 2004-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -40,7 +40,7 @@ AC_DEFUN([gl_FUNC_FCHMODAT],
               #ifndef S_IRWXO
                #define S_IRWXO 0007
               #endif
-            ]],
+            ]GL_MDA_DEFINES],
             [[
               int permissive = S_IRWXU | S_IRWXG | S_IRWXO;
               int desired = S_IRUSR | S_IWUSR;
diff --git a/m4/fcntl.m4 b/m4/fcntl.m4
index 562ae23..ea24f3d 100644
--- a/m4/fcntl.m4
+++ b/m4/fcntl.m4
@@ -1,4 +1,4 @@
-# fcntl.m4 serial 9
+# fcntl.m4 serial 10
 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -34,6 +34,7 @@ AC_DEFUN([gl_FUNC_FCNTL],
               #include <limits.h>
               #include <sys/resource.h>
               #include <unistd.h>
+              ]GL_MDA_DEFINES[
               #ifndef RLIM_SAVED_CUR
               # define RLIM_SAVED_CUR RLIM_INFINITY
               #endif
diff --git a/m4/fdopendir.m4 b/m4/fdopendir.m4
index d9cc1a0..9937a74 100644
--- a/m4/fdopendir.m4
+++ b/m4/fdopendir.m4
@@ -1,4 +1,4 @@
-# serial 12
+# serial 14
 # See if we need to provide fdopendir.
 
 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
@@ -25,10 +25,12 @@ AC_DEFUN([gl_FUNC_FDOPENDIR],
   else
     AC_CACHE_CHECK([whether fdopendir works],
       [gl_cv_func_fdopendir_works],
-      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM([[
 #include <dirent.h>
 #include <fcntl.h>
 #include <unistd.h>
+]GL_MDA_DEFINES[
 #if !HAVE_DECL_FDOPENDIR
 extern
 # ifdef __cplusplus
@@ -36,12 +38,14 @@ extern
 # endif
 DIR *fdopendir (int);
 #endif
-]], [int result = 0;
-     int fd = open ("conftest.c", O_RDONLY);
-     if (fd < 0) result |= 1;
-     if (fdopendir (fd)) result |= 2;
-     if (close (fd)) result |= 4;
-     return result;])],
+]],
+            [[int result = 0;
+              int fd = open ("conftest.c", O_RDONLY);
+              if (fd < 0) result |= 1;
+              if (fdopendir (fd)) result |= 2;
+              if (close (fd)) result |= 4;
+              return result;
+            ]])],
          [gl_cv_func_fdopendir_works=yes],
          [gl_cv_func_fdopendir_works=no],
          [case "$host_os" in
diff --git a/m4/fpending.m4 b/m4/fpending.m4
index ea9725e..edabcec 100644
--- a/m4/fpending.m4
+++ b/m4/fpending.m4
@@ -1,4 +1,4 @@
-# serial 22
+# serial 23
 
 # Copyright (C) 2000-2001, 2004-2020 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -25,7 +25,7 @@ AC_DEFUN([gl_FUNC_FPENDING],
   AC_CACHE_CHECK([for __fpending], [gl_cv_func___fpending],
     [
       AC_LINK_IFELSE(
-        [AC_LANG_PROGRAM([$fp_headers],
+        [AC_LANG_PROGRAM([[$fp_headers]],
            [[return ! __fpending (stdin);]])],
         [gl_cv_func___fpending=yes],
         [gl_cv_func___fpending=no])
diff --git a/m4/futimens.m4 b/m4/futimens.m4
index dc5cfa9..145b8ff 100644
--- a/m4/futimens.m4
+++ b/m4/futimens.m4
@@ -1,4 +1,4 @@
-# serial 8
+# serial 9
 # See if we need to provide futimens replacement.
 
 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
@@ -24,7 +24,8 @@ AC_DEFUN([gl_FUNC_FUTIMENS],
 #include <sys/stat.h>
 #include <unistd.h>
 #include <errno.h>
-]], [[struct timespec ts[2];
+]GL_MDA_DEFINES],
+     [[struct timespec ts[2];
       int fd = creat ("conftest.file", 0600);
       struct stat st;
       if (fd < 0) return 1;
diff --git a/m4/getdtablesize.m4 b/m4/getdtablesize.m4
index ab2e3fe..af32864 100644
--- a/m4/getdtablesize.m4
+++ b/m4/getdtablesize.m4
@@ -1,4 +1,4 @@
-# getdtablesize.m4 serial 7
+# getdtablesize.m4 serial 8
 dnl Copyright (C) 2008-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -29,13 +29,16 @@ AC_DEFUN([gl_FUNC_GETDTABLESIZE],
            dnl correctly require setrlimit before getdtablesize() can report
            dnl a larger value.
            AC_RUN_IFELSE([
-             AC_LANG_PROGRAM([[#include <unistd.h>]],
-               [int size = getdtablesize();
-                if (dup2 (0, getdtablesize()) != -1)
-                  return 1;
-                if (size != getdtablesize())
-                  return 2;
-               ])],
+             AC_LANG_PROGRAM(
+               [[#include <unistd.h>]
+                GL_MDA_DEFINES
+               ],
+               [[int size = getdtablesize();
+                 if (dup2 (0, getdtablesize()) != -1)
+                   return 1;
+                 if (size != getdtablesize())
+                   return 2;
+               ]])],
              [gl_cv_func_getdtablesize_works=yes],
              [gl_cv_func_getdtablesize_works=no],
              [case "$host_os" in
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index 8e96965..9fe328e 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -7,7 +7,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-#serial 9
+#serial 10
 
 # Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
 # New applications should use gl_GETLOADAVG instead.
@@ -147,7 +147,7 @@ fi
 AC_CHECK_HEADERS([nlist.h],
 [AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
                   [], [],
-                  [@%:@include <nlist.h>])
+                  [#include <nlist.h>])
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
                    [[struct nlist x;
                     #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 03da228..33e56fa 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 55
+# gnulib-common.m4 serial 57
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -480,14 +480,6 @@ AC_DEFUN([gl_FEATURES_H],
   AC_SUBST([HAVE_FEATURES_H])
 ])
 
-# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH])
-# ----------------------------------------------------
-# Backport of autoconf-2.63b's macro.
-# Remove this macro when we can assume autoconf >= 2.64.
-m4_ifndef([AS_VAR_IF],
-[m4_define([AS_VAR_IF],
-[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
-
 # gl_PROG_CC_C99
 # Modifies the value of the shell variable CC in an attempt to make $CC
 # understand ISO C99 source code.
@@ -660,6 +652,72 @@ AC_DEFUN([gl_CACHE_VAL_SILENT],
   as_echo_n="$saved_as_echo_n"
 ])
 
-# AS_VAR_COPY was added in autoconf 2.63b
-m4_define_default([AS_VAR_COPY],
-[AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
+dnl Expands to some code for use in .c programs that, on native Windows, 
defines
+dnl the Microsoft deprecated alias function names to the underscore-prefixed
+dnl actual function names. With this macro, these function names are available
+dnl without linking with '-loldnames' and without generating warnings.
+dnl Usage: Use it after all system header files are included.
+dnl          #include <...>
+dnl          #include <...>
+dnl          ]GL_MDA_DEFINES[
+dnl          ...
+AC_DEFUN([GL_MDA_DEFINES],[
+AC_REQUIRE([_GL_MDA_DEFINES])
+[$gl_mda_defines]
+])
+AC_DEFUN([_GL_MDA_DEFINES],
+[gl_mda_defines='
+#if defined _WIN32 && !defined __CYGWIN__
+#define access    _access
+#define chdir     _chdir
+#define chmod     _chmod
+#define close     _close
+#define creat     _creat
+#define dup       _dup
+#define dup2      _dup2
+#define ecvt      _ecvt
+#define execl     _execl
+#define execle    _execle
+#define execlp    _execlp
+#define execv     _execv
+#define execve    _execve
+#define execvp    _execvp
+#define execvpe   _execvpe
+#define fcloseall _fcloseall
+#define fcvt      _fcvt
+#define fdopen    _fdopen
+#define fileno    _fileno
+#define gcvt      _gcvt
+#define getcwd    _getcwd
+#define getpid    _getpid
+#define getw      _getw
+#define isatty    _isatty
+#define j0        _j0
+#define j1        _j1
+#define jn        _jn
+#define lfind     _lfind
+#define lsearch   _lsearch
+#define lseek     _lseek
+#define memccpy   _memccpy
+#define mkdir     _mkdir
+#define mktemp    _mktemp
+#define open      _open
+#define putenv    _putenv
+#define putw      _putw
+#define read      _read
+#define rmdir     _rmdir
+#define strdup    _strdup
+#define swab      _swab
+#define tempnam   _tempnam
+#define tzset     _tzset
+#define umask     _umask
+#define unlink    _unlink
+#define utime     _utime
+#define wcsdup    _wcsdup
+#define write     _write
+#define y0        _y0
+#define y1        _y1
+#define yn        _yn
+#endif
+'
+])
diff --git a/m4/include_next.m4 b/m4/include_next.m4
index 9009e29..33601aa 100644
--- a/m4/include_next.m4
+++ b/m4/include_next.m4
@@ -1,4 +1,4 @@
-# include_next.m4 serial 24
+# include_next.m4 serial 25
 dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -176,42 +176,40 @@ AC_DEFUN([gl_NEXT_HEADERS_INTERNAL],
     [AC_CHECK_HEADERS_ONCE([$1])
     ])
 
-dnl FIXME: gl_next_header and gl_header_exists must be used unquoted
-dnl until we can assume autoconf 2.64 or newer.
   m4_foreach_w([gl_HEADER_NAME], [$1],
     [AS_VAR_PUSHDEF([gl_next_header],
                     [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
      if test $gl_cv_have_include_next = yes; then
-       AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>'])
+       AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
      else
        AC_CACHE_CHECK(
          [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
-         m4_defn([gl_next_header]),
+         [gl_next_header],
          [m4_if([$2], [check],
             [AS_VAR_PUSHDEF([gl_header_exists],
                             [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
-             if test AS_VAR_GET(gl_header_exists) = yes; then
+             if test AS_VAR_GET([gl_header_exists]) = yes; then
              AS_VAR_POPDEF([gl_header_exists])
             ])
            gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME)
            AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME))
-           AS_VAR_SET(gl_next_header, ['"'$gl_header'"'])
+           AS_VAR_SET([gl_next_header], ['"'$gl_header'"'])
           m4_if([$2], [check],
             [else
-               AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>'])
+               AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
              fi
             ])
          ])
      fi
      AC_SUBST(
        AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
-       [AS_VAR_GET(gl_next_header)])
+       [AS_VAR_GET([gl_next_header])])
      if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = 
buggy; then
        # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
        gl_next_as_first_directive='<'gl_HEADER_NAME'>'
      else
        # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
-       gl_next_as_first_directive=AS_VAR_GET(gl_next_header)
+       gl_next_as_first_directive=AS_VAR_GET([gl_next_header])
      fi
      AC_SUBST(
        AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])),
diff --git a/m4/largefile.m4 b/m4/largefile.m4
index f7140dd..f4c5d3a 100644
--- a/m4/largefile.m4
+++ b/m4/largefile.m4
@@ -30,12 +30,12 @@ m4_version_prereq([2.70], [] ,[
 # _AC_SYS_LARGEFILE_TEST_INCLUDES
 # -------------------------------
 m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
-[@%:@include <sys/types.h>
+[#include <sys/types.h>
  /* Check that off_t can represent 2**63 - 1 correctly.
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-@%:@define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
+#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
   int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
                        && LARGE_OFF_T % 2147483647 == 1)
                       ? 1 : -1]];[]dnl
@@ -54,7 +54,7 @@ m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
     [AC_LANG_PROGRAM([$5], [$6])],
     [$3=no; break])
   m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
-    [AC_LANG_PROGRAM([@%:@define $1 $2
+    [AC_LANG_PROGRAM([#define $1 $2
 $5], [$6])],
     [$3=$2; break])
   $3=unknown
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index d18da04..a37cd15 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,4 +1,4 @@
-# manywarnings.m4 serial 20
+# manywarnings.m4 serial 21
 dnl Copyright (C) 2008-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -39,8 +39,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
 
 # Specialization for _AC_LANG = C.
-# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b.
-m4_defun([gl_MANYWARN_ALL_GCC(C)],
+AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
 [
   AC_LANG_PUSH([C])
 
@@ -210,8 +209,7 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
 ])
 
 # Specialization for _AC_LANG = C++.
-# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b.
-m4_defun([gl_MANYWARN_ALL_GCC(C++)],
+AC_DEFUN([gl_MANYWARN_ALL_GCC(C++)],
 [
   gl_MANYWARN_ALL_GCC_CXX_IMPL([$1])
 ])
diff --git a/m4/mktime.m4 b/m4/mktime.m4
index 8d9b827..4e7e423 100644
--- a/m4/mktime.m4
+++ b/m4/mktime.m4
@@ -1,4 +1,4 @@
-# serial 32
+# serial 35
 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2020 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -31,7 +31,6 @@ AC_DEFUN([gl_FUNC_MKTIME_WORKS],
   dnl in Autoconf and because it invokes AC_LIBOBJ.
   AC_CHECK_HEADERS_ONCE([unistd.h])
   AC_CHECK_DECLS_ONCE([alarm])
-  AC_CHECK_FUNCS_ONCE([tzset])
   AC_REQUIRE([gl_MULTIARCH])
   AC_CACHE_CHECK([for working mktime], [gl_cv_func_working_mktime],
     [if test $APPLE_UNIVERSAL_BUILD = 1; then
@@ -55,13 +54,12 @@ AC_DEFUN([gl_FUNC_MKTIME_WORKS],
 # include <signal.h>
 #endif
 
+]GL_MDA_DEFINES[
+
 #ifndef TIME_T_IS_SIGNED
 # define TIME_T_IS_SIGNED 0
 #endif
 
-/* Work around redefinition to rpl_putenv by other config tests.  */
-#undef putenv
-
 static time_t time_t_max;
 static time_t time_t_min;
 
diff --git a/m4/nstrftime.m4 b/m4/nstrftime.m4
index 6f2762a..e4eb87d 100644
--- a/m4/nstrftime.m4
+++ b/m4/nstrftime.m4
@@ -1,4 +1,4 @@
-# serial 35
+# serial 36
 
 # Copyright (C) 1996-1997, 1999-2007, 2009-2020 Free Software Foundation, Inc.
 #
@@ -17,8 +17,6 @@ AC_DEFUN([gl_FUNC_GNU_STRFTIME],
 
  AC_REQUIRE([gl_TM_GMTOFF])
 
- AC_CHECK_FUNCS_ONCE([tzset])
-
  AC_DEFINE([my_strftime], [nstrftime],
    [Define to the name of the strftime replacement function.])
 ])
diff --git a/m4/open-slash.m4 b/m4/open-slash.m4
index 1e57c96..5d84f2b 100644
--- a/m4/open-slash.m4
+++ b/m4/open-slash.m4
@@ -1,4 +1,4 @@
-# open-slash.m4 serial 1
+# open-slash.m4 serial 2
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -25,6 +25,7 @@ AC_DEFUN([gl_OPEN_TRAILING_SLASH_BUG],
 #if HAVE_UNISTD_H
 # include <unistd.h>
 #endif
+]GL_MDA_DEFINES[
 int main ()
 {
   int result = 0;
diff --git a/m4/pselect.m4 b/m4/pselect.m4
index f3e5afe..08a5823 100644
--- a/m4/pselect.m4
+++ b/m4/pselect.m4
@@ -1,4 +1,4 @@
-# pselect.m4 serial 8
+# pselect.m4 serial 9
 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -37,7 +37,8 @@ AC_DEFUN([gl_FUNC_PSELECT],
 #endif
 #include <unistd.h>
 #include <errno.h>
-]],[[
+]GL_MDA_DEFINES],
+[[
   fd_set set;
   dup2(0, 16);
   FD_ZERO(&set);
diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4
index d67511f..030862d 100644
--- a/m4/pthread_sigmask.m4
+++ b/m4/pthread_sigmask.m4
@@ -1,4 +1,4 @@
-# pthread_sigmask.m4 serial 18
+# pthread_sigmask.m4 serial 19
 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -220,6 +220,7 @@ int main ()
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+]GL_MDA_DEFINES[
 static volatile int sigint_occurred;
 static void
 sigint_handler (int sig)
diff --git a/m4/time_h.m4 b/m4/time_h.m4
index d0f8932..a15c09d 100644
--- a/m4/time_h.m4
+++ b/m4/time_h.m4
@@ -121,7 +121,6 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
   HAVE_NANOSLEEP=1;                      AC_SUBST([HAVE_NANOSLEEP])
   HAVE_STRPTIME=1;                       AC_SUBST([HAVE_STRPTIME])
   HAVE_TIMEGM=1;                         AC_SUBST([HAVE_TIMEGM])
-  HAVE_TZSET=1;                          AC_SUBST([HAVE_TZSET])
   dnl Even GNU libc does not have timezone_t yet.
   HAVE_TIMEZONE_T=0;                     AC_SUBST([HAVE_TIMEZONE_T])
   dnl If another module says to replace or to not replace, do that.
diff --git a/m4/utimens.m4 b/m4/utimens.m4
index 65617ac..3d31085 100644
--- a/m4/utimens.m4
+++ b/m4/utimens.m4
@@ -3,7 +3,7 @@ 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.
 
-dnl serial 10
+dnl serial 11
 
 AC_DEFUN([gl_UTIMENS],
 [
@@ -24,7 +24,8 @@ AC_DEFUN([gl_UTIMENS],
 #include <stddef.h>
 #include <sys/times.h>
 #include <fcntl.h>
-]], [[    int fd = open ("conftest.file", O_RDWR);
+]GL_MDA_DEFINES],
+        [[int fd = open ("conftest.file", O_RDWR);
           if (fd < 0) return 1;
           if (futimesat (fd, NULL, NULL)) return 2;
         ]])],
diff --git a/m4/utimensat.m4 b/m4/utimensat.m4
index 2bc1bfe..e9e4f26 100644
--- a/m4/utimensat.m4
+++ b/m4/utimensat.m4
@@ -1,4 +1,4 @@
-# serial 6
+# serial 7
 # See if we need to provide utimensat replacement.
 
 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
@@ -23,7 +23,8 @@ AC_DEFUN([gl_FUNC_UTIMENSAT],
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <unistd.h>
-]],         [[int result = 0;
+]GL_MDA_DEFINES],
+            [[int result = 0;
               const char *f = "conftest.file";
               if (close (creat (f, 0600)))
                 return 1;
diff --git a/m4/utimes.m4 b/m4/utimes.m4
index e1056bb..877bfd2 100644
--- a/m4/utimes.m4
+++ b/m4/utimes.m4
@@ -1,5 +1,5 @@
 # Detect some bugs in glibc's implementation of utimes.
-# serial 7
+# serial 8
 
 dnl Copyright (C) 2003-2005, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
@@ -34,6 +34,7 @@ AC_DEFUN([gl_FUNC_UTIMES],
 #include <stdio.h>
 #include <utime.h>
 #include <errno.h>
+]GL_MDA_DEFINES[
 
 static int
 inorder (time_t a, time_t b, time_t c)
diff --git a/m4/warnings.m4 b/m4/warnings.m4
index d272365..d4e4b07 100644
--- a/m4/warnings.m4
+++ b/m4/warnings.m4
@@ -1,4 +1,4 @@
-# warnings.m4 serial 14
+# warnings.m4 serial 16
 dnl Copyright (C) 2008-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -23,8 +23,6 @@ m4_ifdef([AS_VAR_APPEND],
 # The effects of this macro depend on the current language (_AC_LANG).
 AC_DEFUN([gl_COMPILER_OPTION_IF],
 [
-dnl FIXME: gl_Warn must be used unquoted until we can assume Autoconf
-dnl 2.64 or newer.
 AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl
 AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl
 AS_LITERAL_IF([$1],
@@ -34,13 +32,13 @@ case $gl_positive in
   -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;;
 esac
 m4_pushdef([gl_Positive], [$gl_positive])])dnl
-AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [
+AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], [gl_Warn], [
   gl_save_compiler_FLAGS="$gl_Flags"
   gl_AS_VAR_APPEND(m4_defn([gl_Flags]),
     [" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["])
-  AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])],
-                 [AS_VAR_SET(gl_Warn, [yes])],
-                 [AS_VAR_SET(gl_Warn, [no])])
+  AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([[]])])],
+                 [AS_VAR_SET([gl_Warn], [yes])],
+                 [AS_VAR_SET([gl_Warn], [no])])
   gl_Flags="$gl_save_compiler_FLAGS"
 ])
 AS_VAR_IF(gl_Warn, [yes], [$2], [$3])
@@ -59,8 +57,7 @@ AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS],
 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
 
 # Specialization for _AC_LANG = C. This macro can be AC_REQUIREd.
-# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b.
-m4_defun([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C)],
+AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C)],
 [
   AC_LANG_PUSH([C])
   gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL
@@ -68,8 +65,7 @@ m4_defun([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C)],
 ])
 
 # Specialization for _AC_LANG = C++. This macro can be AC_REQUIREd.
-# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b.
-m4_defun([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C++)],
+AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C++)],
 [
   AC_LANG_PUSH([C++])
   gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL
@@ -77,8 +73,7 @@ m4_defun([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C++)],
 ])
 
 # Specialization for _AC_LANG = Objective C. This macro can be AC_REQUIREd.
-# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b.
-m4_defun([gl_UNKNOWN_WARNINGS_ARE_ERRORS(Objective C)],
+AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(Objective C)],
 [
   AC_LANG_PUSH([Objective C])
   gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL



reply via email to

[Prev in Thread] Current Thread [Next in Thread]