]> git.ipfire.org Git - thirdparty/glibc.git/commit
Clean up bits/types.h.
authorZack Weinberg <zackw@panix.com>
Sat, 9 Mar 2019 23:01:48 +0000 (18:01 -0500)
committerZack Weinberg <zackw@panix.com>
Wed, 8 Jan 2020 17:56:32 +0000 (12:56 -0500)
commit23432307d4e17872f5573df4413f5b1efa0cab6d
tree13e56484dd269eb341a40eb60da64621e3569973
parent9bdd08229bbba415fe9c8e8bb65016adee392412
Clean up bits/types.h.

This makes four linked changes to bits/types.h.  First, we use
__(u)?int(16|32|64)_t to define __[SU](16|32|64)_TYPE.  In addition
to reducing the amount of ifdeffage, this means __STD_TYPE is no longer
necessary, since gcc -std=c89 will complain about ‘typedef long long foo_t’
but not ‘typedef __int64_t foo_t’, even if the underlying type
of __int64_t is long long.

Second, we eliminate __UQUAD_TYPE and __SQUAD_TYPE from the set of
macros bits/typesizes.h should use to define __FOO_T_TYPE macros,
since they are always the same as __U64_TYPE and __S64_TYPE
respectively.

Third, we remove __u_char, __u_short, __u_int, __u_long, __u_quad_t,
and __quad_t, we add __uintptr_t, and we define __intmax_t and
__uintmax_t as __int64_t and __uint64_t.

Fourth, we reorganize the list of typedefs into groups by the
standard (if any) that defines them, and sort them alphabetically within
each group.

* posix/bits/types.h: Move #error for __WORDSIZE neither 32 nor 64
to first group of conditionals on __WORDSIZE, and make it more
explicit.  Update commentary.  Define all __foo_t types with
regular ‘typedef’.  Reorganize all __foo_t types into the same
groups that sys/types.h uses.
(__u_char, __u_short, __u_int, __u_long, __quad_t, __u_quad_t)
(__UQUAD_TYPE, __SQUAD_TYPE, __STD_TYPE): Don’t define.
(__S16_TYPE): Define unconditionally as __int16_t.
(__U16_TYPE): Define unconditionally as __uint16_t.
(__S32_TYPE): Define unconditionally as __int32_t.
(__U32_TYPE): Define unconditionally as __uint32_t.
(__S64_TYPE): Define unconditionally as __int64_t.
(__U64_TYPE): Define unconditionally as __uint64_t.
(__intmax_t): Define unconditionally as __int64_t.
(__uintmax_t): Define unconditionally as __uint64_t.
        (__uintptr_t): New typedef.

* bits/time64.h
* bits/typesizes.h
* sysdeps/mach/hurd/bits/typesizes.h
* sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
* sysdeps/unix/sysv/linux/generic/bits/typesizes.h
* sysdeps/unix/sysv/linux/mips/bits/typesizes.h
* sysdeps/unix/sysv/linux/s390/bits/typesizes.h
* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
* sysdeps/unix/sysv/linux/x86/bits/typesizes.h:
Replace all uses of __UQUAD_TYPE with __U64_TYPE, and all
uses of __SQUAD_TYPE with __S64_TYPE.

        * posix/sys/types.h, rpc/sys/types.h
        (u_char): Define as unsigned char.
        (u_short): Define as unsigned short.
        (u_int): Define as unsigned int.
        (u_long): Define as unsigned long.
        (quad_t): Define as __int64_t.
        (u_quad_t): Define as __uint64_t.

        * stdlib/stdint.h (intptr_t): Define as __intptr_t.
        (uintptr_t): Define as __uintptr_t.

        * scripts/check-obsolete-constructs.py: Update allowed
        definitions for the obsolete types.  No longer allow
        __STD_TYPE as an alias for typedef.
13 files changed:
bits/time64.h
bits/typesizes.h
posix/bits/types.h
posix/sys/types.h
scripts/check-obsolete-constructs.py
stdlib/stdint.h
sunrpc/rpc/types.h
sysdeps/mach/hurd/bits/typesizes.h
sysdeps/unix/sysv/linux/generic/bits/typesizes.h
sysdeps/unix/sysv/linux/mips/bits/typesizes.h
sysdeps/unix/sysv/linux/s390/bits/typesizes.h
sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
sysdeps/unix/sysv/linux/x86/bits/typesizes.h