summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-11-26 13:14:42 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2019-11-26 13:15:41 -0800
commit1b9dbca826ad8a742ab22719279f5ce3c5888a67 (patch)
treeafd37873182a84f6708c19105fedca1b4d58ddd2 /lib
parent50b52390ee5894e91965bd37f2d0c571df1e2e89 (diff)
downloademacs-1b9dbca826ad8a742ab22719279f5ce3c5888a67.tar.gz
Update from Gnulib
This incorporates: 2019-11-24 Fix errors in C++ mode on mingw 2019-11-24 time_r: Fix for mingw (regression from 2019-11-16) 2019-11-24 sys_time: Fix errors in C++ mode on mingw 2019-11-22 intprops: INT_MULTIPLY_WRAPV speedup for GCC 8.4+ 2019-11-21 Disable many _GL_CXXALIASWARN on non-glibc 2019-11-21 Fix various errors in _GL_CXXALIAS_SYS invocations 2019-11-19 intprops: INT_MULTIPLY_WRAPV speedup for GCC 9.3+ 2019-11-18 stdint: Define [u]intptr_t correctly on 64-bit native Windows 2019-11-18 stdint: Fix value of WINT_MAX when we override wint_t 2019-11-18 stdint: Avoid "conflicting types" error on mingw 5.22 2019-11-16 time_r: Fix for mingw 2019-11-06 regex: now back in sync with glibc * lib/intprops.h, lib/regexec.c, lib/signal.in.h: * lib/stdint.in.h, lib/stdio.in.h, lib/stdlib.in.h: * lib/string.in.h, lib/sys_select.in.h, lib/sys_time.in.h: * lib/time.in.h, lib/unistd.in.h, m4/time_r.m4: Copy from Gnulib.
Diffstat (limited to 'lib')
-rw-r--r--lib/intprops.h17
-rw-r--r--lib/regexec.c7
-rw-r--r--lib/signal.in.h6
-rw-r--r--lib/stdint.in.h60
-rw-r--r--lib/stdio.in.h58
-rw-r--r--lib/stdlib.in.h26
-rw-r--r--lib/string.in.h10
-rw-r--r--lib/sys_select.in.h4
-rw-r--r--lib/sys_time.in.h6
-rw-r--r--lib/time.in.h14
-rw-r--r--lib/unistd.in.h4
11 files changed, 173 insertions, 39 deletions
diff --git a/lib/intprops.h b/lib/intprops.h
index bf561ad0a6e..0c3963d3302 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -373,12 +373,17 @@
_GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW)
#endif
#if _GL_HAS_BUILTIN_MUL_OVERFLOW
-/* Work around GCC bug 91450. */
-# define INT_MULTIPLY_WRAPV(a, b, r) \
- ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && EXPR_SIGNED (a) && EXPR_SIGNED (b) \
- && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \
- ? ((void) __builtin_mul_overflow (a, b, r), 1) \
- : __builtin_mul_overflow (a, b, r))
+# if (9 < __GNUC__ + (3 <= __GNUC_MINOR__) \
+ || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__))
+# define INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r)
+# else
+ /* Work around GCC bug 91450. */
+# define INT_MULTIPLY_WRAPV(a, b, r) \
+ ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && EXPR_SIGNED (a) && EXPR_SIGNED (b) \
+ && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \
+ ? ((void) __builtin_mul_overflow (a, b, r), 1) \
+ : __builtin_mul_overflow (a, b, r))
+# endif
#else
# define INT_MULTIPLY_WRAPV(a, b, r) \
_GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW)
diff --git a/lib/regexec.c b/lib/regexec.c
index c5dc6220b2d..03a6b65047e 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -1266,10 +1266,13 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs,
if (type == OP_BACK_REF)
{
Idx subexp_idx = dfa->nodes[node].opr.idx + 1;
- naccepted = regs[subexp_idx].rm_eo - regs[subexp_idx].rm_so;
+ if (subexp_idx < nregs)
+ naccepted = regs[subexp_idx].rm_eo - regs[subexp_idx].rm_so;
if (fs != NULL)
{
- if (regs[subexp_idx].rm_so == -1 || regs[subexp_idx].rm_eo == -1)
+ if (subexp_idx >= nregs
+ || regs[subexp_idx].rm_so == -1
+ || regs[subexp_idx].rm_eo == -1)
return -1;
else if (naccepted)
{
diff --git a/lib/signal.in.h b/lib/signal.in.h
index a6960a252d9..b4e432d7fe0 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -144,7 +144,9 @@ _GL_FUNCDECL_SYS (pthread_sigmask, int,
_GL_CXXALIAS_SYS (pthread_sigmask, int,
(int how, const sigset_t *new_mask, sigset_t *old_mask));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (pthread_sigmask);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef pthread_sigmask
# if HAVE_RAW_DECL_PTHREAD_SIGMASK
@@ -168,7 +170,9 @@ _GL_FUNCDECL_SYS (raise, int, (int sig));
# endif
_GL_CXXALIAS_SYS (raise, int, (int sig));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (raise);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef raise
/* Assume raise is always declared. */
@@ -321,7 +325,9 @@ _GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t,
_GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t,
(int sig, _gl_function_taking_int_returning_void_t func));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (signal);
+# endif
# if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE
/* Raise signal SIGPIPE. */
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index d32de34da19..39b6a4f88aa 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -299,16 +299,26 @@ typedef gl_uint_fast32_t gl_uint_fast16_t;
/* 7.18.1.4. Integer types capable of holding object pointers */
-/* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own
+/* kLIBC's <stdint.h> defines _INTPTR_T_DECLARED and needs its own
definitions of intptr_t and uintptr_t (which use int and unsigned)
- to avoid clashes with declarations of system functions like sbrk. */
-# ifndef _INTPTR_T_DECLARED
-# undef intptr_t
-# undef uintptr_t
+ to avoid clashes with declarations of system functions like sbrk.
+ Similarly, mingw 5.22 <crtdefs.h> defines _INTPTR_T_DEFINED and
+ _UINTPTR_T_DEFINED and needs its own definitions of intptr_t and
+ uintptr_t to avoid conflicting declarations of system functions like
+ _findclose in <io.h>. */
+# if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \
+ || (defined __MINGW32__ && defined _INTPTR_T_DEFINED && defined _UINTPTR_T_DEFINED))
+# undef intptr_t
+# undef uintptr_t
+# ifdef _WIN64
+typedef long long int gl_intptr_t;
+typedef unsigned long long int gl_uintptr_t;
+# else
typedef long int gl_intptr_t;
typedef unsigned long int gl_uintptr_t;
-# define intptr_t gl_intptr_t
-# define uintptr_t gl_uintptr_t
+# endif
+# define intptr_t gl_intptr_t
+# define uintptr_t gl_uintptr_t
# endif
/* 7.18.1.5. Greatest-width integer types */
@@ -485,9 +495,15 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
# undef INTPTR_MIN
# undef INTPTR_MAX
# undef UINTPTR_MAX
-# define INTPTR_MIN LONG_MIN
-# define INTPTR_MAX LONG_MAX
-# define UINTPTR_MAX ULONG_MAX
+# ifdef _WIN64
+# define INTPTR_MIN LLONG_MIN
+# define INTPTR_MAX LLONG_MAX
+# define UINTPTR_MAX ULLONG_MAX
+# else
+# define INTPTR_MIN LONG_MIN
+# define INTPTR_MAX LONG_MAX
+# define UINTPTR_MAX ULONG_MAX
+# endif
/* 7.18.2.5. Limits of greatest-width integer types */
@@ -586,17 +602,21 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
_STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
/* wint_t limits */
-# undef WINT_MIN
-# undef WINT_MAX
-# if @HAVE_SIGNED_WINT_T@
-# define WINT_MIN \
- _STDINT_SIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
-# else
-# define WINT_MIN \
- _STDINT_UNSIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
+/* If gnulib's <wchar.h> or <wctype.h> overrides wint_t, @WINT_T_SUFFIX@ is not
+ accurate, therefore use the definitions from above. */
+# if !@GNULIB_OVERRIDES_WINT_T@
+# undef WINT_MIN
+# undef WINT_MAX
+# if @HAVE_SIGNED_WINT_T@
+# define WINT_MIN \
+ _STDINT_SIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
+# else
+# define WINT_MIN \
+ _STDINT_UNSIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
+# endif
+# define WINT_MAX \
+ _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
# endif
-# define WINT_MAX \
- _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
/* 7.18.4. Macros for integer constants */
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 4a8aa55528b..7c283ad3917 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -203,7 +203,9 @@ _GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
# else
_GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fclose);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef fclose
/* Assume fclose is always declared. */
@@ -247,7 +249,9 @@ _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
# else
_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fflush);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef fflush
/* Assume fflush is always declared. */
@@ -266,7 +270,9 @@ _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
# else
_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fgetc);
+# endif
#endif
#if @GNULIB_FGETS@
@@ -281,7 +287,9 @@ _GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream));
# else
_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fgets);
+# endif
#endif
#if @GNULIB_FOPEN@
@@ -296,7 +304,9 @@ _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
# else
_GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fopen);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef fopen
/* Assume fopen is always declared. */
@@ -324,7 +334,9 @@ _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
# else
_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fprintf);
+# endif
#endif
#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
# if !GNULIB_overrides_fprintf
@@ -375,7 +387,9 @@ _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
# else
_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fputc);
+# endif
#endif
#if @GNULIB_FPUTS@
@@ -390,7 +404,9 @@ _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
# else
_GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fputs);
+# endif
#endif
#if @GNULIB_FREAD@
@@ -405,7 +421,9 @@ _GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
# else
_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fread);
+# endif
#endif
#if @GNULIB_FREOPEN@
@@ -423,7 +441,9 @@ _GL_CXXALIAS_RPL (freopen, FILE *,
_GL_CXXALIAS_SYS (freopen, FILE *,
(const char *filename, const char *mode, FILE *stream));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (freopen);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef freopen
/* Assume freopen is always declared. */
@@ -445,7 +465,9 @@ _GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...));
# else
_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fscanf);
+# endif
#endif
@@ -496,7 +518,9 @@ _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
# else
_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fseek);
+# endif
#endif
#if @GNULIB_FSEEKO@
@@ -559,7 +583,9 @@ _GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
# else
_GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (ftell);
+# endif
#endif
#if @GNULIB_FTELLO@
@@ -639,7 +665,9 @@ extern size_t __REDIRECT (rpl_fwrite_unlocked,
# define fwrite_unlocked rpl_fwrite_unlocked
# endif
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fwrite);
+# endif
#endif
#if @GNULIB_GETC@
@@ -653,7 +681,9 @@ _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
# else
_GL_CXXALIAS_SYS (getc, int, (FILE *stream));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (getc);
+# endif
#endif
#if @GNULIB_GETCHAR@
@@ -667,7 +697,9 @@ _GL_CXXALIAS_RPL (getchar, int, (void));
# else
_GL_CXXALIAS_SYS (getchar, int, (void));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (getchar);
+# endif
#endif
#if @GNULIB_GETDELIM@
@@ -832,7 +864,9 @@ _GL_CXXALIAS_RPL (perror, void, (const char *string));
# else
_GL_CXXALIAS_SYS (perror, void, (const char *string));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (perror);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef perror
/* Assume perror is always declared. */
@@ -903,7 +937,9 @@ _GL_CXXALIAS_RPL (printf, int, (const char *format, ...));
# else
_GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (printf);
+# endif
#endif
#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
# if !GNULIB_overrides_printf
@@ -926,7 +962,9 @@ _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
# else
_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (putc);
+# endif
#endif
#if @GNULIB_PUTCHAR@
@@ -940,7 +978,9 @@ _GL_CXXALIAS_RPL (putchar, int, (int c));
# else
_GL_CXXALIAS_SYS (putchar, int, (int c));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (putchar);
+# endif
#endif
#if @GNULIB_PUTS@
@@ -954,7 +994,9 @@ _GL_CXXALIAS_RPL (puts, int, (const char *string));
# else
_GL_CXXALIAS_SYS (puts, int, (const char *string));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (puts);
+# endif
#endif
#if @GNULIB_REMOVE@
@@ -968,7 +1010,9 @@ _GL_CXXALIAS_RPL (remove, int, (const char *name));
# else
_GL_CXXALIAS_SYS (remove, int, (const char *name));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (remove);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef remove
/* Assume remove is always declared. */
@@ -991,7 +1035,9 @@ _GL_CXXALIAS_RPL (rename, int,
_GL_CXXALIAS_SYS (rename, int,
(const char *old_filename, const char *new_filename));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (rename);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef rename
/* Assume rename is always declared. */
@@ -1056,7 +1102,9 @@ _GL_CXXALIAS_RPL (scanf, int, (const char *format, ...));
# else
_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (scanf);
+# endif
#endif
#if @GNULIB_SNPRINTF@
@@ -1110,7 +1158,9 @@ _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
# else
_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (sprintf);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef sprintf
/* Assume sprintf is always declared. */
@@ -1129,7 +1179,9 @@ _GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
# else
_GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (tmpfile);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef tmpfile
# if HAVE_RAW_DECL_TMPFILE
@@ -1240,7 +1292,9 @@ _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
_GL_CXXALIAS_SYS_CAST (vfprintf, int,
(FILE *fp, const char *format, va_list args));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (vfprintf);
+# endif
#endif
#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
# if !GNULIB_overrides_vfprintf
@@ -1294,7 +1348,9 @@ _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
and GCC's fixincludes did not change this to __gnuc_va_list. */
_GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (vprintf);
+# endif
#endif
#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
# if !GNULIB_overrides_vprintf
@@ -1370,7 +1426,9 @@ _GL_CXXALIAS_RPL (vsprintf, int,
_GL_CXXALIAS_SYS_CAST (vsprintf, int,
(char *str, const char *format, va_list args));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (vsprintf);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef vsprintf
/* Assume vsprintf is always declared. */
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index e5583d967c1..2d02b4b0126 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -176,7 +176,9 @@ _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
# else
_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (calloc);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef calloc
/* Assume calloc is always declared. */
@@ -288,7 +290,9 @@ _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
# else
_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (malloc);
+# endif
#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
# undef malloc
/* Assume malloc is always declared. */
@@ -311,7 +315,9 @@ _GL_FUNCDECL_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
# endif
_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (mbtowc);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef mbtowc
# if HAVE_RAW_DECL_MBTOWC
@@ -616,7 +622,9 @@ _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
# if !@HAVE_RANDOM@
_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
# endif
-_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
+/* Need to cast, because on FreeBSD, the first parameter is
+ unsigned long seed. */
+_GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
# endif
_GL_CXXALIASWARN (srandom);
#elif defined GNULIB_POSIXCHECK
@@ -644,8 +652,10 @@ _GL_FUNCDECL_SYS (initstate, char *,
(unsigned int seed, char *buf, size_t buf_size)
_GL_ARG_NONNULL ((2)));
# endif
-_GL_CXXALIAS_SYS (initstate, char *,
- (unsigned int seed, char *buf, size_t buf_size));
+/* Need to cast, because on FreeBSD, the first parameter is
+ unsigned long seed. */
+_GL_CXXALIAS_SYS_CAST (initstate, char *,
+ (unsigned int seed, char *buf, size_t buf_size));
# endif
_GL_CXXALIASWARN (initstate);
#elif defined GNULIB_POSIXCHECK
@@ -668,7 +678,9 @@ _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
# endif
-_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
+/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
+ is const char *arg_state. */
+_GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
# endif
_GL_CXXALIASWARN (setstate);
#elif defined GNULIB_POSIXCHECK
@@ -809,7 +821,9 @@ _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
# else
_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (realloc);
+# endif
#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
# undef realloc
/* Assume realloc is always declared. */
@@ -940,7 +954,9 @@ _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
# endif
_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (strtod);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef strtod
# if HAVE_RAW_DECL_STRTOD
@@ -1079,7 +1095,9 @@ _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
# else
_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (wctomb);
+# endif
#endif
diff --git a/lib/string.in.h b/lib/string.in.h
index c57f041c06d..9b8ced24cd8 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -149,7 +149,7 @@ _GL_CXXALIAS_SYS_CAST2 (memchr,
_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
_GL_CXXALIASWARN1 (memchr, void const *,
(void const *__s, int __c, size_t __n));
-# else
+# elif __GLIBC__ >= 2
_GL_CXXALIASWARN (memchr);
# endif
#elif defined GNULIB_POSIXCHECK
@@ -417,7 +417,9 @@ _GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n));
# else
_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (strncat);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef strncat
# if HAVE_RAW_DECL_STRNCAT
@@ -512,7 +514,7 @@ _GL_CXXALIAS_SYS_CAST2 (strpbrk,
_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
_GL_CXXALIASWARN1 (strpbrk, char const *,
(char const *__s, char const *__accept));
-# else
+# elif __GLIBC__ >= 2
_GL_CXXALIASWARN (strpbrk);
# endif
# if defined GNULIB_POSIXCHECK
@@ -614,7 +616,7 @@ _GL_CXXALIAS_SYS_CAST2 (strstr,
_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
_GL_CXXALIASWARN1 (strstr, const char *,
(const char *haystack, const char *needle));
-# else
+# elif __GLIBC__ >= 2
_GL_CXXALIASWARN (strstr);
# endif
#elif defined GNULIB_POSIXCHECK
@@ -980,7 +982,9 @@ _GL_CXXALIAS_RPL (strerror, char *, (int));
# else
_GL_CXXALIAS_SYS (strerror, char *, (int));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (strerror);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef strerror
/* Assume strerror is always declared. */
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index 4cf7cfc8e18..1a3c14fb0aa 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -295,11 +295,11 @@ _GL_FUNCDECL_RPL (select, int,
struct timeval *restrict));
_GL_CXXALIAS_RPL (select, int,
(int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
- struct timeval *restrict));
+ timeval *restrict));
# else
_GL_CXXALIAS_SYS (select, int,
(int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
- struct timeval *restrict));
+ timeval *restrict));
# endif
_GL_CXXALIASWARN (select);
#elif @HAVE_WINSOCK2_H@
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
index 539768889d0..d6c215e1f55 100644
--- a/lib/sys_time.in.h
+++ b/lib/sys_time.in.h
@@ -112,8 +112,12 @@ _GL_CXXALIASWARN (gettimeofday);
# if defined __cplusplus && defined GNULIB_NAMESPACE
namespace GNULIB_NAMESPACE {
typedef ::timeval
-#undef timeval
+# undef timeval
timeval;
+# if @REPLACE_STRUCT_TIMEVAL@
+# define timeval rpl_timeval
+ typedef ::timeval timeval;
+# endif
}
# endif
#elif defined GNULIB_POSIXCHECK
diff --git a/lib/time.in.h b/lib/time.in.h
index 40e5b2063fc..1b3bf3ea7ed 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -37,6 +37,12 @@
# define _@GUARD_PREFIX@_TIME_H
+/* mingw's <time.h> provides the functions asctime_r, ctime_r, gmtime_r,
+ localtime_r only if <unistd.h> or <pthread.h> has been included before. */
+# if defined __MINGW32__
+# include <unistd.h>
+# endif
+
# @INCLUDE_NEXT@ @NEXT_TIME_H@
/* NetBSD 5.0 mis-defines NULL. */
@@ -149,7 +155,9 @@ _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
# else
_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (mktime);
+# endif
# endif
/* Convert TIMER to RESULT, assuming local time and UTC respectively. See
@@ -217,7 +225,9 @@ _GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
# else
_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (localtime);
+# endif
# endif
# if 0 || @REPLACE_GMTIME@
@@ -264,7 +274,9 @@ _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp));
# else
_GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (ctime);
+# endif
# endif
/* Convert *TP to a date and time string. See
@@ -283,7 +295,9 @@ _GL_CXXALIAS_RPL (strftime, size_t, (char *__buf, size_t __bufsize,
_GL_CXXALIAS_SYS (strftime, size_t, (char *__buf, size_t __bufsize,
const char *__fmt, const struct tm *__tp));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (strftime);
+# endif
# endif
# if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index cc57ce680d5..4700ccb28e6 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -749,7 +749,9 @@ _GL_CXXALIAS_RPL (getdtablesize, int, (void));
# if !@HAVE_GETDTABLESIZE@
_GL_FUNCDECL_SYS (getdtablesize, int, (void));
# endif
-_GL_CXXALIAS_SYS (getdtablesize, int, (void));
+/* Need to cast, because on AIX, the parameter list is
+ (...). */
+_GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void));
# endif
_GL_CXXALIASWARN (getdtablesize);
#elif defined GNULIB_POSIXCHECK