aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2019-11-26 13:14:42 -0800
committerPaul Eggert2019-11-26 13:15:41 -0800
commit1b9dbca826ad8a742ab22719279f5ce3c5888a67 (patch)
treeafd37873182a84f6708c19105fedca1b4d58ddd2
parent50b52390ee5894e91965bd37f2d0c571df1e2e89 (diff)
downloademacs-1b9dbca826ad8a742ab22719279f5ce3c5888a67.tar.gz
emacs-1b9dbca826ad8a742ab22719279f5ce3c5888a67.zip
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.
-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
-rw-r--r--m4/time_r.m445
12 files changed, 216 insertions, 41 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 @@
373 _GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW) 373 _GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW)
374#endif 374#endif
375#if _GL_HAS_BUILTIN_MUL_OVERFLOW 375#if _GL_HAS_BUILTIN_MUL_OVERFLOW
376/* Work around GCC bug 91450. */ 376# if (9 < __GNUC__ + (3 <= __GNUC_MINOR__) \
377# define INT_MULTIPLY_WRAPV(a, b, r) \ 377 || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__))
378 ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && EXPR_SIGNED (a) && EXPR_SIGNED (b) \ 378# define INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r)
379 && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \ 379# else
380 ? ((void) __builtin_mul_overflow (a, b, r), 1) \ 380 /* Work around GCC bug 91450. */
381 : __builtin_mul_overflow (a, b, r)) 381# define INT_MULTIPLY_WRAPV(a, b, r) \
382 ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && EXPR_SIGNED (a) && EXPR_SIGNED (b) \
383 && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \
384 ? ((void) __builtin_mul_overflow (a, b, r), 1) \
385 : __builtin_mul_overflow (a, b, r))
386# endif
382#else 387#else
383# define INT_MULTIPLY_WRAPV(a, b, r) \ 388# define INT_MULTIPLY_WRAPV(a, b, r) \
384 _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW) 389 _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,
1266 if (type == OP_BACK_REF) 1266 if (type == OP_BACK_REF)
1267 { 1267 {
1268 Idx subexp_idx = dfa->nodes[node].opr.idx + 1; 1268 Idx subexp_idx = dfa->nodes[node].opr.idx + 1;
1269 naccepted = regs[subexp_idx].rm_eo - regs[subexp_idx].rm_so; 1269 if (subexp_idx < nregs)
1270 naccepted = regs[subexp_idx].rm_eo - regs[subexp_idx].rm_so;
1270 if (fs != NULL) 1271 if (fs != NULL)
1271 { 1272 {
1272 if (regs[subexp_idx].rm_so == -1 || regs[subexp_idx].rm_eo == -1) 1273 if (subexp_idx >= nregs
1274 || regs[subexp_idx].rm_so == -1
1275 || regs[subexp_idx].rm_eo == -1)
1273 return -1; 1276 return -1;
1274 else if (naccepted) 1277 else if (naccepted)
1275 { 1278 {
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,
144_GL_CXXALIAS_SYS (pthread_sigmask, int, 144_GL_CXXALIAS_SYS (pthread_sigmask, int,
145 (int how, const sigset_t *new_mask, sigset_t *old_mask)); 145 (int how, const sigset_t *new_mask, sigset_t *old_mask));
146# endif 146# endif
147# if __GLIBC__ >= 2
147_GL_CXXALIASWARN (pthread_sigmask); 148_GL_CXXALIASWARN (pthread_sigmask);
149# endif
148#elif defined GNULIB_POSIXCHECK 150#elif defined GNULIB_POSIXCHECK
149# undef pthread_sigmask 151# undef pthread_sigmask
150# if HAVE_RAW_DECL_PTHREAD_SIGMASK 152# if HAVE_RAW_DECL_PTHREAD_SIGMASK
@@ -168,7 +170,9 @@ _GL_FUNCDECL_SYS (raise, int, (int sig));
168# endif 170# endif
169_GL_CXXALIAS_SYS (raise, int, (int sig)); 171_GL_CXXALIAS_SYS (raise, int, (int sig));
170# endif 172# endif
173# if __GLIBC__ >= 2
171_GL_CXXALIASWARN (raise); 174_GL_CXXALIASWARN (raise);
175# endif
172#elif defined GNULIB_POSIXCHECK 176#elif defined GNULIB_POSIXCHECK
173# undef raise 177# undef raise
174/* Assume raise is always declared. */ 178/* Assume raise is always declared. */
@@ -321,7 +325,9 @@ _GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t,
321_GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t, 325_GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t,
322 (int sig, _gl_function_taking_int_returning_void_t func)); 326 (int sig, _gl_function_taking_int_returning_void_t func));
323# endif 327# endif
328# if __GLIBC__ >= 2
324_GL_CXXALIASWARN (signal); 329_GL_CXXALIASWARN (signal);
330# endif
325 331
326# if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE 332# if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE
327/* Raise signal SIGPIPE. */ 333/* 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;
299 299
300/* 7.18.1.4. Integer types capable of holding object pointers */ 300/* 7.18.1.4. Integer types capable of holding object pointers */
301 301
302/* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own 302/* kLIBC's <stdint.h> defines _INTPTR_T_DECLARED and needs its own
303 definitions of intptr_t and uintptr_t (which use int and unsigned) 303 definitions of intptr_t and uintptr_t (which use int and unsigned)
304 to avoid clashes with declarations of system functions like sbrk. */ 304 to avoid clashes with declarations of system functions like sbrk.
305# ifndef _INTPTR_T_DECLARED 305 Similarly, mingw 5.22 <crtdefs.h> defines _INTPTR_T_DEFINED and
306# undef intptr_t 306 _UINTPTR_T_DEFINED and needs its own definitions of intptr_t and
307# undef uintptr_t 307 uintptr_t to avoid conflicting declarations of system functions like
308 _findclose in <io.h>. */
309# if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \
310 || (defined __MINGW32__ && defined _INTPTR_T_DEFINED && defined _UINTPTR_T_DEFINED))
311# undef intptr_t
312# undef uintptr_t
313# ifdef _WIN64
314typedef long long int gl_intptr_t;
315typedef unsigned long long int gl_uintptr_t;
316# else
308typedef long int gl_intptr_t; 317typedef long int gl_intptr_t;
309typedef unsigned long int gl_uintptr_t; 318typedef unsigned long int gl_uintptr_t;
310# define intptr_t gl_intptr_t 319# endif
311# define uintptr_t gl_uintptr_t 320# define intptr_t gl_intptr_t
321# define uintptr_t gl_uintptr_t
312# endif 322# endif
313 323
314/* 7.18.1.5. Greatest-width integer types */ 324/* 7.18.1.5. Greatest-width integer types */
@@ -485,9 +495,15 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
485# undef INTPTR_MIN 495# undef INTPTR_MIN
486# undef INTPTR_MAX 496# undef INTPTR_MAX
487# undef UINTPTR_MAX 497# undef UINTPTR_MAX
488# define INTPTR_MIN LONG_MIN 498# ifdef _WIN64
489# define INTPTR_MAX LONG_MAX 499# define INTPTR_MIN LLONG_MIN
490# define UINTPTR_MAX ULONG_MAX 500# define INTPTR_MAX LLONG_MAX
501# define UINTPTR_MAX ULLONG_MAX
502# else
503# define INTPTR_MIN LONG_MIN
504# define INTPTR_MAX LONG_MAX
505# define UINTPTR_MAX ULONG_MAX
506# endif
491 507
492/* 7.18.2.5. Limits of greatest-width integer types */ 508/* 7.18.2.5. Limits of greatest-width integer types */
493 509
@@ -586,17 +602,21 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
586 _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) 602 _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
587 603
588/* wint_t limits */ 604/* wint_t limits */
589# undef WINT_MIN 605/* If gnulib's <wchar.h> or <wctype.h> overrides wint_t, @WINT_T_SUFFIX@ is not
590# undef WINT_MAX 606 accurate, therefore use the definitions from above. */
591# if @HAVE_SIGNED_WINT_T@ 607# if !@GNULIB_OVERRIDES_WINT_T@
592# define WINT_MIN \ 608# undef WINT_MIN
593 _STDINT_SIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) 609# undef WINT_MAX
594# else 610# if @HAVE_SIGNED_WINT_T@
595# define WINT_MIN \ 611# define WINT_MIN \
596 _STDINT_UNSIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) 612 _STDINT_SIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
613# else
614# define WINT_MIN \
615 _STDINT_UNSIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
616# endif
617# define WINT_MAX \
618 _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
597# endif 619# endif
598# define WINT_MAX \
599 _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
600 620
601/* 7.18.4. Macros for integer constants */ 621/* 7.18.4. Macros for integer constants */
602 622
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));
203# else 203# else
204_GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); 204_GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
205# endif 205# endif
206# if __GLIBC__ >= 2
206_GL_CXXALIASWARN (fclose); 207_GL_CXXALIASWARN (fclose);
208# endif
207#elif defined GNULIB_POSIXCHECK 209#elif defined GNULIB_POSIXCHECK
208# undef fclose 210# undef fclose
209/* Assume fclose is always declared. */ 211/* Assume fclose is always declared. */
@@ -247,7 +249,9 @@ _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
247# else 249# else
248_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); 250_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
249# endif 251# endif
252# if __GLIBC__ >= 2
250_GL_CXXALIASWARN (fflush); 253_GL_CXXALIASWARN (fflush);
254# endif
251#elif defined GNULIB_POSIXCHECK 255#elif defined GNULIB_POSIXCHECK
252# undef fflush 256# undef fflush
253/* Assume fflush is always declared. */ 257/* Assume fflush is always declared. */
@@ -266,7 +270,9 @@ _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
266# else 270# else
267_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); 271_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
268# endif 272# endif
273# if __GLIBC__ >= 2
269_GL_CXXALIASWARN (fgetc); 274_GL_CXXALIASWARN (fgetc);
275# endif
270#endif 276#endif
271 277
272#if @GNULIB_FGETS@ 278#if @GNULIB_FGETS@
@@ -281,7 +287,9 @@ _GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream));
281# else 287# else
282_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream)); 288_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream));
283# endif 289# endif
290# if __GLIBC__ >= 2
284_GL_CXXALIASWARN (fgets); 291_GL_CXXALIASWARN (fgets);
292# endif
285#endif 293#endif
286 294
287#if @GNULIB_FOPEN@ 295#if @GNULIB_FOPEN@
@@ -296,7 +304,9 @@ _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
296# else 304# else
297_GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode)); 305_GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
298# endif 306# endif
307# if __GLIBC__ >= 2
299_GL_CXXALIASWARN (fopen); 308_GL_CXXALIASWARN (fopen);
309# endif
300#elif defined GNULIB_POSIXCHECK 310#elif defined GNULIB_POSIXCHECK
301# undef fopen 311# undef fopen
302/* Assume fopen is always declared. */ 312/* Assume fopen is always declared. */
@@ -324,7 +334,9 @@ _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
324# else 334# else
325_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...)); 335_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
326# endif 336# endif
337# if __GLIBC__ >= 2
327_GL_CXXALIASWARN (fprintf); 338_GL_CXXALIASWARN (fprintf);
339# endif
328#endif 340#endif
329#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK 341#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
330# if !GNULIB_overrides_fprintf 342# if !GNULIB_overrides_fprintf
@@ -375,7 +387,9 @@ _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
375# else 387# else
376_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); 388_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
377# endif 389# endif
390# if __GLIBC__ >= 2
378_GL_CXXALIASWARN (fputc); 391_GL_CXXALIASWARN (fputc);
392# endif
379#endif 393#endif
380 394
381#if @GNULIB_FPUTS@ 395#if @GNULIB_FPUTS@
@@ -390,7 +404,9 @@ _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
390# else 404# else
391_GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream)); 405_GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
392# endif 406# endif
407# if __GLIBC__ >= 2
393_GL_CXXALIASWARN (fputs); 408_GL_CXXALIASWARN (fputs);
409# endif
394#endif 410#endif
395 411
396#if @GNULIB_FREAD@ 412#if @GNULIB_FREAD@
@@ -405,7 +421,9 @@ _GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
405# else 421# else
406_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); 422_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
407# endif 423# endif
424# if __GLIBC__ >= 2
408_GL_CXXALIASWARN (fread); 425_GL_CXXALIASWARN (fread);
426# endif
409#endif 427#endif
410 428
411#if @GNULIB_FREOPEN@ 429#if @GNULIB_FREOPEN@
@@ -423,7 +441,9 @@ _GL_CXXALIAS_RPL (freopen, FILE *,
423_GL_CXXALIAS_SYS (freopen, FILE *, 441_GL_CXXALIAS_SYS (freopen, FILE *,
424 (const char *filename, const char *mode, FILE *stream)); 442 (const char *filename, const char *mode, FILE *stream));
425# endif 443# endif
444# if __GLIBC__ >= 2
426_GL_CXXALIASWARN (freopen); 445_GL_CXXALIASWARN (freopen);
446# endif
427#elif defined GNULIB_POSIXCHECK 447#elif defined GNULIB_POSIXCHECK
428# undef freopen 448# undef freopen
429/* Assume freopen is always declared. */ 449/* Assume freopen is always declared. */
@@ -445,7 +465,9 @@ _GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...));
445# else 465# else
446_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...)); 466_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...));
447# endif 467# endif
468# if __GLIBC__ >= 2
448_GL_CXXALIASWARN (fscanf); 469_GL_CXXALIASWARN (fscanf);
470# endif
449#endif 471#endif
450 472
451 473
@@ -496,7 +518,9 @@ _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
496# else 518# else
497_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); 519_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
498# endif 520# endif
521# if __GLIBC__ >= 2
499_GL_CXXALIASWARN (fseek); 522_GL_CXXALIASWARN (fseek);
523# endif
500#endif 524#endif
501 525
502#if @GNULIB_FSEEKO@ 526#if @GNULIB_FSEEKO@
@@ -559,7 +583,9 @@ _GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
559# else 583# else
560_GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); 584_GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
561# endif 585# endif
586# if __GLIBC__ >= 2
562_GL_CXXALIASWARN (ftell); 587_GL_CXXALIASWARN (ftell);
588# endif
563#endif 589#endif
564 590
565#if @GNULIB_FTELLO@ 591#if @GNULIB_FTELLO@
@@ -639,7 +665,9 @@ extern size_t __REDIRECT (rpl_fwrite_unlocked,
639# define fwrite_unlocked rpl_fwrite_unlocked 665# define fwrite_unlocked rpl_fwrite_unlocked
640# endif 666# endif
641# endif 667# endif
668# if __GLIBC__ >= 2
642_GL_CXXALIASWARN (fwrite); 669_GL_CXXALIASWARN (fwrite);
670# endif
643#endif 671#endif
644 672
645#if @GNULIB_GETC@ 673#if @GNULIB_GETC@
@@ -653,7 +681,9 @@ _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
653# else 681# else
654_GL_CXXALIAS_SYS (getc, int, (FILE *stream)); 682_GL_CXXALIAS_SYS (getc, int, (FILE *stream));
655# endif 683# endif
684# if __GLIBC__ >= 2
656_GL_CXXALIASWARN (getc); 685_GL_CXXALIASWARN (getc);
686# endif
657#endif 687#endif
658 688
659#if @GNULIB_GETCHAR@ 689#if @GNULIB_GETCHAR@
@@ -667,7 +697,9 @@ _GL_CXXALIAS_RPL (getchar, int, (void));
667# else 697# else
668_GL_CXXALIAS_SYS (getchar, int, (void)); 698_GL_CXXALIAS_SYS (getchar, int, (void));
669# endif 699# endif
700# if __GLIBC__ >= 2
670_GL_CXXALIASWARN (getchar); 701_GL_CXXALIASWARN (getchar);
702# endif
671#endif 703#endif
672 704
673#if @GNULIB_GETDELIM@ 705#if @GNULIB_GETDELIM@
@@ -832,7 +864,9 @@ _GL_CXXALIAS_RPL (perror, void, (const char *string));
832# else 864# else
833_GL_CXXALIAS_SYS (perror, void, (const char *string)); 865_GL_CXXALIAS_SYS (perror, void, (const char *string));
834# endif 866# endif
867# if __GLIBC__ >= 2
835_GL_CXXALIASWARN (perror); 868_GL_CXXALIASWARN (perror);
869# endif
836#elif defined GNULIB_POSIXCHECK 870#elif defined GNULIB_POSIXCHECK
837# undef perror 871# undef perror
838/* Assume perror is always declared. */ 872/* Assume perror is always declared. */
@@ -903,7 +937,9 @@ _GL_CXXALIAS_RPL (printf, int, (const char *format, ...));
903# else 937# else
904_GL_CXXALIAS_SYS (printf, int, (const char *format, ...)); 938_GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
905# endif 939# endif
940# if __GLIBC__ >= 2
906_GL_CXXALIASWARN (printf); 941_GL_CXXALIASWARN (printf);
942# endif
907#endif 943#endif
908#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK 944#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
909# if !GNULIB_overrides_printf 945# if !GNULIB_overrides_printf
@@ -926,7 +962,9 @@ _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
926# else 962# else
927_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); 963_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
928# endif 964# endif
965# if __GLIBC__ >= 2
929_GL_CXXALIASWARN (putc); 966_GL_CXXALIASWARN (putc);
967# endif
930#endif 968#endif
931 969
932#if @GNULIB_PUTCHAR@ 970#if @GNULIB_PUTCHAR@
@@ -940,7 +978,9 @@ _GL_CXXALIAS_RPL (putchar, int, (int c));
940# else 978# else
941_GL_CXXALIAS_SYS (putchar, int, (int c)); 979_GL_CXXALIAS_SYS (putchar, int, (int c));
942# endif 980# endif
981# if __GLIBC__ >= 2
943_GL_CXXALIASWARN (putchar); 982_GL_CXXALIASWARN (putchar);
983# endif
944#endif 984#endif
945 985
946#if @GNULIB_PUTS@ 986#if @GNULIB_PUTS@
@@ -954,7 +994,9 @@ _GL_CXXALIAS_RPL (puts, int, (const char *string));
954# else 994# else
955_GL_CXXALIAS_SYS (puts, int, (const char *string)); 995_GL_CXXALIAS_SYS (puts, int, (const char *string));
956# endif 996# endif
997# if __GLIBC__ >= 2
957_GL_CXXALIASWARN (puts); 998_GL_CXXALIASWARN (puts);
999# endif
958#endif 1000#endif
959 1001
960#if @GNULIB_REMOVE@ 1002#if @GNULIB_REMOVE@
@@ -968,7 +1010,9 @@ _GL_CXXALIAS_RPL (remove, int, (const char *name));
968# else 1010# else
969_GL_CXXALIAS_SYS (remove, int, (const char *name)); 1011_GL_CXXALIAS_SYS (remove, int, (const char *name));
970# endif 1012# endif
1013# if __GLIBC__ >= 2
971_GL_CXXALIASWARN (remove); 1014_GL_CXXALIASWARN (remove);
1015# endif
972#elif defined GNULIB_POSIXCHECK 1016#elif defined GNULIB_POSIXCHECK
973# undef remove 1017# undef remove
974/* Assume remove is always declared. */ 1018/* Assume remove is always declared. */
@@ -991,7 +1035,9 @@ _GL_CXXALIAS_RPL (rename, int,
991_GL_CXXALIAS_SYS (rename, int, 1035_GL_CXXALIAS_SYS (rename, int,
992 (const char *old_filename, const char *new_filename)); 1036 (const char *old_filename, const char *new_filename));
993# endif 1037# endif
1038# if __GLIBC__ >= 2
994_GL_CXXALIASWARN (rename); 1039_GL_CXXALIASWARN (rename);
1040# endif
995#elif defined GNULIB_POSIXCHECK 1041#elif defined GNULIB_POSIXCHECK
996# undef rename 1042# undef rename
997/* Assume rename is always declared. */ 1043/* Assume rename is always declared. */
@@ -1056,7 +1102,9 @@ _GL_CXXALIAS_RPL (scanf, int, (const char *format, ...));
1056# else 1102# else
1057_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...)); 1103_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...));
1058# endif 1104# endif
1105# if __GLIBC__ >= 2
1059_GL_CXXALIASWARN (scanf); 1106_GL_CXXALIASWARN (scanf);
1107# endif
1060#endif 1108#endif
1061 1109
1062#if @GNULIB_SNPRINTF@ 1110#if @GNULIB_SNPRINTF@
@@ -1110,7 +1158,9 @@ _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
1110# else 1158# else
1111_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...)); 1159_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
1112# endif 1160# endif
1161# if __GLIBC__ >= 2
1113_GL_CXXALIASWARN (sprintf); 1162_GL_CXXALIASWARN (sprintf);
1163# endif
1114#elif defined GNULIB_POSIXCHECK 1164#elif defined GNULIB_POSIXCHECK
1115# undef sprintf 1165# undef sprintf
1116/* Assume sprintf is always declared. */ 1166/* Assume sprintf is always declared. */
@@ -1129,7 +1179,9 @@ _GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
1129# else 1179# else
1130_GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); 1180_GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
1131# endif 1181# endif
1182# if __GLIBC__ >= 2
1132_GL_CXXALIASWARN (tmpfile); 1183_GL_CXXALIASWARN (tmpfile);
1184# endif
1133#elif defined GNULIB_POSIXCHECK 1185#elif defined GNULIB_POSIXCHECK
1134# undef tmpfile 1186# undef tmpfile
1135# if HAVE_RAW_DECL_TMPFILE 1187# if HAVE_RAW_DECL_TMPFILE
@@ -1240,7 +1292,9 @@ _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
1240_GL_CXXALIAS_SYS_CAST (vfprintf, int, 1292_GL_CXXALIAS_SYS_CAST (vfprintf, int,
1241 (FILE *fp, const char *format, va_list args)); 1293 (FILE *fp, const char *format, va_list args));
1242# endif 1294# endif
1295# if __GLIBC__ >= 2
1243_GL_CXXALIASWARN (vfprintf); 1296_GL_CXXALIASWARN (vfprintf);
1297# endif
1244#endif 1298#endif
1245#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK 1299#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1246# if !GNULIB_overrides_vfprintf 1300# if !GNULIB_overrides_vfprintf
@@ -1294,7 +1348,9 @@ _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
1294 and GCC's fixincludes did not change this to __gnuc_va_list. */ 1348 and GCC's fixincludes did not change this to __gnuc_va_list. */
1295_GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args)); 1349_GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
1296# endif 1350# endif
1351# if __GLIBC__ >= 2
1297_GL_CXXALIASWARN (vprintf); 1352_GL_CXXALIASWARN (vprintf);
1353# endif
1298#endif 1354#endif
1299#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK 1355#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1300# if !GNULIB_overrides_vprintf 1356# if !GNULIB_overrides_vprintf
@@ -1370,7 +1426,9 @@ _GL_CXXALIAS_RPL (vsprintf, int,
1370_GL_CXXALIAS_SYS_CAST (vsprintf, int, 1426_GL_CXXALIAS_SYS_CAST (vsprintf, int,
1371 (char *str, const char *format, va_list args)); 1427 (char *str, const char *format, va_list args));
1372# endif 1428# endif
1429# if __GLIBC__ >= 2
1373_GL_CXXALIASWARN (vsprintf); 1430_GL_CXXALIASWARN (vsprintf);
1431# endif
1374#elif defined GNULIB_POSIXCHECK 1432#elif defined GNULIB_POSIXCHECK
1375# undef vsprintf 1433# undef vsprintf
1376/* Assume vsprintf is always declared. */ 1434/* 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));
176# else 176# else
177_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); 177_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
178# endif 178# endif
179# if __GLIBC__ >= 2
179_GL_CXXALIASWARN (calloc); 180_GL_CXXALIASWARN (calloc);
181# endif
180#elif defined GNULIB_POSIXCHECK 182#elif defined GNULIB_POSIXCHECK
181# undef calloc 183# undef calloc
182/* Assume calloc is always declared. */ 184/* Assume calloc is always declared. */
@@ -288,7 +290,9 @@ _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
288# else 290# else
289_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); 291_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
290# endif 292# endif
293# if __GLIBC__ >= 2
291_GL_CXXALIASWARN (malloc); 294_GL_CXXALIASWARN (malloc);
295# endif
292#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 296#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
293# undef malloc 297# undef malloc
294/* Assume malloc is always declared. */ 298/* Assume malloc is always declared. */
@@ -311,7 +315,9 @@ _GL_FUNCDECL_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
311# endif 315# endif
312_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); 316_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
313# endif 317# endif
318# if __GLIBC__ >= 2
314_GL_CXXALIASWARN (mbtowc); 319_GL_CXXALIASWARN (mbtowc);
320# endif
315#elif defined GNULIB_POSIXCHECK 321#elif defined GNULIB_POSIXCHECK
316# undef mbtowc 322# undef mbtowc
317# if HAVE_RAW_DECL_MBTOWC 323# if HAVE_RAW_DECL_MBTOWC
@@ -616,7 +622,9 @@ _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
616# if !@HAVE_RANDOM@ 622# if !@HAVE_RANDOM@
617_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); 623_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
618# endif 624# endif
619_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed)); 625/* Need to cast, because on FreeBSD, the first parameter is
626 unsigned long seed. */
627_GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
620# endif 628# endif
621_GL_CXXALIASWARN (srandom); 629_GL_CXXALIASWARN (srandom);
622#elif defined GNULIB_POSIXCHECK 630#elif defined GNULIB_POSIXCHECK
@@ -644,8 +652,10 @@ _GL_FUNCDECL_SYS (initstate, char *,
644 (unsigned int seed, char *buf, size_t buf_size) 652 (unsigned int seed, char *buf, size_t buf_size)
645 _GL_ARG_NONNULL ((2))); 653 _GL_ARG_NONNULL ((2)));
646# endif 654# endif
647_GL_CXXALIAS_SYS (initstate, char *, 655/* Need to cast, because on FreeBSD, the first parameter is
648 (unsigned int seed, char *buf, size_t buf_size)); 656 unsigned long seed. */
657_GL_CXXALIAS_SYS_CAST (initstate, char *,
658 (unsigned int seed, char *buf, size_t buf_size));
649# endif 659# endif
650_GL_CXXALIASWARN (initstate); 660_GL_CXXALIASWARN (initstate);
651#elif defined GNULIB_POSIXCHECK 661#elif defined GNULIB_POSIXCHECK
@@ -668,7 +678,9 @@ _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
668# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ 678# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
669_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 679_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
670# endif 680# endif
671_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state)); 681/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
682 is const char *arg_state. */
683_GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
672# endif 684# endif
673_GL_CXXALIASWARN (setstate); 685_GL_CXXALIASWARN (setstate);
674#elif defined GNULIB_POSIXCHECK 686#elif defined GNULIB_POSIXCHECK
@@ -809,7 +821,9 @@ _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
809# else 821# else
810_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); 822_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
811# endif 823# endif
824# if __GLIBC__ >= 2
812_GL_CXXALIASWARN (realloc); 825_GL_CXXALIASWARN (realloc);
826# endif
813#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 827#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
814# undef realloc 828# undef realloc
815/* Assume realloc is always declared. */ 829/* Assume realloc is always declared. */
@@ -940,7 +954,9 @@ _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
940# endif 954# endif
941_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp)); 955_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
942# endif 956# endif
957# if __GLIBC__ >= 2
943_GL_CXXALIASWARN (strtod); 958_GL_CXXALIASWARN (strtod);
959# endif
944#elif defined GNULIB_POSIXCHECK 960#elif defined GNULIB_POSIXCHECK
945# undef strtod 961# undef strtod
946# if HAVE_RAW_DECL_STRTOD 962# if HAVE_RAW_DECL_STRTOD
@@ -1079,7 +1095,9 @@ _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
1079# else 1095# else
1080_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); 1096_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
1081# endif 1097# endif
1098# if __GLIBC__ >= 2
1082_GL_CXXALIASWARN (wctomb); 1099_GL_CXXALIASWARN (wctomb);
1100# endif
1083#endif 1101#endif
1084 1102
1085 1103
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,
149_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n)); 149_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
150_GL_CXXALIASWARN1 (memchr, void const *, 150_GL_CXXALIASWARN1 (memchr, void const *,
151 (void const *__s, int __c, size_t __n)); 151 (void const *__s, int __c, size_t __n));
152# else 152# elif __GLIBC__ >= 2
153_GL_CXXALIASWARN (memchr); 153_GL_CXXALIASWARN (memchr);
154# endif 154# endif
155#elif defined GNULIB_POSIXCHECK 155#elif defined GNULIB_POSIXCHECK
@@ -417,7 +417,9 @@ _GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n));
417# else 417# else
418_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n)); 418_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n));
419# endif 419# endif
420# if __GLIBC__ >= 2
420_GL_CXXALIASWARN (strncat); 421_GL_CXXALIASWARN (strncat);
422# endif
421#elif defined GNULIB_POSIXCHECK 423#elif defined GNULIB_POSIXCHECK
422# undef strncat 424# undef strncat
423# if HAVE_RAW_DECL_STRNCAT 425# if HAVE_RAW_DECL_STRNCAT
@@ -512,7 +514,7 @@ _GL_CXXALIAS_SYS_CAST2 (strpbrk,
512_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept)); 514_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
513_GL_CXXALIASWARN1 (strpbrk, char const *, 515_GL_CXXALIASWARN1 (strpbrk, char const *,
514 (char const *__s, char const *__accept)); 516 (char const *__s, char const *__accept));
515# else 517# elif __GLIBC__ >= 2
516_GL_CXXALIASWARN (strpbrk); 518_GL_CXXALIASWARN (strpbrk);
517# endif 519# endif
518# if defined GNULIB_POSIXCHECK 520# if defined GNULIB_POSIXCHECK
@@ -614,7 +616,7 @@ _GL_CXXALIAS_SYS_CAST2 (strstr,
614_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle)); 616_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
615_GL_CXXALIASWARN1 (strstr, const char *, 617_GL_CXXALIASWARN1 (strstr, const char *,
616 (const char *haystack, const char *needle)); 618 (const char *haystack, const char *needle));
617# else 619# elif __GLIBC__ >= 2
618_GL_CXXALIASWARN (strstr); 620_GL_CXXALIASWARN (strstr);
619# endif 621# endif
620#elif defined GNULIB_POSIXCHECK 622#elif defined GNULIB_POSIXCHECK
@@ -980,7 +982,9 @@ _GL_CXXALIAS_RPL (strerror, char *, (int));
980# else 982# else
981_GL_CXXALIAS_SYS (strerror, char *, (int)); 983_GL_CXXALIAS_SYS (strerror, char *, (int));
982# endif 984# endif
985# if __GLIBC__ >= 2
983_GL_CXXALIASWARN (strerror); 986_GL_CXXALIASWARN (strerror);
987# endif
984#elif defined GNULIB_POSIXCHECK 988#elif defined GNULIB_POSIXCHECK
985# undef strerror 989# undef strerror
986/* Assume strerror is always declared. */ 990/* 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,
295 struct timeval *restrict)); 295 struct timeval *restrict));
296_GL_CXXALIAS_RPL (select, int, 296_GL_CXXALIAS_RPL (select, int,
297 (int, fd_set *restrict, fd_set *restrict, fd_set *restrict, 297 (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
298 struct timeval *restrict)); 298 timeval *restrict));
299# else 299# else
300_GL_CXXALIAS_SYS (select, int, 300_GL_CXXALIAS_SYS (select, int,
301 (int, fd_set *restrict, fd_set *restrict, fd_set *restrict, 301 (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
302 struct timeval *restrict)); 302 timeval *restrict));
303# endif 303# endif
304_GL_CXXALIASWARN (select); 304_GL_CXXALIASWARN (select);
305#elif @HAVE_WINSOCK2_H@ 305#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);
112# if defined __cplusplus && defined GNULIB_NAMESPACE 112# if defined __cplusplus && defined GNULIB_NAMESPACE
113namespace GNULIB_NAMESPACE { 113namespace GNULIB_NAMESPACE {
114 typedef ::timeval 114 typedef ::timeval
115#undef timeval 115# undef timeval
116 timeval; 116 timeval;
117# if @REPLACE_STRUCT_TIMEVAL@
118# define timeval rpl_timeval
119 typedef ::timeval timeval;
120# endif
117} 121}
118# endif 122# endif
119#elif defined GNULIB_POSIXCHECK 123#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 @@
37 37
38# define _@GUARD_PREFIX@_TIME_H 38# define _@GUARD_PREFIX@_TIME_H
39 39
40/* mingw's <time.h> provides the functions asctime_r, ctime_r, gmtime_r,
41 localtime_r only if <unistd.h> or <pthread.h> has been included before. */
42# if defined __MINGW32__
43# include <unistd.h>
44# endif
45
40# @INCLUDE_NEXT@ @NEXT_TIME_H@ 46# @INCLUDE_NEXT@ @NEXT_TIME_H@
41 47
42/* NetBSD 5.0 mis-defines NULL. */ 48/* NetBSD 5.0 mis-defines NULL. */
@@ -149,7 +155,9 @@ _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
149# else 155# else
150_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); 156_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
151# endif 157# endif
158# if __GLIBC__ >= 2
152_GL_CXXALIASWARN (mktime); 159_GL_CXXALIASWARN (mktime);
160# endif
153# endif 161# endif
154 162
155/* Convert TIMER to RESULT, assuming local time and UTC respectively. See 163/* 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));
217# else 225# else
218_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); 226_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
219# endif 227# endif
228# if __GLIBC__ >= 2
220_GL_CXXALIASWARN (localtime); 229_GL_CXXALIASWARN (localtime);
230# endif
221# endif 231# endif
222 232
223# if 0 || @REPLACE_GMTIME@ 233# if 0 || @REPLACE_GMTIME@
@@ -264,7 +274,9 @@ _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp));
264# else 274# else
265_GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp)); 275_GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp));
266# endif 276# endif
277# if __GLIBC__ >= 2
267_GL_CXXALIASWARN (ctime); 278_GL_CXXALIASWARN (ctime);
279# endif
268# endif 280# endif
269 281
270/* Convert *TP to a date and time string. See 282/* Convert *TP to a date and time string. See
@@ -283,7 +295,9 @@ _GL_CXXALIAS_RPL (strftime, size_t, (char *__buf, size_t __bufsize,
283_GL_CXXALIAS_SYS (strftime, size_t, (char *__buf, size_t __bufsize, 295_GL_CXXALIAS_SYS (strftime, size_t, (char *__buf, size_t __bufsize,
284 const char *__fmt, const struct tm *__tp)); 296 const char *__fmt, const struct tm *__tp));
285# endif 297# endif
298# if __GLIBC__ >= 2
286_GL_CXXALIASWARN (strftime); 299_GL_CXXALIASWARN (strftime);
300# endif
287# endif 301# endif
288 302
289# if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ 303# 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));
749# if !@HAVE_GETDTABLESIZE@ 749# if !@HAVE_GETDTABLESIZE@
750_GL_FUNCDECL_SYS (getdtablesize, int, (void)); 750_GL_FUNCDECL_SYS (getdtablesize, int, (void));
751# endif 751# endif
752_GL_CXXALIAS_SYS (getdtablesize, int, (void)); 752/* Need to cast, because on AIX, the parameter list is
753 (...). */
754_GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void));
753# endif 755# endif
754_GL_CXXALIASWARN (getdtablesize); 756_GL_CXXALIASWARN (getdtablesize);
755#elif defined GNULIB_POSIXCHECK 757#elif defined GNULIB_POSIXCHECK
diff --git a/m4/time_r.m4 b/m4/time_r.m4
index 5caeca75093..cc4b3e009b9 100644
--- a/m4/time_r.m4
+++ b/m4/time_r.m4
@@ -17,7 +17,15 @@ AC_DEFUN([gl_TIME_R],
17 17
18 dnl Some systems don't declare localtime_r() and gmtime_r() if _REENTRANT is 18 dnl Some systems don't declare localtime_r() and gmtime_r() if _REENTRANT is
19 dnl not defined. 19 dnl not defined.
20 AC_CHECK_DECLS([localtime_r], [], [], [[#include <time.h>]]) 20 AC_CHECK_DECLS([localtime_r], [], [],
21 [[/* mingw's <time.h> provides the functions asctime_r, ctime_r,
22 gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has
23 been included before. */
24 #if defined __MINGW32__
25 # include <unistd.h>
26 #endif
27 #include <time.h>
28 ]])
21 if test $ac_cv_have_decl_localtime_r = no; then 29 if test $ac_cv_have_decl_localtime_r = no; then
22 HAVE_DECL_LOCALTIME_R=0 30 HAVE_DECL_LOCALTIME_R=0
23 fi 31 fi
@@ -29,7 +37,14 @@ AC_DEFUN([gl_TIME_R],
29 [gl_cv_time_r_posix], 37 [gl_cv_time_r_posix],
30 [AC_COMPILE_IFELSE( 38 [AC_COMPILE_IFELSE(
31 [AC_LANG_PROGRAM( 39 [AC_LANG_PROGRAM(
32 [[#include <time.h>]], 40 [[/* mingw's <time.h> provides the functions asctime_r, ctime_r,
41 gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has
42 been included before. */
43 #if defined __MINGW32__
44 # include <unistd.h>
45 #endif
46 #include <time.h>
47 ]],
33 [[/* We don't need to append 'restrict's to the argument types, 48 [[/* We don't need to append 'restrict's to the argument types,
34 even though the POSIX signature has the 'restrict's, 49 even though the POSIX signature has the 'restrict's,
35 since C99 says they can't affect type compatibility. */ 50 since C99 says they can't affect type compatibility. */
@@ -49,6 +64,32 @@ AC_DEFUN([gl_TIME_R],
49 fi 64 fi
50 else 65 else
51 HAVE_LOCALTIME_R=0 66 HAVE_LOCALTIME_R=0
67 dnl On mingw, localtime_r() is defined as an inline function; use through a
68 dnl direct function call works but the use as a function pointer leads to a
69 dnl link error.
70 AC_CACHE_CHECK([whether localtime_r exists as an inline function],
71 [gl_cv_func_localtime_r_inline],
72 [AC_LINK_IFELSE(
73 [AC_LANG_PROGRAM(
74 [[/* mingw's <time.h> provides the functions asctime_r, ctime_r,
75 gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has
76 been included before. */
77 #if defined __MINGW32__
78 # include <unistd.h>
79 #endif
80 #include <time.h>
81 ]],
82 [[time_t a;
83 struct tm r;
84 localtime_r (&a, &r);
85 ]])
86 ],
87 [gl_cv_func_localtime_r_inline=yes],
88 [gl_cv_func_localtime_r_inline=no])
89 ])
90 if test $gl_cv_func_localtime_r_inline = yes; then
91 REPLACE_LOCALTIME_R=1
92 fi
52 fi 93 fi
53]) 94])
54 95