aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2020-08-16 14:22:56 -0700
committerPaul Eggert2020-08-16 14:30:29 -0700
commit846657afaf021e8a796335d740ac4a34056abbeb (patch)
treea6e9e88571b6ed6b257609bc743879043d02263f
parent8c68a15f2ab484dabea4d4c2c760061d8ef440db (diff)
downloademacs-846657afaf021e8a796335d740ac4a34056abbeb.tar.gz
emacs-846657afaf021e8a796335d740ac4a34056abbeb.zip
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.
-rw-r--r--lib/c++defs.h10
-rw-r--r--lib/canonicalize-lgpl.c4
-rw-r--r--lib/cdefs.h7
-rw-r--r--lib/dup2.c4
-rw-r--r--lib/fcntl.in.h18
-rw-r--r--lib/getopt-cdefs.in.h2
-rw-r--r--lib/gnulib.mk.in4
-rw-r--r--lib/intprops.h2
-rw-r--r--lib/md5.h2
-rw-r--r--lib/mktime.c2
-rw-r--r--lib/nstrftime.c22
-rw-r--r--lib/open.c4
-rw-r--r--lib/regcomp.c2
-rw-r--r--lib/regex_internal.h2
-rw-r--r--lib/stdio.in.h46
-rw-r--r--lib/stdlib.in.h29
-rw-r--r--lib/strftime.h7
-rw-r--r--lib/string.in.h15
-rw-r--r--lib/sys_select.in.h6
-rw-r--r--lib/sys_stat.in.h14
-rw-r--r--lib/sys_time.in.h2
-rw-r--r--lib/time.in.h12
-rw-r--r--lib/time_rz.c51
-rw-r--r--lib/unistd.in.h159
-rw-r--r--lib/verify.h23
-rw-r--r--m4/00gnulib.m438
-rw-r--r--m4/absolute-header.m410
-rw-r--r--m4/alloca.m44
-rw-r--r--m4/canonicalize.m414
-rw-r--r--m4/dup2.m43
-rw-r--r--m4/fchmodat.m44
-rw-r--r--m4/fcntl.m43
-rw-r--r--m4/fdopendir.m420
-rw-r--r--m4/fpending.m44
-rw-r--r--m4/futimens.m45
-rw-r--r--m4/getdtablesize.m419
-rw-r--r--m4/getloadavg.m44
-rw-r--r--m4/gnulib-common.m482
-rw-r--r--m4/include_next.m418
-rw-r--r--m4/largefile.m46
-rw-r--r--m4/manywarnings.m48
-rw-r--r--m4/mktime.m48
-rw-r--r--m4/nstrftime.m44
-rw-r--r--m4/open-slash.m43
-rw-r--r--m4/pselect.m45
-rw-r--r--m4/pthread_sigmask.m43
-rw-r--r--m4/time_h.m41
-rw-r--r--m4/utimens.m45
-rw-r--r--m4/utimensat.m45
-rw-r--r--m4/utimes.m43
-rw-r--r--m4/warnings.m421
51 files changed, 547 insertions, 202 deletions
diff --git a/lib/c++defs.h b/lib/c++defs.h
index 90e6fd62e6d..6a9bf295eb5 100644
--- a/lib/c++defs.h
+++ b/lib/c++defs.h
@@ -146,6 +146,16 @@
146 _GL_EXTERN_C int _gl_cxxalias_dummy 146 _GL_EXTERN_C int _gl_cxxalias_dummy
147#endif 147#endif
148 148
149/* _GL_CXXALIAS_MDA (func, rettype, parameters);
150 is to be used when func is a Microsoft deprecated alias, on native Windows.
151 It declares a C++ alias called GNULIB_NAMESPACE::func
152 that redirects to _func, if GNULIB_NAMESPACE is defined.
153 Example:
154 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
155 */
156#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
157 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
158
149/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 159/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
150 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 160 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
151 except that the C function rpl_func may have a slightly different 161 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 9f990988393..0b89d2a1842 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -52,7 +52,9 @@
52# include "pathmax.h" 52# include "pathmax.h"
53# include "malloca.h" 53# include "malloca.h"
54# include "filename.h" 54# include "filename.h"
55# if HAVE_GETCWD 55# if defined _WIN32 && !defined __CYGWIN__
56# define __getcwd _getcwd
57# elif HAVE_GETCWD
56# if IN_RELOCWRAPPER 58# if IN_RELOCWRAPPER
57 /* When building the relocatable program wrapper, use the system's getcwd 59 /* When building the relocatable program wrapper, use the system's getcwd
58 function, not the gnulib override, otherwise we would get a link error. 60 function, not the gnulib override, otherwise we would get a link error.
diff --git a/lib/cdefs.h b/lib/cdefs.h
index 4f89f4e4bf0..0cc27806a19 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -85,7 +85,7 @@
85# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct 85# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
86# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct 86# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct
87# else 87# else
88# if defined __cplusplus && __GNUC_PREREQ (2,8) 88# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4)
89# define __THROW throw () 89# define __THROW throw ()
90# define __THROWNL throw () 90# define __THROWNL throw ()
91# define __NTH(fct) __LEAF_ATTR fct throw () 91# define __NTH(fct) __LEAF_ATTR fct throw ()
@@ -194,7 +194,7 @@
194 Example: 194 Example:
195 int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ 195 int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
196 196
197#if defined __GNUC__ && __GNUC__ >= 2 197#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
198 198
199# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) 199# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
200# ifdef __cplusplus 200# ifdef __cplusplus
@@ -465,7 +465,8 @@
465 465
466#if (!defined _Static_assert && !defined __cplusplus \ 466#if (!defined _Static_assert && !defined __cplusplus \
467 && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ 467 && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
468 && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__)) 468 && (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \
469 || defined __STRICT_ANSI__))
469# define _Static_assert(expr, diagnostic) \ 470# define _Static_assert(expr, diagnostic) \
470 extern int (*__Static_assert_function (void)) \ 471 extern int (*__Static_assert_function (void)) \
471 [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] 472 [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
diff --git a/lib/dup2.c b/lib/dup2.c
index 9bc3951f3d2..323e19b25ec 100644
--- a/lib/dup2.c
+++ b/lib/dup2.c
@@ -52,7 +52,7 @@ dup2_nothrow (int fd, int desired_fd)
52 52
53 TRY_MSVC_INVAL 53 TRY_MSVC_INVAL
54 { 54 {
55 result = dup2 (fd, desired_fd); 55 result = _dup2 (fd, desired_fd);
56 } 56 }
57 CATCH_MSVC_INVAL 57 CATCH_MSVC_INVAL
58 { 58 {
@@ -64,7 +64,7 @@ dup2_nothrow (int fd, int desired_fd)
64 return result; 64 return result;
65} 65}
66# else 66# else
67# define dup2_nothrow dup2 67# define dup2_nothrow _dup2
68# endif 68# endif
69 69
70static int 70static int
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 0a21c957baf..6f16bc66921 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -97,6 +97,12 @@
97_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode) 97_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode)
98 _GL_ARG_NONNULL ((1))); 98 _GL_ARG_NONNULL ((1)));
99_GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode)); 99_GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode));
100# elif defined _WIN32 && !defined __CYGWIN__
101# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
102# undef creat
103# define creat _creat
104# endif
105_GL_CXXALIAS_MDA (creat, int, (const char *filename, mode_t mode));
100# else 106# else
101_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode)); 107_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode));
102# endif 108# endif
@@ -106,6 +112,9 @@ _GL_CXXALIASWARN (creat);
106/* Assume creat is always declared. */ 112/* Assume creat is always declared. */
107_GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - " 113_GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - "
108 "use gnulib module creat for portability"); 114 "use gnulib module creat for portability");
115#elif defined _WIN32 && !defined __CYGWIN__
116# undef creat
117# define creat _creat
109#endif 118#endif
110 119
111#if @GNULIB_FCNTL@ 120#if @GNULIB_FCNTL@
@@ -146,6 +155,12 @@ _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
146_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 155_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
147 _GL_ARG_NONNULL ((1))); 156 _GL_ARG_NONNULL ((1)));
148_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 157_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
158# elif defined _WIN32 && !defined __CYGWIN__
159# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
160# undef open
161# define open _open
162# endif
163_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
149# else 164# else
150_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 165_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
151# endif 166# endif
@@ -159,6 +174,9 @@ _GL_CXXALIASWARN (open);
159/* Assume open is always declared. */ 174/* Assume open is always declared. */
160_GL_WARN_ON_USE (open, "open is not always POSIX compliant - " 175_GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
161 "use gnulib module open for portability"); 176 "use gnulib module open for portability");
177#elif defined _WIN32 && !defined __CYGWIN__
178# undef open
179# define open _open
162#endif 180#endif
163 181
164#if @GNULIB_OPENAT@ 182#if @GNULIB_OPENAT@
diff --git a/lib/getopt-cdefs.in.h b/lib/getopt-cdefs.in.h
index c510ab163c3..674838c666a 100644
--- a/lib/getopt-cdefs.in.h
+++ b/lib/getopt-cdefs.in.h
@@ -57,7 +57,7 @@
57#endif 57#endif
58 58
59#ifndef __THROW 59#ifndef __THROW
60# if defined __cplusplus && __GNUC_PREREQ (2,8) 60# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
61# define __THROW throw () 61# define __THROW throw ()
62# else 62# else
63# define __THROW 63# define __THROW
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 92d0621c61a..7b4fc74219f 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -682,7 +682,6 @@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
682HAVE_TIMEGM = @HAVE_TIMEGM@ 682HAVE_TIMEGM = @HAVE_TIMEGM@
683HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ 683HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@
684HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ 684HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
685HAVE_TZSET = @HAVE_TZSET@
686HAVE_UNISTD_H = @HAVE_UNISTD_H@ 685HAVE_UNISTD_H = @HAVE_UNISTD_H@
687HAVE_UNLINKAT = @HAVE_UNLINKAT@ 686HAVE_UNLINKAT = @HAVE_UNLINKAT@
688HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ 687HAVE_UNLOCKPT = @HAVE_UNLOCKPT@
@@ -1159,7 +1158,7 @@ ifeq (,$(OMIT_GNULIB_MODULE_absolute-header))
1159# Use this preprocessor expression to decide whether #include_next works. 1158# Use this preprocessor expression to decide whether #include_next works.
1160# Do not rely on a 'configure'-time test for this, since the expression 1159# Do not rely on a 'configure'-time test for this, since the expression
1161# might appear in an installed header, which is used by some other compiler. 1160# might appear in an installed header, which is used by some other compiler.
1162HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER) 1161HAVE_INCLUDE_NEXT = (__GNUC__ || __clang__ || 60000000 <= __DECC_VER)
1163 1162
1164endif 1163endif
1165## end gnulib module absolute-header 1164## end gnulib module absolute-header
@@ -3185,7 +3184,6 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
3185 -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ 3184 -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
3186 -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ 3185 -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \
3187 -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ 3186 -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \
3188 -e 's|@''HAVE_TZSET''@|$(HAVE_TZSET)|g' \
3189 -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \ 3187 -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \
3190 -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ 3188 -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \
3191 -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ 3189 -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \
diff --git a/lib/intprops.h b/lib/intprops.h
index 220f532e499..f2f70b3e733 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -396,7 +396,7 @@
396 For now, assume all versions of GCC-like compilers generate bogus 396 For now, assume all versions of GCC-like compilers generate bogus
397 warnings for _Generic. This matters only for compilers that 397 warnings for _Generic. This matters only for compilers that
398 lack relevant builtins. */ 398 lack relevant builtins. */
399#if __GNUC__ 399#if __GNUC__ || defined __clang__
400# define _GL__GENERIC_BOGUS 1 400# define _GL__GENERIC_BOGUS 1
401#else 401#else
402# define _GL__GENERIC_BOGUS 0 402# define _GL__GENERIC_BOGUS 0
diff --git a/lib/md5.h b/lib/md5.h
index 3c6048242b0..c728ba1b6f2 100644
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -40,7 +40,7 @@
40#endif 40#endif
41 41
42#ifndef __THROW 42#ifndef __THROW
43# if defined __cplusplus && __GNUC_PREREQ (2,8) 43# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
44# define __THROW throw () 44# define __THROW throw ()
45# else 45# else
46# define __THROW 46# define __THROW
diff --git a/lib/mktime.c b/lib/mktime.c
index 92c00b2b14b..5b4c144ecad 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -94,7 +94,7 @@ my_tzset (void)
94 const char *tz = getenv ("TZ"); 94 const char *tz = getenv ("TZ");
95 if (tz != NULL && strchr (tz, '/') != NULL) 95 if (tz != NULL && strchr (tz, '/') != NULL)
96 _putenv ("TZ="); 96 _putenv ("TZ=");
97# elif HAVE_TZSET 97# else
98 tzset (); 98 tzset ();
99# endif 99# endif
100} 100}
diff --git a/lib/nstrftime.c b/lib/nstrftime.c
index 2816cf4d58b..7d5a97f7635 100644
--- a/lib/nstrftime.c
+++ b/lib/nstrftime.c
@@ -21,7 +21,6 @@
21# define HAVE_TM_GMTOFF 1 21# define HAVE_TM_GMTOFF 1
22# define HAVE_TM_ZONE 1 22# define HAVE_TM_ZONE 1
23# define HAVE_TZNAME 1 23# define HAVE_TZNAME 1
24# define HAVE_TZSET 1
25# include "../locale/localeinfo.h" 24# include "../locale/localeinfo.h"
26#else 25#else
27# include <config.h> 26# include <config.h>
@@ -34,6 +33,7 @@
34#endif 33#endif
35 34
36#include <ctype.h> 35#include <ctype.h>
36#include <errno.h>
37#include <time.h> 37#include <time.h>
38 38
39#if HAVE_TZNAME && !HAVE_DECL_TZNAME 39#if HAVE_TZNAME && !HAVE_DECL_TZNAME
@@ -163,7 +163,10 @@ extern char *tzname[];
163 size_t _w = pad == L_('-') || width < 0 ? 0 : width; \ 163 size_t _w = pad == L_('-') || width < 0 ? 0 : width; \
164 size_t _incr = _n < _w ? _w : _n; \ 164 size_t _incr = _n < _w ? _w : _n; \
165 if (_incr >= maxsize - i) \ 165 if (_incr >= maxsize - i) \
166 return 0; \ 166 { \
167 errno = ERANGE; \
168 return 0; \
169 } \
167 if (p) \ 170 if (p) \
168 { \ 171 { \
169 if (_n < _w) \ 172 if (_n < _w) \
@@ -365,7 +368,7 @@ tm_diff (const struct tm *a, const struct tm *b)
365#define ISO_WEEK1_WDAY 4 /* Thursday */ 368#define ISO_WEEK1_WDAY 4 /* Thursday */
366#define YDAY_MINIMUM (-366) 369#define YDAY_MINIMUM (-366)
367static int iso_week_days (int, int); 370static int iso_week_days (int, int);
368#ifdef __GNUC__ 371#if defined __GNUC__ || defined __clang__
369__inline__ 372__inline__
370#endif 373#endif
371static int 374static int
@@ -389,7 +392,6 @@ iso_week_days (int yday, int wday)
389#endif 392#endif
390 393
391#ifdef my_strftime 394#ifdef my_strftime
392# undef HAVE_TZSET
393# define extra_args , tz, ns 395# define extra_args , tz, ns
394# define extra_args_spec , timezone_t tz, int ns 396# define extra_args_spec , timezone_t tz, int ns
395#else 397#else
@@ -449,6 +451,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
449 size_t maxsize = (size_t) -1; 451 size_t maxsize = (size_t) -1;
450#endif 452#endif
451 453
454 int saved_errno = errno;
452 int hour12 = tp->tm_hour; 455 int hour12 = tp->tm_hour;
453#ifdef _NL_CURRENT 456#ifdef _NL_CURRENT
454 /* We cannot make the following values variables since we must delay 457 /* 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)
523 { 526 {
524 /* POSIX.1 requires that local time zone information be used as 527 /* POSIX.1 requires that local time zone information be used as
525 though strftime called tzset. */ 528 though strftime called tzset. */
526# if HAVE_TZSET 529# ifndef my_strftime
527 if (!*tzset_called) 530 if (!*tzset_called)
528 { 531 {
529 tzset (); 532 tzset ();
@@ -1188,7 +1191,13 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
1188 time_t t; 1191 time_t t;
1189 1192
1190 ltm = *tp; 1193 ltm = *tp;
1194 ltm.tm_yday = -1;
1191 t = mktime_z (tz, &ltm); 1195 t = mktime_z (tz, &ltm);
1196 if (ltm.tm_yday < 0)
1197 {
1198 errno = EOVERFLOW;
1199 return 0;
1200 }
1192 1201
1193 /* Generate string value for T using time_t arithmetic; 1202 /* Generate string value for T using time_t arithmetic;
1194 this works even if sizeof (long) < sizeof (time_t). */ 1203 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)
1417 1426
1418 /* POSIX.1 requires that local time zone information be used as 1427 /* POSIX.1 requires that local time zone information be used as
1419 though strftime called tzset. */ 1428 though strftime called tzset. */
1420# if HAVE_TZSET 1429# ifndef my_strftime
1421 if (!*tzset_called) 1430 if (!*tzset_called)
1422 { 1431 {
1423 tzset (); 1432 tzset ();
@@ -1486,5 +1495,6 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
1486 *p = L_('\0'); 1495 *p = L_('\0');
1487#endif 1496#endif
1488 1497
1498 errno = saved_errno;
1489 return i; 1499 return i;
1490} 1500}
diff --git a/lib/open.c b/lib/open.c
index 751b42d7dcf..0f7c6e9b9d3 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -30,7 +30,11 @@
30static int 30static int
31orig_open (const char *filename, int flags, mode_t mode) 31orig_open (const char *filename, int flags, mode_t mode)
32{ 32{
33#if defined _WIN32 && !defined __CYGWIN__
34 return _open (filename, flags, mode);
35#else
33 return open (filename, flags, mode); 36 return open (filename, flags, mode);
37#endif
34} 38}
35 39
36/* Specification. */ 40/* Specification. */
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 84044be5e09..a4b95b0b2ff 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -558,7 +558,7 @@ weak_alias (__regerror, regerror)
558static const bitset_t utf8_sb_map = 558static const bitset_t utf8_sb_map =
559{ 559{
560 /* Set the first 128 bits. */ 560 /* Set the first 128 bits. */
561# if defined __GNUC__ && !defined __STRICT_ANSI__ 561# if (defined __GNUC__ || __clang_major__ >= 4) && !defined __STRICT_ANSI__
562 [0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX 562 [0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX
563# else 563# else
564# if 4 * BITSET_WORD_BITS < ASCII_CHARS 564# if 4 * BITSET_WORD_BITS < ASCII_CHARS
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index 9a0c2ed97c8..0c72e3f7b01 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -335,7 +335,7 @@ typedef struct
335 Idx idx; /* for BACK_REF */ 335 Idx idx; /* for BACK_REF */
336 re_context_type ctx_type; /* for ANCHOR */ 336 re_context_type ctx_type; /* for ANCHOR */
337 } opr; 337 } opr;
338#if __GNUC__ >= 2 && !defined __STRICT_ANSI__ 338#if (__GNUC__ >= 2 || defined __clang__) && !defined __STRICT_ANSI__
339 re_token_type_t type : 8; 339 re_token_type_t type : 8;
340#else 340#else
341 re_token_type_t type; 341 re_token_type_t type;
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index cbebc8462fd..6d12cd826de 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 - "
215 "use gnulib module fclose for portable POSIX compliance"); 215 "use gnulib module fclose for portable POSIX compliance");
216#endif 216#endif
217 217
218#if defined _WIN32 && !defined __CYGWIN__
219# undef fcloseall
220# define fcloseall _fcloseall
221#endif
222
218#if @GNULIB_FDOPEN@ 223#if @GNULIB_FDOPEN@
219# if @REPLACE_FDOPEN@ 224# if @REPLACE_FDOPEN@
220# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 225# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -224,6 +229,12 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
224_GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode) 229_GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode)
225 _GL_ARG_NONNULL ((2))); 230 _GL_ARG_NONNULL ((2)));
226_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); 231_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
232# elif defined _WIN32 && !defined __CYGWIN__
233# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
234# undef fdopen
235# define fdopen _fdopen
236# endif
237_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
227# else 238# else
228_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); 239_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
229# endif 240# endif
@@ -233,6 +244,9 @@ _GL_CXXALIASWARN (fdopen);
233/* Assume fdopen is always declared. */ 244/* Assume fdopen is always declared. */
234_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " 245_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
235 "use gnulib module fdopen for portability"); 246 "use gnulib module fdopen for portability");
247#elif defined _WIN32 && !defined __CYGWIN__
248# undef fdopen
249# define fdopen _fdopen
236#endif 250#endif
237 251
238#if @GNULIB_FFLUSH@ 252#if @GNULIB_FFLUSH@
@@ -297,6 +311,11 @@ _GL_CXXALIASWARN (fgets);
297# endif 311# endif
298#endif 312#endif
299 313
314#if defined _WIN32 && !defined __CYGWIN__
315# undef fileno
316# define fileno _fileno
317#endif
318
300#if @GNULIB_FOPEN@ 319#if @GNULIB_FOPEN@
301# if @REPLACE_FOPEN@ 320# if @REPLACE_FOPEN@
302# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 321# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -824,6 +843,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
824_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); 843_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
825#endif 844#endif
826 845
846#if defined _WIN32 && !defined __CYGWIN__
847# undef getw
848# define getw _getw
849#endif
850
827#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ 851#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
828struct obstack; 852struct obstack;
829/* Grow an obstack with formatted output. Return the number of 853/* 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 - "
940#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ 964#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
941# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ 965# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
942 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) 966 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
943# if defined __GNUC__ 967# if defined __GNUC__ || defined __clang__
944# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 968# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
945/* Don't break __attribute__((format(printf,M,N))). */ 969/* Don't break __attribute__((format(printf,M,N))). */
946# define printf __printf__ 970# define printf __printf__
@@ -1037,6 +1061,11 @@ _GL_CXXALIASWARN (puts);
1037# endif 1061# endif
1038#endif 1062#endif
1039 1063
1064#if defined _WIN32 && !defined __CYGWIN__
1065# undef putw
1066# define putw _putw
1067#endif
1068
1040#if @GNULIB_REMOVE@ 1069#if @GNULIB_REMOVE@
1041# if @REPLACE_REMOVE@ 1070# if @REPLACE_REMOVE@
1042# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1071# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1114,7 +1143,7 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - "
1114 1143
1115#if @GNULIB_SCANF@ 1144#if @GNULIB_SCANF@
1116# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ 1145# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1117# if defined __GNUC__ 1146# if defined __GNUC__ || defined __clang__
1118# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1147# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1119# undef scanf 1148# undef scanf
1120/* Don't break __attribute__((format(scanf,M,N))). */ 1149/* Don't break __attribute__((format(scanf,M,N))). */
@@ -1170,7 +1199,9 @@ _GL_CXXALIAS_SYS (snprintf, int,
1170 (char *restrict str, size_t size, 1199 (char *restrict str, size_t size,
1171 const char *restrict format, ...)); 1200 const char *restrict format, ...));
1172# endif 1201# endif
1202# if __GLIBC__ >= 2
1173_GL_CXXALIASWARN (snprintf); 1203_GL_CXXALIASWARN (snprintf);
1204# endif
1174#elif defined GNULIB_POSIXCHECK 1205#elif defined GNULIB_POSIXCHECK
1175# undef snprintf 1206# undef snprintf
1176# if HAVE_RAW_DECL_SNPRINTF 1207# if HAVE_RAW_DECL_SNPRINTF
@@ -1214,6 +1245,11 @@ _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
1214 "POSIX compliance"); 1245 "POSIX compliance");
1215#endif 1246#endif
1216 1247
1248#if defined _WIN32 && !defined __CYGWIN__
1249# undef tempnam
1250# define tempnam _tempnam
1251#endif
1252
1217#if @GNULIB_TMPFILE@ 1253#if @GNULIB_TMPFILE@
1218# if @REPLACE_TMPFILE@ 1254# if @REPLACE_TMPFILE@
1219# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1255# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1382,7 +1418,9 @@ _GL_CXXALIAS_SYS (vfscanf, int,
1382 (FILE *restrict stream, 1418 (FILE *restrict stream,
1383 const char *restrict format, va_list args)); 1419 const char *restrict format, va_list args));
1384# endif 1420# endif
1421# if __GLIBC__ >= 2
1385_GL_CXXALIASWARN (vfscanf); 1422_GL_CXXALIASWARN (vfscanf);
1423# endif
1386#endif 1424#endif
1387 1425
1388#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ 1426#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
@@ -1436,7 +1474,9 @@ _GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args));
1436# else 1474# else
1437_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args)); 1475_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args));
1438# endif 1476# endif
1477# if __GLIBC__ >= 2
1439_GL_CXXALIASWARN (vscanf); 1478_GL_CXXALIASWARN (vscanf);
1479# endif
1440#endif 1480#endif
1441 1481
1442#if @GNULIB_VSNPRINTF@ 1482#if @GNULIB_VSNPRINTF@
@@ -1464,7 +1504,9 @@ _GL_CXXALIAS_SYS (vsnprintf, int,
1464 (char *restrict str, size_t size, 1504 (char *restrict str, size_t size,
1465 const char *restrict format, va_list args)); 1505 const char *restrict format, va_list args));
1466# endif 1506# endif
1507# if __GLIBC__ >= 2
1467_GL_CXXALIASWARN (vsnprintf); 1508_GL_CXXALIASWARN (vsnprintf);
1509# endif
1468#elif defined GNULIB_POSIXCHECK 1510#elif defined GNULIB_POSIXCHECK
1469# undef vsnprintf 1511# undef vsnprintf
1470# if HAVE_RAW_DECL_VSNPRINTF 1512# if HAVE_RAW_DECL_VSNPRINTF
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 5c598a275d1..47a1309e633 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -217,6 +217,21 @@ _GL_WARN_ON_USE (canonicalize_file_name,
217# endif 217# endif
218#endif 218#endif
219 219
220#if defined _WIN32 && !defined __CYGWIN__
221# undef ecvt
222# define ecvt _ecvt
223#endif
224
225#if defined _WIN32 && !defined __CYGWIN__
226# undef fcvt
227# define fcvt _fcvt
228#endif
229
230#if defined _WIN32 && !defined __CYGWIN__
231# undef gcvt
232# define gcvt _gcvt
233#endif
234
220#if @GNULIB_GETLOADAVG@ 235#if @GNULIB_GETLOADAVG@
221/* Store max(NELEM,3) load average numbers in LOADAVG[]. 236/* Store max(NELEM,3) load average numbers in LOADAVG[].
222 The three numbers are the load average of the last 1 minute, the last 5 237 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 - "
468# endif 483# endif
469#endif 484#endif
470 485
486#if defined _WIN32 && !defined __CYGWIN__
487# undef mktemp
488# define mktemp _mktemp
489#endif
490
471#if @GNULIB_POSIX_OPENPT@ 491#if @GNULIB_POSIX_OPENPT@
472/* Return an FD open to the master side of a pseudo-terminal. Flags should 492/* Return an FD open to the master side of a pseudo-terminal. Flags should
473 include O_RDWR, and may also include O_NOCTTY. */ 493 include O_RDWR, and may also include O_NOCTTY. */
@@ -546,10 +566,19 @@ _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
546# endif 566# endif
547_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); 567_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
548_GL_CXXALIAS_RPL (putenv, int, (char *string)); 568_GL_CXXALIAS_RPL (putenv, int, (char *string));
569# elif defined _WIN32 && !defined __CYGWIN__
570# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
571# undef putenv
572# define putenv _putenv
573# endif
574_GL_CXXALIAS_MDA (putenv, int, (char *string));
549# else 575# else
550_GL_CXXALIAS_SYS (putenv, int, (char *string)); 576_GL_CXXALIAS_SYS (putenv, int, (char *string));
551# endif 577# endif
552_GL_CXXALIASWARN (putenv); 578_GL_CXXALIASWARN (putenv);
579#elif defined _WIN32 && !defined __CYGWIN__
580# undef putenv
581# define putenv _putenv
553#endif 582#endif
554 583
555#if @GNULIB_QSORT_R@ 584#if @GNULIB_QSORT_R@
diff --git a/lib/strftime.h b/lib/strftime.h
index e8501631573..fe0c4195a59 100644
--- a/lib/strftime.h
+++ b/lib/strftime.h
@@ -24,7 +24,12 @@ extern "C" {
24/* Just like strftime, but with two more arguments: 24/* Just like strftime, but with two more arguments:
25 POSIX requires that strftime use the local timezone information. 25 POSIX requires that strftime use the local timezone information.
26 Use the timezone __TZ instead. Use __NS as the number of 26 Use the timezone __TZ instead. Use __NS as the number of
27 nanoseconds in the %N directive. */ 27 nanoseconds in the %N directive.
28
29 On error, set errno and return 0. Otherwise, return the number of
30 bytes generated (not counting the trailing NUL), preserving errno
31 if the number is 0. This errno behavior is in draft POSIX 202x
32 plus some requested changes to POSIX. */
28size_t nstrftime (char *restrict, size_t, char const *, struct tm const *, 33size_t nstrftime (char *restrict, size_t, char const *, struct tm const *,
29 timezone_t __tz, int __ns); 34 timezone_t __tz, int __ns);
30 35
diff --git a/lib/string.in.h b/lib/string.in.h
index c0c1a54f39d..7d83668f6ec 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");
123#endif 123#endif
124 124
125 125
126#if defined _WIN32 && !defined __CYGWIN__
127# undef memccpy
128# define memccpy _memccpy
129#endif
130
131
126/* Return the first instance of C within N bytes of S, or NULL. */ 132/* Return the first instance of C within N bytes of S, or NULL. */
127#if @GNULIB_MEMCHR@ 133#if @GNULIB_MEMCHR@
128# if @REPLACE_MEMCHR@ 134# if @REPLACE_MEMCHR@
@@ -384,6 +390,12 @@ _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
384# endif 390# endif
385_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); 391_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
386_GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); 392_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
393# elif defined _WIN32 && !defined __CYGWIN__
394# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
395# undef strdup
396# define strdup _strdup
397# endif
398_GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
387# else 399# else
388# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup 400# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
389 /* strdup exists as a function and as a macro. Get rid of the macro. */ 401 /* strdup exists as a function and as a macro. Get rid of the macro. */
@@ -401,6 +413,9 @@ _GL_CXXALIASWARN (strdup);
401_GL_WARN_ON_USE (strdup, "strdup is unportable - " 413_GL_WARN_ON_USE (strdup, "strdup is unportable - "
402 "use gnulib module strdup for portability"); 414 "use gnulib module strdup for portability");
403# endif 415# endif
416#elif defined _WIN32 && !defined __CYGWIN__
417# undef strdup
418# define strdup _strdup
404#endif 419#endif
405 420
406/* Append no more than N characters from SRC onto DEST. */ 421/* 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 7a7b157d545..72cb9ba7b0f 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)
177# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 177# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
178# undef close 178# undef close
179# define close close_used_without_including_unistd_h 179# define close close_used_without_including_unistd_h
180# else 180# elif !defined __clang__
181 _GL_WARN_ON_USE (close, 181 _GL_WARN_ON_USE (close,
182 "close() used without including <unistd.h>"); 182 "close() used without including <unistd.h>");
183# endif 183# endif
184# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 184# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
185# undef gethostname 185# undef gethostname
186# define gethostname gethostname_used_without_including_unistd_h 186# define gethostname gethostname_used_without_including_unistd_h
187# else 187# elif !defined __clang__
188 _GL_WARN_ON_USE (gethostname, 188 _GL_WARN_ON_USE (gethostname,
189 "gethostname() used without including <unistd.h>"); 189 "gethostname() used without including <unistd.h>");
190# endif 190# endif
@@ -219,7 +219,7 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
219# define setsockopt setsockopt_used_without_including_sys_socket_h 219# define setsockopt setsockopt_used_without_including_sys_socket_h
220# undef shutdown 220# undef shutdown
221# define shutdown shutdown_used_without_including_sys_socket_h 221# define shutdown shutdown_used_without_including_sys_socket_h
222# else 222# elif !defined __clang__
223 _GL_WARN_ON_USE (socket, 223 _GL_WARN_ON_USE (socket,
224 "socket() used without including <sys/socket.h>"); 224 "socket() used without including <sys/socket.h>");
225 _GL_WARN_ON_USE (connect, 225 _GL_WARN_ON_USE (connect,
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 89e167f6d1c..3e0e4b27b7e 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -391,6 +391,12 @@ struct stat
391#endif 391#endif
392 392
393 393
394#if defined _WIN32 && !defined __CYGWIN__
395# undef chmod
396# define chmod _chmod
397#endif
398
399
394#if @GNULIB_FCHMODAT@ 400#if @GNULIB_FCHMODAT@
395# if @REPLACE_FCHMODAT@ 401# if @REPLACE_FCHMODAT@
396# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 402# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -432,7 +438,9 @@ _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
432# else 438# else
433_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); 439_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
434# endif 440# endif
441# if __GLIBC__ >= 2
435_GL_CXXALIASWARN (fstat); 442_GL_CXXALIASWARN (fstat);
443# endif
436#elif @GNULIB_OVERRIDES_STRUCT_STAT@ 444#elif @GNULIB_OVERRIDES_STRUCT_STAT@
437# undef fstat 445# undef fstat
438# define fstat fstat_used_without_requesting_gnulib_module_fstat 446# define fstat fstat_used_without_requesting_gnulib_module_fstat
@@ -800,6 +808,12 @@ _GL_WARN_ON_USE (stat, "stat is unportable - "
800#endif 808#endif
801 809
802 810
811#if defined _WIN32 && !defined __CYGWIN__
812# undef umask
813# define umask _umask
814#endif
815
816
803#if @GNULIB_UTIMENSAT@ 817#if @GNULIB_UTIMENSAT@
804/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat 818/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
805 implementation relies on futimesat, which on Solaris 10 makes an invocation 819 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 d30b26719b2..1c12d5f13d7 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 - "
135# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 135# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
136# undef close 136# undef close
137# define close close_used_without_including_unistd_h 137# define close close_used_without_including_unistd_h
138# else 138# elif !defined __clang__
139 _GL_WARN_ON_USE (close, 139 _GL_WARN_ON_USE (close,
140 "close() used without including <unistd.h>"); 140 "close() used without including <unistd.h>");
141# endif 141# endif
diff --git a/lib/time.in.h b/lib/time.in.h
index 1d11650e77f..32e6ec03ef4 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -135,13 +135,19 @@ _GL_CXXALIASWARN (nanosleep);
135# endif 135# endif
136_GL_FUNCDECL_RPL (tzset, void, (void)); 136_GL_FUNCDECL_RPL (tzset, void, (void));
137_GL_CXXALIAS_RPL (tzset, void, (void)); 137_GL_CXXALIAS_RPL (tzset, void, (void));
138# else 138# elif defined _WIN32 && !defined __CYGWIN__
139# if ! @HAVE_TZSET@ 139# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
140_GL_FUNCDECL_SYS (tzset, void, (void)); 140# undef tzset
141# define tzset _tzset
141# endif 142# endif
143_GL_CXXALIAS_MDA (tzset, void, (void));
144# else
142_GL_CXXALIAS_SYS (tzset, void, (void)); 145_GL_CXXALIAS_SYS (tzset, void, (void));
143# endif 146# endif
144_GL_CXXALIASWARN (tzset); 147_GL_CXXALIASWARN (tzset);
148# elif defined _WIN32 && !defined __CYGWIN__
149# undef tzset
150# define tzset _tzset
145# endif 151# endif
146 152
147/* Return the 'time_t' representation of TP and normalize TP. */ 153/* Return the 'time_t' representation of TP and normalize TP. */
diff --git a/lib/time_rz.c b/lib/time_rz.c
index 5d85963c9ed..95438cf876e 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) };
54 matters; the pointer is never dereferenced. */ 54 matters; the pointer is never dereferenced. */
55static timezone_t const local_tz = (timezone_t) 1; 55static timezone_t const local_tz = (timezone_t) 1;
56 56
57#if HAVE_TM_ZONE || HAVE_TZNAME
58
59/* Return true if the values A and B differ according to the rules for
60 tm_isdst: A and B differ if one is zero and the other positive. */
61static bool
62isdst_differ (int a, int b)
63{
64 return !a != !b && 0 <= a && 0 <= b;
65}
66
67/* Return true if A and B are equal. */
68static int
69equal_tm (const struct tm *a, const struct tm *b)
70{
71 return ! ((a->tm_sec ^ b->tm_sec)
72 | (a->tm_min ^ b->tm_min)
73 | (a->tm_hour ^ b->tm_hour)
74 | (a->tm_mday ^ b->tm_mday)
75 | (a->tm_mon ^ b->tm_mon)
76 | (a->tm_year ^ b->tm_year)
77 | isdst_differ (a->tm_isdst, b->tm_isdst));
78}
79
80#endif
81
82/* Copy to ABBRS the abbreviation at ABBR with size ABBR_SIZE (this 57/* Copy to ABBRS the abbreviation at ABBR with size ABBR_SIZE (this
83 includes its trailing null byte). Append an extra null byte to 58 includes its trailing null byte). Append an extra null byte to
84 mark the end of ABBRS. */ 59 mark the end of ABBRS. */
@@ -327,17 +302,25 @@ mktime_z (timezone_t tz, struct tm *tm)
327 timezone_t old_tz = set_tz (tz); 302 timezone_t old_tz = set_tz (tz);
328 if (old_tz) 303 if (old_tz)
329 { 304 {
330 time_t t = mktime (tm);
331#if HAVE_TM_ZONE || HAVE_TZNAME
332 time_t badtime = -1;
333 struct tm tm_1; 305 struct tm tm_1;
334 if ((t != badtime 306 tm_1.tm_sec = tm->tm_sec;
335 || (localtime_r (&t, &tm_1) && equal_tm (tm, &tm_1))) 307 tm_1.tm_min = tm->tm_min;
336 && !save_abbr (tz, tm)) 308 tm_1.tm_hour = tm->tm_hour;
337 t = badtime; 309 tm_1.tm_mday = tm->tm_mday;
310 tm_1.tm_mon = tm->tm_mon;
311 tm_1.tm_year = tm->tm_year;
312 tm_1.tm_yday = -1;
313 tm_1.tm_isdst = tm->tm_isdst;
314 time_t t = mktime (&tm_1);
315 bool ok = 0 <= tm_1.tm_yday;
316#if HAVE_TM_ZONE || HAVE_TZNAME
317 ok = ok && save_abbr (tz, &tm_1);
338#endif 318#endif
339 if (revert_tz (old_tz)) 319 if (revert_tz (old_tz) && ok)
340 return t; 320 {
321 *tm = tm_1;
322 return t;
323 }
341 } 324 }
342 return -1; 325 return -1;
343 } 326 }
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index a81a14fe873..357a35e3881 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -273,6 +273,12 @@ _GL_INLINE_HEADER_BEGIN
273_GL_FUNCDECL_RPL (access, int, (const char *file, int mode) 273_GL_FUNCDECL_RPL (access, int, (const char *file, int mode)
274 _GL_ARG_NONNULL ((1))); 274 _GL_ARG_NONNULL ((1)));
275_GL_CXXALIAS_RPL (access, int, (const char *file, int mode)); 275_GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
276# elif defined _WIN32 && !defined __CYGWIN__
277# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
278# undef access
279# define access _access
280# endif
281_GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
276# else 282# else
277_GL_CXXALIAS_SYS (access, int, (const char *file, int mode)); 283_GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
278# endif 284# endif
@@ -286,11 +292,22 @@ _GL_WARN_ON_USE (access, "access does not always support X_OK - "
286 "also, this function is a security risk - " 292 "also, this function is a security risk - "
287 "use the gnulib module faccessat instead"); 293 "use the gnulib module faccessat instead");
288# endif 294# endif
295#elif defined _WIN32 && !defined __CYGWIN__
296# undef access
297# define access _access
289#endif 298#endif
290 299
291 300
292#if @GNULIB_CHDIR@ 301#if @GNULIB_CHDIR@
302# if defined _WIN32 && !defined __CYGWIN__
303# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
304# undef chdir
305# define chdir _chdir
306# endif
307_GL_CXXALIAS_MDA (chdir, int, (const char *file));
308# else
293_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); 309_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
310# endif
294_GL_CXXALIASWARN (chdir); 311_GL_CXXALIASWARN (chdir);
295#elif defined GNULIB_POSIXCHECK 312#elif defined GNULIB_POSIXCHECK
296# undef chdir 313# undef chdir
@@ -298,6 +315,9 @@ _GL_CXXALIASWARN (chdir);
298_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " 315_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
299 "use gnulib module chdir for portability"); 316 "use gnulib module chdir for portability");
300# endif 317# endif
318#elif defined _WIN32 && !defined __CYGWIN__
319# undef chdir
320# define chdir _chdir
301#endif 321#endif
302 322
303 323
@@ -342,6 +362,12 @@ _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
342# endif 362# endif
343_GL_FUNCDECL_RPL (close, int, (int fd)); 363_GL_FUNCDECL_RPL (close, int, (int fd));
344_GL_CXXALIAS_RPL (close, int, (int fd)); 364_GL_CXXALIAS_RPL (close, int, (int fd));
365# elif defined _WIN32 && !defined __CYGWIN__
366# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
367# undef close
368# define close _close
369# endif
370_GL_CXXALIAS_MDA (close, int, (int fd));
345# else 371# else
346_GL_CXXALIAS_SYS (close, int, (int fd)); 372_GL_CXXALIAS_SYS (close, int, (int fd));
347# endif 373# endif
@@ -354,6 +380,9 @@ _GL_CXXALIASWARN (close);
354/* Assume close is always declared. */ 380/* Assume close is always declared. */
355_GL_WARN_ON_USE (close, "close does not portably work on sockets - " 381_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
356 "use gnulib module close for portability"); 382 "use gnulib module close for portability");
383#elif defined _WIN32 && !defined __CYGWIN__
384# undef close
385# define close _close
357#endif 386#endif
358 387
359 388
@@ -382,6 +411,12 @@ _GL_WARN_ON_USE (copy_file_range,
382# endif 411# endif
383_GL_FUNCDECL_RPL (dup, int, (int oldfd)); 412_GL_FUNCDECL_RPL (dup, int, (int oldfd));
384_GL_CXXALIAS_RPL (dup, int, (int oldfd)); 413_GL_CXXALIAS_RPL (dup, int, (int oldfd));
414# elif defined _WIN32 && !defined __CYGWIN__
415# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
416# undef dup
417# define dup _dup
418# endif
419_GL_CXXALIAS_MDA (dup, int, (int oldfd));
385# else 420# else
386_GL_CXXALIAS_SYS (dup, int, (int oldfd)); 421_GL_CXXALIAS_SYS (dup, int, (int oldfd));
387# endif 422# endif
@@ -392,6 +427,9 @@ _GL_CXXALIASWARN (dup);
392_GL_WARN_ON_USE (dup, "dup is unportable - " 427_GL_WARN_ON_USE (dup, "dup is unportable - "
393 "use gnulib module dup for portability"); 428 "use gnulib module dup for portability");
394# endif 429# endif
430#elif defined _WIN32 && !defined __CYGWIN__
431# undef dup
432# define dup _dup
395#endif 433#endif
396 434
397 435
@@ -407,6 +445,12 @@ _GL_WARN_ON_USE (dup, "dup is unportable - "
407# endif 445# endif
408_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); 446_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
409_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); 447_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
448# elif defined _WIN32 && !defined __CYGWIN__
449# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
450# undef dup2
451# define dup2 _dup2
452# endif
453_GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
410# else 454# else
411_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); 455_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
412# endif 456# endif
@@ -417,6 +461,9 @@ _GL_CXXALIASWARN (dup2);
417_GL_WARN_ON_USE (dup2, "dup2 is unportable - " 461_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
418 "use gnulib module dup2 for portability"); 462 "use gnulib module dup2 for portability");
419# endif 463# endif
464#elif defined _WIN32 && !defined __CYGWIN__
465# undef dup2
466# define dup2 _dup2
420#endif 467#endif
421 468
422 469
@@ -517,6 +564,43 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
517#endif 564#endif
518 565
519 566
567#if defined _WIN32 && !defined __CYGWIN__
568# undef execl
569# define execl _execl
570#endif
571
572#if defined _WIN32 && !defined __CYGWIN__
573# undef execle
574# define execle _execle
575#endif
576
577#if defined _WIN32 && !defined __CYGWIN__
578# undef execlp
579# define execlp _execlp
580#endif
581
582
583#if defined _WIN32 && !defined __CYGWIN__
584# undef execv
585# define execv _execv
586#endif
587
588#if defined _WIN32 && !defined __CYGWIN__
589# undef execve
590# define execve _execve
591#endif
592
593#if defined _WIN32 && !defined __CYGWIN__
594# undef execvp
595# define execvp _execvp
596#endif
597
598#if defined _WIN32 && !defined __CYGWIN__
599# undef execvpe
600# define execvpe _execvpe
601#endif
602
603
520#if @GNULIB_FACCESSAT@ 604#if @GNULIB_FACCESSAT@
521# if @REPLACE_FACCESSAT@ 605# if @REPLACE_FACCESSAT@
522# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 606# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -692,6 +776,12 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
692# endif 776# endif
693_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); 777_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
694_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); 778_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
779# elif defined _WIN32 && !defined __CYGWIN__
780# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
781# undef getcwd
782# define getcwd _getcwd
783# endif
784_GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size));
695# else 785# else
696/* Need to cast, because on mingw, the second parameter is 786/* Need to cast, because on mingw, the second parameter is
697 int size. */ 787 int size. */
@@ -704,6 +794,9 @@ _GL_CXXALIASWARN (getcwd);
704_GL_WARN_ON_USE (getcwd, "getcwd is unportable - " 794_GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
705 "use gnulib module getcwd for portability"); 795 "use gnulib module getcwd for portability");
706# endif 796# endif
797#elif defined _WIN32 && !defined __CYGWIN__
798# undef getcwd
799# define getcwd _getcwd
707#endif 800#endif
708 801
709 802
@@ -1038,6 +1131,12 @@ _GL_WARN_ON_USE (getpass, "getpass is unportable - "
1038#endif 1131#endif
1039 1132
1040 1133
1134#if defined _WIN32 && !defined __CYGWIN__
1135# undef getpid
1136# define getpid _getpid
1137#endif
1138
1139
1041#if @GNULIB_GETUSERSHELL@ 1140#if @GNULIB_GETUSERSHELL@
1042/* Return the next valid login shell on the system, or NULL when the end of 1141/* Return the next valid login shell on the system, or NULL when the end of
1043 the list has been reached. */ 1142 the list has been reached. */
@@ -1110,6 +1209,12 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - "
1110# endif 1209# endif
1111_GL_FUNCDECL_RPL (isatty, int, (int fd)); 1210_GL_FUNCDECL_RPL (isatty, int, (int fd));
1112_GL_CXXALIAS_RPL (isatty, int, (int fd)); 1211_GL_CXXALIAS_RPL (isatty, int, (int fd));
1212# elif defined _WIN32 && !defined __CYGWIN__
1213# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1214# undef isatty
1215# define isatty _isatty
1216# endif
1217_GL_CXXALIAS_MDA (isatty, int, (int fd));
1113# else 1218# else
1114_GL_CXXALIAS_SYS (isatty, int, (int fd)); 1219_GL_CXXALIAS_SYS (isatty, int, (int fd));
1115# endif 1220# endif
@@ -1120,6 +1225,9 @@ _GL_CXXALIASWARN (isatty);
1120_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " 1225_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
1121 "use gnulib module isatty for portability"); 1226 "use gnulib module isatty for portability");
1122# endif 1227# endif
1228#elif defined _WIN32 && !defined __CYGWIN__
1229# undef isatty
1230# define isatty _isatty
1123#endif 1231#endif
1124 1232
1125 1233
@@ -1231,6 +1339,12 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - "
1231# endif 1339# endif
1232_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); 1340_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1233_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); 1341_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1342# elif defined _WIN32 && !defined __CYGWIN__
1343# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1344# undef lseek
1345# define lseek _lseek
1346# endif
1347_GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence));
1234# else 1348# else
1235_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); 1349_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
1236# endif 1350# endif
@@ -1241,6 +1355,9 @@ _GL_CXXALIASWARN (lseek);
1241_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " 1355_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
1242 "systems - use gnulib module lseek for portability"); 1356 "systems - use gnulib module lseek for portability");
1243# endif 1357# endif
1358#elif defined _WIN32 && !defined __CYGWIN__
1359# undef lseek
1360# define lseek _lseek
1244#endif 1361#endif
1245 1362
1246 1363
@@ -1373,6 +1490,12 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1373_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) 1490_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
1374 _GL_ARG_NONNULL ((2))); 1491 _GL_ARG_NONNULL ((2)));
1375_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); 1492_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1493# elif defined _WIN32 && !defined __CYGWIN__
1494# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1495# undef read
1496# define read _read
1497# endif
1498_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count));
1376# else 1499# else
1377/* Need to cast, because on mingw, the third parameter is 1500/* Need to cast, because on mingw, the third parameter is
1378 unsigned int count 1501 unsigned int count
@@ -1380,6 +1503,9 @@ _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1380_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count)); 1503_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
1381# endif 1504# endif
1382_GL_CXXALIASWARN (read); 1505_GL_CXXALIASWARN (read);
1506#elif defined _WIN32 && !defined __CYGWIN__
1507# undef read
1508# define read _read
1383#endif 1509#endif
1384 1510
1385 1511
@@ -1462,6 +1588,12 @@ _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1462# endif 1588# endif
1463_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); 1589_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
1464_GL_CXXALIAS_RPL (rmdir, int, (char const *name)); 1590_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1591# elif defined _WIN32 && !defined __CYGWIN__
1592# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1593# undef rmdir
1594# define rmdir _rmdir
1595# endif
1596_GL_CXXALIAS_MDA (rmdir, int, (char const *name));
1465# else 1597# else
1466_GL_CXXALIAS_SYS (rmdir, int, (char const *name)); 1598_GL_CXXALIAS_SYS (rmdir, int, (char const *name));
1467# endif 1599# endif
@@ -1472,6 +1604,9 @@ _GL_CXXALIASWARN (rmdir);
1472_GL_WARN_ON_USE (rmdir, "rmdir is unportable - " 1604_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1473 "use gnulib module rmdir for portability"); 1605 "use gnulib module rmdir for portability");
1474# endif 1606# endif
1607#elif defined _WIN32 && !defined __CYGWIN__
1608# undef rmdir
1609# define rmdir _rmdir
1475#endif 1610#endif
1476 1611
1477 1612
@@ -1530,6 +1665,12 @@ _GL_WARN_ON_USE (sleep, "sleep is unportable - "
1530#endif 1665#endif
1531 1666
1532 1667
1668#if defined _WIN32 && !defined __CYGWIN__
1669# undef swab
1670# define swab _swab
1671#endif
1672
1673
1533#if @GNULIB_SYMLINK@ 1674#if @GNULIB_SYMLINK@
1534# if @REPLACE_SYMLINK@ 1675# if @REPLACE_SYMLINK@
1535# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1676# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1654,6 +1795,12 @@ _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
1654# endif 1795# endif
1655_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); 1796_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
1656_GL_CXXALIAS_RPL (unlink, int, (char const *file)); 1797_GL_CXXALIAS_RPL (unlink, int, (char const *file));
1798# elif defined _WIN32 && !defined __CYGWIN__
1799# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1800# undef unlink
1801# define unlink _unlink
1802# endif
1803_GL_CXXALIAS_MDA (unlink, int, (char const *file));
1657# else 1804# else
1658_GL_CXXALIAS_SYS (unlink, int, (char const *file)); 1805_GL_CXXALIAS_SYS (unlink, int, (char const *file));
1659# endif 1806# endif
@@ -1664,6 +1811,9 @@ _GL_CXXALIASWARN (unlink);
1664_GL_WARN_ON_USE (unlink, "unlink is not portable - " 1811_GL_WARN_ON_USE (unlink, "unlink is not portable - "
1665 "use gnulib module unlink for portability"); 1812 "use gnulib module unlink for portability");
1666# endif 1813# endif
1814#elif defined _WIN32 && !defined __CYGWIN__
1815# undef unlink
1816# define unlink _unlink
1667#endif 1817#endif
1668 1818
1669 1819
@@ -1735,6 +1885,12 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
1735_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) 1885_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
1736 _GL_ARG_NONNULL ((2))); 1886 _GL_ARG_NONNULL ((2)));
1737_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); 1887_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1888# elif defined _WIN32 && !defined __CYGWIN__
1889# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1890# undef write
1891# define write _write
1892# endif
1893_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count));
1738# else 1894# else
1739/* Need to cast, because on mingw, the third parameter is 1895/* Need to cast, because on mingw, the third parameter is
1740 unsigned int count 1896 unsigned int count
@@ -1742,6 +1898,9 @@ _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1742_GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count)); 1898_GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
1743# endif 1899# endif
1744_GL_CXXALIASWARN (write); 1900_GL_CXXALIASWARN (write);
1901#elif defined _WIN32 && !defined __CYGWIN__
1902# undef write
1903# define write _write
1745#endif 1904#endif
1746 1905
1747_GL_INLINE_HEADER_END 1906_GL_INLINE_HEADER_END
diff --git a/lib/verify.h b/lib/verify.h
index 58172f3cb7f..0ba8d579071 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -23,11 +23,15 @@
23 23
24/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert (R, DIAGNOSTIC) 24/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert (R, DIAGNOSTIC)
25 works as per C11. This is supported by GCC 4.6.0 and later, in C 25 works as per C11. This is supported by GCC 4.6.0 and later, in C
26 mode. 26 mode, and by clang (also in C++ mode).
27 27
28 Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as 28 Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as
29 per C2X, and define _GL_HAVE_STATIC_ASSERT1 if static_assert (R) 29 per C2X. This is supported by GCC 9.1 and later, and by clang in
30 works as per C++17. This is supported by GCC 9.1 and later. 30 C++1z mode.
31
32 Define _GL_HAVE_STATIC_ASSERT1 if static_assert (R) works as per
33 C++17. This is supported by GCC 9.1 and later, and by clang in
34 C++1z mode.
31 35
32 Support compilers claiming conformance to the relevant standard, 36 Support compilers claiming conformance to the relevant standard,
33 and also support GCC when not pedantic. If we were willing to slow 37 and also support GCC when not pedantic. If we were willing to slow
@@ -35,7 +39,8 @@
35 since this affects only the quality of diagnostics, why bother? */ 39 since this affects only the quality of diagnostics, why bother? */
36#ifndef __cplusplus 40#ifndef __cplusplus
37# if (201112L <= __STDC_VERSION__ \ 41# if (201112L <= __STDC_VERSION__ \
38 || (!defined __STRICT_ANSI__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__))) 42 || (!defined __STRICT_ANSI__ \
43 && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 4 <= __clang_major__)))
39# define _GL_HAVE__STATIC_ASSERT 1 44# define _GL_HAVE__STATIC_ASSERT 1
40# endif 45# endif
41# if (202000L <= __STDC_VERSION__ \ 46# if (202000L <= __STDC_VERSION__ \
@@ -43,7 +48,15 @@
43# define _GL_HAVE__STATIC_ASSERT1 1 48# define _GL_HAVE__STATIC_ASSERT1 1
44# endif 49# endif
45#else 50#else
46# if 201703L <= __cplusplus || 9 <= __GNUC__ 51# if 4 <= __clang_major__
52# define _GL_HAVE__STATIC_ASSERT 1
53# endif
54# if 4 <= __clang_major__ && 201411 <= __cpp_static_assert
55# define _GL_HAVE__STATIC_ASSERT1 1
56# endif
57# if 201703L <= __cplusplus \
58 || 9 <= __GNUC__ \
59 || (4 <= __clang_major__ && 201411 <= __cpp_static_assert)
47# define _GL_HAVE_STATIC_ASSERT1 1 60# define _GL_HAVE_STATIC_ASSERT1 1
48# endif 61# endif
49#endif 62#endif
diff --git a/m4/00gnulib.m4 b/m4/00gnulib.m4
index 06eff4f3863..14628c363b7 100644
--- a/m4/00gnulib.m4
+++ b/m4/00gnulib.m4
@@ -1,44 +1,12 @@
1# 00gnulib.m4 serial 7 1# 00gnulib.m4 serial 8
2dnl Copyright (C) 2009-2020 Free Software Foundation, Inc. 2dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7dnl This file must be named something that sorts before all other 7dnl This file must be named something that sorts before all other
8dnl gnulib-provided .m4 files. The first part is needed until such time 8dnl gnulib-provided .m4 files. It is needed until the clang fix has
9dnl as we can assume Autoconf 2.64, with its improved AC_DEFUN_ONCE and 9dnl been included in Autoconf.
10dnl m4_divert semantics. The second part is needed until the clang fix
11dnl has been included in Autoconf.
12
13# Until autoconf 2.63, handling of the diversion stack required m4_init
14# to be called first; but this does not happen with aclocal. Wrapping
15# the entire execution in another layer of the diversion stack fixes this.
16# Worse, prior to autoconf 2.62, m4_wrap depended on the underlying m4
17# for whether it was FIFO or LIFO; in order to properly balance with
18# m4_init, we need to undo our push just before anything wrapped within
19# the m4_init body. The way to ensure this is to wrap both sides of
20# m4_init with a one-shot macro that does the pop at the right time.
21m4_ifndef([_m4_divert_diversion],
22[m4_divert_push([KILL])
23m4_define([gl_divert_fixup], [m4_divert_pop()m4_define([$0])])
24m4_define([m4_init],
25 [gl_divert_fixup()]m4_defn([m4_init])[gl_divert_fixup()])])
26
27
28# AC_DEFUN_ONCE([NAME], VALUE)
29# ----------------------------
30# Define NAME to expand to VALUE on the first use (whether by direct
31# expansion, or by AC_REQUIRE), and to nothing on all subsequent uses.
32# Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This
33# definition is slower than the version in Autoconf 2.64, because it
34# can only use interfaces that existed since 2.59; but it achieves the
35# same effect. Quoting is necessary to avoid confusing Automake.
36m4_version_prereq([2.63.263], [],
37[m4_define([AC][_DEFUN_ONCE],
38 [AC][_DEFUN([$1],
39 [AC_REQUIRE([_gl_DEFUN_ONCE([$1])],
40 [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl
41[AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])])
42 10
43# The following definitions arrange to use a compiler option 11# The following definitions arrange to use a compiler option
44# -Werror=implicit-function-declaration in AC_CHECK_DECL, when the 12# -Werror=implicit-function-declaration in AC_CHECK_DECL, when the
diff --git a/m4/absolute-header.m4 b/m4/absolute-header.m4
index 39726ba57ba..c043233de36 100644
--- a/m4/absolute-header.m4
+++ b/m4/absolute-header.m4
@@ -1,4 +1,4 @@
1# absolute-header.m4 serial 16 1# absolute-header.m4 serial 17
2dnl Copyright (C) 2006-2020 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -22,23 +22,21 @@ dnl From Derek Price.
22AC_DEFUN([gl_ABSOLUTE_HEADER], 22AC_DEFUN([gl_ABSOLUTE_HEADER],
23[AC_REQUIRE([AC_CANONICAL_HOST]) 23[AC_REQUIRE([AC_CANONICAL_HOST])
24AC_LANG_PREPROC_REQUIRE()dnl 24AC_LANG_PREPROC_REQUIRE()dnl
25dnl FIXME: gl_absolute_header and ac_header_exists must be used unquoted
26dnl until we can assume autoconf 2.64 or newer.
27m4_foreach_w([gl_HEADER_NAME], [$1], 25m4_foreach_w([gl_HEADER_NAME], [$1],
28 [AS_VAR_PUSHDEF([gl_absolute_header], 26 [AS_VAR_PUSHDEF([gl_absolute_header],
29 [gl_cv_absolute_]m4_defn([gl_HEADER_NAME]))dnl 27 [gl_cv_absolute_]m4_defn([gl_HEADER_NAME]))dnl
30 AC_CACHE_CHECK([absolute name of <]m4_defn([gl_HEADER_NAME])[>], 28 AC_CACHE_CHECK([absolute name of <]m4_defn([gl_HEADER_NAME])[>],
31 m4_defn([gl_absolute_header]), 29 [gl_absolute_header],
32 [AS_VAR_PUSHDEF([ac_header_exists], 30 [AS_VAR_PUSHDEF([ac_header_exists],
33 [ac_cv_header_]m4_defn([gl_HEADER_NAME]))dnl 31 [ac_cv_header_]m4_defn([gl_HEADER_NAME]))dnl
34 AC_CHECK_HEADERS_ONCE(m4_defn([gl_HEADER_NAME]))dnl 32 AC_CHECK_HEADERS_ONCE(m4_defn([gl_HEADER_NAME]))dnl
35 if test AS_VAR_GET(ac_header_exists) = yes; then 33 if test AS_VAR_GET([ac_header_exists]) = yes; then
36 gl_ABSOLUTE_HEADER_ONE(m4_defn([gl_HEADER_NAME])) 34 gl_ABSOLUTE_HEADER_ONE(m4_defn([gl_HEADER_NAME]))
37 fi 35 fi
38 AS_VAR_POPDEF([ac_header_exists])dnl 36 AS_VAR_POPDEF([ac_header_exists])dnl
39 ])dnl 37 ])dnl
40 AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_defn([gl_HEADER_NAME])), 38 AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_defn([gl_HEADER_NAME])),
41 ["AS_VAR_GET(gl_absolute_header)"], 39 ["AS_VAR_GET([gl_absolute_header])"],
42 [Define this to an absolute name of <]m4_defn([gl_HEADER_NAME])[>.]) 40 [Define this to an absolute name of <]m4_defn([gl_HEADER_NAME])[>.])
43 AS_VAR_POPDEF([gl_absolute_header])dnl 41 AS_VAR_POPDEF([gl_absolute_header])dnl
44])dnl 42])dnl
diff --git a/m4/alloca.m4 b/m4/alloca.m4
index b777f8450ce..d8414896308 100644
--- a/m4/alloca.m4
+++ b/m4/alloca.m4
@@ -1,4 +1,4 @@
1# alloca.m4 serial 17 1# alloca.m4 serial 18
2dnl Copyright (C) 2002-2004, 2006-2007, 2009-2020 Free Software Foundation, 2dnl Copyright (C) 2002-2004, 2006-2007, 2009-2020 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
@@ -102,7 +102,7 @@ AH_VERBATIM([STACK_DIRECTION],
102 STACK_DIRECTION > 0 => grows toward higher addresses 102 STACK_DIRECTION > 0 => grows toward higher addresses
103 STACK_DIRECTION < 0 => grows toward lower addresses 103 STACK_DIRECTION < 0 => grows toward lower addresses
104 STACK_DIRECTION = 0 => direction of growth unknown */ 104 STACK_DIRECTION = 0 => direction of growth unknown */
105@%:@undef STACK_DIRECTION])dnl 105#undef STACK_DIRECTION])dnl
106AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) 106AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
107]) 107])
108]) 108])
diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4
index bdc5c8f71a7..14ea3e12fa0 100644
--- a/m4/canonicalize.m4
+++ b/m4/canonicalize.m4
@@ -1,4 +1,4 @@
1# canonicalize.m4 serial 31 1# canonicalize.m4 serial 33
2 2
3dnl Copyright (C) 2003-2007, 2009-2020 Free Software Foundation, Inc. 3dnl Copyright (C) 2003-2007, 2009-2020 Free Software Foundation, Inc.
4 4
@@ -56,7 +56,16 @@ AC_DEFUN([gl_CANONICALIZE_LGPL],
56AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE], 56AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE],
57[ 57[
58 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 58 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
59 AC_CHECK_FUNCS_ONCE([canonicalize_file_name getcwd readlink]) 59 AC_CHECK_FUNCS_ONCE([canonicalize_file_name readlink])
60
61 dnl On native Windows, we use _getcwd(), regardless whether getcwd() is
62 dnl available through the linker option '-loldnames'.
63 AC_REQUIRE([AC_CANONICAL_HOST])
64 case "$host_os" in
65 mingw*) ;;
66 *) AC_CHECK_FUNCS([getcwd]) ;;
67 esac
68
60 AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) 69 AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
61 AC_REQUIRE([gl_FUNC_REALPATH_WORKS]) 70 AC_REQUIRE([gl_FUNC_REALPATH_WORKS])
62 AC_CHECK_HEADERS_ONCE([sys/param.h]) 71 AC_CHECK_HEADERS_ONCE([sys/param.h])
@@ -70,6 +79,7 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS],
70 AC_CHECK_FUNCS_ONCE([realpath]) 79 AC_CHECK_FUNCS_ONCE([realpath])
71 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 80 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
72 AC_CACHE_CHECK([whether realpath works], [gl_cv_func_realpath_works], [ 81 AC_CACHE_CHECK([whether realpath works], [gl_cv_func_realpath_works], [
82 rm -rf conftest.a conftest.d
73 touch conftest.a 83 touch conftest.a
74 mkdir conftest.d 84 mkdir conftest.d
75 AC_RUN_IFELSE([ 85 AC_RUN_IFELSE([
diff --git a/m4/dup2.m4 b/m4/dup2.m4
index 462bfd0e526..a82798d6bba 100644
--- a/m4/dup2.m4
+++ b/m4/dup2.m4
@@ -1,4 +1,4 @@
1#serial 26 1#serial 27
2dnl Copyright (C) 2002, 2005, 2007, 2009-2020 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2005, 2007, 2009-2020 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -16,6 +16,7 @@ AC_DEFUN([gl_FUNC_DUP2],
16 #include <limits.h> 16 #include <limits.h>
17 #include <sys/resource.h> 17 #include <sys/resource.h>
18 #include <unistd.h> 18 #include <unistd.h>
19 ]GL_MDA_DEFINES[
19 #ifndef RLIM_SAVED_CUR 20 #ifndef RLIM_SAVED_CUR
20 # define RLIM_SAVED_CUR RLIM_INFINITY 21 # define RLIM_SAVED_CUR RLIM_INFINITY
21 #endif 22 #endif
diff --git a/m4/fchmodat.m4 b/m4/fchmodat.m4
index e3f2f048162..cf5c87999c5 100644
--- a/m4/fchmodat.m4
+++ b/m4/fchmodat.m4
@@ -1,4 +1,4 @@
1# fchmodat.m4 serial 4 1# fchmodat.m4 serial 5
2dnl Copyright (C) 2004-2020 Free Software Foundation, Inc. 2dnl Copyright (C) 2004-2020 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -40,7 +40,7 @@ AC_DEFUN([gl_FUNC_FCHMODAT],
40 #ifndef S_IRWXO 40 #ifndef S_IRWXO
41 #define S_IRWXO 0007 41 #define S_IRWXO 0007
42 #endif 42 #endif
43 ]], 43 ]GL_MDA_DEFINES],
44 [[ 44 [[
45 int permissive = S_IRWXU | S_IRWXG | S_IRWXO; 45 int permissive = S_IRWXU | S_IRWXG | S_IRWXO;
46 int desired = S_IRUSR | S_IWUSR; 46 int desired = S_IRUSR | S_IWUSR;
diff --git a/m4/fcntl.m4 b/m4/fcntl.m4
index 562ae2395df..ea24f3d64ef 100644
--- a/m4/fcntl.m4
+++ b/m4/fcntl.m4
@@ -1,4 +1,4 @@
1# fcntl.m4 serial 9 1# fcntl.m4 serial 10
2dnl Copyright (C) 2009-2020 Free Software Foundation, Inc. 2dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -34,6 +34,7 @@ AC_DEFUN([gl_FUNC_FCNTL],
34 #include <limits.h> 34 #include <limits.h>
35 #include <sys/resource.h> 35 #include <sys/resource.h>
36 #include <unistd.h> 36 #include <unistd.h>
37 ]GL_MDA_DEFINES[
37 #ifndef RLIM_SAVED_CUR 38 #ifndef RLIM_SAVED_CUR
38 # define RLIM_SAVED_CUR RLIM_INFINITY 39 # define RLIM_SAVED_CUR RLIM_INFINITY
39 #endif 40 #endif
diff --git a/m4/fdopendir.m4 b/m4/fdopendir.m4
index d9cc1a00173..9937a74ea8d 100644
--- a/m4/fdopendir.m4
+++ b/m4/fdopendir.m4
@@ -1,4 +1,4 @@
1# serial 12 1# serial 14
2# See if we need to provide fdopendir. 2# See if we need to provide fdopendir.
3 3
4dnl Copyright (C) 2009-2020 Free Software Foundation, Inc. 4dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
@@ -25,10 +25,12 @@ AC_DEFUN([gl_FUNC_FDOPENDIR],
25 else 25 else
26 AC_CACHE_CHECK([whether fdopendir works], 26 AC_CACHE_CHECK([whether fdopendir works],
27 [gl_cv_func_fdopendir_works], 27 [gl_cv_func_fdopendir_works],
28 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 28 [AC_RUN_IFELSE(
29 [AC_LANG_PROGRAM([[
29#include <dirent.h> 30#include <dirent.h>
30#include <fcntl.h> 31#include <fcntl.h>
31#include <unistd.h> 32#include <unistd.h>
33]GL_MDA_DEFINES[
32#if !HAVE_DECL_FDOPENDIR 34#if !HAVE_DECL_FDOPENDIR
33extern 35extern
34# ifdef __cplusplus 36# ifdef __cplusplus
@@ -36,12 +38,14 @@ extern
36# endif 38# endif
37DIR *fdopendir (int); 39DIR *fdopendir (int);
38#endif 40#endif
39]], [int result = 0; 41]],
40 int fd = open ("conftest.c", O_RDONLY); 42 [[int result = 0;
41 if (fd < 0) result |= 1; 43 int fd = open ("conftest.c", O_RDONLY);
42 if (fdopendir (fd)) result |= 2; 44 if (fd < 0) result |= 1;
43 if (close (fd)) result |= 4; 45 if (fdopendir (fd)) result |= 2;
44 return result;])], 46 if (close (fd)) result |= 4;
47 return result;
48 ]])],
45 [gl_cv_func_fdopendir_works=yes], 49 [gl_cv_func_fdopendir_works=yes],
46 [gl_cv_func_fdopendir_works=no], 50 [gl_cv_func_fdopendir_works=no],
47 [case "$host_os" in 51 [case "$host_os" in
diff --git a/m4/fpending.m4 b/m4/fpending.m4
index ea9725e4890..edabcec5f0b 100644
--- a/m4/fpending.m4
+++ b/m4/fpending.m4
@@ -1,4 +1,4 @@
1# serial 22 1# serial 23
2 2
3# Copyright (C) 2000-2001, 2004-2020 Free Software Foundation, Inc. 3# Copyright (C) 2000-2001, 2004-2020 Free Software Foundation, Inc.
4# This file is free software; the Free Software Foundation 4# This file is free software; the Free Software Foundation
@@ -25,7 +25,7 @@ AC_DEFUN([gl_FUNC_FPENDING],
25 AC_CACHE_CHECK([for __fpending], [gl_cv_func___fpending], 25 AC_CACHE_CHECK([for __fpending], [gl_cv_func___fpending],
26 [ 26 [
27 AC_LINK_IFELSE( 27 AC_LINK_IFELSE(
28 [AC_LANG_PROGRAM([$fp_headers], 28 [AC_LANG_PROGRAM([[$fp_headers]],
29 [[return ! __fpending (stdin);]])], 29 [[return ! __fpending (stdin);]])],
30 [gl_cv_func___fpending=yes], 30 [gl_cv_func___fpending=yes],
31 [gl_cv_func___fpending=no]) 31 [gl_cv_func___fpending=no])
diff --git a/m4/futimens.m4 b/m4/futimens.m4
index dc5cfa94119..145b8ff0d51 100644
--- a/m4/futimens.m4
+++ b/m4/futimens.m4
@@ -1,4 +1,4 @@
1# serial 8 1# serial 9
2# See if we need to provide futimens replacement. 2# See if we need to provide futimens replacement.
3 3
4dnl Copyright (C) 2009-2020 Free Software Foundation, Inc. 4dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
@@ -24,7 +24,8 @@ AC_DEFUN([gl_FUNC_FUTIMENS],
24#include <sys/stat.h> 24#include <sys/stat.h>
25#include <unistd.h> 25#include <unistd.h>
26#include <errno.h> 26#include <errno.h>
27]], [[struct timespec ts[2]; 27]GL_MDA_DEFINES],
28 [[struct timespec ts[2];
28 int fd = creat ("conftest.file", 0600); 29 int fd = creat ("conftest.file", 0600);
29 struct stat st; 30 struct stat st;
30 if (fd < 0) return 1; 31 if (fd < 0) return 1;
diff --git a/m4/getdtablesize.m4 b/m4/getdtablesize.m4
index ab2e3feb37b..af328644adb 100644
--- a/m4/getdtablesize.m4
+++ b/m4/getdtablesize.m4
@@ -1,4 +1,4 @@
1# getdtablesize.m4 serial 7 1# getdtablesize.m4 serial 8
2dnl Copyright (C) 2008-2020 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2020 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -29,13 +29,16 @@ AC_DEFUN([gl_FUNC_GETDTABLESIZE],
29 dnl correctly require setrlimit before getdtablesize() can report 29 dnl correctly require setrlimit before getdtablesize() can report
30 dnl a larger value. 30 dnl a larger value.
31 AC_RUN_IFELSE([ 31 AC_RUN_IFELSE([
32 AC_LANG_PROGRAM([[#include <unistd.h>]], 32 AC_LANG_PROGRAM(
33 [int size = getdtablesize(); 33 [[#include <unistd.h>]
34 if (dup2 (0, getdtablesize()) != -1) 34 GL_MDA_DEFINES
35 return 1; 35 ],
36 if (size != getdtablesize()) 36 [[int size = getdtablesize();
37 return 2; 37 if (dup2 (0, getdtablesize()) != -1)
38 ])], 38 return 1;
39 if (size != getdtablesize())
40 return 2;
41 ]])],
39 [gl_cv_func_getdtablesize_works=yes], 42 [gl_cv_func_getdtablesize_works=yes],
40 [gl_cv_func_getdtablesize_works=no], 43 [gl_cv_func_getdtablesize_works=no],
41 [case "$host_os" in 44 [case "$host_os" in
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index 8e96965d828..9fe328efc02 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -7,7 +7,7 @@
7# gives unlimited permission to copy and/or distribute it, 7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved. 8# with or without modifications, as long as this notice is preserved.
9 9
10#serial 9 10#serial 10
11 11
12# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent. 12# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
13# New applications should use gl_GETLOADAVG instead. 13# New applications should use gl_GETLOADAVG instead.
@@ -147,7 +147,7 @@ fi
147AC_CHECK_HEADERS([nlist.h], 147AC_CHECK_HEADERS([nlist.h],
148[AC_CHECK_MEMBERS([struct nlist.n_un.n_name], 148[AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
149 [], [], 149 [], [],
150 [@%:@include <nlist.h>]) 150 [#include <nlist.h>])
151 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]], 151 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
152 [[struct nlist x; 152 [[struct nlist x;
153 #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME 153 #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 03da2287d48..33e56faa98e 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
1# gnulib-common.m4 serial 55 1# gnulib-common.m4 serial 57
2dnl Copyright (C) 2007-2020 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -480,14 +480,6 @@ AC_DEFUN([gl_FEATURES_H],
480 AC_SUBST([HAVE_FEATURES_H]) 480 AC_SUBST([HAVE_FEATURES_H])
481]) 481])
482 482
483# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH])
484# ----------------------------------------------------
485# Backport of autoconf-2.63b's macro.
486# Remove this macro when we can assume autoconf >= 2.64.
487m4_ifndef([AS_VAR_IF],
488[m4_define([AS_VAR_IF],
489[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
490
491# gl_PROG_CC_C99 483# gl_PROG_CC_C99
492# Modifies the value of the shell variable CC in an attempt to make $CC 484# Modifies the value of the shell variable CC in an attempt to make $CC
493# understand ISO C99 source code. 485# understand ISO C99 source code.
@@ -660,6 +652,72 @@ AC_DEFUN([gl_CACHE_VAL_SILENT],
660 as_echo_n="$saved_as_echo_n" 652 as_echo_n="$saved_as_echo_n"
661]) 653])
662 654
663# AS_VAR_COPY was added in autoconf 2.63b 655dnl Expands to some code for use in .c programs that, on native Windows, defines
664m4_define_default([AS_VAR_COPY], 656dnl the Microsoft deprecated alias function names to the underscore-prefixed
665[AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])]) 657dnl actual function names. With this macro, these function names are available
658dnl without linking with '-loldnames' and without generating warnings.
659dnl Usage: Use it after all system header files are included.
660dnl #include <...>
661dnl #include <...>
662dnl ]GL_MDA_DEFINES[
663dnl ...
664AC_DEFUN([GL_MDA_DEFINES],[
665AC_REQUIRE([_GL_MDA_DEFINES])
666[$gl_mda_defines]
667])
668AC_DEFUN([_GL_MDA_DEFINES],
669[gl_mda_defines='
670#if defined _WIN32 && !defined __CYGWIN__
671#define access _access
672#define chdir _chdir
673#define chmod _chmod
674#define close _close
675#define creat _creat
676#define dup _dup
677#define dup2 _dup2
678#define ecvt _ecvt
679#define execl _execl
680#define execle _execle
681#define execlp _execlp
682#define execv _execv
683#define execve _execve
684#define execvp _execvp
685#define execvpe _execvpe
686#define fcloseall _fcloseall
687#define fcvt _fcvt
688#define fdopen _fdopen
689#define fileno _fileno
690#define gcvt _gcvt
691#define getcwd _getcwd
692#define getpid _getpid
693#define getw _getw
694#define isatty _isatty
695#define j0 _j0
696#define j1 _j1
697#define jn _jn
698#define lfind _lfind
699#define lsearch _lsearch
700#define lseek _lseek
701#define memccpy _memccpy
702#define mkdir _mkdir
703#define mktemp _mktemp
704#define open _open
705#define putenv _putenv
706#define putw _putw
707#define read _read
708#define rmdir _rmdir
709#define strdup _strdup
710#define swab _swab
711#define tempnam _tempnam
712#define tzset _tzset
713#define umask _umask
714#define unlink _unlink
715#define utime _utime
716#define wcsdup _wcsdup
717#define write _write
718#define y0 _y0
719#define y1 _y1
720#define yn _yn
721#endif
722'
723])
diff --git a/m4/include_next.m4 b/m4/include_next.m4
index 9009e293b53..33601aa3b43 100644
--- a/m4/include_next.m4
+++ b/m4/include_next.m4
@@ -1,4 +1,4 @@
1# include_next.m4 serial 24 1# include_next.m4 serial 25
2dnl Copyright (C) 2006-2020 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -176,42 +176,40 @@ AC_DEFUN([gl_NEXT_HEADERS_INTERNAL],
176 [AC_CHECK_HEADERS_ONCE([$1]) 176 [AC_CHECK_HEADERS_ONCE([$1])
177 ]) 177 ])
178 178
179dnl FIXME: gl_next_header and gl_header_exists must be used unquoted
180dnl until we can assume autoconf 2.64 or newer.
181 m4_foreach_w([gl_HEADER_NAME], [$1], 179 m4_foreach_w([gl_HEADER_NAME], [$1],
182 [AS_VAR_PUSHDEF([gl_next_header], 180 [AS_VAR_PUSHDEF([gl_next_header],
183 [gl_cv_next_]m4_defn([gl_HEADER_NAME])) 181 [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
184 if test $gl_cv_have_include_next = yes; then 182 if test $gl_cv_have_include_next = yes; then
185 AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) 183 AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
186 else 184 else
187 AC_CACHE_CHECK( 185 AC_CACHE_CHECK(
188 [absolute name of <]m4_defn([gl_HEADER_NAME])[>], 186 [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
189 m4_defn([gl_next_header]), 187 [gl_next_header],
190 [m4_if([$2], [check], 188 [m4_if([$2], [check],
191 [AS_VAR_PUSHDEF([gl_header_exists], 189 [AS_VAR_PUSHDEF([gl_header_exists],
192 [ac_cv_header_]m4_defn([gl_HEADER_NAME])) 190 [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
193 if test AS_VAR_GET(gl_header_exists) = yes; then 191 if test AS_VAR_GET([gl_header_exists]) = yes; then
194 AS_VAR_POPDEF([gl_header_exists]) 192 AS_VAR_POPDEF([gl_header_exists])
195 ]) 193 ])
196 gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME) 194 gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME)
197 AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME)) 195 AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME))
198 AS_VAR_SET(gl_next_header, ['"'$gl_header'"']) 196 AS_VAR_SET([gl_next_header], ['"'$gl_header'"'])
199 m4_if([$2], [check], 197 m4_if([$2], [check],
200 [else 198 [else
201 AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) 199 AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
202 fi 200 fi
203 ]) 201 ])
204 ]) 202 ])
205 fi 203 fi
206 AC_SUBST( 204 AC_SUBST(
207 AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), 205 AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
208 [AS_VAR_GET(gl_next_header)]) 206 [AS_VAR_GET([gl_next_header])])
209 if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then 207 if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
210 # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' 208 # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
211 gl_next_as_first_directive='<'gl_HEADER_NAME'>' 209 gl_next_as_first_directive='<'gl_HEADER_NAME'>'
212 else 210 else
213 # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' 211 # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
214 gl_next_as_first_directive=AS_VAR_GET(gl_next_header) 212 gl_next_as_first_directive=AS_VAR_GET([gl_next_header])
215 fi 213 fi
216 AC_SUBST( 214 AC_SUBST(
217 AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])), 215 AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])),
diff --git a/m4/largefile.m4 b/m4/largefile.m4
index f7140dd0a3a..f4c5d3a5cea 100644
--- a/m4/largefile.m4
+++ b/m4/largefile.m4
@@ -30,12 +30,12 @@ m4_version_prereq([2.70], [] ,[
30# _AC_SYS_LARGEFILE_TEST_INCLUDES 30# _AC_SYS_LARGEFILE_TEST_INCLUDES
31# ------------------------------- 31# -------------------------------
32m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], 32m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
33[@%:@include <sys/types.h> 33[#include <sys/types.h>
34 /* Check that off_t can represent 2**63 - 1 correctly. 34 /* Check that off_t can represent 2**63 - 1 correctly.
35 We can't simply define LARGE_OFF_T to be 9223372036854775807, 35 We can't simply define LARGE_OFF_T to be 9223372036854775807,
36 since some C++ compilers masquerading as C compilers 36 since some C++ compilers masquerading as C compilers
37 incorrectly reject 9223372036854775807. */ 37 incorrectly reject 9223372036854775807. */
38@%:@define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) 38#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
39 int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 39 int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
40 && LARGE_OFF_T % 2147483647 == 1) 40 && LARGE_OFF_T % 2147483647 == 1)
41 ? 1 : -1]];[]dnl 41 ? 1 : -1]];[]dnl
@@ -54,7 +54,7 @@ m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
54 [AC_LANG_PROGRAM([$5], [$6])], 54 [AC_LANG_PROGRAM([$5], [$6])],
55 [$3=no; break]) 55 [$3=no; break])
56 m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( 56 m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
57 [AC_LANG_PROGRAM([@%:@define $1 $2 57 [AC_LANG_PROGRAM([#define $1 $2
58$5], [$6])], 58$5], [$6])],
59 [$3=$2; break]) 59 [$3=$2; break])
60 $3=unknown 60 $3=unknown
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index d18da048d9e..a37cd15b69a 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,4 +1,4 @@
1# manywarnings.m4 serial 20 1# manywarnings.m4 serial 21
2dnl Copyright (C) 2008-2020 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2020 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -39,8 +39,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
39[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) 39[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
40 40
41# Specialization for _AC_LANG = C. 41# Specialization for _AC_LANG = C.
42# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b. 42AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
43m4_defun([gl_MANYWARN_ALL_GCC(C)],
44[ 43[
45 AC_LANG_PUSH([C]) 44 AC_LANG_PUSH([C])
46 45
@@ -210,8 +209,7 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
210]) 209])
211 210
212# Specialization for _AC_LANG = C++. 211# Specialization for _AC_LANG = C++.
213# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b. 212AC_DEFUN([gl_MANYWARN_ALL_GCC(C++)],
214m4_defun([gl_MANYWARN_ALL_GCC(C++)],
215[ 213[
216 gl_MANYWARN_ALL_GCC_CXX_IMPL([$1]) 214 gl_MANYWARN_ALL_GCC_CXX_IMPL([$1])
217]) 215])
diff --git a/m4/mktime.m4 b/m4/mktime.m4
index 8d9b827fe21..4e7e423fa54 100644
--- a/m4/mktime.m4
+++ b/m4/mktime.m4
@@ -1,4 +1,4 @@
1# serial 32 1# serial 35
2dnl Copyright (C) 2002-2003, 2005-2007, 2009-2020 Free Software Foundation, 2dnl Copyright (C) 2002-2003, 2005-2007, 2009-2020 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
@@ -31,7 +31,6 @@ AC_DEFUN([gl_FUNC_MKTIME_WORKS],
31 dnl in Autoconf and because it invokes AC_LIBOBJ. 31 dnl in Autoconf and because it invokes AC_LIBOBJ.
32 AC_CHECK_HEADERS_ONCE([unistd.h]) 32 AC_CHECK_HEADERS_ONCE([unistd.h])
33 AC_CHECK_DECLS_ONCE([alarm]) 33 AC_CHECK_DECLS_ONCE([alarm])
34 AC_CHECK_FUNCS_ONCE([tzset])
35 AC_REQUIRE([gl_MULTIARCH]) 34 AC_REQUIRE([gl_MULTIARCH])
36 AC_CACHE_CHECK([for working mktime], [gl_cv_func_working_mktime], 35 AC_CACHE_CHECK([for working mktime], [gl_cv_func_working_mktime],
37 [if test $APPLE_UNIVERSAL_BUILD = 1; then 36 [if test $APPLE_UNIVERSAL_BUILD = 1; then
@@ -55,13 +54,12 @@ AC_DEFUN([gl_FUNC_MKTIME_WORKS],
55# include <signal.h> 54# include <signal.h>
56#endif 55#endif
57 56
57]GL_MDA_DEFINES[
58
58#ifndef TIME_T_IS_SIGNED 59#ifndef TIME_T_IS_SIGNED
59# define TIME_T_IS_SIGNED 0 60# define TIME_T_IS_SIGNED 0
60#endif 61#endif
61 62
62/* Work around redefinition to rpl_putenv by other config tests. */
63#undef putenv
64
65static time_t time_t_max; 63static time_t time_t_max;
66static time_t time_t_min; 64static time_t time_t_min;
67 65
diff --git a/m4/nstrftime.m4 b/m4/nstrftime.m4
index 6f2762aa276..e4eb87de0b9 100644
--- a/m4/nstrftime.m4
+++ b/m4/nstrftime.m4
@@ -1,4 +1,4 @@
1# serial 35 1# serial 36
2 2
3# Copyright (C) 1996-1997, 1999-2007, 2009-2020 Free Software Foundation, Inc. 3# Copyright (C) 1996-1997, 1999-2007, 2009-2020 Free Software Foundation, Inc.
4# 4#
@@ -17,8 +17,6 @@ AC_DEFUN([gl_FUNC_GNU_STRFTIME],
17 17
18 AC_REQUIRE([gl_TM_GMTOFF]) 18 AC_REQUIRE([gl_TM_GMTOFF])
19 19
20 AC_CHECK_FUNCS_ONCE([tzset])
21
22 AC_DEFINE([my_strftime], [nstrftime], 20 AC_DEFINE([my_strftime], [nstrftime],
23 [Define to the name of the strftime replacement function.]) 21 [Define to the name of the strftime replacement function.])
24]) 22])
diff --git a/m4/open-slash.m4 b/m4/open-slash.m4
index 1e57c96960e..5d84f2b548a 100644
--- a/m4/open-slash.m4
+++ b/m4/open-slash.m4
@@ -1,4 +1,4 @@
1# open-slash.m4 serial 1 1# open-slash.m4 serial 2
2dnl Copyright (C) 2007-2020 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -25,6 +25,7 @@ AC_DEFUN([gl_OPEN_TRAILING_SLASH_BUG],
25#if HAVE_UNISTD_H 25#if HAVE_UNISTD_H
26# include <unistd.h> 26# include <unistd.h>
27#endif 27#endif
28]GL_MDA_DEFINES[
28int main () 29int main ()
29{ 30{
30 int result = 0; 31 int result = 0;
diff --git a/m4/pselect.m4 b/m4/pselect.m4
index f3e5afe0b38..08a5823c6f9 100644
--- a/m4/pselect.m4
+++ b/m4/pselect.m4
@@ -1,4 +1,4 @@
1# pselect.m4 serial 8 1# pselect.m4 serial 9
2dnl Copyright (C) 2011-2020 Free Software Foundation, Inc. 2dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -37,7 +37,8 @@ AC_DEFUN([gl_FUNC_PSELECT],
37#endif 37#endif
38#include <unistd.h> 38#include <unistd.h>
39#include <errno.h> 39#include <errno.h>
40]],[[ 40]GL_MDA_DEFINES],
41[[
41 fd_set set; 42 fd_set set;
42 dup2(0, 16); 43 dup2(0, 16);
43 FD_ZERO(&set); 44 FD_ZERO(&set);
diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4
index d67511f73dd..030862de015 100644
--- a/m4/pthread_sigmask.m4
+++ b/m4/pthread_sigmask.m4
@@ -1,4 +1,4 @@
1# pthread_sigmask.m4 serial 18 1# pthread_sigmask.m4 serial 19
2dnl Copyright (C) 2011-2020 Free Software Foundation, Inc. 2dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -220,6 +220,7 @@ int main ()
220#include <stdio.h> 220#include <stdio.h>
221#include <stdlib.h> 221#include <stdlib.h>
222#include <unistd.h> 222#include <unistd.h>
223]GL_MDA_DEFINES[
223static volatile int sigint_occurred; 224static volatile int sigint_occurred;
224static void 225static void
225sigint_handler (int sig) 226sigint_handler (int sig)
diff --git a/m4/time_h.m4 b/m4/time_h.m4
index d0f89327c4b..a15c09dc07b 100644
--- a/m4/time_h.m4
+++ b/m4/time_h.m4
@@ -121,7 +121,6 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
121 HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) 121 HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP])
122 HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME]) 122 HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME])
123 HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) 123 HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM])
124 HAVE_TZSET=1; AC_SUBST([HAVE_TZSET])
125 dnl Even GNU libc does not have timezone_t yet. 124 dnl Even GNU libc does not have timezone_t yet.
126 HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) 125 HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T])
127 dnl If another module says to replace or to not replace, do that. 126 dnl If another module says to replace or to not replace, do that.
diff --git a/m4/utimens.m4 b/m4/utimens.m4
index 65617ac862c..3d31085fc6d 100644
--- a/m4/utimens.m4
+++ b/m4/utimens.m4
@@ -3,7 +3,7 @@ dnl This file is free software; the Free Software Foundation
3dnl gives unlimited permission to copy and/or distribute it, 3dnl gives unlimited permission to copy and/or distribute it,
4dnl with or without modifications, as long as this notice is preserved. 4dnl with or without modifications, as long as this notice is preserved.
5 5
6dnl serial 10 6dnl serial 11
7 7
8AC_DEFUN([gl_UTIMENS], 8AC_DEFUN([gl_UTIMENS],
9[ 9[
@@ -24,7 +24,8 @@ AC_DEFUN([gl_UTIMENS],
24#include <stddef.h> 24#include <stddef.h>
25#include <sys/times.h> 25#include <sys/times.h>
26#include <fcntl.h> 26#include <fcntl.h>
27]], [[ int fd = open ("conftest.file", O_RDWR); 27]GL_MDA_DEFINES],
28 [[int fd = open ("conftest.file", O_RDWR);
28 if (fd < 0) return 1; 29 if (fd < 0) return 1;
29 if (futimesat (fd, NULL, NULL)) return 2; 30 if (futimesat (fd, NULL, NULL)) return 2;
30 ]])], 31 ]])],
diff --git a/m4/utimensat.m4 b/m4/utimensat.m4
index 2bc1bfebb5d..e9e4f26b1c1 100644
--- a/m4/utimensat.m4
+++ b/m4/utimensat.m4
@@ -1,4 +1,4 @@
1# serial 6 1# serial 7
2# See if we need to provide utimensat replacement. 2# See if we need to provide utimensat replacement.
3 3
4dnl Copyright (C) 2009-2020 Free Software Foundation, Inc. 4dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
@@ -23,7 +23,8 @@ AC_DEFUN([gl_FUNC_UTIMENSAT],
23#include <fcntl.h> 23#include <fcntl.h>
24#include <sys/stat.h> 24#include <sys/stat.h>
25#include <unistd.h> 25#include <unistd.h>
26]], [[int result = 0; 26]GL_MDA_DEFINES],
27 [[int result = 0;
27 const char *f = "conftest.file"; 28 const char *f = "conftest.file";
28 if (close (creat (f, 0600))) 29 if (close (creat (f, 0600)))
29 return 1; 30 return 1;
diff --git a/m4/utimes.m4 b/m4/utimes.m4
index e1056bbba4e..877bfd2a735 100644
--- a/m4/utimes.m4
+++ b/m4/utimes.m4
@@ -1,5 +1,5 @@
1# Detect some bugs in glibc's implementation of utimes. 1# Detect some bugs in glibc's implementation of utimes.
2# serial 7 2# serial 8
3 3
4dnl Copyright (C) 2003-2005, 2009-2020 Free Software Foundation, Inc. 4dnl Copyright (C) 2003-2005, 2009-2020 Free Software Foundation, Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
@@ -34,6 +34,7 @@ AC_DEFUN([gl_FUNC_UTIMES],
34#include <stdio.h> 34#include <stdio.h>
35#include <utime.h> 35#include <utime.h>
36#include <errno.h> 36#include <errno.h>
37]GL_MDA_DEFINES[
37 38
38static int 39static int
39inorder (time_t a, time_t b, time_t c) 40inorder (time_t a, time_t b, time_t c)
diff --git a/m4/warnings.m4 b/m4/warnings.m4
index d272365f0a1..d4e4b073453 100644
--- a/m4/warnings.m4
+++ b/m4/warnings.m4
@@ -1,4 +1,4 @@
1# warnings.m4 serial 14 1# warnings.m4 serial 16
2dnl Copyright (C) 2008-2020 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2020 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -23,8 +23,6 @@ m4_ifdef([AS_VAR_APPEND],
23# The effects of this macro depend on the current language (_AC_LANG). 23# The effects of this macro depend on the current language (_AC_LANG).
24AC_DEFUN([gl_COMPILER_OPTION_IF], 24AC_DEFUN([gl_COMPILER_OPTION_IF],
25[ 25[
26dnl FIXME: gl_Warn must be used unquoted until we can assume Autoconf
27dnl 2.64 or newer.
28AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl 26AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl
29AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl 27AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl
30AS_LITERAL_IF([$1], 28AS_LITERAL_IF([$1],
@@ -34,13 +32,13 @@ case $gl_positive in
34 -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;; 32 -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;;
35esac 33esac
36m4_pushdef([gl_Positive], [$gl_positive])])dnl 34m4_pushdef([gl_Positive], [$gl_positive])])dnl
37AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [ 35AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], [gl_Warn], [
38 gl_save_compiler_FLAGS="$gl_Flags" 36 gl_save_compiler_FLAGS="$gl_Flags"
39 gl_AS_VAR_APPEND(m4_defn([gl_Flags]), 37 gl_AS_VAR_APPEND(m4_defn([gl_Flags]),
40 [" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["]) 38 [" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["])
41 AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])], 39 AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([[]])])],
42 [AS_VAR_SET(gl_Warn, [yes])], 40 [AS_VAR_SET([gl_Warn], [yes])],
43 [AS_VAR_SET(gl_Warn, [no])]) 41 [AS_VAR_SET([gl_Warn], [no])])
44 gl_Flags="$gl_save_compiler_FLAGS" 42 gl_Flags="$gl_save_compiler_FLAGS"
45]) 43])
46AS_VAR_IF(gl_Warn, [yes], [$2], [$3]) 44AS_VAR_IF(gl_Warn, [yes], [$2], [$3])
@@ -59,8 +57,7 @@ AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS],
59[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) 57[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
60 58
61# Specialization for _AC_LANG = C. This macro can be AC_REQUIREd. 59# Specialization for _AC_LANG = C. This macro can be AC_REQUIREd.
62# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b. 60AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C)],
63m4_defun([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C)],
64[ 61[
65 AC_LANG_PUSH([C]) 62 AC_LANG_PUSH([C])
66 gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL 63 gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL
@@ -68,8 +65,7 @@ m4_defun([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C)],
68]) 65])
69 66
70# Specialization for _AC_LANG = C++. This macro can be AC_REQUIREd. 67# Specialization for _AC_LANG = C++. This macro can be AC_REQUIREd.
71# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b. 68AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C++)],
72m4_defun([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C++)],
73[ 69[
74 AC_LANG_PUSH([C++]) 70 AC_LANG_PUSH([C++])
75 gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL 71 gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL
@@ -77,8 +73,7 @@ m4_defun([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C++)],
77]) 73])
78 74
79# Specialization for _AC_LANG = Objective C. This macro can be AC_REQUIREd. 75# Specialization for _AC_LANG = Objective C. This macro can be AC_REQUIREd.
80# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b. 76AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(Objective C)],
81m4_defun([gl_UNKNOWN_WARNINGS_ARE_ERRORS(Objective C)],
82[ 77[
83 AC_LANG_PUSH([Objective C]) 78 AC_LANG_PUSH([Objective C])
84 gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL 79 gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL