refactor headers, especially alltypes.h, and improve C++ ABI compat

the arch-specific bits/alltypes.h.sh has been replaced with a generic
alltypes.h.in and minimal arch-specific bits/alltypes.h.in.

this commit is intended to have no functional changes except:
- exposing additional symbols that POSIX allows but does not require
- changing the C++ name mangling for some types
- fixing the signedness of blksize_t on powerpc (POSIX requires signed)
- fixing the limit macros for sig_atomic_t on x86_64
- making dev_t an unsigned type (ABI matching goal, and more logical)

in addition, some types that were wrongly defined with long on 32-bit
archs were changed to int, and vice versa; this change is
non-functional except for the possibility of making pointer types
mismatch, and only affects programs that were using them incorrectly,
and only at build-time, not runtime.

the following changes were made in the interest of moving
non-arch-specific types out of the alltypes system and into the
headers they're associated with, and also will tend to improve
application compatibility:
- netdb.h now includes netinet/in.h (for socklen_t and uint32_t)
- netinet/in.h now includes sys/socket.h and inttypes.h
- sys/resource.h now includes sys/time.h (for struct timeval)
- sys/wait.h now includes signal.h (for siginfo_t)
- langinfo.h now includes nl_types.h (for nl_item)

for the types in stdint.h:
- types which are of no interest to other headers were moved out of
  the alltypes system.
- fast types for 8- and 64-bit are hard-coded (at least for now); only
  the 16- and 32-bit ones have reason to vary by arch.

and the following types have been changed for C++ ABI purposes;
- mbstate_t now has a struct tag, __mbstate_t
- FILE's struct tag has been changed to _IO_FILE
- DIR's struct tag has been changed to __dirstream
- locale_t's struct tag has been changed to __locale_struct
- pthread_t is defined as unsigned long in C++ mode only
- fpos_t now has a struct tag, _G_fpos64_t
- fsid_t's struct tag has been changed to __fsid_t
- idtype_t has been made an enum type (also required by POSIX)
- nl_catd has been changed from long to void *
- siginfo_t's struct tag has been removed
- sigset_t's has been given a struct tag, __sigset_t
- stack_t has been given a struct tag, sigaltstack
- suseconds_t has been changed to long on 32-bit archs
- [u]intptr_t have been changed from long to int rank on 32-bit archs
- dev_t has been made unsigned

summary of tests that have been performed against these changes:
- nsz's libc-test (diff -u before and after)
- C++ ABI check symbol dump (diff -u before, after, glibc)
- grepped for __NEED, made sure types needed are still in alltypes
- built gcc 3.4.6
This commit is contained in:
Rich Felker 2013-07-22 11:22:36 -04:00
parent 976c0fdcb5
commit 9448b0513e
41 changed files with 335 additions and 907 deletions

View File

@ -73,10 +73,10 @@ include/bits:
@test "$(ARCH)" || { echo "Please set ARCH in config.mak before running make." ; exit 1 ; }
ln -sf ../arch/$(ARCH)/bits $@
include/bits/alltypes.h.sh: include/bits
include/bits/alltypes.h.in: include/bits
include/bits/alltypes.h: include/bits/alltypes.h.sh
sh $< > $@
include/bits/alltypes.h: include/bits/alltypes.h.in include/alltypes.h.in tools/mkalltypes.sed
sed -f tools/mkalltypes.sed include/bits/alltypes.h.in include/alltypes.h.in > $@
src/ldso/dynlink.lo: arch/$(ARCH)/reloc.h

View File

@ -0,0 +1,22 @@
#define _Addr int
#define _Int64 long long
TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;
#ifndef __cplusplus
TYPEDEF unsigned wchar_t;
#endif
TYPEDEF int wint_t;
TYPEDEF float float_t;
TYPEDEF double double_t;
TYPEDEF long time_t;
TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[9]; unsigned __s[9]; } __u; } pthread_attr_t;
TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;

View File

@ -1,127 +0,0 @@
#!/bin/sh
sed -e << EOF \
'/^TYPEDEF/s/TYPEDEF \(.*\) \([^ ]*\);$/#if defined(__NEED_\2) \&\& !defined(__DEFINED_\2)\
typedef \1 \2;\
#define __DEFINED_\2\
#endif\
/
/^STRUCT/s/STRUCT * \([^ ]*\) \(.*\);$/#if defined(__NEED_struct_\1) \&\& !defined(__DEFINED_struct_\1)\
struct \1 \2;\
#define __DEFINED_struct_\1\
#endif\
/
/^UNION/s/UNION * \([^ ]*\) \(.*\);$/#if defined(__NEED_union_\1) \&\& !defined(__DEFINED_union_\1)\
union \1 \2;\
#define __DEFINED_union_\1\
#endif\
/'
TYPEDEF unsigned size_t;
TYPEDEF int ssize_t;
TYPEDEF int ptrdiff_t;
TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;
#ifndef __cplusplus
TYPEDEF unsigned wchar_t;
#endif
TYPEDEF int wint_t;
TYPEDEF const int * wctrans_t;
TYPEDEF unsigned long wctype_t;
TYPEDEF signed char int8_t;
TYPEDEF short int16_t;
TYPEDEF int int32_t;
TYPEDEF long long int64_t;
TYPEDEF unsigned char uint8_t;
TYPEDEF unsigned short uint16_t;
TYPEDEF unsigned int uint32_t;
TYPEDEF unsigned long long uint64_t;
TYPEDEF unsigned short __uint16_t;
TYPEDEF unsigned int __uint32_t;
TYPEDEF unsigned long long __uint64_t;
TYPEDEF int8_t int_fast8_t;
TYPEDEF int int_fast16_t;
TYPEDEF int int_fast32_t;
TYPEDEF int64_t int_fast64_t;
TYPEDEF unsigned char uint_fast8_t;
TYPEDEF unsigned int uint_fast16_t;
TYPEDEF unsigned int uint_fast32_t;
TYPEDEF uint64_t uint_fast64_t;
TYPEDEF long intptr_t;
TYPEDEF unsigned long uintptr_t;
TYPEDEF long long intmax_t;
TYPEDEF unsigned long long uintmax_t;
TYPEDEF float float_t;
TYPEDEF double double_t;
TYPEDEF long time_t;
TYPEDEF int suseconds_t;
TYPEDEF unsigned useconds_t;
STRUCT timeval { time_t tv_sec; int tv_usec; };
STRUCT timespec { time_t tv_sec; long tv_nsec; };
TYPEDEF int pid_t;
TYPEDEF unsigned id_t;
TYPEDEF unsigned uid_t;
TYPEDEF unsigned gid_t;
TYPEDEF int key_t;
TYPEDEF struct __pthread * pthread_t;
TYPEDEF int pthread_once_t;
TYPEDEF int pthread_key_t;
TYPEDEF int pthread_spinlock_t;
TYPEDEF struct { union { int __i[9]; size_t __s[9]; } __u; } pthread_attr_t;
TYPEDEF unsigned pthread_mutexattr_t;
TYPEDEF unsigned pthread_condattr_t;
TYPEDEF unsigned pthread_barrierattr_t;
TYPEDEF struct { unsigned __attr[2]; } pthread_rwlockattr_t;
TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;
TYPEDEF long long off_t;
TYPEDEF unsigned int mode_t;
TYPEDEF unsigned int nlink_t;
TYPEDEF unsigned long long ino_t;
TYPEDEF long long dev_t;
TYPEDEF long blksize_t;
TYPEDEF long long blkcnt_t;
TYPEDEF unsigned long long fsblkcnt_t;
TYPEDEF unsigned long long fsfilcnt_t;
TYPEDEF void * timer_t;
TYPEDEF int clockid_t;
TYPEDEF long clock_t;
TYPEDEF struct { unsigned long __bits[128/sizeof(long)]; } sigset_t;
TYPEDEF struct __siginfo siginfo_t;
TYPEDEF unsigned int socklen_t;
TYPEDEF unsigned short sa_family_t;
TYPEDEF unsigned short in_port_t;
TYPEDEF unsigned int in_addr_t;
STRUCT in_addr { in_addr_t s_addr; };
TYPEDEF struct __FILE_s FILE;
TYPEDEF int nl_item;
TYPEDEF struct __locale * locale_t;
STRUCT iovec { void *iov_base; size_t iov_len; };
EOF

View File

@ -1,17 +1,16 @@
#define INT_FAST8_MIN INT8_MIN
typedef int32_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
#define INT_FAST16_MIN INT32_MIN
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MAX INT32_MAX
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT32_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
#define INTPTR_MIN INT32_MIN
#define INTPTR_MAX INT32_MAX

View File

@ -0,0 +1,36 @@
#define _Addr int
#define _Int64 long long
#if __GNUC__ >= 3
TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;
#else
TYPEDEF struct __va_list * va_list;
TYPEDEF struct __va_list * __isoc_va_list;
#endif
#ifndef __cplusplus
#ifdef __WCHAR_TYPE__
TYPEDEF __WCHAR_TYPE__ wchar_t;
#else
TYPEDEF long wchar_t;
#endif
#endif
TYPEDEF long wint_t;
#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 0
TYPEDEF float float_t;
TYPEDEF double double_t;
#else
TYPEDEF long double float_t;
TYPEDEF long double double_t;
#endif
TYPEDEF long time_t;
TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[9]; unsigned __s[9]; } __u; } pthread_attr_t;
TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;

View File

@ -1,141 +0,0 @@
#!/bin/sh
sed -e << EOF \
'/^TYPEDEF/s/TYPEDEF \(.*\) \([^ ]*\);$/#if defined(__NEED_\2) \&\& !defined(__DEFINED_\2)\
typedef \1 \2;\
#define __DEFINED_\2\
#endif\
/
/^STRUCT/s/STRUCT * \([^ ]*\) \(.*\);$/#if defined(__NEED_struct_\1) \&\& !defined(__DEFINED_struct_\1)\
struct \1 \2;\
#define __DEFINED_struct_\1\
#endif\
/
/^UNION/s/UNION * \([^ ]*\) \(.*\);$/#if defined(__NEED_union_\1) \&\& !defined(__DEFINED_union_\1)\
union \1 \2;\
#define __DEFINED_union_\1\
#endif\
/'
TYPEDEF unsigned size_t;
TYPEDEF int ssize_t;
TYPEDEF int ptrdiff_t;
#if __GNUC__ >= 3
TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;
#else
TYPEDEF struct __va_list * va_list;
TYPEDEF struct __va_list * __isoc_va_list;
#endif
#ifndef __cplusplus
#ifdef __WCHAR_TYPE__
TYPEDEF __WCHAR_TYPE__ wchar_t;
#else
TYPEDEF long wchar_t;
#endif
#endif
TYPEDEF long wint_t;
TYPEDEF const int * wctrans_t;
TYPEDEF unsigned long wctype_t;
TYPEDEF signed char int8_t;
TYPEDEF short int16_t;
TYPEDEF int int32_t;
TYPEDEF long long int64_t;
TYPEDEF unsigned char uint8_t;
TYPEDEF unsigned short uint16_t;
TYPEDEF unsigned int uint32_t;
TYPEDEF unsigned long long uint64_t;
TYPEDEF unsigned short __uint16_t;
TYPEDEF unsigned int __uint32_t;
TYPEDEF unsigned long long __uint64_t;
TYPEDEF int8_t int_fast8_t;
TYPEDEF int int_fast16_t;
TYPEDEF int int_fast32_t;
TYPEDEF int64_t int_fast64_t;
TYPEDEF unsigned char uint_fast8_t;
TYPEDEF unsigned int uint_fast16_t;
TYPEDEF unsigned int uint_fast32_t;
TYPEDEF uint64_t uint_fast64_t;
TYPEDEF long intptr_t;
TYPEDEF unsigned long uintptr_t;
TYPEDEF long long intmax_t;
TYPEDEF unsigned long long uintmax_t;
#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 0
TYPEDEF float float_t;
TYPEDEF double double_t;
#else
TYPEDEF long double float_t;
TYPEDEF long double double_t;
#endif
TYPEDEF long time_t;
TYPEDEF int suseconds_t;
TYPEDEF unsigned useconds_t;
STRUCT timeval { time_t tv_sec; int tv_usec; };
STRUCT timespec { time_t tv_sec; long tv_nsec; };
TYPEDEF int pid_t;
TYPEDEF unsigned id_t;
TYPEDEF unsigned uid_t;
TYPEDEF unsigned gid_t;
TYPEDEF int key_t;
TYPEDEF struct __pthread * pthread_t;
TYPEDEF int pthread_once_t;
TYPEDEF int pthread_key_t;
TYPEDEF int pthread_spinlock_t;
TYPEDEF struct { union { int __i[9]; size_t __s[9]; } __u; } pthread_attr_t;
TYPEDEF unsigned pthread_mutexattr_t;
TYPEDEF unsigned pthread_condattr_t;
TYPEDEF unsigned pthread_barrierattr_t;
TYPEDEF struct { unsigned __attr[2]; } pthread_rwlockattr_t;
TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;
TYPEDEF long long off_t;
TYPEDEF unsigned int mode_t;
TYPEDEF unsigned int nlink_t;
TYPEDEF unsigned long long ino_t;
TYPEDEF long long dev_t;
TYPEDEF long blksize_t;
TYPEDEF long long blkcnt_t;
TYPEDEF unsigned long long fsblkcnt_t;
TYPEDEF unsigned long long fsfilcnt_t;
TYPEDEF void * timer_t;
TYPEDEF int clockid_t;
TYPEDEF long clock_t;
TYPEDEF struct { unsigned long __bits[128/sizeof(long)]; } sigset_t;
TYPEDEF struct __siginfo siginfo_t;
TYPEDEF unsigned int socklen_t;
TYPEDEF unsigned short sa_family_t;
TYPEDEF unsigned short in_port_t;
TYPEDEF unsigned int in_addr_t;
STRUCT in_addr { in_addr_t s_addr; };
TYPEDEF struct __FILE_s FILE;
TYPEDEF int nl_item;
TYPEDEF struct __locale * locale_t;
STRUCT iovec { void *iov_base; size_t iov_len; };
EOF

View File

@ -1,23 +1,20 @@
#define INT_FAST8_MIN INT8_MIN
typedef int32_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
#define INT_FAST16_MIN INT32_MIN
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MAX INT32_MAX
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT32_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
#define INTPTR_MIN INT32_MIN
#define INTPTR_MAX INT32_MAX
#define UINTPTR_MAX UINT32_MAX
#define PTRDIFF_MIN INT32_MIN
#define PTRDIFF_MAX INT32_MAX
#define SIG_ATOMIC_MIN INT32_MIN
#define SIG_ATOMIC_MAX INT32_MAX
#define SIZE_MAX UINT32_MAX

View File

@ -0,0 +1,22 @@
#define _Addr int
#define _Int64 long long
TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;
#ifndef __cplusplus
TYPEDEF int wchar_t;
#endif
TYPEDEF int wint_t;
TYPEDEF float float_t;
TYPEDEF double double_t;
TYPEDEF long time_t;
TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[9]; unsigned __s[9]; } __u; } pthread_attr_t;
TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;

View File

@ -1,127 +0,0 @@
#!/bin/sh
sed -e << EOF \
'/^TYPEDEF/s/TYPEDEF \(.*\) \([^ ]*\);$/#if defined(__NEED_\2) \&\& !defined(__DEFINED_\2)\
typedef \1 \2;\
#define __DEFINED_\2\
#endif\
/
/^STRUCT/s/STRUCT * \([^ ]*\) \(.*\);$/#if defined(__NEED_struct_\1) \&\& !defined(__DEFINED_struct_\1)\
struct \1 \2;\
#define __DEFINED_struct_\1\
#endif\
/
/^UNION/s/UNION * \([^ ]*\) \(.*\);$/#if defined(__NEED_union_\1) \&\& !defined(__DEFINED_union_\1)\
union \1 \2;\
#define __DEFINED_union_\1\
#endif\
/'
TYPEDEF unsigned size_t;
TYPEDEF int ssize_t;
TYPEDEF int ptrdiff_t;
TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;
#ifndef __cplusplus
TYPEDEF int wchar_t;
#endif
TYPEDEF int wint_t;
TYPEDEF const int * wctrans_t;
TYPEDEF unsigned long wctype_t;
TYPEDEF signed char int8_t;
TYPEDEF short int16_t;
TYPEDEF int int32_t;
TYPEDEF long long int64_t;
TYPEDEF unsigned char uint8_t;
TYPEDEF unsigned short uint16_t;
TYPEDEF unsigned int uint32_t;
TYPEDEF unsigned long long uint64_t;
TYPEDEF unsigned short __uint16_t;
TYPEDEF unsigned int __uint32_t;
TYPEDEF unsigned long long __uint64_t;
TYPEDEF int8_t int_fast8_t;
TYPEDEF int int_fast16_t;
TYPEDEF int int_fast32_t;
TYPEDEF int64_t int_fast64_t;
TYPEDEF unsigned char uint_fast8_t;
TYPEDEF unsigned int uint_fast16_t;
TYPEDEF unsigned int uint_fast32_t;
TYPEDEF uint64_t uint_fast64_t;
TYPEDEF long intptr_t;
TYPEDEF unsigned long uintptr_t;
TYPEDEF long long intmax_t;
TYPEDEF unsigned long long uintmax_t;
TYPEDEF float float_t;
TYPEDEF double double_t;
TYPEDEF long time_t;
TYPEDEF int suseconds_t;
TYPEDEF unsigned useconds_t;
STRUCT timeval { time_t tv_sec; int tv_usec; };
STRUCT timespec { time_t tv_sec; long tv_nsec; };
TYPEDEF int pid_t;
TYPEDEF unsigned id_t;
TYPEDEF unsigned uid_t;
TYPEDEF unsigned gid_t;
TYPEDEF int key_t;
TYPEDEF struct __pthread * pthread_t;
TYPEDEF int pthread_once_t;
TYPEDEF int pthread_key_t;
TYPEDEF int pthread_spinlock_t;
TYPEDEF struct { union { int __i[9]; size_t __s[9]; } __u; } pthread_attr_t;
TYPEDEF unsigned pthread_mutexattr_t;
TYPEDEF unsigned pthread_condattr_t;
TYPEDEF unsigned pthread_barrierattr_t;
TYPEDEF struct { unsigned __attr[2]; } pthread_rwlockattr_t;
TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;
TYPEDEF long long off_t;
TYPEDEF unsigned int mode_t;
TYPEDEF unsigned int nlink_t;
TYPEDEF unsigned long long ino_t;
TYPEDEF long long dev_t;
TYPEDEF long blksize_t;
TYPEDEF long long blkcnt_t;
TYPEDEF unsigned long long fsblkcnt_t;
TYPEDEF unsigned long long fsfilcnt_t;
TYPEDEF void * timer_t;
TYPEDEF int clockid_t;
TYPEDEF long clock_t;
TYPEDEF struct { unsigned long __bits[128/sizeof(long)]; } sigset_t;
TYPEDEF struct __siginfo siginfo_t;
TYPEDEF unsigned int socklen_t;
TYPEDEF unsigned short sa_family_t;
TYPEDEF unsigned short in_port_t;
TYPEDEF unsigned int in_addr_t;
STRUCT in_addr { in_addr_t s_addr; };
TYPEDEF struct __FILE_s FILE;
TYPEDEF int nl_item;
TYPEDEF struct __locale * locale_t;
STRUCT iovec { void *iov_base; size_t iov_len; };
EOF

View File

@ -1,17 +1,16 @@
#define INT_FAST8_MIN INT8_MIN
typedef int32_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
#define INT_FAST16_MIN INT32_MIN
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MAX INT32_MAX
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT32_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
#define INTPTR_MIN INT32_MIN
#define INTPTR_MAX INT32_MAX

View File

@ -0,0 +1,22 @@
#define _Addr int
#define _Int64 long long
TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;
#ifndef __cplusplus
TYPEDEF int wchar_t;
#endif
TYPEDEF int wint_t;
TYPEDEF float float_t;
TYPEDEF double double_t;
TYPEDEF long time_t;
TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[9]; unsigned __s[9]; } __u; } pthread_attr_t;
TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;

View File

@ -1,127 +0,0 @@
#!/bin/sh
sed -e << EOF \
'/^TYPEDEF/s/TYPEDEF \(.*\) \([^ ]*\);$/#if defined(__NEED_\2) \&\& !defined(__DEFINED_\2)\
typedef \1 \2;\
#define __DEFINED_\2\
#endif\
/
/^STRUCT/s/STRUCT * \([^ ]*\) \(.*\);$/#if defined(__NEED_struct_\1) \&\& !defined(__DEFINED_struct_\1)\
struct \1 \2;\
#define __DEFINED_struct_\1\
#endif\
/
/^UNION/s/UNION * \([^ ]*\) \(.*\);$/#if defined(__NEED_union_\1) \&\& !defined(__DEFINED_union_\1)\
union \1 \2;\
#define __DEFINED_union_\1\
#endif\
/'
TYPEDEF unsigned size_t;
TYPEDEF int ssize_t;
TYPEDEF int ptrdiff_t;
TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;
#ifndef __cplusplus
TYPEDEF int wchar_t;
#endif
TYPEDEF int wint_t;
TYPEDEF const int * wctrans_t;
TYPEDEF unsigned long wctype_t;
TYPEDEF signed char int8_t;
TYPEDEF short int16_t;
TYPEDEF int int32_t;
TYPEDEF long long int64_t;
TYPEDEF unsigned char uint8_t;
TYPEDEF unsigned short uint16_t;
TYPEDEF unsigned int uint32_t;
TYPEDEF unsigned long long uint64_t;
TYPEDEF unsigned short __uint16_t;
TYPEDEF unsigned int __uint32_t;
TYPEDEF unsigned long long __uint64_t;
TYPEDEF int8_t int_fast8_t;
TYPEDEF int int_fast16_t;
TYPEDEF int int_fast32_t;
TYPEDEF int64_t int_fast64_t;
TYPEDEF unsigned char uint_fast8_t;
TYPEDEF unsigned int uint_fast16_t;
TYPEDEF unsigned int uint_fast32_t;
TYPEDEF uint64_t uint_fast64_t;
TYPEDEF long intptr_t;
TYPEDEF unsigned long uintptr_t;
TYPEDEF long long intmax_t;
TYPEDEF unsigned long long uintmax_t;
TYPEDEF float float_t;
TYPEDEF double double_t;
TYPEDEF long time_t;
TYPEDEF int suseconds_t;
TYPEDEF unsigned useconds_t;
STRUCT timeval { time_t tv_sec; int tv_usec; };
STRUCT timespec { time_t tv_sec; long tv_nsec; };
TYPEDEF int pid_t;
TYPEDEF unsigned id_t;
TYPEDEF unsigned uid_t;
TYPEDEF unsigned gid_t;
TYPEDEF int key_t;
TYPEDEF struct __pthread * pthread_t;
TYPEDEF int pthread_once_t;
TYPEDEF int pthread_key_t;
TYPEDEF int pthread_spinlock_t;
TYPEDEF struct { union { int __i[9]; size_t __s[9]; } __u; } pthread_attr_t;
TYPEDEF unsigned pthread_mutexattr_t;
TYPEDEF unsigned pthread_condattr_t;
TYPEDEF unsigned pthread_barrierattr_t;
TYPEDEF struct { unsigned __attr[2]; } pthread_rwlockattr_t;
TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;
TYPEDEF long long off_t;
TYPEDEF unsigned int mode_t;
TYPEDEF unsigned int nlink_t;
TYPEDEF unsigned long long ino_t;
TYPEDEF long long dev_t;
TYPEDEF long blksize_t;
TYPEDEF long long blkcnt_t;
TYPEDEF unsigned long long fsblkcnt_t;
TYPEDEF unsigned long long fsfilcnt_t;
TYPEDEF void * timer_t;
TYPEDEF int clockid_t;
TYPEDEF long clock_t;
TYPEDEF struct { unsigned long __bits[128/sizeof(long)]; } sigset_t;
TYPEDEF struct __siginfo siginfo_t;
TYPEDEF unsigned int socklen_t;
TYPEDEF unsigned short sa_family_t;
TYPEDEF unsigned short in_port_t;
TYPEDEF unsigned int in_addr_t;
STRUCT in_addr { in_addr_t s_addr; };
TYPEDEF struct __FILE_s FILE;
TYPEDEF int nl_item;
TYPEDEF struct __locale * locale_t;
STRUCT iovec { void *iov_base; size_t iov_len; };
EOF

View File

@ -1,17 +1,16 @@
#define INT_FAST8_MIN INT8_MIN
typedef int32_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
#define INT_FAST16_MIN INT32_MIN
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MAX INT32_MAX
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT32_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
#define INTPTR_MIN INT32_MIN
#define INTPTR_MAX INT32_MAX

View File

@ -0,0 +1,22 @@
#define _Addr int
#define _Int64 long long
TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;
#ifndef __cplusplus
TYPEDEF long wchar_t;
#endif
TYPEDEF int wint_t;
TYPEDEF float float_t;
TYPEDEF double double_t;
TYPEDEF long time_t;
TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[9]; unsigned __s[9]; } __u; } pthread_attr_t;
TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;

