diff options
author | Zack Weinberg <zackw@panix.com> | 2017-04-20 11:21:30 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2017-08-23 07:52:27 -0400 |
commit | 6d350b3b179175b52172bd2cdd7de62186b3860d (patch) | |
tree | 9a16b8f077dd5dbafb28cba9361a36787aa2d9d7 /locale/bits/locale.h | |
parent | 5a706f649de3952271930a8340db4ca8aa50f485 (diff) | |
download | glibc-zack/dont-install-libio-h.tar.gz |
Don't install libio.h or _G_config.h.zack/dont-install-libio-h
This is an experimental patch which removes libio.h (and _G_config.h)
from the set of application-exposed headers. After this change, the
public stdio.h does not define any symbols whose names begin with _G_
nor _IO_, except that when optimizing, the guts of struct _IO_FILE and
three of the flag constants are visible (see bits/stdio.h and
bits/types/FILE_internals.h). There is a small amount of code
duplication in bits/stdio.h, of macro bodies from libio.h that are no
longer available. A number of internal .c files that were manually
doing PLT bypass for flockfile/funlockfile can now rely on
include/stdio.h to do it for them.
It passes the testsuite on x86_64-linux, but it needs a great deal of
additional testing; in particular I'm almost certain I broke the
support for old-format (GLIBC_2.0) struct _IO_FILE, which is
configured out on this target. Testing this properly would require
someone to get their hands on _really_ old binaries, compiled against
glibc 2.0, possibly statically-linked-but-using-NSS. Unfortunately,
libc.so cannot be expected to be binary identical.
However, this should be ready to feed into archive rebuilds to find
out what applications break.
Substantial clean-ups to the libio implementation are possible if this
sticks, but I haven't done 'em; this is intended to be minimal.
* libio/Makefile: Don't install libio.h or _G_config.h. Do install
bits/types/FILE_internals.h, bits/types/cookie_io_functions_t.h,
and bits/types/__fpos_t.h.
* libio/stdio.h: Don't include libio.h. Get __gnuc_va_list
directly from stdarg.h, __fpos_t and __fpos64_t from
bits/types/__fpos_t.h, and the cookie types from
bits/types/cookie_io_functions_t.h. Change all uses of
_G_va_list, _G_fpos_t, _G_fpos64_t, _IO_FILE,
_IO_cookie_io_functions_t, and _IO_ssize_t to __gnuc_va_list,
__fpos_t, __fpos64_t, FILE, cookie_io_functions_t, and __ssize_t
respectively.
Do not define getc nor putc as macros.
Define BUFSIZ as literal 8192.
* libio/bits/types/FILE_internals.h: New header. Provide complete
definition of struct _IO_FILE (the complete version) here.
Duplicate definitions of _IO_EOF_SEEN, _IO_ERR_SEEN, and _IO_USER_LOCK
here, with value assertions if they are already defined.
* libio/bits/types/__fpos_t.h: New header. Define __fpos_t and
__fpos64_t here.
* libio/bits/types/cookie_io_functions_t.h: New header. Define
cookie_read_function_t, cookie_write_function_t,
cookie_seek_function_t, cookie_close_function_t, and
cookie_io_functions_t here.
* libio/libio.h: Include features.h first thing, then error out if
either _LIBC or __USE_GNU is not defined, or if _ISOMAC is
defined. Inline all of _G_config.h except _G_HAVE_MREMAP here.
Get definitions of __mbstate_t, __fpos_t, __fpos64_t, struct
_IO_FILE, and the cookie-related types from the relevant
bits/types headers. Get definition of NULL from stddef.h.
Make all #ifdef _LIBC and #if __GNUC__ >= (2,3) blocks
unconditional. Remove all #if 0 and #ifdef __cplusplus blocks.
Change all uses of _G_va_list, _G_fpos_t, and _G_fpos64_t to
__gnuc_va_list, __fpos_t, __fpos64_t respectively. Provide
definitions of _STDIO_USES_IOSTREAM, __HAVE_COLUMN,
_IO_file_flags, __io_read_fn, __io_write_fn, __io_seek_fn,
__io_close_fn, _IO_cookie_io_functions_t for the sake of the
implementation. When _IO_USE_OLD_IO_FILE is defined, define
struct _IO_FILE_old.
* libio/libioP.h: When _IO_USE_OLD_IO_FILE is defined, define
struct _IO_FILE_old_plus. Only declare _IO_old_file_init_internal
when _IO_USE_OLD_IO_FILE is defined, and have it take an
argument of type struct _IO_FILE_old_plus.
* libio/oldfileops.c: Change all uses of _IO_FILE to _IO_FILE_old,
_IO_FILE_plus to _IO_FILE_old_plus, _IO_FILE_complete to _IO_FILE,
and _IO_FILE_complete_plus to _IO_FILE_plus. Then adjust types
to match caller/callee's expectations.
* libio/oldiofdopen.c, libio/oldiofopen.c, libio/oldiopopen.c
* libio/oldstdfiles.c: Likewise.
* sysdeps/generic/_G_config.h, sysdeps/unix/sysv/linux/_G_config.h:
Only provide definition or non-definition of _G_HAVE_MREMAP.
* sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c: Delete file.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Remove iovfscanf.
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c: Define
__nldbl__IO_vsprintf as alias to __nldbl_vsprintf instead of
the other way around.
* sysdeps/ieee754/ldbl-opt/nldbl-compat.h:
Change all uses of _G_va_list to __gnuc_va_list. Remove
NLDBL_DECL for _IO_vfscanf.
* sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-scanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c:
Use __nldbl_vfscanf, not __nldbl__IO_vfscanf.
* libio/bits/stdio.h: Add multiple-inclusion guard. Include
bits/types/FILE_internals.h. Declare __uflow and __overflow here.
Remove redundant __USE_EXTERN_INLINES ifdef. Change all uses of
_G_va_list to __gnuc_va_list and _IO_ssize_t to __ssize_t.
(getchar): Use getc, not _IO_getc.
(__getc_unlocked, __putc_unlocked): New inlines, duplicating the
bodies of _IO_getc_unlocked and _IO_putc_unlocked.
(fgetc_unlocked, getc_unlocked, getchar_unlocked, fread_unlocked):
Use __getc_unlocked.
(fputc_unlocked, putc_unlocked, putchar_unlocked, fwrite_unlocked):
Use __putc_unlocked.
(feof_unlocked): Duplicate the body of _IO_feof_unlocked here.
(ferror_unlocked): Duplicate the body of _IO_ferror_unlocked here.
* libio/bits/stdio2.h: Change all uses of _G_va_list to __gnuc_va_list.
(fread_unlocked): Use __getc_unlocked.
* libio/bits/types/FILE.h, libio/bits/types/__FILE.h: Explain in
comments why the name _IO_FILE is used.
* include/stdio.h: Change all uses of _G_va_list to __gnuc_va_list,
_IO_ssize_t to __size_t, _IO_FILE to FILE, and _IO_fpos_t to __fpos_t.
When IS_IN (libc), redirect flockfile and funlockfile to
__flockfile and __funlockfile respectively.
When _IO_MTSAFE_IO and not _ISOMAC, include stdio-lock.h before
stdio.h proper.
* include/stdio_ext.h: Include bits/types/FILE_internals.h for the
sake of the inline definition of __fsetlocking.
* include/libio.h: Adjust #ifdef nest to activate multiple-include
optimization.
* include/bits/types/FILE_internals.h, include/bits/types/__fpos_t.h
* include/bits/types/cookie_io_functions_t.h: New trivial wrappers.
* include/bits/stdio.h: New wrapper; mark __uflow and __overflow
as hidden for intra-libc callers.
* csu/init.c: Include libio.h, not _G_config.h.
* grp/fgetgrent_r.c, grp/putgrent.c, gshadow/fgetsgent_r.c
* gshadow/putsgent.c, misc/getpass.c, misc/getttyent.c
* misc/mntent_r.c, posix/getopt.c, pwd/fgetpwent_r.c
* shadow/fgetspent_r.c, shadow/putspent.c:
Don't include libio/iolibio.h. Don't redefine flockfile or
funlockfile. Don't use _IO_flockfile or _IO_funlockfile.
* libio/__fbufsize.c, libio/__flbf.c, libio/__fpending.c
* libio/__freadable.c, libio/__freading.c, libio/__fwritable.c
* libio/__fwriting.c, malloc/malloc.c: Include libio.h.
* misc/err.c: Include libio.h. Don't redefine flockfile or funlockfile.
* stdio-common/tstgetln.c: Include sys/types.h. Don't redefine ssize_t.
* conform/data/stdio.h-data: va_list may be defined as __gnuc_va_list,
not _G_va_list.
* benchtests/strcoll-inputs/filelist#en_US.UTF-8: Remove _G_config.h.
Diffstat (limited to 'locale/bits/locale.h')
0 files changed, 0 insertions, 0 deletions