From 23432307d4e17872f5573df4413f5b1efa0cab6d Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Sat, 9 Mar 2019 18:01:48 -0500 Subject: Clean up bits/types.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- sysdeps/unix/sysv/linux/generic/bits/typesizes.h | 14 +++++++------- sysdeps/unix/sysv/linux/mips/bits/typesizes.h | 16 ++++++++-------- sysdeps/unix/sysv/linux/s390/bits/typesizes.h | 14 +++++++------- sysdeps/unix/sysv/linux/sparc/bits/typesizes.h | 14 +++++++------- sysdeps/unix/sysv/linux/x86/bits/typesizes.h | 20 ++++++++++---------- 5 files changed, 39 insertions(+), 39 deletions(-) (limited to 'sysdeps/unix/sysv/linux') diff --git a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h index c7e72f3ca5..52f7967d1e 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h @@ -27,24 +27,24 @@ /* See for the meaning of these macros. This file exists so that need not vary across different GNU platforms. */ -#define __DEV_T_TYPE __UQUAD_TYPE +#define __DEV_T_TYPE __U64_TYPE #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE #define __INO_T_TYPE __ULONGWORD_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE +#define __INO64_T_TYPE __U64_TYPE #define __MODE_T_TYPE __U32_TYPE #define __NLINK_T_TYPE __U32_TYPE #define __OFF_T_TYPE __SLONGWORD_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE +#define __OFF64_T_TYPE __S64_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __ULONGWORD_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __RLIM64_T_TYPE __U64_TYPE #define __BLKCNT_T_TYPE __SLONGWORD_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __BLKCNT64_T_TYPE __S64_TYPE #define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __U64_TYPE #define __FSFILCNT_T_TYPE __ULONGWORD_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __U64_TYPE #define __FSWORD_T_TYPE __SWORD_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SLONGWORD_TYPE diff --git a/sysdeps/unix/sysv/linux/mips/bits/typesizes.h b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h index 7c1bedd9af..e73bba4ee7 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h @@ -26,24 +26,24 @@ /* See for the meaning of these macros. This file exists so that need not vary across different GNU platforms. */ -#define __DEV_T_TYPE __UQUAD_TYPE +#define __DEV_T_TYPE __U64_TYPE #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE #define __INO_T_TYPE __ULONGWORD_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE +#define __INO64_T_TYPE __U64_TYPE #define __MODE_T_TYPE __U32_TYPE #define __NLINK_T_TYPE __UWORD_TYPE #define __OFF_T_TYPE __SLONGWORD_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE +#define __OFF64_T_TYPE __S64_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __ULONGWORD_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __RLIM64_T_TYPE __U64_TYPE #define __BLKCNT_T_TYPE __SLONGWORD_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __BLKCNT64_T_TYPE __S64_TYPE #define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __U64_TYPE #define __FSFILCNT_T_TYPE __ULONGWORD_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __U64_TYPE #define __FSWORD_T_TYPE __SWORD_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SLONGWORD_TYPE @@ -61,7 +61,7 @@ #define __CPU_MASK_TYPE __ULONGWORD_TYPE #if defined _ABIN32 && _MIPS_SIM == _ABIN32 -#define __REGISTER_T_TYPE __SQUAD_TYPE +#define __REGISTER_T_TYPE __S64_TYPE #else #define __REGISTER_T_TYPE __SWORD_TYPE #endif diff --git a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h index e812109140..3671355225 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h @@ -26,24 +26,24 @@ /* See for the meaning of these macros. This file exists so that need not vary across different GNU platforms. */ -#define __DEV_T_TYPE __UQUAD_TYPE +#define __DEV_T_TYPE __U64_TYPE #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE #define __INO_T_TYPE __ULONGWORD_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE +#define __INO64_T_TYPE __U64_TYPE #define __MODE_T_TYPE __U32_TYPE #define __NLINK_T_TYPE __UWORD_TYPE #define __OFF_T_TYPE __SLONGWORD_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE +#define __OFF64_T_TYPE __S64_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __ULONGWORD_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __RLIM64_T_TYPE __U64_TYPE #define __BLKCNT_T_TYPE __SLONGWORD_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __BLKCNT64_T_TYPE __S64_TYPE #define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __U64_TYPE #define __FSFILCNT_T_TYPE __ULONGWORD_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __U64_TYPE #define __FSWORD_T_TYPE __SWORD_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SLONGWORD_TYPE diff --git a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h index 830a45f01c..37627bd297 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h @@ -26,24 +26,24 @@ /* See for the meaning of these macros. This file exists so that need not vary across different GNU platforms. */ -#define __DEV_T_TYPE __UQUAD_TYPE +#define __DEV_T_TYPE __U64_TYPE #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE #define __INO_T_TYPE __ULONGWORD_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE +#define __INO64_T_TYPE __U64_TYPE #define __MODE_T_TYPE __U32_TYPE #define __NLINK_T_TYPE __U32_TYPE #define __OFF_T_TYPE __SLONGWORD_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE +#define __OFF64_T_TYPE __S64_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __ULONGWORD_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __RLIM64_T_TYPE __U64_TYPE #define __BLKCNT_T_TYPE __SLONGWORD_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __BLKCNT64_T_TYPE __S64_TYPE #define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __U64_TYPE #define __FSFILCNT_T_TYPE __ULONGWORD_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __U64_TYPE #define __FSWORD_T_TYPE __SWORD_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SLONGWORD_TYPE diff --git a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h index 55f9a4c430..e4f3698976 100644 --- a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h @@ -28,20 +28,20 @@ /* X32 kernel interface is 64-bit. */ #if defined __x86_64__ && defined __ILP32__ -# define __SYSCALL_SLONG_TYPE __SQUAD_TYPE -# define __SYSCALL_ULONG_TYPE __UQUAD_TYPE -# define __REGISTER_T_TYPE __SQUAD_TYPE +# define __SYSCALL_SLONG_TYPE __S64_TYPE +# define __SYSCALL_ULONG_TYPE __U64_TYPE +# define __REGISTER_T_TYPE __S64_TYPE #else # define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE # define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE # define __REGISTER_T_TYPE __SWORD_TYPE #endif -#define __DEV_T_TYPE __UQUAD_TYPE +#define __DEV_T_TYPE __U64_TYPE #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE #define __INO_T_TYPE __SYSCALL_ULONG_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE +#define __INO64_T_TYPE __U64_TYPE #define __MODE_T_TYPE __U32_TYPE #ifdef __x86_64__ # define __NLINK_T_TYPE __SYSCALL_ULONG_TYPE @@ -51,16 +51,16 @@ # define __FSWORD_T_TYPE __SWORD_TYPE #endif #define __OFF_T_TYPE __SYSCALL_SLONG_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE +#define __OFF64_T_TYPE __S64_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __SYSCALL_ULONG_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __RLIM64_T_TYPE __U64_TYPE #define __BLKCNT_T_TYPE __SYSCALL_SLONG_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __BLKCNT64_T_TYPE __S64_TYPE #define __FSBLKCNT_T_TYPE __SYSCALL_ULONG_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __U64_TYPE #define __FSFILCNT_T_TYPE __SYSCALL_ULONG_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __U64_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SYSCALL_SLONG_TYPE #define __TIME_T_TYPE __SYSCALL_SLONG_TYPE -- cgit 1.4.1