View File

@ -1,127 +0,0 @@
#!/bin/sh
sed -e << EOF \
'/^TYPEDEF/s/TYPEDEF \(.*\) \([^ ]*\);$/#if defined(__NEED_\2) \&\& !defined(__DEFINED_\2)\
typedef \1 \2;\
#define __DEFINED_\2\
#endif\
/
/^STRUCT/s/STRUCT * \([^ ]*\) \(.*\);$/#if defined(__NEED_struct_\1) \&\& !defined(__DEFINED_struct_\1)\
struct \1 \2;\
#define __DEFINED_struct_\1\
#endif\
/
/^UNION/s/UNION * \([^ ]*\) \(.*\);$/#if defined(__NEED_union_\1) \&\& !defined(__DEFINED_union_\1)\
union \1 \2;\
#define __DEFINED_union_\1\
#endif\
/'
TYPEDEF unsigned size_t;
TYPEDEF int ssize_t;
TYPEDEF int ptrdiff_t;
TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;
#ifndef __cplusplus
TYPEDEF long wchar_t;
#endif
TYPEDEF int wint_t;
TYPEDEF const int * wctrans_t;
TYPEDEF unsigned long wctype_t;
TYPEDEF signed char int8_t;
TYPEDEF short int16_t;
TYPEDEF int int32_t;
TYPEDEF long long int64_t;
TYPEDEF unsigned char uint8_t;
TYPEDEF unsigned short uint16_t;
TYPEDEF unsigned int uint32_t;
TYPEDEF unsigned long long uint64_t;
TYPEDEF unsigned short __uint16_t;
TYPEDEF unsigned int __uint32_t;
TYPEDEF unsigned long long __uint64_t;
TYPEDEF int8_t int_fast8_t;
TYPEDEF int int_fast16_t;
TYPEDEF int int_fast32_t;
TYPEDEF int64_t int_fast64_t;
TYPEDEF unsigned char uint_fast8_t;
TYPEDEF unsigned int uint_fast16_t;
TYPEDEF unsigned int uint_fast32_t;
TYPEDEF uint64_t uint_fast64_t;
TYPEDEF int intptr_t;
TYPEDEF unsigned uintptr_t;
TYPEDEF long long intmax_t;
TYPEDEF unsigned long long uintmax_t;
TYPEDEF float float_t;
TYPEDEF double double_t;
TYPEDEF long time_t;
TYPEDEF int suseconds_t;
TYPEDEF unsigned useconds_t;
STRUCT timeval { time_t tv_sec; int tv_usec; };
STRUCT timespec { time_t tv_sec; long tv_nsec; };
TYPEDEF int pid_t;
TYPEDEF unsigned id_t;
TYPEDEF unsigned uid_t;
TYPEDEF unsigned gid_t;
TYPEDEF int key_t;
TYPEDEF struct __pthread * pthread_t;
TYPEDEF int pthread_once_t;
TYPEDEF int pthread_key_t;
TYPEDEF int pthread_spinlock_t;
TYPEDEF struct { union { int __i[9]; size_t __s[9]; } __u; } pthread_attr_t;
TYPEDEF unsigned pthread_mutexattr_t;
TYPEDEF unsigned pthread_condattr_t;
TYPEDEF unsigned pthread_barrierattr_t;
TYPEDEF struct { unsigned __attr[2]; } pthread_rwlockattr_t;
TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;
TYPEDEF long long off_t;
TYPEDEF unsigned int mode_t;
TYPEDEF unsigned int nlink_t;
TYPEDEF unsigned long long ino_t;
TYPEDEF unsigned long long dev_t;
TYPEDEF unsigned long blksize_t;
TYPEDEF unsigned long long blkcnt_t;
TYPEDEF unsigned long long fsblkcnt_t;
TYPEDEF unsigned long long fsfilcnt_t;
TYPEDEF void * timer_t;
TYPEDEF int clockid_t;
TYPEDEF long clock_t;
TYPEDEF struct { unsigned long __bits[128/sizeof(long)]; } sigset_t;
TYPEDEF struct __siginfo siginfo_t;
TYPEDEF unsigned int socklen_t;
TYPEDEF unsigned short sa_family_t;
TYPEDEF unsigned short in_port_t;
TYPEDEF unsigned int in_addr_t;
STRUCT in_addr { in_addr_t s_addr; };
TYPEDEF struct __FILE_s FILE;
TYPEDEF int nl_item;
TYPEDEF struct __locale * locale_t;
STRUCT iovec { void *iov_base; size_t iov_len; };
EOF

View File

@ -1,17 +1,16 @@
#define INT_FAST8_MIN INT8_MIN
typedef int32_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
#define INT_FAST16_MIN INT32_MIN
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MAX INT32_MAX
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT32_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
#define INTPTR_MIN INT32_MIN
#define INTPTR_MAX INT32_MAX

View File

@ -0,0 +1,27 @@
#define _Addr long
#define _Int64 long
TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;
#ifndef __cplusplus
TYPEDEF int wchar_t;
#endif
TYPEDEF int wint_t;
#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 2
TYPEDEF long double float_t;
TYPEDEF long double double_t;
#else
TYPEDEF float float_t;
TYPEDEF double double_t;
#endif
TYPEDEF long time_t;
TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[14]; unsigned long __s[7]; } __u; } pthread_attr_t;
TYPEDEF struct { union { int __i[10]; void *__p[5]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[6]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[14]; void *__p[7]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[8]; void *__p[4]; } __u; } pthread_barrier_t;

View File

@ -1,127 +0,0 @@
#!/bin/sh
sed -e << EOF \
'/^TYPEDEF/s/TYPEDEF \(.*\) \([^ ]*\);$/#if defined(__NEED_\2) \&\& !defined(__DEFINED_\2)\
typedef \1 \2;\
#define __DEFINED_\2\
#endif\
/
/^STRUCT/s/STRUCT * \([^ ]*\) \(.*\);$/#if defined(__NEED_struct_\1) \&\& !defined(__DEFINED_struct_\1)\
struct \1 \2;\
#define __DEFINED_struct_\1\
#endif\
/
/^UNION/s/UNION * \([^ ]*\) \(.*\);$/#if defined(__NEED_union_\1) \&\& !defined(__DEFINED_union_\1)\
union \1 \2;\
#define __DEFINED_union_\1\
#endif\
/'
TYPEDEF unsigned long size_t;
TYPEDEF long ssize_t;
TYPEDEF long ptrdiff_t;
TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;
#ifndef __cplusplus
TYPEDEF int wchar_t;
#endif
TYPEDEF int wint_t;
TYPEDEF const int * wctrans_t;
TYPEDEF unsigned long wctype_t;
TYPEDEF signed char int8_t;
TYPEDEF short int16_t;
TYPEDEF int int32_t;
TYPEDEF long int64_t;
TYPEDEF unsigned char uint8_t;
TYPEDEF unsigned short uint16_t;
TYPEDEF unsigned int uint32_t;
TYPEDEF unsigned long uint64_t;
TYPEDEF unsigned short __uint16_t;
TYPEDEF unsigned int __uint32_t;
TYPEDEF unsigned long __uint64_t;
TYPEDEF int8_t int_fast8_t;
TYPEDEF int int_fast16_t;
TYPEDEF int int_fast32_t;
TYPEDEF int64_t int_fast64_t;
TYPEDEF unsigned char uint_fast8_t;
TYPEDEF unsigned int uint_fast16_t;
TYPEDEF unsigned int uint_fast32_t;
TYPEDEF uint64_t uint_fast64_t;
TYPEDEF long intptr_t;
TYPEDEF unsigned long uintptr_t;
TYPEDEF long intmax_t;
TYPEDEF unsigned long uintmax_t;
TYPEDEF float float_t;
TYPEDEF double double_t;
TYPEDEF long time_t;
TYPEDEF long suseconds_t;
TYPEDEF unsigned useconds_t;
STRUCT timeval { time_t tv_sec; long tv_usec; };
STRUCT timespec { time_t tv_sec; long tv_nsec; };
TYPEDEF int pid_t;
TYPEDEF unsigned id_t;
TYPEDEF unsigned uid_t;
TYPEDEF unsigned gid_t;
TYPEDEF int key_t;
TYPEDEF struct __pthread * pthread_t;
TYPEDEF int pthread_once_t;
TYPEDEF int pthread_key_t;
TYPEDEF int pthread_spinlock_t;
TYPEDEF struct { union { int __i[14]; size_t __s[7]; } __u; } pthread_attr_t;
TYPEDEF unsigned pthread_mutexattr_t;
TYPEDEF unsigned pthread_condattr_t;
TYPEDEF unsigned pthread_barrierattr_t;
TYPEDEF struct { unsigned __attr[2]; } pthread_rwlockattr_t;
TYPEDEF struct { union { int __i[10]; void *__p[5]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[6]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[14]; void *__p[7]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[8]; void *__p[4]; } __u; } pthread_barrier_t;
TYPEDEF long off_t;
TYPEDEF unsigned int mode_t;
TYPEDEF unsigned long nlink_t;
TYPEDEF unsigned long ino_t;
TYPEDEF unsigned long dev_t;
TYPEDEF long blksize_t;
TYPEDEF long blkcnt_t;
TYPEDEF unsigned long fsblkcnt_t;
TYPEDEF unsigned long fsfilcnt_t;
TYPEDEF void * timer_t;
TYPEDEF int clockid_t;
TYPEDEF long clock_t;
TYPEDEF struct { unsigned long __bits[128/sizeof(long)]; } sigset_t;
TYPEDEF struct __siginfo siginfo_t;
TYPEDEF unsigned int socklen_t;
TYPEDEF unsigned short sa_family_t;
TYPEDEF unsigned short in_port_t;
TYPEDEF unsigned int in_addr_t;
STRUCT in_addr { in_addr_t s_addr; };
TYPEDEF struct __FILE_s FILE;
TYPEDEF int nl_item;
TYPEDEF struct __locale * locale_t;
STRUCT iovec { void *iov_base; size_t iov_len; };
EOF

View File

@ -1,17 +1,16 @@
#define INT_FAST8_MIN INT8_MIN
typedef int32_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
#define INT_FAST16_MIN INT32_MIN
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MAX INT32_MAX
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT32_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
#define INTPTR_MIN INT64_MIN
#define INTPTR_MAX INT64_MAX

65
include/alltypes.h.in Normal file
View File

@ -0,0 +1,65 @@
TYPEDEF unsigned _Addr size_t;
TYPEDEF unsigned _Addr uintptr_t;
TYPEDEF _Addr ptrdiff_t;
TYPEDEF _Addr ssize_t;
TYPEDEF _Addr intptr_t;
TYPEDEF signed char int8_t;
TYPEDEF short int16_t;
TYPEDEF int int32_t;
TYPEDEF _Int64 int64_t;
TYPEDEF _Int64 intmax_t;
TYPEDEF unsigned char uint8_t;
TYPEDEF unsigned short uint16_t;
TYPEDEF unsigned int uint32_t;
TYPEDEF unsigned _Int64 uint64_t;
TYPEDEF unsigned _Int64 uintmax_t;
TYPEDEF unsigned mode_t;
TYPEDEF unsigned nlink_t;
TYPEDEF _Int64 off_t;
TYPEDEF unsigned _Int64 ino_t;
TYPEDEF unsigned _Int64 dev_t;
TYPEDEF long blksize_t;
TYPEDEF _Int64 blkcnt_t;
TYPEDEF unsigned _Int64 fsblkcnt_t;
TYPEDEF unsigned _Int64 fsfilcnt_t;
TYPEDEF unsigned long wctype_t;
TYPEDEF void * timer_t;
TYPEDEF int clockid_t;
TYPEDEF long clock_t;
STRUCT timeval { time_t tv_sec; suseconds_t tv_usec; };
STRUCT timespec { time_t tv_sec; long tv_nsec; };
TYPEDEF int pid_t;
TYPEDEF unsigned id_t;
TYPEDEF unsigned uid_t;
TYPEDEF unsigned gid_t;
TYPEDEF int key_t;
TYPEDEF unsigned useconds_t;
#ifdef __cplusplus
TYPEDEF unsigned long pthread_t;
#else
TYPEDEF struct __pthread * pthread_t;
#endif
TYPEDEF int pthread_once_t;
TYPEDEF int pthread_key_t;
TYPEDEF int pthread_spinlock_t;
TYPEDEF unsigned pthread_mutexattr_t;
TYPEDEF unsigned pthread_condattr_t;
TYPEDEF unsigned pthread_barrierattr_t;
TYPEDEF struct { unsigned __attr[2]; } pthread_rwlockattr_t;
TYPEDEF struct _IO_FILE FILE;
TYPEDEF struct __locale_struct * locale_t;
TYPEDEF struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t;
STRUCT iovec { void *iov_base; size_t iov_len; };
TYPEDEF unsigned socklen_t;
TYPEDEF unsigned short sa_family_t;

View File

@ -7,16 +7,6 @@ extern "C" {
#include <features.h>
#include <netinet/in.h>
#include <inttypes.h>
#define __NEED_socklen_t
#define __NEED_in_addr_t
#define __NEED_in_port_t
#define __NEED_uint16_t
#define __NEED_uint32_t
#define __NEED_struct_in_addr
#include <bits/alltypes.h>
uint32_t htonl(uint32_t);
uint16_t htons(uint16_t);

View File

@ -15,7 +15,7 @@ extern "C" {
#include <bits/alltypes.h>
typedef struct __DIR_s DIR;
typedef struct __dirstream DIR;
struct dirent
{

View File

@ -5,7 +5,8 @@
extern "C" {
#endif
#define __NEED_nl_item
#include <nl_types.h>
#define __NEED_locale_t
#include <bits/alltypes.h>

View File

@ -9,9 +9,6 @@ extern "C" {
#define __NEED_float_t
#define __NEED_double_t
#define __NEED___uint16_t
#define __NEED___uint32_t
#define __NEED___uint64_t
#include <bits/alltypes.h>
#if 100*__GNUC__+__GNUC_MINOR__ >= 303
@ -43,14 +40,14 @@ int __fpclassify(double);
int __fpclassifyf(float);
int __fpclassifyl(long double);
static __inline __uint32_t __FLOAT_BITS(float __f)
static __inline unsigned __FLOAT_BITS(float __f)
{
union {float __f; __uint32_t __i;} __u = {__f};
union {float __f; unsigned __i;} __u = {__f};
return __u.__i;
}
static __inline __uint64_t __DOUBLE_BITS(double __f)
static __inline unsigned long long __DOUBLE_BITS(double __f)
{
union {double __f; __uint64_t __i;} __u = {__f};
union {double __f; unsigned long long __i;} __u = {__f};
return __u.__i;
}
@ -61,22 +58,22 @@ static __inline __uint64_t __DOUBLE_BITS(double __f)
#define isinf(x) ( \
sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000 : \
sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & (__uint64_t)-1>>1) == (__uint64_t)0x7ff<<52 : \
sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) == 0x7ffULL<<52 : \
__fpclassifyl(x) == FP_INFINITE)
#define isnan(x) ( \
sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 : \
sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : \
sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52 : \
__fpclassifyl(x) == FP_NAN)
#define isnormal(x) ( \
sizeof(x) == sizeof(float) ? ((__FLOAT_BITS(x)+0x00800000) & 0x7fffffff) >= 0x01000000 : \
sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x)+((__uint64_t)1<<52)) & (__uint64_t)-1>>1) >= (__uint64_t)1<<53 : \
sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x)+(1ULL<<52)) & -1ULL>>1) >= 1ULL<<53 : \
__fpclassifyl(x) == FP_NORMAL)
#define isfinite(x) ( \
sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000 : \
sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & (__uint64_t)-1>>1) < (__uint64_t)0x7ff<<52 : \
sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) < 0x7ffULL<<52 : \
__fpclassifyl(x) > FP_INFINITE)
int __signbit(double);

View File

