about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--arch/arm/bits/alltypes.h.in22
-rwxr-xr-xarch/arm/bits/alltypes.h.sh127
-rw-r--r--arch/arm/bits/stdint.h11
-rw-r--r--arch/i386/bits/alltypes.h.in36
-rwxr-xr-xarch/i386/bits/alltypes.h.sh141
-rw-r--r--arch/i386/bits/stdint.h13
-rw-r--r--arch/microblaze/bits/alltypes.h.in22
-rwxr-xr-xarch/microblaze/bits/alltypes.h.sh127
-rw-r--r--arch/microblaze/bits/stdint.h11
-rw-r--r--arch/mips/bits/alltypes.h.in22
-rwxr-xr-xarch/mips/bits/alltypes.h.sh127
-rw-r--r--arch/mips/bits/stdint.h11
-rw-r--r--arch/powerpc/bits/alltypes.h.in22
-rwxr-xr-xarch/powerpc/bits/alltypes.h.sh127
-rw-r--r--arch/powerpc/bits/stdint.h11
-rw-r--r--arch/x86_64/bits/alltypes.h.in27
-rwxr-xr-xarch/x86_64/bits/alltypes.h.sh127
-rw-r--r--arch/x86_64/bits/stdint.h11
-rw-r--r--include/alltypes.h.in65
-rw-r--r--include/arpa/inet.h10
-rw-r--r--include/dirent.h2
-rw-r--r--include/langinfo.h3
-rw-r--r--include/math.h19
-rw-r--r--include/netdb.h7
-rw-r--r--include/netinet/in.h14
-rw-r--r--include/nl_types.h6
-rw-r--r--include/signal.h32
-rw-r--r--include/stdint.h28
-rw-r--r--include/stdio.h2
-rw-r--r--include/sys/resource.h3
-rw-r--r--include/sys/statfs.h2
-rw-r--r--include/sys/types.h10
-rw-r--r--include/sys/wait.h11
-rw-r--r--include/utmpx.h1
-rw-r--r--include/wchar.h2
-rw-r--r--include/wctype.h3
-rw-r--r--src/dirent/__dirent.h2
-rw-r--r--src/internal/locale_impl.h2
-rw-r--r--src/internal/stdio_impl.h2
-rw-r--r--tools/mkalltypes.sed15
41 files changed, 335 insertions, 907 deletions
diff --git a/Makefile b/Makefile
index 2fb1c998..b9b78078 100644
--- a/Makefile
+++ b/Makefile
@@ -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
 
diff --git a/arch/arm/bits/alltypes.h.in b/arch/arm/bits/alltypes.h.in
new file mode 100644
index 00000000..c3228b55
--- /dev/null
+++ b/arch/arm/bits/alltypes.h.in
@@ -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;
diff --git a/arch/arm/bits/alltypes.h.sh b/arch/arm/bits/alltypes.h.sh
deleted file mode 100755
index f1aca666..00000000
--- a/arch/arm/bits/alltypes.h.sh
+++ /dev/null
@@ -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
diff --git a/arch/arm/bits/stdint.h b/arch/arm/bits/stdint.h
index 8e21a8cb..43d3d59d 100644
--- a/arch/arm/bits/stdint.h
+++ b/arch/arm/bits/stdint.h
@@ -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
diff --git a/arch/i386/bits/alltypes.h.in b/arch/i386/bits/alltypes.h.in
new file mode 100644
index 00000000..ea6471ed
--- /dev/null
+++ b/arch/i386/bits/alltypes.h.in
@@ -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;
diff --git a/arch/i386/bits/alltypes.h.sh b/arch/i386/bits/alltypes.h.sh
deleted file mode 100755
index 381e2c9b..00000000
--- a/arch/i386/bits/alltypes.h.sh
+++ /dev/null
@@ -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
diff --git a/arch/i386/bits/stdint.h b/arch/i386/bits/stdint.h
index 8e21a8cb..d1b27121 100644
--- a/arch/i386/bits/stdint.h
+++ b/arch/i386/bits/stdint.h
@@ -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
diff --git a/arch/microblaze/bits/alltypes.h.in b/arch/microblaze/bits/alltypes.h.in
new file mode 100644
index 00000000..f0ab35fa
--- /dev/null
+++ b/arch/microblaze/bits/alltypes.h.in
@@ -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;
diff --git a/arch/microblaze/bits/alltypes.h.sh b/arch/microblaze/bits/alltypes.h.sh
deleted file mode 100755
index 032b45a4..00000000
--- a/arch/microblaze/bits/alltypes.h.sh
+++ /dev/null
@@ -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
diff --git a/arch/microblaze/bits/stdint.h b/arch/microblaze/bits/stdint.h
index 8e21a8cb..43d3d59d 100644
--- a/arch/microblaze/bits/stdint.h
+++ b/arch/microblaze/bits/stdint.h
@@ -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
diff --git a/arch/mips/bits/alltypes.h.in b/arch/mips/bits/alltypes.h.in
new file mode 100644
index 00000000..f0ab35fa
--- /dev/null
+++ b/arch/mips/bits/alltypes.h.in
@@ -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;
diff --git a/arch/mips/bits/alltypes.h.sh b/arch/mips/bits/alltypes.h.sh
deleted file mode 100755
index 032b45a4..00000000
--- a/arch/mips/bits/alltypes.h.sh
+++ /dev/null
@@ -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
diff --git a/arch/mips/bits/stdint.h b/arch/mips/bits/stdint.h
index 8e21a8cb..43d3d59d 100644
--- a/arch/mips/bits/stdint.h
+++ b/arch/mips/bits/stdint.h
@@ -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
diff --git a/arch/powerpc/bits/alltypes.h.in b/arch/powerpc/bits/alltypes.h.in
new file mode 100644
index 00000000..928ce70b
--- /dev/null
+++ b/arch/powerpc/bits/alltypes.h.in
@@ -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;
diff --git a/arch/powerpc/bits/alltypes.h.sh b/arch/powerpc/bits/alltypes.h.sh
deleted file mode 100755
index 0cb90007..00000000
--- a/arch/powerpc/bits/alltypes.h.sh
+++ /dev/null
@@ -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
diff --git a/arch/powerpc/bits/stdint.h b/arch/powerpc/bits/stdint.h
index 8e21a8cb..43d3d59d 100644
--- a/arch/powerpc/bits/stdint.h
+++ b/arch/powerpc/bits/stdint.h
@@ -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
diff --git a/arch/x86_64/bits/alltypes.h.in b/arch/x86_64/bits/alltypes.h.in
new file mode 100644
index 00000000..e931d114
--- /dev/null
+++ b/arch/x86_64/bits/alltypes.h.in
@@ -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;
diff --git a/arch/x86_64/bits/alltypes.h.sh b/arch/x86_64/bits/alltypes.h.sh
deleted file mode 100755
index 8f122c32..00000000
--- a/arch/x86_64/bits/alltypes.h.sh
+++ /dev/null
@@ -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
diff --git a/arch/x86_64/bits/stdint.h b/arch/x86_64/bits/stdint.h
index 878e4de2..495e1e42 100644
--- a/arch/x86_64/bits/stdint.h
+++ b/arch/x86_64/bits/stdint.h
@@ -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
diff --git a/include/alltypes.h.in b/include/alltypes.h.in
new file mode 100644
index 00000000..b2454365
--- /dev/null
+++ b/include/alltypes.h.in
@@ -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;
diff --git a/include/arpa/inet.h b/include/arpa/inet.h
index e47a41f6..5dcadaae 100644
--- a/include/arpa/inet.h
+++ b/include/arpa/inet.h
@@ -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);
diff --git a/include/dirent.h b/include/dirent.h
index d445f80a..5aa8510b 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -15,7 +15,7 @@ extern "C" {
 
 #include <bits/alltypes.h>
 
-typedef struct __DIR_s DIR;
+typedef struct __dirstream DIR;
 
 struct dirent
 {
diff --git a/include/langinfo.h b/include/langinfo.h
index b9c55695..c6349ad1 100644
--- a/include/langinfo.h
+++ b/include/langinfo.h
@@ -5,7 +5,8 @@
 extern "C" {
 #endif
 
-#define __NEED_nl_item
+#include <nl_types.h>
+
 #define __NEED_locale_t
 
 #include <bits/alltypes.h>
diff --git a/include/math.h b/include/math.h
index 01428152..c029156a 100644
--- a/include/math.h
+++ b/include/math.h
@@ -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);
diff --git a/include/netdb.h b/include/netdb.h
index 3cda7114..8a7013ad 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -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
 {
diff --git a/include/netinet/in.h b/include/netinet/in.h
index fcab298b..d886fc28 100644
--- a/include/netinet/in.h
+++ b/include/netinet/in.h
@@ -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
 {
diff --git a/include/nl_types.h b/include/nl_types.h
index ca61efb6..7c2d48e0 100644
--- a/include/nl_types.h
+++ b/include/nl_types.h
@@ -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 *);
diff --git a/include/signal.h b/include/signal.h
index 242b4ad2..ee20372b 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -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;
diff --git a/include/stdint.h b/include/stdint.h
index 76284048..a783ad96 100644
--- a/include/stdint.h
+++ b/include/stdint.h
@@ -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
diff --git a/include/stdio.h b/include/stdio.h
index ad407fb1..cd60bb55 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -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;
diff --git a/include/sys/resource.h b/include/sys/resource.h
index ff8ee205..0cfbcf44 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -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
diff --git a/include/sys/statfs.h b/include/sys/statfs.h
index d8128a25..6f4c6230 100644
--- a/include/sys/statfs.h
+++ b/include/sys/statfs.h
@@ -9,7 +9,7 @@ extern "C" {
 
 #include <sys/statvfs.h>
 
-typedef struct {
+typedef struct __fsid_t {
 	int __val[2];
 } fsid_t;
 
diff --git a/include/sys/types.h b/include/sys/types.h
index 6ead8b6e..db8661bf 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -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;
diff --git a/include/sys/wait.h b/include/sys/wait.h
index b8d6432e..b6dfe01d 100644
--- a/include/sys/wait.h
+++ b/include/sys/wait.h
@@ -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)
diff --git a/include/utmpx.h b/include/utmpx.h
index 0b3f6232..fd5f515a 100644
--- a/include/utmpx.h
+++ b/include/utmpx.h
@@ -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>
diff --git a/include/wchar.h b/include/wchar.h
index 0f1f6d26..a6742e37 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -38,7 +38,7 @@ extern "C" {
 #undef WEOF
 #define WEOF (-1)
 
-typedef struct
+typedef struct __mbstate_t
 {
 	unsigned __opaque1, __opaque2;
 } mbstate_t;
diff --git a/include/wctype.h b/include/wctype.h
index abc7d36f..5640eddb 100644
--- a/include/wctype.h
+++ b/include/wctype.h
@@ -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)
 
diff --git a/src/dirent/__dirent.h b/src/dirent/__dirent.h
index 38a27b06..45509e19 100644
--- a/src/dirent/__dirent.h
+++ b/src/dirent/__dirent.h
@@ -1,4 +1,4 @@
-struct __DIR_s
+struct __dirstream
 {
 	int fd;
 	off_t tell;
diff --git a/src/internal/locale_impl.h b/src/internal/locale_impl.h
index c268124f..f41c6f24 100644
--- a/src/internal/locale_impl.h
+++ b/src/internal/locale_impl.h
@@ -1,5 +1,5 @@
 #include <locale.h>
 
-struct __locale {
+struct __locale_struct {
 	int dummy;
 };
diff --git a/src/internal/stdio_impl.h b/src/internal/stdio_impl.h
index c9d20fac..2083b2fe 100644
--- a/src/internal/stdio_impl.h
+++ b/src/internal/stdio_impl.h
@@ -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 *);
diff --git a/tools/mkalltypes.sed b/tools/mkalltypes.sed
new file mode 100644
index 00000000..fa15efc3
--- /dev/null
+++ b/tools/mkalltypes.sed
@@ -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\
+/