summaryrefslogtreecommitdiff
path: root/misc/err.c
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2017-12-25 20:58:46 -0800
committerZack Weinberg <zackw@panix.com>2017-12-25 21:55:54 -0800
commit7959f855a7c739602a2227c85563650b28d8a0cf (patch)
tree3604bbdc17f738fe77c60f6a5deffdd7fc97d49a /misc/err.c
parentd663336f8e3aae73b0beb7e42cd37d2dd4b04b9d (diff)
downloadglibc-7959f855a7c739602a2227c85563650b28d8a0cf.tar.gz
Don't include libio.h from stdio.h.
The only thing stdio.h really needed libio.h for was the complete definition of the FILE struct. This is moved to bits/types/struct_FILE.h, along with just enough ancillary definitions for the inlines in bits/stdio.h. stdio.h itself leaves FILE as an opaque typedef; bits/types/struct_FILE.h will only be read when the inlines are active. Code within glibc that needs to see libio internal definitions should, for the time being, include <libio/libioP.h>. Once we stop shipping libio.h as an exposed header, we can fold libio.h, libioP.h, and iolibio.h together and much cruft will become unneccessary. Unlike the earlier patch where I had us stop shipping libio.h entirely, I left the struct _IO_FILE / struct _IO_FILE_complete distinction strictly alone in this patch, so it shouldn't break old ABI compatibility. This is still quite messy, particularly where it touches on the _IO_MTSAFE_IO mess; close review would be appreciated. More automatic PLT bypassing is added for fwide, flockfile, and funlockfile; the earlier patches were apparently not thorough enough. * libio/stdio.h: Don't include bits/libio.h. Don't define getc or putc as macros. Declare __underflow, __uflow, and __overflow here. * libio/bits/types/struct_FILE.h: New header containing the complete definitions of struct _IO_FILE and struct _IO_FILE_complete and a few ancillary definitions. * libio/Makefile: Install bits/types/struct_FILE.h. * libio/bits/stdio.h: Add multiple inclusion guard. Include bits/types/struct_FILE.h. Use getc, not _IO_getc; putc, not _IO_putc; __getc_unlocked_body, not _IO_getc_unlocked; __putc_unlocked_body, not _IO_putc_unlocked; __feof_unlocked_body, not _IO_feof_unlocked; __ferror_unlocked_body, not _IO_ferror_unlocked. * libio/bits/stdio2.h: Add multiple inclusion guard. Use getc_unlocked, not _IO_getc_unlocked. * libio/bits/libio.h: Allow inclusion by libioP.h, not stdio.h. Move __HAVE_COLUMN and _IO_file_flags to the set of compatibility defines. Get definition of _IO_FILE and fallback definition of _IO_lock_t from bits/types/struct_FILE.h. Use macros from bits/types/struct_FILE.h for _IO_getc_unlocked, _IO_putc_unlocked, _IO_feof_unlocked, and _IO_ferror_unlocked. Remove some #if 0 blocks and redundant prototypes. Only provide non-thread-safe fallback definitions of several macros when neither _IO_MTSAFE_IO nor _LIBC is defined. Avoid unwanted macro expansion when declaring _IO_flockfile and _IO_funlockfile. * libio/libioP.h: Add multiple-include guard. Include stdio.h and bits/libio.h. * libio/strfile.h: Include libio/libioP.h. * include/bits/libio.h: Move the libc_hidden_proto declarations for __woverflow, __wunderflow, __wuflow, _IO_free_backup_area, _IO_free_wbackup_area, _IO_padn, _IO_putc, _IO_sgetn, _IO_vfprintf, and _IO_vfscanf back here. Add libc_hidden_proto declarations for _IO_flockfile, _IO_ftrylockfile, and _IO_funlockfile. * include/stdio.h: Use __gnuc_va_list instead of _G_va_list, __ssize_t instead of _IO_ssize_t, and FILE instead of _IO_FILE. Don't redefine _IO_peekc. Don't macro-redirect putc. Define _IO_USER_LOCK here. Add libc_hidden_proto declarations for __flockfile, __funlockfile, and __ftrylockfile. When IS_IN(libc), macro-redirect flockfile to __flockfile and funlockfile to __funlockfile. When IS_IN(libc) and _IO_MTSAFE_IO, macro-redirect __flockfile to _IO_flockfile and __funlockfile to _IO_funlockfile. Use __flockfile and __funlockfile in the expensive-lock variants of _IO_flockfile and _IO_funlockfile. * include/stdio_ext.h: Define _IO_USER_LOCK here. * include/wchar.h: When IS_IN(libc), macro-redirect fwide to _IO_fwide. * include/bits/types/struct_FILE.h: New wrapper. * argp/argp-fmtstream.c, argp/argp-help.c, misc/err.c, misc/error.c: Use fwide, not _IO_fwide. * resolv/res_init.c: Use ferror_unlocked, not _IO_ferror_unlocked. * stdio-common/scanf.c: Use __vfscanf, not _IO_vfscanf. * stdio-common/tstgetln.c: Get ssize_t from sys/types.h. * csu/init.c, libio/__fbufsize.c, libio/__flbf.c, libio/__fpending.c * libio/__freadable.c, libio/__fwritable.c, libio/__fwriting.c * malloc/malloc.c, misc/err.c, misc/error.c, stdio-common/perror.c Include libio/libioP.h instead of, or in addition to, stdio.h. * libio/fwide.c: #undef fwide before defining it as a function. * stdio-common/flockfile.c: Include stdio.h and libio/libioP.h and remove unnecessary headers. #undef flockfile, __flockfile, and _IO_flockfile before defining __flockfile as a function. Make _IO_flockfile a strong alias. Add libc_hidden_def for __flockfile and _IO_flockfile. * stdio-common/ftrylockfile.c, stdio-common/funlockfile.c * sysdeps/pthread/flockfile.c, sysdeps/pthread/ftrylockfile.c * sysdeps/pthread/funlockfile.c: Similarly.
Diffstat (limited to 'misc/err.c')
-rw-r--r--misc/err.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/misc/err.c b/misc/err.c
index d96778adac..79437835b6 100644
--- a/misc/err.c
+++ b/misc/err.c
@@ -23,6 +23,7 @@
#include <string.h>
#include <stdio.h>
#include <wchar.h>
+#include <libio/libioP.h>
extern char *__progname;
@@ -84,7 +85,7 @@ void
vwarnx (const char *format, __gnuc_va_list ap)
{
flockfile (stderr);
- if (_IO_fwide (stderr, 0) > 0)
+ if (fwide (stderr, 0) > 0)
{
__fwprintf (stderr, L"%s: ", __progname);
convert_and_print (format, ap);
@@ -107,7 +108,7 @@ vwarn (const char *format, __gnuc_va_list ap)
int error = errno;
flockfile (stderr);
- if (_IO_fwide (stderr, 0) > 0)
+ if (fwide (stderr, 0) > 0)
{
__fwprintf (stderr, L"%s: ", __progname);
if (format)