@ -6,15 +6,12 @@ extern "C" {
#endif
#include <features.h>
#include <netinet/in.h>
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define __NEED_size_t
#endif
#define __NEED_socklen_t
#define __NEED_uint32_t
#include <bits/alltypes.h>
#endif
struct addrinfo
{

View File

@ -6,16 +6,12 @@ extern "C" {
#endif
#include <features.h>
#include <inttypes.h>
#include <sys/socket.h>
#define __NEED_in_addr_t
#define __NEED_in_port_t
#define __NEED_sa_family_t
#define __NEED_struct_in_addr
#define __NEED_uint8_t
#define __NEED_uint16_t
#define __NEED_uint32_t
#include <bits/alltypes.h>
typedef uint16_t in_port_t;
typedef uint32_t in_addr_t;
struct in_addr { in_addr_t s_addr; };
struct sockaddr_in
{

View File

@ -8,10 +8,8 @@ extern "C" {
#define NL_SETD 1
#define NL_CAT_LOCALE 1
#define __NEED_nl_item
#include <bits/alltypes.h>
typedef long nl_catd;
typedef int nl_item;
typedef void *nl_catd;
nl_catd catopen (const char *, int);
char *catgets (nl_catd, int, int, const char *);

View File

@ -12,7 +12,6 @@ extern "C" {
|| defined(_BSD_SOURCE)
#ifdef _GNU_SOURCE
#define __siginfo siginfo
#define __ucontext ucontext
#endif
@ -25,7 +24,6 @@ extern "C" {
#define __NEED_time_t
#define __NEED_clock_t
#define __NEED_sigset_t
#define __NEED_siginfo_t
#include <bits/alltypes.h>
@ -77,19 +75,7 @@ extern "C" {
#define CLD_STOPPED 5
#define CLD_CONTINUED 6
struct sigaction {
union {
void (*sa_handler)(int);
void (*sa_sigaction)(int, siginfo_t *, void *);
} __sa_handler;
sigset_t sa_mask;
int sa_flags;
void (*sa_restorer)(void);
};
#define sa_handler __sa_handler.sa_handler
#define sa_sigaction __sa_handler.sa_sigaction
typedef struct {
typedef struct sigaltstack {
void *ss_sp;
int ss_flags;
size_t ss_size;
@ -100,7 +86,7 @@ union sigval {
void *sival_ptr;
};
struct __siginfo {
typedef struct {
int si_signo, si_errno, si_code;
union {
char __pad[128 - 2*sizeof(int) - sizeof(long)];
@ -126,7 +112,7 @@ struct __siginfo {
int si_fd;
} __sigpoll;
} __si_fields;
};
} siginfo_t;
#define si_pid __si_fields.__sigchld.si_pid
#define si_uid __si_fields.__sigchld.si_uid
#define si_status __si_fields.__sigchld.si_status
@ -141,6 +127,18 @@ struct __siginfo {
#define si_ptr __si_fields.__rt.si_sigval.sival_ptr
#define si_int __si_fields.__rt.si_sigval.sival_int
struct sigaction {
union {
void (*sa_handler)(int);
void (*sa_sigaction)(int, siginfo_t *, void *);
} __sa_handler;
sigset_t sa_mask;
int sa_flags;
void (*sa_restorer)(void);
};
#define sa_handler __sa_handler.sa_handler
#define sa_sigaction __sa_handler.sa_sigaction
struct sigevent {
union sigval sigev_value;
int sigev_signo;

View File

@ -11,16 +11,6 @@
#define __NEED_uint32_t
#define __NEED_uint64_t
#define __NEED_int_fast8_t
#define __NEED_int_fast16_t
#define __NEED_int_fast32_t
#define __NEED_int_fast64_t
#define __NEED_uint_fast8_t
#define __NEED_uint_fast16_t
#define __NEED_uint_fast32_t
#define __NEED_uint_fast64_t
#define __NEED_intptr_t
#define __NEED_uintptr_t
@ -29,11 +19,17 @@
#include <bits/alltypes.h>
typedef int8_t int_fast8_t;
typedef int64_t int_fast64_t;
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;
typedef uint8_t uint_fast8_t;
typedef uint64_t uint_fast64_t;
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
@ -54,16 +50,25 @@ typedef uint64_t uint_least64_t;
#define UINT32_MAX (0xffffffff)
#define UINT64_MAX (0xffffffffffffffff)
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST64_MIN INT64_MIN
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST64_MIN INT64_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST64_MAX INT64_MAX
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST64_MAX UINT64_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
@ -84,6 +89,9 @@ typedef uint64_t uint_least64_t;
#define WCHAR_MIN (-1-0x7fffffff+L'\0')
#endif
#define SIG_ATOMIC_MIN INT32_MIN
#define SIG_ATOMIC_MAX INT32_MAX
#include <bits/stdint.h>
#define INT8_C(c) c

View File

@ -43,7 +43,7 @@ extern "C" {
#define TMP_MAX 10000
#define L_tmpnam 20
typedef union {
typedef union _G_fpos64_t {
char __opaque[16];
double __align;
} fpos_t;

View File

@ -6,10 +6,9 @@ extern "C" {
#endif
#include <features.h>
#include <sys/time.h>
#define __NEED_id_t
#define __NEED_time_t
#define __NEED_struct_timeval
#ifdef _GNU_SOURCE
#define __NEED_pid_t

View File

@ -9,7 +9,7 @@ extern "C" {
#include <sys/statvfs.h>
typedef struct {
typedef struct __fsid_t {
int __val[2];
} fsid_t;

View File

@ -25,10 +25,6 @@ extern "C" {
#define __NEED_int32_t
#define __NEED_int64_t
#define __NEED___uint16_t
#define __NEED___uint32_t
#define __NEED___uint64_t
#define __NEED_blkcnt_t
#define __NEED_fsblkcnt_t
#define __NEED_fsfilcnt_t
@ -57,9 +53,9 @@ extern "C" {
#include <bits/alltypes.h>
typedef unsigned char u_int8_t;
typedef __uint16_t u_int16_t;
typedef __uint32_t u_int32_t;
typedef __uint64_t u_int64_t;
typedef unsigned short u_int16_t;
typedef unsigned u_int32_t;
typedef unsigned long long u_int64_t;
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
typedef char *caddr_t;

View File

@ -10,10 +10,13 @@ extern "C" {
#define __NEED_pid_t
#define __NEED_id_t
#define __NEED_siginfo_t
#include <bits/alltypes.h>
typedef int idtype_t;
typedef enum {
P_ALL = 0,
P_PID = 1,
P_PGID = 2
} idtype_t;
pid_t wait (int *);
int waitid (idtype_t, id_t, siginfo_t *, int);
@ -37,10 +40,6 @@ pid_t wait4 (pid_t, int *, int, struct rusage *);
#define __WALL 0x40000000
#define __WCLONE 0x80000000
#define P_ALL 0
#define P_PID 1
#define P_PGID 2
#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
#define WTERMSIG(s) ((s) & 0x7f)
#define WSTOPSIG(s) WEXITSTATUS(s)

View File

@ -7,6 +7,7 @@ extern "C" {
#define __NEED_pid_t
#define __NEED_time_t
#define __NEED_suseconds_t
#define __NEED_struct_timeval
#include <bits/alltypes.h>

View File

@ -38,7 +38,7 @@ extern "C" {
#undef WEOF
#define WEOF (-1)
typedef struct
typedef struct __mbstate_t
{
unsigned __opaque1, __opaque2;
} mbstate_t;

View File

@ -8,7 +8,6 @@ extern "C" {
#include <features.h>
#define __NEED_wint_t
#define __NEED_wctrans_t
#define __NEED_wctype_t
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
@ -18,6 +17,8 @@ extern "C" {
#include <bits/alltypes.h>
typedef const int * wctrans_t;
#undef WEOF
#define WEOF (-1)

View File

@ -1,4 +1,4 @@
struct __DIR_s
struct __dirstream
{
int fd;
off_t tell;

View File

@ -1,5 +1,5 @@
#include <locale.h>
struct __locale {
struct __locale_struct {
int dummy;
};

View File

@ -18,7 +18,7 @@
#define F_ERR 32
#define F_SVB 64
struct __FILE_s {
struct _IO_FILE {
unsigned flags;
unsigned char *rpos, *rend;
int (*close)(FILE *);

15
tools/mkalltypes.sed Normal file
View File

@ -0,0 +1,15 @@
/^TYPEDEF/s/TYPEDEF \(.*\) \([^ ]*\);$/#if defined(__NEED_\2) \&\& !defined(__DEFINED_\2)\
typedef \1 \2;\
#define __DEFINED_\2\
#endif\
/
/^STRUCT/s/STRUCT * \([^ ]*\) \(.*\);$/#if defined(__NEED_struct_\1) \&\& !defined(__DEFINED_struct_\1)\
struct \1 \2;\
#define __DEFINED_struct_\1\
#endif\
/
/^UNION/s/UNION * \([^ ]*\) \(.*\);$/#if defined(__NEED_union_\1) \&\& !defined(__DEFINED_union_\1)\
union \1 \2;\
#define __DEFINED_union_\1\
#endif\
/