aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2011-04-17 21:03:18 -0700
committerPaul Eggert2011-04-17 21:03:18 -0700
commitcc2e7b46b8c45216af99090b1ffd683a493c1564 (patch)
tree5943370f24483206b7152b658d8cedd679d995f8 /lib
parent4581706e272ad522d495dd12040d94b86a333b6d (diff)
downloademacs-cc2e7b46b8c45216af99090b1ffd683a493c1564.tar.gz
emacs-cc2e7b46b8c45216af99090b1ffd683a493c1564.zip
Merge from gnulib.
Diffstat (limited to 'lib')
-rw-r--r--lib/gnulib.mk15
-rw-r--r--lib/stdio.in.h217
-rw-r--r--lib/unistd.in.h27
3 files changed, 242 insertions, 17 deletions
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 1938c6127a2..868249dda27 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -327,20 +327,27 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
327 -e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \ 327 -e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \
328 -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \ 328 -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \
329 -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \ 329 -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
330 -e 's|@''GNULIB_FGETC''@|$(GNULIB_FGETC)|g' \
331 -e 's|@''GNULIB_FGETS''@|$(GNULIB_FGETS)|g' \
330 -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \ 332 -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
331 -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \ 333 -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \
332 -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \ 334 -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
333 -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \ 335 -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \
334 -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \ 336 -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \
335 -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \ 337 -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \
338 -e 's|@''GNULIB_FREAD''@|$(GNULIB_FREAD)|g' \
336 -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \ 339 -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
340 -e 's|@''GNULIB_FSCANF''@|$(GNULIB_FSCANF)|g' \
337 -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \ 341 -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
338 -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \ 342 -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
339 -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ 343 -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
340 -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \ 344 -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
341 -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \ 345 -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \
346 -e 's|@''GNULIB_GETC''@|$(GNULIB_GETC)|g' \
347 -e 's|@''GNULIB_GETCHAR''@|$(GNULIB_GETCHAR)|g' \
342 -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \ 348 -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \
343 -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \ 349 -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \
350 -e 's|@''GNULIB_GETS''@|$(GNULIB_GETS)|g' \
344 -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \ 351 -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \
345 -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \ 352 -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \
346 -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \ 353 -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \
@@ -353,14 +360,18 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
353 -e 's|@''GNULIB_REMOVE''@|$(GNULIB_REMOVE)|g' \ 360 -e 's|@''GNULIB_REMOVE''@|$(GNULIB_REMOVE)|g' \
354 -e 's|@''GNULIB_RENAME''@|$(GNULIB_RENAME)|g' \ 361 -e 's|@''GNULIB_RENAME''@|$(GNULIB_RENAME)|g' \
355 -e 's|@''GNULIB_RENAMEAT''@|$(GNULIB_RENAMEAT)|g' \ 362 -e 's|@''GNULIB_RENAMEAT''@|$(GNULIB_RENAMEAT)|g' \
363 -e 's|@''GNULIB_SCANF''@|$(GNULIB_SCANF)|g' \
356 -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ 364 -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
357 -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ 365 -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
366 -e 's|@''GNULIB_STDIO_H_NONBLOCKING''@|$(GNULIB_STDIO_H_NONBLOCKING)|g' \
358 -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \ 367 -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \
359 -e 's|@''GNULIB_TMPFILE''@|$(GNULIB_TMPFILE)|g' \ 368 -e 's|@''GNULIB_TMPFILE''@|$(GNULIB_TMPFILE)|g' \
360 -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ 369 -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
361 -e 's|@''GNULIB_VDPRINTF''@|$(GNULIB_VDPRINTF)|g' \ 370 -e 's|@''GNULIB_VDPRINTF''@|$(GNULIB_VDPRINTF)|g' \
362 -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \ 371 -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \
363 -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \ 372 -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
373 -e 's|@''GNULIB_VFSCANF''@|$(GNULIB_VFSCANF)|g' \
374 -e 's|@''GNULIB_VSCANF''@|$(GNULIB_VSCANF)|g' \
364 -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \ 375 -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \
365 -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \ 376 -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
366 -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ 377 -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
@@ -402,6 +413,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
402 -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \ 413 -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \
403 -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \ 414 -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
404 -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ 415 -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
416 -e 's|@''REPLACE_STDIO_READ_FUNCS''@|$(REPLACE_STDIO_READ_FUNCS)|g' \
405 -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \ 417 -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \
406 -e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \ 418 -e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \
407 -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ 419 -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
@@ -680,6 +692,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
680 -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \ 692 -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \
681 -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \ 693 -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \
682 -e 's|@''GNULIB_PWRITE''@|$(GNULIB_PWRITE)|g' \ 694 -e 's|@''GNULIB_PWRITE''@|$(GNULIB_PWRITE)|g' \
695 -e 's|@''GNULIB_READ''@|$(GNULIB_READ)|g' \
683 -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ 696 -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
684 -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \ 697 -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \
685 -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \ 698 -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \
@@ -688,6 +701,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
688 -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \ 701 -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \
689 -e 's|@''GNULIB_TTYNAME_R''@|$(GNULIB_TTYNAME_R)|g' \ 702 -e 's|@''GNULIB_TTYNAME_R''@|$(GNULIB_TTYNAME_R)|g' \
690 -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \ 703 -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \
704 -e 's|@''GNULIB_UNISTD_H_NONBLOCKING''@|$(GNULIB_UNISTD_H_NONBLOCKING)|g' \
691 -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \ 705 -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \
692 -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \ 706 -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \
693 -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \ 707 -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \
@@ -748,6 +762,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
748 -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ 762 -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
749 -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ 763 -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \
750 -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ 764 -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \
765 -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \
751 -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ 766 -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \
752 -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ 767 -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \
753 -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ 768 -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 57e93badce3..0b85d0c28cc 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -87,6 +87,25 @@
87#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ 87#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
88 _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) 88 _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
89 89
90/* _GL_ATTRIBUTE_FORMAT_SCANF
91 indicates to GCC that the function takes a format string and arguments,
92 where the format string directives are the ones standardized by ISO C99
93 and POSIX. */
94#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
95# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
96 _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument))
97#else
98# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
99 _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
100#endif
101
102/* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF,
103 except that it indicates to GCC that the supported format string directives
104 are the ones of the system scanf(), rather than the ones standardized by
105 ISO C99 and POSIX. */
106#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
107 _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
108
90/* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */ 109/* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */
91/* But in any case avoid namespace pollution on glibc systems. */ 110/* But in any case avoid namespace pollution on glibc systems. */
92#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \ 111#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \
@@ -175,11 +194,34 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
175 "use gnulib module fflush for portable POSIX compliance"); 194 "use gnulib module fflush for portable POSIX compliance");
176#endif 195#endif
177 196
178/* It is very rare that the developer ever has full control of stdin, 197#if @GNULIB_FGETC@
179 so any use of gets warrants an unconditional warning. Assume it is 198# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
180 always declared, since it is required by C89. */ 199# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
181#undef gets 200# undef fgetc
182_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); 201# define fgetc rpl_fgetc
202# endif
203_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
204_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
205# else
206_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
207# endif
208_GL_CXXALIASWARN (fgetc);
209#endif
210
211#if @GNULIB_FGETS@
212# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
213# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
214# undef fgets
215# define fgets rpl_fgets
216# endif
217_GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream)
218 _GL_ARG_NONNULL ((1, 3)));
219_GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream));
220# else
221_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream));
222# endif
223_GL_CXXALIASWARN (fgets);
224#endif
183 225
184#if @GNULIB_FOPEN@ 226#if @GNULIB_FOPEN@
185# if @REPLACE_FOPEN@ 227# if @REPLACE_FOPEN@
@@ -203,7 +245,7 @@ _GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
203 245
204#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ 246#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
205# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \ 247# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
206 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) 248 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
207# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 249# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
208# define fprintf rpl_fprintf 250# define fprintf rpl_fprintf
209# endif 251# endif
@@ -262,7 +304,7 @@ _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
262#endif 304#endif
263 305
264#if @GNULIB_FPUTC@ 306#if @GNULIB_FPUTC@
265# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 307# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
266# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 308# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
267# undef fputc 309# undef fputc
268# define fputc rpl_fputc 310# define fputc rpl_fputc
@@ -276,7 +318,7 @@ _GL_CXXALIASWARN (fputc);
276#endif 318#endif
277 319
278#if @GNULIB_FPUTS@ 320#if @GNULIB_FPUTS@
279# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 321# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
280# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 322# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
281# undef fputs 323# undef fputs
282# define fputs rpl_fputs 324# define fputs rpl_fputs
@@ -290,6 +332,21 @@ _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
290_GL_CXXALIASWARN (fputs); 332_GL_CXXALIASWARN (fputs);
291#endif 333#endif
292 334
335#if @GNULIB_FREAD@
336# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
337# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
338# undef fread
339# define fread rpl_fread
340# endif
341_GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)
342 _GL_ARG_NONNULL ((4)));
343_GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
344# else
345_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
346# endif
347_GL_CXXALIASWARN (fread);
348#endif
349
293#if @GNULIB_FREOPEN@ 350#if @GNULIB_FREOPEN@
294# if @REPLACE_FREOPEN@ 351# if @REPLACE_FREOPEN@
295# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 352# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -314,6 +371,22 @@ _GL_WARN_ON_USE (freopen,
314 "use gnulib module freopen for portability"); 371 "use gnulib module freopen for portability");
315#endif 372#endif
316 373
374#if @GNULIB_FSCANF@
375# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
376# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
377# undef fscanf
378# define fscanf rpl_fscanf
379# endif
380_GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...)
381 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
382 _GL_ARG_NONNULL ((1, 2)));
383_GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...));
384# else
385_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...));
386# endif
387_GL_CXXALIASWARN (fscanf);
388#endif
389
317 390
318/* Set up the following warnings, based on which modules are in use. 391/* Set up the following warnings, based on which modules are in use.
319 GNU Coding Standards discourage the use of fseek, since it imposes 392 GNU Coding Standards discourage the use of fseek, since it imposes
@@ -506,7 +579,7 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
506 579
507 580
508#if @GNULIB_FWRITE@ 581#if @GNULIB_FWRITE@
509# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 582# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
510# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 583# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
511# undef fwrite 584# undef fwrite
512# define fwrite rpl_fwrite 585# define fwrite rpl_fwrite
@@ -540,6 +613,34 @@ rpl_fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
540_GL_CXXALIASWARN (fwrite); 613_GL_CXXALIASWARN (fwrite);
541#endif 614#endif
542 615
616#if @GNULIB_GETC@
617# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
618# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
619# undef getc
620# define getc rpl_fgetc
621# endif
622_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
623_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
624# else
625_GL_CXXALIAS_SYS (getc, int, (FILE *stream));
626# endif
627_GL_CXXALIASWARN (getc);
628#endif
629
630#if @GNULIB_GETCHAR@
631# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
632# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
633# undef getchar
634# define getchar rpl_getchar
635# endif
636_GL_FUNCDECL_RPL (getchar, int, (void));
637_GL_CXXALIAS_RPL (getchar, int, (void));
638# else
639_GL_CXXALIAS_SYS (getchar, int, (void));
640# endif
641_GL_CXXALIASWARN (getchar);
642#endif
643
543#if @GNULIB_GETDELIM@ 644#if @GNULIB_GETDELIM@
544/* Read input, up to (and including) the next occurrence of DELIMITER, from 645/* Read input, up to (and including) the next occurrence of DELIMITER, from
545 STREAM, store it in *LINEPTR (and NUL-terminate it). 646 STREAM, store it in *LINEPTR (and NUL-terminate it).
@@ -616,6 +717,26 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
616# endif 717# endif
617#endif 718#endif
618 719
720#if @GNULIB_GETS@
721# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
722# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
723# undef gets
724# define gets rpl_gets
725# endif
726_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
727_GL_CXXALIAS_RPL (gets, char *, (char *s));
728# else
729_GL_CXXALIAS_SYS (gets, char *, (char *s));
730# undef gets
731# endif
732_GL_CXXALIASWARN (gets);
733/* It is very rare that the developer ever has full control of stdin,
734 so any use of gets warrants an unconditional warning. Assume it is
735 always declared, since it is required by C89. */
736_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
737#endif
738
739
619#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ 740#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
620struct obstack; 741struct obstack;
621/* Grow an obstack with formatted output. Return the number of 742/* Grow an obstack with formatted output. Return the number of
@@ -711,7 +832,7 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
711 832
712#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ 833#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
713# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ 834# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
714 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) 835 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
715# if defined __GNUC__ 836# if defined __GNUC__
716# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 837# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
717/* Don't break __attribute__((format(printf,M,N))). */ 838/* Don't break __attribute__((format(printf,M,N))). */
@@ -760,7 +881,7 @@ _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
760#endif 881#endif
761 882
762#if @GNULIB_PUTC@ 883#if @GNULIB_PUTC@
763# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 884# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
764# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 885# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
765# undef putc 886# undef putc
766# define putc rpl_fputc 887# define putc rpl_fputc
@@ -774,7 +895,7 @@ _GL_CXXALIASWARN (putc);
774#endif 895#endif
775 896
776#if @GNULIB_PUTCHAR@ 897#if @GNULIB_PUTCHAR@
777# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 898# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
778# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 899# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
779# undef putchar 900# undef putchar
780# define putchar rpl_putchar 901# define putchar rpl_putchar
@@ -788,7 +909,7 @@ _GL_CXXALIASWARN (putchar);
788#endif 909#endif
789 910
790#if @GNULIB_PUTS@ 911#if @GNULIB_PUTS@
791# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 912# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
792# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 913# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
793# undef puts 914# undef puts
794# define puts rpl_puts 915# define puts rpl_puts
@@ -872,6 +993,37 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - "
872# endif 993# endif
873#endif 994#endif
874 995
996#if @GNULIB_SCANF@
997# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
998# if defined __GNUC__
999# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1000# undef scanf
1001/* Don't break __attribute__((format(scanf,M,N))). */
1002# define scanf __scanf__
1003# endif
1004_GL_FUNCDECL_RPL_1 (__scanf__, int,
1005 (const char *format, ...)
1006 __asm__ (@ASM_SYMBOL_PREFIX@
1007 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
1008 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1009 _GL_ARG_NONNULL ((1)));
1010_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...));
1011# else
1012# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1013# undef scanf
1014# define scanf rpl_scanf
1015# endif
1016_GL_FUNCDECL_RPL (scanf, int, (const char *format, ...)
1017 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1018 _GL_ARG_NONNULL ((1)));
1019_GL_CXXALIAS_RPL (scanf, int, (const char *format, ...));
1020# endif
1021# else
1022_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...));
1023# endif
1024_GL_CXXALIASWARN (scanf);
1025#endif
1026
875#if @GNULIB_SNPRINTF@ 1027#if @GNULIB_SNPRINTF@
876# if @REPLACE_SNPRINTF@ 1028# if @REPLACE_SNPRINTF@
877# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1029# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1031,7 +1183,7 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
1031 1183
1032#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@ 1184#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
1033# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \ 1185# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
1034 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) 1186 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1035# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1187# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1036# define vfprintf rpl_vfprintf 1188# define vfprintf rpl_vfprintf
1037# endif 1189# endif
@@ -1065,9 +1217,28 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
1065 "POSIX compliance"); 1217 "POSIX compliance");
1066#endif 1218#endif
1067 1219
1220#if @GNULIB_VFSCANF@
1221# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1222# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1223# undef vfscanf
1224# define vfscanf rpl_vfscanf
1225# endif
1226_GL_FUNCDECL_RPL (vfscanf, int,
1227 (FILE *stream, const char *format, va_list args)
1228 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
1229 _GL_ARG_NONNULL ((1, 2)));
1230_GL_CXXALIAS_RPL (vfscanf, int,
1231 (FILE *stream, const char *format, va_list args));
1232# else
1233_GL_CXXALIAS_SYS (vfscanf, int,
1234 (FILE *stream, const char *format, va_list args));
1235# endif
1236_GL_CXXALIASWARN (vfscanf);
1237#endif
1238
1068#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ 1239#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
1069# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ 1240# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
1070 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) 1241 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1071# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1242# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1072# define vprintf rpl_vprintf 1243# define vprintf rpl_vprintf
1073# endif 1244# endif
@@ -1100,6 +1271,22 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
1100 "POSIX compliance"); 1271 "POSIX compliance");
1101#endif 1272#endif
1102 1273
1274#if @GNULIB_VSCANF@
1275# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1276# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1277# undef vscanf
1278# define vscanf rpl_vscanf
1279# endif
1280_GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args)
1281 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
1282 _GL_ARG_NONNULL ((1)));
1283_GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args));
1284# else
1285_GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args));
1286# endif
1287_GL_CXXALIASWARN (vscanf);
1288#endif
1289
1103#if @GNULIB_VSNPRINTF@ 1290#if @GNULIB_VSNPRINTF@
1104# if @REPLACE_VSNPRINTF@ 1291# if @REPLACE_VSNPRINTF@
1105# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1292# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 15893d7eecc..3b58d0f42a5 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -97,7 +97,8 @@
97# include <netdb.h> 97# include <netdb.h>
98#endif 98#endif
99 99
100#if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ 100#if (@GNULIB_READ@ || @GNULIB_WRITE@ \
101 || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
101 || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) 102 || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
102/* Get ssize_t. */ 103/* Get ssize_t. */
103# include <sys/types.h> 104# include <sys/types.h>
@@ -1105,6 +1106,28 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1105#endif 1106#endif
1106 1107
1107 1108
1109#if @GNULIB_READ@
1110/* Read up to COUNT bytes from file descriptor FD into the buffer starting
1111 at BUF. See the POSIX:2001 specification
1112 <http://www.opengroup.org/susv3xsh/read.html>. */
1113# if @REPLACE_READ@ && @GNULIB_UNISTD_H_NONBLOCKING@
1114# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1115# undef read
1116# define read rpl_read
1117# endif
1118_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
1119 _GL_ARG_NONNULL ((2)));
1120_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1121# else
1122/* Need to cast, because on mingw, the third parameter is
1123 unsigned int count
1124 and the return type is 'int'. */
1125_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
1126# endif
1127_GL_CXXALIASWARN (read);
1128#endif
1129
1130
1108#if @GNULIB_READLINK@ 1131#if @GNULIB_READLINK@
1109/* Read the contents of the symbolic link FILE and place the first BUFSIZE 1132/* Read the contents of the symbolic link FILE and place the first BUFSIZE
1110 bytes of it into BUF. Return the number of bytes placed into BUF if 1133 bytes of it into BUF. Return the number of bytes placed into BUF if
@@ -1359,7 +1382,7 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
1359/* Write up to COUNT bytes starting at BUF to file descriptor FD. 1382/* Write up to COUNT bytes starting at BUF to file descriptor FD.
1360 See the POSIX:2001 specification 1383 See the POSIX:2001 specification
1361 <http://www.opengroup.org/susv3xsh/write.html>. */ 1384 <http://www.opengroup.org/susv3xsh/write.html>. */
1362# if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@ 1385# if @REPLACE_WRITE@ && (@GNULIB_UNISTD_H_NONBLOCKING@ || @GNULIB_UNISTD_H_SIGPIPE@)
1363# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1386# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1364# undef write 1387# undef write
1365# define write rpl_write 1388# define write rpl_write