aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdio.in.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stdio.in.h')
-rw-r--r--lib/stdio.in.h270
1 files changed, 167 insertions, 103 deletions
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index ebcbfaf5e77..4a95f323a9a 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -171,17 +171,17 @@
171# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 171# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
172# define dprintf rpl_dprintf 172# define dprintf rpl_dprintf
173# endif 173# endif
174_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...) 174_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...)
175 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 175 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
176 _GL_ARG_NONNULL ((2))); 176 _GL_ARG_NONNULL ((2)));
177_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...)); 177_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...));
178# else 178# else
179# if !@HAVE_DPRINTF@ 179# if !@HAVE_DPRINTF@
180_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...) 180_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...)
181 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 181 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
182 _GL_ARG_NONNULL ((2))); 182 _GL_ARG_NONNULL ((2)));
183# endif 183# endif
184_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...)); 184_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...));
185# endif 185# endif
186_GL_CXXALIASWARN (dprintf); 186_GL_CXXALIASWARN (dprintf);
187#elif defined GNULIB_POSIXCHECK 187#elif defined GNULIB_POSIXCHECK
@@ -281,11 +281,14 @@ _GL_CXXALIASWARN (fgetc);
281# undef fgets 281# undef fgets
282# define fgets rpl_fgets 282# define fgets rpl_fgets
283# endif 283# endif
284_GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream) 284_GL_FUNCDECL_RPL (fgets, char *,
285 _GL_ARG_NONNULL ((1, 3))); 285 (char *restrict s, int n, FILE *restrict stream)
286_GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream)); 286 _GL_ARG_NONNULL ((1, 3)));
287_GL_CXXALIAS_RPL (fgets, char *,
288 (char *restrict s, int n, FILE *restrict stream));
287# else 289# else
288_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream)); 290_GL_CXXALIAS_SYS (fgets, char *,
291 (char *restrict s, int n, FILE *restrict stream));
289# endif 292# endif
290# if __GLIBC__ >= 2 293# if __GLIBC__ >= 2
291_GL_CXXALIASWARN (fgets); 294_GL_CXXALIASWARN (fgets);
@@ -298,11 +301,14 @@ _GL_CXXALIASWARN (fgets);
298# undef fopen 301# undef fopen
299# define fopen rpl_fopen 302# define fopen rpl_fopen
300# endif 303# endif
301_GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode) 304_GL_FUNCDECL_RPL (fopen, FILE *,
302 _GL_ARG_NONNULL ((1, 2))); 305 (const char *restrict filename, const char *restrict mode)
303_GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode)); 306 _GL_ARG_NONNULL ((1, 2)));
307_GL_CXXALIAS_RPL (fopen, FILE *,
308 (const char *restrict filename, const char *restrict mode));
304# else 309# else
305_GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode)); 310_GL_CXXALIAS_SYS (fopen, FILE *,
311 (const char *restrict filename, const char *restrict mode));
306# endif 312# endif
307# if __GLIBC__ >= 2 313# if __GLIBC__ >= 2
308_GL_CXXALIASWARN (fopen); 314_GL_CXXALIASWARN (fopen);
@@ -322,17 +328,21 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX complian
322# endif 328# endif
323# define GNULIB_overrides_fprintf 1 329# define GNULIB_overrides_fprintf 1
324# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ 330# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
325_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) 331_GL_FUNCDECL_RPL (fprintf, int,
326 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 332 (FILE *restrict fp, const char *restrict format, ...)
327 _GL_ARG_NONNULL ((1, 2))); 333 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
334 _GL_ARG_NONNULL ((1, 2)));
328# else 335# else
329_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) 336_GL_FUNCDECL_RPL (fprintf, int,
330 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) 337 (FILE *restrict fp, const char *restrict format, ...)
331 _GL_ARG_NONNULL ((1, 2))); 338 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
339 _GL_ARG_NONNULL ((1, 2)));
332# endif 340# endif
333_GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...)); 341_GL_CXXALIAS_RPL (fprintf, int,
342 (FILE *restrict fp, const char *restrict format, ...));
334# else 343# else
335_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...)); 344_GL_CXXALIAS_SYS (fprintf, int,
345 (FILE *restrict fp, const char *restrict format, ...));
336# endif 346# endif
337# if __GLIBC__ >= 2 347# if __GLIBC__ >= 2
338_GL_CXXALIASWARN (fprintf); 348_GL_CXXALIASWARN (fprintf);
@@ -398,11 +408,14 @@ _GL_CXXALIASWARN (fputc);
398# undef fputs 408# undef fputs
399# define fputs rpl_fputs 409# define fputs rpl_fputs
400# endif 410# endif
401_GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream) 411_GL_FUNCDECL_RPL (fputs, int,
402 _GL_ARG_NONNULL ((1, 2))); 412 (const char *restrict string, FILE *restrict stream)
403_GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream)); 413 _GL_ARG_NONNULL ((1, 2)));
414_GL_CXXALIAS_RPL (fputs, int,
415 (const char *restrict string, FILE *restrict stream));
404# else 416# else
405_GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream)); 417_GL_CXXALIAS_SYS (fputs, int,
418 (const char *restrict string, FILE *restrict stream));
406# endif 419# endif
407# if __GLIBC__ >= 2 420# if __GLIBC__ >= 2
408_GL_CXXALIASWARN (fputs); 421_GL_CXXALIASWARN (fputs);
@@ -415,11 +428,17 @@ _GL_CXXALIASWARN (fputs);
415# undef fread 428# undef fread
416# define fread rpl_fread 429# define fread rpl_fread
417# endif 430# endif
418_GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream) 431_GL_FUNCDECL_RPL (fread, size_t,
419 _GL_ARG_NONNULL ((4))); 432 (void *restrict ptr, size_t s, size_t n,
420_GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); 433 FILE *restrict stream)
434 _GL_ARG_NONNULL ((4)));
435_GL_CXXALIAS_RPL (fread, size_t,
436 (void *restrict ptr, size_t s, size_t n,
437 FILE *restrict stream));
421# else 438# else
422_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); 439_GL_CXXALIAS_SYS (fread, size_t,
440 (void *restrict ptr, size_t s, size_t n,
441 FILE *restrict stream));
423# endif 442# endif
424# if __GLIBC__ >= 2 443# if __GLIBC__ >= 2
425_GL_CXXALIASWARN (fread); 444_GL_CXXALIASWARN (fread);
@@ -433,13 +452,16 @@ _GL_CXXALIASWARN (fread);
433# define freopen rpl_freopen 452# define freopen rpl_freopen
434# endif 453# endif
435_GL_FUNCDECL_RPL (freopen, FILE *, 454_GL_FUNCDECL_RPL (freopen, FILE *,
436 (const char *filename, const char *mode, FILE *stream) 455 (const char *restrict filename, const char *restrict mode,
456 FILE *restrict stream)
437 _GL_ARG_NONNULL ((2, 3))); 457 _GL_ARG_NONNULL ((2, 3)));
438_GL_CXXALIAS_RPL (freopen, FILE *, 458_GL_CXXALIAS_RPL (freopen, FILE *,
439 (const char *filename, const char *mode, FILE *stream)); 459 (const char *restrict filename, const char *restrict mode,
460 FILE *restrict stream));
440# else 461# else
441_GL_CXXALIAS_SYS (freopen, FILE *, 462_GL_CXXALIAS_SYS (freopen, FILE *,
442 (const char *filename, const char *mode, FILE *stream)); 463 (const char *restrict filename, const char *restrict mode,
464 FILE *restrict stream));
443# endif 465# endif
444# if __GLIBC__ >= 2 466# if __GLIBC__ >= 2
445_GL_CXXALIASWARN (freopen); 467_GL_CXXALIASWARN (freopen);
@@ -458,12 +480,15 @@ _GL_WARN_ON_USE (freopen,
458# undef fscanf 480# undef fscanf
459# define fscanf rpl_fscanf 481# define fscanf rpl_fscanf
460# endif 482# endif
461_GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...) 483_GL_FUNCDECL_RPL (fscanf, int,
462 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) 484 (FILE *restrict stream, const char *restrict format, ...)
463 _GL_ARG_NONNULL ((1, 2))); 485 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
464_GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...)); 486 _GL_ARG_NONNULL ((1, 2)));
487_GL_CXXALIAS_RPL (fscanf, int,
488 (FILE *restrict stream, const char *restrict format, ...));
465# else 489# else
466_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...)); 490_GL_CXXALIAS_SYS (fscanf, int,
491 (FILE *restrict stream, const char *restrict format, ...));
467# endif 492# endif
468# if __GLIBC__ >= 2 493# if __GLIBC__ >= 2
469_GL_CXXALIASWARN (fscanf); 494_GL_CXXALIASWARN (fscanf);
@@ -634,13 +659,16 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
634# define fwrite rpl_fwrite 659# define fwrite rpl_fwrite
635# endif 660# endif
636_GL_FUNCDECL_RPL (fwrite, size_t, 661_GL_FUNCDECL_RPL (fwrite, size_t,
637 (const void *ptr, size_t s, size_t n, FILE *stream) 662 (const void *restrict ptr, size_t s, size_t n,
663 FILE *restrict stream)
638 _GL_ARG_NONNULL ((1, 4))); 664 _GL_ARG_NONNULL ((1, 4)));
639_GL_CXXALIAS_RPL (fwrite, size_t, 665_GL_CXXALIAS_RPL (fwrite, size_t,
640 (const void *ptr, size_t s, size_t n, FILE *stream)); 666 (const void *restrict ptr, size_t s, size_t n,
667 FILE *restrict stream));
641# else 668# else
642_GL_CXXALIAS_SYS (fwrite, size_t, 669_GL_CXXALIAS_SYS (fwrite, size_t,
643 (const void *ptr, size_t s, size_t n, FILE *stream)); 670 (const void *restrict ptr, size_t s, size_t n,
671 FILE *restrict stream));
644 672
645/* Work around bug 11959 when fortifying glibc 2.4 through 2.15 673/* Work around bug 11959 when fortifying glibc 2.4 through 2.15
646 <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>, 674 <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>,
@@ -715,22 +743,26 @@ _GL_CXXALIASWARN (getchar);
715# define getdelim rpl_getdelim 743# define getdelim rpl_getdelim
716# endif 744# endif
717_GL_FUNCDECL_RPL (getdelim, ssize_t, 745_GL_FUNCDECL_RPL (getdelim, ssize_t,
718 (char **lineptr, size_t *linesize, int delimiter, 746 (char **restrict lineptr, size_t *restrict linesize,
719 FILE *stream) 747 int delimiter,
748 FILE *restrict stream)
720 _GL_ARG_NONNULL ((1, 2, 4))); 749 _GL_ARG_NONNULL ((1, 2, 4)));
721_GL_CXXALIAS_RPL (getdelim, ssize_t, 750_GL_CXXALIAS_RPL (getdelim, ssize_t,
722 (char **lineptr, size_t *linesize, int delimiter, 751 (char **restrict lineptr, size_t *restrict linesize,
723 FILE *stream)); 752 int delimiter,
753 FILE *restrict stream));
724# else 754# else
725# if !@HAVE_DECL_GETDELIM@ 755# if !@HAVE_DECL_GETDELIM@
726_GL_FUNCDECL_SYS (getdelim, ssize_t, 756_GL_FUNCDECL_SYS (getdelim, ssize_t,
727 (char **lineptr, size_t *linesize, int delimiter, 757 (char **restrict lineptr, size_t *restrict linesize,
728 FILE *stream) 758 int delimiter,
759 FILE *restrict stream)
729 _GL_ARG_NONNULL ((1, 2, 4))); 760 _GL_ARG_NONNULL ((1, 2, 4)));
730# endif 761# endif
731_GL_CXXALIAS_SYS (getdelim, ssize_t, 762_GL_CXXALIAS_SYS (getdelim, ssize_t,
732 (char **lineptr, size_t *linesize, int delimiter, 763 (char **restrict lineptr, size_t *restrict linesize,
733 FILE *stream)); 764 int delimiter,
765 FILE *restrict stream));
734# endif 766# endif
735_GL_CXXALIASWARN (getdelim); 767_GL_CXXALIASWARN (getdelim);
736#elif defined GNULIB_POSIXCHECK 768#elif defined GNULIB_POSIXCHECK
@@ -754,18 +786,22 @@ _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
754# define getline rpl_getline 786# define getline rpl_getline
755# endif 787# endif
756_GL_FUNCDECL_RPL (getline, ssize_t, 788_GL_FUNCDECL_RPL (getline, ssize_t,
757 (char **lineptr, size_t *linesize, FILE *stream) 789 (char **restrict lineptr, size_t *restrict linesize,
790 FILE *restrict stream)
758 _GL_ARG_NONNULL ((1, 2, 3))); 791 _GL_ARG_NONNULL ((1, 2, 3)));
759_GL_CXXALIAS_RPL (getline, ssize_t, 792_GL_CXXALIAS_RPL (getline, ssize_t,
760 (char **lineptr, size_t *linesize, FILE *stream)); 793 (char **restrict lineptr, size_t *restrict linesize,
794 FILE *restrict stream));
761# else 795# else
762# if !@HAVE_DECL_GETLINE@ 796# if !@HAVE_DECL_GETLINE@
763_GL_FUNCDECL_SYS (getline, ssize_t, 797_GL_FUNCDECL_SYS (getline, ssize_t,
764 (char **lineptr, size_t *linesize, FILE *stream) 798 (char **restrict lineptr, size_t *restrict linesize,
799 FILE *restrict stream)
765 _GL_ARG_NONNULL ((1, 2, 3))); 800 _GL_ARG_NONNULL ((1, 2, 3)));
766# endif 801# endif
767_GL_CXXALIAS_SYS (getline, ssize_t, 802_GL_CXXALIAS_SYS (getline, ssize_t,
768 (char **lineptr, size_t *linesize, FILE *stream)); 803 (char **restrict lineptr, size_t *restrict linesize,
804 FILE *restrict stream));
769# endif 805# endif
770# if @HAVE_DECL_GETLINE@ 806# if @HAVE_DECL_GETLINE@
771_GL_CXXALIASWARN (getline); 807_GL_CXXALIASWARN (getline);
@@ -909,14 +945,14 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
909# endif 945# endif
910# if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ 946# if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
911_GL_FUNCDECL_RPL_1 (__printf__, int, 947_GL_FUNCDECL_RPL_1 (__printf__, int,
912 (const char *format, ...) 948 (const char *restrict format, ...)
913 __asm__ (@ASM_SYMBOL_PREFIX@ 949 __asm__ (@ASM_SYMBOL_PREFIX@
914 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) 950 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
915 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) 951 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
916 _GL_ARG_NONNULL ((1))); 952 _GL_ARG_NONNULL ((1)));
917# else 953# else
918_GL_FUNCDECL_RPL_1 (__printf__, int, 954_GL_FUNCDECL_RPL_1 (__printf__, int,
919 (const char *format, ...) 955 (const char *restrict format, ...)
920 __asm__ (@ASM_SYMBOL_PREFIX@ 956 __asm__ (@ASM_SYMBOL_PREFIX@
921 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) 957 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
922 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) 958 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
@@ -928,14 +964,14 @@ _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
928# define printf rpl_printf 964# define printf rpl_printf
929# endif 965# endif
930_GL_FUNCDECL_RPL (printf, int, 966_GL_FUNCDECL_RPL (printf, int,
931 (const char *format, ...) 967 (const char *restrict format, ...)
932 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) 968 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
933 _GL_ARG_NONNULL ((1))); 969 _GL_ARG_NONNULL ((1)));
934_GL_CXXALIAS_RPL (printf, int, (const char *format, ...)); 970_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...));
935# endif 971# endif
936# define GNULIB_overrides_printf 1 972# define GNULIB_overrides_printf 1
937# else 973# else
938_GL_CXXALIAS_SYS (printf, int, (const char *format, ...)); 974_GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...));
939# endif 975# endif
940# if __GLIBC__ >= 2 976# if __GLIBC__ >= 2
941_GL_CXXALIASWARN (printf); 977_GL_CXXALIASWARN (printf);
@@ -1083,24 +1119,24 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - "
1083# define scanf __scanf__ 1119# define scanf __scanf__
1084# endif 1120# endif
1085_GL_FUNCDECL_RPL_1 (__scanf__, int, 1121_GL_FUNCDECL_RPL_1 (__scanf__, int,
1086 (const char *format, ...) 1122 (const char *restrict format, ...)
1087 __asm__ (@ASM_SYMBOL_PREFIX@ 1123 __asm__ (@ASM_SYMBOL_PREFIX@
1088 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) 1124 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
1089 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) 1125 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1090 _GL_ARG_NONNULL ((1))); 1126 _GL_ARG_NONNULL ((1)));
1091_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...)); 1127_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...));
1092# else 1128# else
1093# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1129# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1094# undef scanf 1130# undef scanf
1095# define scanf rpl_scanf 1131# define scanf rpl_scanf
1096# endif 1132# endif
1097_GL_FUNCDECL_RPL (scanf, int, (const char *format, ...) 1133_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...)
1098 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) 1134 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1099 _GL_ARG_NONNULL ((1))); 1135 _GL_ARG_NONNULL ((1)));
1100_GL_CXXALIAS_RPL (scanf, int, (const char *format, ...)); 1136_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...));
1101# endif 1137# endif
1102# else 1138# else
1103_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...)); 1139_GL_CXXALIAS_SYS (scanf, int, (const char *restrict format, ...));
1104# endif 1140# endif
1105# if __GLIBC__ >= 2 1141# if __GLIBC__ >= 2
1106_GL_CXXALIASWARN (scanf); 1142_GL_CXXALIASWARN (scanf);
@@ -1113,20 +1149,24 @@ _GL_CXXALIASWARN (scanf);
1113# define snprintf rpl_snprintf 1149# define snprintf rpl_snprintf
1114# endif 1150# endif
1115_GL_FUNCDECL_RPL (snprintf, int, 1151_GL_FUNCDECL_RPL (snprintf, int,
1116 (char *str, size_t size, const char *format, ...) 1152 (char *restrict str, size_t size,
1153 const char *restrict format, ...)
1117 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) 1154 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
1118 _GL_ARG_NONNULL ((3))); 1155 _GL_ARG_NONNULL ((3)));
1119_GL_CXXALIAS_RPL (snprintf, int, 1156_GL_CXXALIAS_RPL (snprintf, int,
1120 (char *str, size_t size, const char *format, ...)); 1157 (char *restrict str, size_t size,
1158 const char *restrict format, ...));
1121# else 1159# else
1122# if !@HAVE_DECL_SNPRINTF@ 1160# if !@HAVE_DECL_SNPRINTF@
1123_GL_FUNCDECL_SYS (snprintf, int, 1161_GL_FUNCDECL_SYS (snprintf, int,
1124 (char *str, size_t size, const char *format, ...) 1162 (char *restrict str, size_t size,
1163 const char *restrict format, ...)
1125 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) 1164 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
1126 _GL_ARG_NONNULL ((3))); 1165 _GL_ARG_NONNULL ((3)));
1127# endif 1166# endif
1128_GL_CXXALIAS_SYS (snprintf, int, 1167_GL_CXXALIAS_SYS (snprintf, int,
1129 (char *str, size_t size, const char *format, ...)); 1168 (char *restrict str, size_t size,
1169 const char *restrict format, ...));
1130# endif 1170# endif
1131_GL_CXXALIASWARN (snprintf); 1171_GL_CXXALIASWARN (snprintf);
1132#elif defined GNULIB_POSIXCHECK 1172#elif defined GNULIB_POSIXCHECK
@@ -1151,12 +1191,15 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
1151# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1191# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1152# define sprintf rpl_sprintf 1192# define sprintf rpl_sprintf
1153# endif 1193# endif
1154_GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...) 1194_GL_FUNCDECL_RPL (sprintf, int,
1155 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 1195 (char *restrict str, const char *restrict format, ...)
1156 _GL_ARG_NONNULL ((1, 2))); 1196 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
1157_GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...)); 1197 _GL_ARG_NONNULL ((1, 2)));
1198_GL_CXXALIAS_RPL (sprintf, int,
1199 (char *restrict str, const char *restrict format, ...));
1158# else 1200# else
1159_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...)); 1201_GL_CXXALIAS_SYS (sprintf, int,
1202 (char *restrict str, const char *restrict format, ...));
1160# endif 1203# endif
1161# if __GLIBC__ >= 2 1204# if __GLIBC__ >= 2
1162_GL_CXXALIASWARN (sprintf); 1205_GL_CXXALIASWARN (sprintf);
@@ -1244,20 +1287,23 @@ _GL_CXXALIASWARN (vasprintf);
1244# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1287# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1245# define vdprintf rpl_vdprintf 1288# define vdprintf rpl_vdprintf
1246# endif 1289# endif
1247_GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args) 1290_GL_FUNCDECL_RPL (vdprintf, int,
1248 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1291 (int fd, const char *restrict format, va_list args)
1249 _GL_ARG_NONNULL ((2))); 1292 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1250_GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args)); 1293 _GL_ARG_NONNULL ((2)));
1294_GL_CXXALIAS_RPL (vdprintf, int,
1295 (int fd, const char *restrict format, va_list args));
1251# else 1296# else
1252# if !@HAVE_VDPRINTF@ 1297# if !@HAVE_VDPRINTF@
1253_GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args) 1298_GL_FUNCDECL_SYS (vdprintf, int,
1254 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1299 (int fd, const char *restrict format, va_list args)
1255 _GL_ARG_NONNULL ((2))); 1300 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1301 _GL_ARG_NONNULL ((2)));
1256# endif 1302# endif
1257/* Need to cast, because on Solaris, the third parameter will likely be 1303/* Need to cast, because on Solaris, the third parameter will likely be
1258 __va_list args. */ 1304 __va_list args. */
1259_GL_CXXALIAS_SYS_CAST (vdprintf, int, 1305_GL_CXXALIAS_SYS_CAST (vdprintf, int,
1260 (int fd, const char *format, va_list args)); 1306 (int fd, const char *restrict format, va_list args));
1261# endif 1307# endif
1262# if __GLIBC__ >= 2 1308# if __GLIBC__ >= 2
1263_GL_CXXALIASWARN (vdprintf); 1309_GL_CXXALIASWARN (vdprintf);
@@ -1278,21 +1324,28 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
1278# endif 1324# endif
1279# define GNULIB_overrides_vfprintf 1 1325# define GNULIB_overrides_vfprintf 1
1280# if @GNULIB_VFPRINTF_POSIX@ 1326# if @GNULIB_VFPRINTF_POSIX@
1281_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) 1327_GL_FUNCDECL_RPL (vfprintf, int,
1282 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1328 (FILE *restrict fp,
1283 _GL_ARG_NONNULL ((1, 2))); 1329 const char *restrict format, va_list args)
1330 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1331 _GL_ARG_NONNULL ((1, 2)));
1284# else 1332# else
1285_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) 1333_GL_FUNCDECL_RPL (vfprintf, int,
1286 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) 1334 (FILE *restrict fp,
1287 _GL_ARG_NONNULL ((1, 2))); 1335 const char *restrict format, va_list args)
1336 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
1337 _GL_ARG_NONNULL ((1, 2)));
1288# endif 1338# endif
1289_GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)); 1339_GL_CXXALIAS_RPL (vfprintf, int,
1340 (FILE *restrict fp,
1341 const char *restrict format, va_list args));
1290# else 1342# else
1291/* Need to cast, because on Solaris, the third parameter is 1343/* Need to cast, because on Solaris, the third parameter is
1292 __va_list args 1344 __va_list args
1293 and GCC's fixincludes did not change this to __gnuc_va_list. */ 1345 and GCC's fixincludes did not change this to __gnuc_va_list. */
1294_GL_CXXALIAS_SYS_CAST (vfprintf, int, 1346_GL_CXXALIAS_SYS_CAST (vfprintf, int,
1295 (FILE *fp, const char *format, va_list args)); 1347 (FILE *restrict fp,
1348 const char *restrict format, va_list args));
1296# endif 1349# endif
1297# if __GLIBC__ >= 2 1350# if __GLIBC__ >= 2
1298_GL_CXXALIASWARN (vfprintf); 1351_GL_CXXALIASWARN (vfprintf);
@@ -1315,14 +1368,17 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
1315# define vfscanf rpl_vfscanf 1368# define vfscanf rpl_vfscanf
1316# endif 1369# endif
1317_GL_FUNCDECL_RPL (vfscanf, int, 1370_GL_FUNCDECL_RPL (vfscanf, int,
1318 (FILE *stream, const char *format, va_list args) 1371 (FILE *restrict stream,
1372 const char *restrict format, va_list args)
1319 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) 1373 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
1320 _GL_ARG_NONNULL ((1, 2))); 1374 _GL_ARG_NONNULL ((1, 2)));
1321_GL_CXXALIAS_RPL (vfscanf, int, 1375_GL_CXXALIAS_RPL (vfscanf, int,
1322 (FILE *stream, const char *format, va_list args)); 1376 (FILE *restrict stream,
1377 const char *restrict format, va_list args));
1323# else 1378# else
1324_GL_CXXALIAS_SYS (vfscanf, int, 1379_GL_CXXALIAS_SYS (vfscanf, int,
1325 (FILE *stream, const char *format, va_list args)); 1380 (FILE *restrict stream,
1381 const char *restrict format, va_list args));
1326# endif 1382# endif
1327_GL_CXXALIASWARN (vfscanf); 1383_GL_CXXALIASWARN (vfscanf);
1328#endif 1384#endif
@@ -1335,20 +1391,21 @@ _GL_CXXALIASWARN (vfscanf);
1335# endif 1391# endif
1336# define GNULIB_overrides_vprintf 1 1392# define GNULIB_overrides_vprintf 1
1337# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ 1393# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1338_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) 1394_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
1339 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0) 1395 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0)
1340 _GL_ARG_NONNULL ((1))); 1396 _GL_ARG_NONNULL ((1)));
1341# else 1397# else
1342_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) 1398_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
1343 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) 1399 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
1344 _GL_ARG_NONNULL ((1))); 1400 _GL_ARG_NONNULL ((1)));
1345# endif 1401# endif
1346_GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args)); 1402_GL_CXXALIAS_RPL (vprintf, int, (const char *restrict format, va_list args));
1347# else 1403# else
1348/* Need to cast, because on Solaris, the second parameter is 1404/* Need to cast, because on Solaris, the second parameter is
1349 __va_list args 1405 __va_list args
1350 and GCC's fixincludes did not change this to __gnuc_va_list. */ 1406 and GCC's fixincludes did not change this to __gnuc_va_list. */
1351_GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args)); 1407_GL_CXXALIAS_SYS_CAST (vprintf, int,
1408 (const char *restrict format, va_list args));
1352# endif 1409# endif
1353# if __GLIBC__ >= 2 1410# if __GLIBC__ >= 2
1354_GL_CXXALIASWARN (vprintf); 1411_GL_CXXALIASWARN (vprintf);
@@ -1370,12 +1427,12 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
1370# undef vscanf 1427# undef vscanf
1371# define vscanf rpl_vscanf 1428# define vscanf rpl_vscanf
1372# endif 1429# endif
1373_GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args) 1430_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args)
1374 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) 1431 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
1375 _GL_ARG_NONNULL ((1))); 1432 _GL_ARG_NONNULL ((1)));
1376_GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args)); 1433_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args));
1377# else 1434# else
1378_GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args)); 1435_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args));
1379# endif 1436# endif
1380_GL_CXXALIASWARN (vscanf); 1437_GL_CXXALIASWARN (vscanf);
1381#endif 1438#endif
@@ -1386,20 +1443,24 @@ _GL_CXXALIASWARN (vscanf);
1386# define vsnprintf rpl_vsnprintf 1443# define vsnprintf rpl_vsnprintf
1387# endif 1444# endif
1388_GL_FUNCDECL_RPL (vsnprintf, int, 1445_GL_FUNCDECL_RPL (vsnprintf, int,
1389 (char *str, size_t size, const char *format, va_list args) 1446 (char *restrict str, size_t size,
1447 const char *restrict format, va_list args)
1390 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) 1448 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
1391 _GL_ARG_NONNULL ((3))); 1449 _GL_ARG_NONNULL ((3)));
1392_GL_CXXALIAS_RPL (vsnprintf, int, 1450_GL_CXXALIAS_RPL (vsnprintf, int,
1393 (char *str, size_t size, const char *format, va_list args)); 1451 (char *restrict str, size_t size,
1452 const char *restrict format, va_list args));
1394# else 1453# else
1395# if !@HAVE_DECL_VSNPRINTF@ 1454# if !@HAVE_DECL_VSNPRINTF@
1396_GL_FUNCDECL_SYS (vsnprintf, int, 1455_GL_FUNCDECL_SYS (vsnprintf, int,
1397 (char *str, size_t size, const char *format, va_list args) 1456 (char *restrict str, size_t size,
1457 const char *restrict format, va_list args)
1398 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) 1458 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
1399 _GL_ARG_NONNULL ((3))); 1459 _GL_ARG_NONNULL ((3)));
1400# endif 1460# endif
1401_GL_CXXALIAS_SYS (vsnprintf, int, 1461_GL_CXXALIAS_SYS (vsnprintf, int,
1402 (char *str, size_t size, const char *format, va_list args)); 1462 (char *restrict str, size_t size,
1463 const char *restrict format, va_list args));
1403# endif 1464# endif
1404_GL_CXXALIASWARN (vsnprintf); 1465_GL_CXXALIASWARN (vsnprintf);
1405#elif defined GNULIB_POSIXCHECK 1466#elif defined GNULIB_POSIXCHECK
@@ -1416,17 +1477,20 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
1416# define vsprintf rpl_vsprintf 1477# define vsprintf rpl_vsprintf
1417# endif 1478# endif
1418_GL_FUNCDECL_RPL (vsprintf, int, 1479_GL_FUNCDECL_RPL (vsprintf, int,
1419 (char *str, const char *format, va_list args) 1480 (char *restrict str,
1481 const char *restrict format, va_list args)
1420 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1482 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1421 _GL_ARG_NONNULL ((1, 2))); 1483 _GL_ARG_NONNULL ((1, 2)));
1422_GL_CXXALIAS_RPL (vsprintf, int, 1484_GL_CXXALIAS_RPL (vsprintf, int,
1423 (char *str, const char *format, va_list args)); 1485 (char *restrict str,
1486 const char *restrict format, va_list args));
1424# else 1487# else
1425/* Need to cast, because on Solaris, the third parameter is 1488/* Need to cast, because on Solaris, the third parameter is
1426 __va_list args 1489 __va_list args
1427 and GCC's fixincludes did not change this to __gnuc_va_list. */ 1490 and GCC's fixincludes did not change this to __gnuc_va_list. */
1428_GL_CXXALIAS_SYS_CAST (vsprintf, int, 1491_GL_CXXALIAS_SYS_CAST (vsprintf, int,
1429 (char *str, const char *format, va_list args)); 1492 (char *restrict str,
1493 const char *restrict format, va_list args));
1430# endif 1494# endif
1431# if __GLIBC__ >= 2 1495# if __GLIBC__ >= 2
1432_GL_CXXALIASWARN (vsprintf); 1496_GL_CXXALIASWARN (vsprintf);