Commit 846657af authored by Paul Eggert's avatar Paul Eggert

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.
parent 8c68a15f
......@@ -146,6 +146,16 @@
_GL_EXTERN_C int _gl_cxxalias_dummy
#endif
/* _GL_CXXALIAS_MDA (func, rettype, parameters);
is to be used when func is a Microsoft deprecated alias, on native Windows.
It declares a C++ alias called GNULIB_NAMESPACE::func
that redirects to _func, if GNULIB_NAMESPACE is defined.
Example:
_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
*/
#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
_GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
except that the C function rpl_func may have a slightly different
......
......@@ -52,7 +52,9 @@
# include "pathmax.h"
# include "malloca.h"
# include "filename.h"
# if HAVE_GETCWD
# if defined _WIN32 && !defined __CYGWIN__
# define __getcwd _getcwd
# elif HAVE_GETCWD
# if IN_RELOCWRAPPER
/* When building the relocatable program wrapper, use the system's getcwd
function, not the gnulib override, otherwise we would get a link error.
......
......@@ -85,7 +85,7 @@
# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct
# else
# if defined __cplusplus && __GNUC_PREREQ (2,8)
# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4)
# define __THROW throw ()
# define __THROWNL throw ()
# define __NTH(fct) __LEAF_ATTR fct throw ()
......@@ -194,7 +194,7 @@
Example:
int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
#if defined __GNUC__ && __GNUC__ >= 2
#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
# ifdef __cplusplus
......@@ -465,7 +465,8 @@
#if (!defined _Static_assert && !defined __cplusplus \
&& (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
&& (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__))
&& (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \
|| defined __STRICT_ANSI__))
# define _Static_assert(expr, diagnostic) \
extern int (*__Static_assert_function (void)) \
[!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
......
......@@ -52,7 +52,7 @@ dup2_nothrow (int fd, int desired_fd)
TRY_MSVC_INVAL
{
result = dup2 (fd, desired_fd);
result = _dup2 (fd, desired_fd);
}
CATCH_MSVC_INVAL
{
......@@ -64,7 +64,7 @@ dup2_nothrow (int fd, int desired_fd)
return result;
}
# else
# define dup2_nothrow dup2
# define dup2_nothrow _dup2
# endif
static int
......
......@@ -97,6 +97,12 @@
_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef creat
# define creat _creat
# endif
_GL_CXXALIAS_MDA (creat, int, (const char *filename, mode_t mode));
# else
_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode));
# endif
......@@ -106,6 +112,9 @@ _GL_CXXALIASWARN (creat);
/* Assume creat is always declared. */
_GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - "
"use gnulib module creat for portability");
#elif defined _WIN32 && !defined __CYGWIN__
# undef creat
# define creat _creat
#endif
#if @GNULIB_FCNTL@
......@@ -146,6 +155,12 @@ _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef open
# define open _open
# endif
_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
# else
_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
# endif
......@@ -159,6 +174,9 @@ _GL_CXXALIASWARN (open);
/* Assume open is always declared. */
_GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
"use gnulib module open for portability");
#elif defined _WIN32 && !defined __CYGWIN__
# undef open
# define open _open
#endif
#if @GNULIB_OPENAT@
......
......@@ -57,7 +57,7 @@
#endif
#ifndef __THROW
# if defined __cplusplus && __GNUC_PREREQ (2,8)
# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
# define __THROW throw ()
# else
# define __THROW
......
......@@ -682,7 +682,6 @@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
HAVE_TIMEGM = @HAVE_TIMEGM@
HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@
HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
HAVE_TZSET = @HAVE_TZSET@
HAVE_UNISTD_H = @HAVE_UNISTD_H@
HAVE_UNLINKAT = @HAVE_UNLINKAT@
HAVE_UNLOCKPT = @HAVE_UNLOCKPT@
......@@ -1159,7 +1158,7 @@ ifeq (,$(OMIT_GNULIB_MODULE_absolute-header))
# Use this preprocessor expression to decide whether #include_next works.
# Do not rely on a 'configure'-time test for this, since the expression
# might appear in an installed header, which is used by some other compiler.
HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER)
HAVE_INCLUDE_NEXT = (__GNUC__ || __clang__ || 60000000 <= __DECC_VER)
endif
## end gnulib module absolute-header
......@@ -3185,7 +3184,6 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
-e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \
-e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \
-e 's|@''HAVE_TZSET''@|$(HAVE_TZSET)|g' \
-e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \
-e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \
-e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \
......
......@@ -396,7 +396,7 @@
For now, assume all versions of GCC-like compilers generate bogus
warnings for _Generic. This matters only for compilers that
lack relevant builtins. */
#if __GNUC__
#if __GNUC__ || defined __clang__
# define _GL__GENERIC_BOGUS 1
#else
# define _GL__GENERIC_BOGUS 0
......
......@@ -40,7 +40,7 @@
#endif
#ifndef __THROW
# if defined __cplusplus && __GNUC_PREREQ (2,8)
# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
# define __THROW throw ()
# else
# define __THROW
......
......@@ -94,7 +94,7 @@ my_tzset (void)
const char *tz = getenv ("TZ");
if (tz != NULL && strchr (tz, '/') != NULL)
_putenv ("TZ=");
# elif HAVE_TZSET
# else
tzset ();
# endif
}
......
......@@ -21,7 +21,6 @@
# define HAVE_TM_GMTOFF 1
# define HAVE_TM_ZONE 1
# define HAVE_TZNAME 1
# define HAVE_TZSET 1
# include "../locale/localeinfo.h"
#else
# include <config.h>
......@@ -34,6 +33,7 @@
#endif
#include <ctype.h>
#include <errno.h>
#include <time.h>
#if HAVE_TZNAME && !HAVE_DECL_TZNAME
......@@ -163,7 +163,10 @@ extern char *tzname[];
size_t _w = pad == L_('-') || width < 0 ? 0 : width; \
size_t _incr = _n < _w ? _w : _n; \
if (_incr >= maxsize - i) \
return 0; \
{ \
errno = ERANGE; \
return 0; \
} \
if (p) \
{ \
if (_n < _w) \
......@@ -365,7 +368,7 @@ tm_diff (const struct tm *a, const struct tm *b)
#define ISO_WEEK1_WDAY 4 /* Thursday */
#define YDAY_MINIMUM (-366)
static int iso_week_days (int, int);
#ifdef __GNUC__
#if defined __GNUC__ || defined __clang__
__inline__
#endif
static int
......@@ -389,7 +392,6 @@ iso_week_days (int yday, int wday)
#endif
#ifdef my_strftime
# undef HAVE_TZSET
# define extra_args , tz, ns
# define extra_args_spec , timezone_t tz, int ns
#else
......@@ -449,6 +451,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
size_t maxsize = (size_t) -1;
#endif
int saved_errno = errno;
int hour12 = tp->tm_hour;
#ifdef _NL_CURRENT
/* We cannot make the following values variables since we must delay
......@@ -523,7 +526,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
{
/* POSIX.1 requires that local time zone information be used as
though strftime called tzset. */
# if HAVE_TZSET
# ifndef my_strftime
if (!*tzset_called)
{
tzset ();
......@@ -1188,7 +1191,13 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
time_t t;
ltm = *tp;
ltm.tm_yday = -1;
t = mktime_z (tz, &ltm);
if (ltm.tm_yday < 0)
{
errno = EOVERFLOW;
return 0;
}
/* Generate string value for T using time_t arithmetic;
this works even if sizeof (long) < sizeof (time_t). */
......@@ -1417,7 +1426,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
/* POSIX.1 requires that local time zone information be used as
though strftime called tzset. */
# if HAVE_TZSET
# ifndef my_strftime
if (!*tzset_called)
{
tzset ();
......@@ -1486,5 +1495,6 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
*p = L_('\0');
#endif
errno = saved_errno;
return i;
}
......@@ -30,7 +30,11 @@
static int
orig_open (const char *filename, int flags, mode_t mode)
{
#if defined _WIN32 && !defined __CYGWIN__
return _open (filename, flags, mode);
#else
return open (filename, flags, mode);
#endif
}
/* Specification. */
......
......@@ -558,7 +558,7 @@ weak_alias (__regerror, regerror)
static const bitset_t utf8_sb_map =
{
/* Set the first 128 bits. */
# if defined __GNUC__ && !defined __STRICT_ANSI__
# if (defined __GNUC__ || __clang_major__ >= 4) && !defined __STRICT_ANSI__
[0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX
# else
# if 4 * BITSET_WORD_BITS < ASCII_CHARS
......
......@@ -335,7 +335,7 @@ typedef struct
Idx idx; /* for BACK_REF */
re_context_type ctx_type; /* for ANCHOR */
} opr;
#if __GNUC__ >= 2 && !defined __STRICT_ANSI__
#if (__GNUC__ >= 2 || defined __clang__) && !defined __STRICT_ANSI__
re_token_type_t type : 8;
#else
re_token_type_t type;
......
......@@ -215,6 +215,11 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
"use gnulib module fclose for portable POSIX compliance");
#endif
#if defined _WIN32 && !defined __CYGWIN__
# undef fcloseall
# define fcloseall _fcloseall
#endif
#if @GNULIB_FDOPEN@
# if @REPLACE_FDOPEN@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
......@@ -224,6 +229,12 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
_GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fdopen
# define fdopen _fdopen
# endif
_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
# else
_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
# endif
......@@ -233,6 +244,9 @@ _GL_CXXALIASWARN (fdopen);
/* Assume fdopen is always declared. */
_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
"use gnulib module fdopen for portability");
#elif defined _WIN32 && !defined __CYGWIN__
# undef fdopen
# define fdopen _fdopen
#endif
#if @GNULIB_FFLUSH@
......@@ -297,6 +311,11 @@ _GL_CXXALIASWARN (fgets);
# endif
#endif
#if defined _WIN32 && !defined __CYGWIN__
# undef fileno
# define fileno _fileno
#endif
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
......@@ -824,6 +843,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
#if defined _WIN32 && !defined __CYGWIN__
# undef getw
# define getw _getw
#endif
#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
struct obstack;
/* Grow an obstack with formatted output. Return the number of
......@@ -940,7 +964,7 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
|| (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
# if defined __GNUC__
# if defined __GNUC__ || defined __clang__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
/* Don't break __attribute__((format(printf,M,N))). */
# define printf __printf__
......@@ -1037,6 +1061,11 @@ _GL_CXXALIASWARN (puts);
# endif
#endif
#if defined _WIN32 && !defined __CYGWIN__
# undef putw
# define putw _putw
#endif
#if @GNULIB_REMOVE@
# if @REPLACE_REMOVE@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
......@@ -1114,7 +1143,7 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - "
#if @GNULIB_SCANF@
# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
# if defined __GNUC__
# if defined __GNUC__ || defined __clang__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef scanf
/* Don't break __attribute__((format(scanf,M,N))). */
......@@ -1170,7 +1199,9 @@ _GL_CXXALIAS_SYS (snprintf, int,
(char *restrict str, size_t size,
const char *restrict format, ...));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (snprintf);
# endif
#elif defined GNULIB_POSIXCHECK
# undef snprintf
# if HAVE_RAW_DECL_SNPRINTF
......@@ -1214,6 +1245,11 @@ _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
"POSIX compliance");
#endif
#if defined _WIN32 && !defined __CYGWIN__
# undef tempnam
# define tempnam _tempnam
#endif
#if @GNULIB_TMPFILE@
# if @REPLACE_TMPFILE@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
......@@ -1382,7 +1418,9 @@ _GL_CXXALIAS_SYS (vfscanf, int,
(FILE *restrict stream,
const char *restrict format, va_list args));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (vfscanf);
# endif
#endif
#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
......@@ -1436,7 +1474,9 @@ _GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args));
# else
_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (vscanf);
# endif
#endif
#if @GNULIB_VSNPRINTF@
......@@ -1464,7 +1504,9 @@ _GL_CXXALIAS_SYS (vsnprintf, int,
(char *restrict str, size_t size,
const char *restrict format, va_list args));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (vsnprintf);
# endif
#elif defined GNULIB_POSIXCHECK
# undef vsnprintf
# if HAVE_RAW_DECL_VSNPRINTF
......
......@@ -217,6 +217,21 @@ _GL_WARN_ON_USE (canonicalize_file_name,
# endif
#endif
#if defined _WIN32 && !defined __CYGWIN__
# undef ecvt
# define ecvt _ecvt
#endif
#if defined _WIN32 && !defined __CYGWIN__
# undef fcvt
# define fcvt _fcvt
#endif
#if defined _WIN32 && !defined __CYGWIN__
# undef gcvt
# define gcvt _gcvt
#endif
#if @GNULIB_GETLOADAVG@
/* Store max(NELEM,3) load average numbers in LOADAVG[].
The three numbers are the load average of the last 1 minute, the last 5
......@@ -468,6 +483,11 @@ _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
# endif
#endif
#if defined _WIN32 && !defined __CYGWIN__
# undef mktemp
# define mktemp _mktemp
#endif
#if @GNULIB_POSIX_OPENPT@
/* Return an FD open to the master side of a pseudo-terminal. Flags should
include O_RDWR, and may also include O_NOCTTY. */
......@@ -546,10 +566,19 @@ _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
# endif
_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (putenv, int, (char *string));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef putenv
# define putenv _putenv
# endif
_GL_CXXALIAS_MDA (putenv, int, (char *string));
# else
_GL_CXXALIAS_SYS (putenv, int, (char *string));
# endif
_GL_CXXALIASWARN (putenv);
#elif defined _WIN32 && !defined __CYGWIN__
# undef putenv
# define putenv _putenv
#endif
#if @GNULIB_QSORT_R@
......
......@@ -24,7 +24,12 @@ extern "C" {
/* Just like strftime, but with two more arguments:
POSIX requires that strftime use the local timezone information.
Use the timezone __TZ instead. Use __NS as the number of
nanoseconds in the %N directive. */
nanoseconds in the %N directive.
On error, set errno and return 0. Otherwise, return the number of
bytes generated (not counting the trailing NUL), preserving errno
if the number is 0. This errno behavior is in draft POSIX 202x
plus some requested changes to POSIX. */
size_t nstrftime (char *restrict, size_t, char const *, struct tm const *,
timezone_t __tz, int __ns);
......
......@@ -123,6 +123,12 @@ _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
#endif
#if defined _WIN32 && !defined __CYGWIN__
# undef memccpy
# define memccpy _memccpy
#endif
/* Return the first instance of C within N bytes of S, or NULL. */
#if @GNULIB_MEMCHR@
# if @REPLACE_MEMCHR@
......@@ -384,6 +390,12 @@ _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
# endif
_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef strdup
# define strdup _strdup
# endif
_GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
# else
# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
/* strdup exists as a function and as a macro. Get rid of the macro. */
......@@ -401,6 +413,9 @@ _GL_CXXALIASWARN (strdup);
_GL_WARN_ON_USE (strdup, "strdup is unportable - "
"use gnulib module strdup for portability");
# endif
#elif defined _WIN32 && !defined __CYGWIN__
# undef strdup
# define strdup _strdup
#endif
/* Append no more than N characters from SRC onto DEST. */
......
......@@ -177,14 +177,14 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef close
# define close close_used_without_including_unistd_h
# else
# elif !defined __clang__
_GL_WARN_ON_USE (close,
"close() used without including <unistd.h>");
# endif
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef gethostname
# define gethostname gethostname_used_without_including_unistd_h
# else
# elif !defined __clang__
_GL_WARN_ON_USE (gethostname,
"gethostname() used without including <unistd.h>");
# endif
......@@ -219,7 +219,7 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
# define setsockopt setsockopt_used_without_including_sys_socket_h
# undef shutdown
# define shutdown shutdown_used_without_including_sys_socket_h
# else
# elif !defined __clang__
_GL_WARN_ON_USE (socket,
"socket() used without including <sys/socket.h>");
_GL_WARN_ON_USE (connect,
......
......@@ -391,6 +391,12 @@ struct stat
#endif
#if defined _WIN32 && !defined __CYGWIN__
# undef chmod
# define chmod _chmod
#endif
#if @GNULIB_FCHMODAT@
# if @REPLACE_FCHMODAT@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
......@@ -432,7 +438,9 @@ _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
# else
_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fstat);
# endif
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
# undef fstat
# define fstat fstat_used_without_requesting_gnulib_module_fstat
......@@ -800,6 +808,12 @@ _GL_WARN_ON_USE (stat, "stat is unportable - "
#endif
#if defined _WIN32 && !defined __CYGWIN__
# undef umask
# define umask _umask
#endif
#if @GNULIB_UTIMENSAT@
/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
implementation relies on futimesat, which on Solaris 10 makes an invocation
......
......@@ -135,7 +135,7 @@ _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef close
# define close close_used_without_including_unistd_h
# else
# elif !defined __clang__
_GL_WARN_ON_USE (close,
"close() used without including <unistd.h>");
# endif
......
......@@ -135,13 +135,19 @@ _GL_CXXALIASWARN (nanosleep);
# endif
_GL_FUNCDECL_RPL (tzset, void, (void));
_GL_CXXALIAS_RPL (tzset, void, (void));
# else
# if ! @HAVE_TZSET@
_GL_FUNCDECL_SYS (tzset, void, (void));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef tzset
# define tzset _tzset
# endif
_GL_CXXALIAS_MDA (tzset, void, (void));
# else
_GL_CXXALIAS_SYS (tzset, void, (void));
# endif
_GL_CXXALIASWARN (tzset);
# elif defined _WIN32 && !defined __CYGWIN__
# undef tzset
# define tzset _tzset
# endif
/* Return the 'time_t' representation of TP and normalize TP. */
......
......@@ -54,31 +54,6 @@ enum { ABBR_SIZE_MIN = DEFAULT_MXFAST - offsetof (struct tm_zone, abbrs) };
matters; the pointer is never dereferenced. */
static timezone_t const local_tz = (timezone_t) 1;
#if HAVE_TM_ZONE || HAVE_TZNAME
/* Return true if the values A and B differ according to the rules for
tm_isdst: A and B differ if one is zero and the other positive. */
static bool
isdst_differ (int a, int b)
{
return !a != !b && 0 <= a && 0 <= b;
}
/* Return true if A and B are equal. */
static int
equal_tm (const struct tm *a, const struct tm *b)
{
return ! ((a->tm_sec ^ b->tm_sec)
| (a->tm_min ^ b->tm_min)
| (a->tm_hour ^ b->tm_hour)
| (a->tm_mday ^ b->tm_mday)
| (a->tm_mon ^ b->tm_mon)
| (a->tm_year ^ b->tm_year)
| isdst_differ (a->tm_isdst, b->tm_isdst));
}
#endif
/* Copy to ABBRS the abbreviation at ABBR with size ABBR_SIZ