diff options
author | Zack Weinberg <zackw@panix.com> | 2019-03-09 20:54:02 -0500 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2020-01-08 12:56:32 -0500 |
commit | d5ebebf969165c51e6a9fcff3a21b6591269eaea (patch) | |
tree | 2655d6b5d54a8315a1ca50819d4a86e05ceeaa36 /dirent | |
parent | 23432307d4e17872f5573df4413f5b1efa0cab6d (diff) | |
download | glibc-d5ebebf969165c51e6a9fcff3a21b6591269eaea.zip glibc-d5ebebf969165c51e6a9fcff3a21b6591269eaea.tar.gz glibc-d5ebebf969165c51e6a9fcff3a21b6591269eaea.tar.bz2 |
Create bits/types headers for most remaining __T_defined macros.
This doesn't exactly fit the theme but as long as I'm tinkering with
sys/types.h it makes sense to go through and create single-declaration
bits/types/ headers for all of the remaining cases where we have
two or more headers declaring a public type.
The remaining uses of the original __T_defined idiom are:
__error_t_defined in files shared with gnulib, which probably has to
remain as is; ____gwchar_t_defined in inttypes.h, which may not be
necessary anymore and should be addressed separately, and
__ldiv_t_defined and __lldiv_t_defined in stdlib.h, ditto.
Our handling of LFS types is a little inconsistent: some headers
declare both off_t and off64_t (for instance) when
_LARGEFILE64_SOURCE, others will only declare off_t regardless of
_LARGEFILE64_SOURCE. I don't know if this was intentional or not.
I am tempted to centralize responsibility for _LARGEFILE64_SOURCE as
well as _FILE_OFFSET_BITS=64 in bits/types/off_t.h (etc) so that any
header that declares off_t will automatically also declare off64_t
when _LARGEFILE64_SOURCE.
sunrpc/rpc/types.h is special, because it is included in files
compiled by the *build* compiler (cross-rpcgen-objs), and therefore it
cannot unconditionally assume bits/types headers are available. What
I did was have it include the appropriate bits/types headers only if
including sys/types.h did not cause __BIT_TYPES_DEFINED__ to be
defined. This will do the right thing when an installed rpc/types.h
is included by application code compiled without __USE_MISC in effect.
During the build, we rely on the fact that we compile all of our own
code with __USE_MISC in effect. This is fragile, but should be
acceptable for code that's no longer built by default anyway.
scripts/check-obsolete-constructs.py ensures that only sys/types.h and
rpc/types.h include the bits/types/ headers that define obsolete types.
* posix/bits/types/blkcnt64_t.h
* posix/bits/types/blkcnt_t.h
* posix/bits/types/blksize_t.h
* posix/bits/types/dev_t.h
* posix/bits/types/fsblkcnt64_t.h
* posix/bits/types/fsblkcnt_t.h
* posix/bits/types/fsfilcnt64_t.h
* posix/bits/types/fsfilcnt_t.h
* posix/bits/types/fsid_t.h
* posix/bits/types/gid_t.h
* posix/bits/types/id_t.h
* posix/bits/types/ino64_t.h
* posix/bits/types/ino_t.h
* posix/bits/types/intptr_t.h
* posix/bits/types/key_t.h
* posix/bits/types/loff_t.h
* posix/bits/types/mode_t.h
* posix/bits/types/nlink_t.h
* posix/bits/types/off64_t.h
* posix/bits/types/off_t.h
* posix/bits/types/pid_t.h
* posix/bits/types/socklen_t.h
* posix/bits/types/ssize_t.h
* posix/bits/types/suseconds_t.h
* posix/bits/types/uid_t.h
* posix/bits/types/useconds_t.h:
New single-declaration headers for standard types canonically
defined by sys/types.h, sys/socket.h, or inttypes.h but also
exposed by other headers under some circumstances. Code moved
from posix/sys/types.h, socket/sys/socket.h, stdlib/inttypes.h
as appropriate.
* posix/bits/types/uint.h
* posix/bits/types/u_int.h
* posix/bits/types/u_intN_t.h
* posix/bits/types/caddr_t.h
* posix/bits/types/daddr_t.h
* posix/bits/types/loff_t.h
* posix/bits/types/register_t.h:
Similarly, but for obsolete BSD-derived types whose canonical
home is sys/types.h. Some of these headers define more than
one type.
* posix/Makefile (headers): Install the above new headers.
Rewrap the list.
* posix/sys/types.h: All definitions of public types now
accomplished using the above new headers. Consolidate
groups of definitions controlled by the same feature
selection macros.
* inet/arpa/inet.h, bits/socket.h
* sysdeps/mach/hurd/bits/socket.h
* sysdeps/unix/sysv/linux/bits/socket.h:
Use bits/types/socklen_t.h.
* dirent/dirent.h: Use bits/types/ino_t.h and bits/types/ino64_t.h.
* grp/grp.h: Use bits/types/gid_t.h.
* io/fcntl.h: Use bits/types/mode_t.h, bits/types/off_t.h,
bits/types/pid_t.h, and bits/types/off64_t.h.
* io/sys/stat.h: Use bits/types/dev_t.h, bits/types/gid_t.h,
bits/types/ino_t.h, bits/types/mode_t.h, bits/types/nlink_t.h,
bits/types/off_t.h, bits/types/uid_t.h, and bits/types/blkcnt_t.h.
* libio/stdio.h: Use bits/types/off_t.h, bits/types/off64_t.h,
and bits/types/ssize_t.h.
* misc/sys/mman.h: Use bits/types/off_t.h and bits/types/mode_t.h.
* misc/sys/select.h: Use bits/types/suseconds_t.h.
* posix/sched.h: Use bits/types/pid_t.h.
* posix/sys/wait.h: Use bits/types/pid_t.h and bits/types/id_t.h.
* posix/unistd.h: Use bits/types/gid_t.h, bits/types/uid_t.h,
bits/types/off_t.h, bits/types/off64_t.h, bits/types/useconds_t.h,
bits/types/intptr_t.h, and bits/types/socklen_t.h.
* pwd/pwd.h: Use bits/types/gid_t.h and bits/types/uid_t.h.
* resource/sys/resource.h: Use bits/types/id_t.h.
* signal/signal.h: Use bits/types/pid_t.h and bits/types/uid_t.h.
* stdlib/monetary.h: Use bits/types/ssize_t.h.
* sysdeps/gnu/utmpx.h: Use bits/types/pid_t.h.
* sysvipc/sys/ipc.h: Use bits/types/uid_t.h, bits/types/gid_t.h,
bits/types/mode_t.h, and bits/types/key_t.h.
* sysvipc/sys/msg.h: Use bits/types/pid_t.h and bits/types/ssize_t.h.
* sysvipc/sys/shm.h: Use bits/types/pid_t.h.
* termios/termios.h: Use bits/types/pid_t.h.
* time/sys/time.h: Use bits/types/suseconds_t.h.
* time/time.h: Use bits/types/pid_t.h.
* sunrpc/rpc/types.h: Consolidate all #includes at the top of
the file. If __BIT_TYPES_DEFINED__ is not defined after
including sys/types.h, also include bits/types/caddr_t.h,
bits/types/daddr_t.h, bits/types/fsid_t.h, and bits/types/u_int.h.
* scripts/check-obsolete-constructs.py (OBSOLETE_TYPE_HDR_RE_): New.
(ObsoleteIndirectDefinitionsAllowed): New; allows inclusion of
bits/types/ headers that define obsolete typedefs, but not
direct definitions of those types.
(ObsoleteNotAllowed, ObsoletePrivateDefinitionsAllowed)
(ObsoletePublicDefinitionsAllowed): Do not allow inclusion of
bits/types/ headers that define obsolete typedefs.
* include/bits/types/blkcnt64_t.h
* include/bits/types/blkcnt_t.h
* include/bits/types/blksize_t.h
* include/bits/types/caddr_t.h
* include/bits/types/daddr_t.h
* include/bits/types/dev_t.h
* include/bits/types/fsblkcnt64_t.h
* include/bits/types/fsblkcnt_t.h
* include/bits/types/fsfilcnt64_t.h
* include/bits/types/fsfilcnt_t.h
* include/bits/types/fsid_t.h
* include/bits/types/gid_t.h
* include/bits/types/id_t.h
* include/bits/types/ino64_t.h
* include/bits/types/ino_t.h
* include/bits/types/intptr_t.h
* include/bits/types/key_t.h
* include/bits/types/loff_t.h
* include/bits/types/mode_t.h
* include/bits/types/nlink_t.h
* include/bits/types/off64_t.h
* include/bits/types/off_t.h
* include/bits/types/pid_t.h
* include/bits/types/register_t.h
* include/bits/types/socklen_t.h
* include/bits/types/ssize_t.h
* include/bits/types/suseconds_t.h
* include/bits/types/u_char.h
* include/bits/types/u_intN_t.h
* include/bits/types/uchar.h
* include/bits/types/uid_t.h
* include/bits/types/useconds_t.h: New wrappers.
Diffstat (limited to 'dirent')
-rw-r--r-- | dirent/dirent.h | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/dirent/dirent.h b/dirent/dirent.h index 92d0925..0886b6d 100644 --- a/dirent/dirent.h +++ b/dirent/dirent.h @@ -29,17 +29,9 @@ __BEGIN_DECLS #include <bits/types.h> #ifdef __USE_XOPEN -# ifndef __ino_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __ino_t ino_t; -# else -typedef __ino64_t ino_t; -# endif -# define __ino_t_defined -# endif -# if defined __USE_LARGEFILE64 && !defined __ino64_t_defined -typedef __ino64_t ino64_t; -# define __ino64_t_defined +# include <bits/types/ino_t.h> +# ifdef __USE_LARGEFILE64 +# include <bits/types/ino64_t.h> # endif #endif |