@@ -23,11 +23,9 @@
# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
#endif
-#define __need_size_t
-#include <stddef.h>
-
#include <bits/wordsize.h>
#include <bits/types.h>
+#include <bits/types/size_t.h>
#include <bits/types/socklen_t.h>
/* Types of sockets. */
@@ -19,8 +19,7 @@
#ifndef __stack_t_defined
#define __stack_t_defined 1
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
/* Structure describing a signal stack. */
typedef struct
@@ -17,8 +17,6 @@
<http://www.gnu.org/licenses/>. */
#include <wchar.h>
-
-#define __need_ptrdiff_t
#include <stddef.h>
@@ -233,8 +233,7 @@ extern int dirfd (DIR *__dirp) __THROW __nonnull ((1));
# endif
# endif
-# define __need_size_t
-# include <stddef.h>
+# include <bits/types/size_t.h>
/* Scan the directory DIR, calling SELECTOR on each directory entry.
Entries for which SELECT returns nonzero are individually malloc'd,
@@ -20,8 +20,8 @@
#define _DLFCN_H 1
#include <features.h>
-#define __need_size_t
-#include <stddef.h>
+
+#include <bits/types/size_t.h>
/* Collect various system dependent definitions and declarations. */
#include <bits/dlfcn.h>
@@ -27,9 +27,7 @@
__BEGIN_DECLS
#include <bits/types.h>
-
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
/* For the Single Unix specification we must define this type here. */
#if defined __USE_XOPEN || defined __USE_XOPEN2K
@@ -167,9 +165,6 @@ extern int fgetgrent_r (FILE *__restrict __stream,
#ifdef __USE_MISC
-# define __need_size_t
-# include <stddef.h>
-
/* Set the group set for the current user to GROUPS (N of them). */
extern int setgroups (size_t __n, const __gid_t *__groups) __THROW;
@@ -23,9 +23,7 @@
#include <features.h>
#include <paths.h>
#include <bits/types/FILE.h>
-
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
/* Path to the user database files. */
#define GSHADOW _PATH_GSHADOW
@@ -19,8 +19,6 @@
#ifndef _HURD_IOCTL_H
#define _HURD_IOCTL_H 1
-#define __need___va_list
-#include <stdarg.h>
#include <bits/ioctls.h>
#include <mach/port.h>
@@ -21,10 +21,6 @@
#define _HURD_SIGNAL_H 1
#include <features.h>
-#define __need_size_t
-#define __need_NULL
-#include <stddef.h>
-
#include <mach/mach_types.h>
#include <mach/port.h>
#include <mach/message.h>
@@ -34,6 +30,7 @@
#include <bits/types/error_t.h>
#include <bits/types/stack_t.h>
#include <bits/types/sigset_t.h>
+#include <bits/types/size_t.h>
#include <bits/sigaction.h>
#include <hurd/msg.h>
@@ -138,7 +135,7 @@ extern struct hurd_sigstate *_hurd_self_sigstate (void)
_HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate *
_hurd_self_sigstate (void)
{
- if (THREAD_SELF->_hurd_sigstate == NULL)
+ if (! THREAD_SELF->_hurd_sigstate)
THREAD_SELF->_hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
return THREAD_SELF->_hurd_sigstate;
}
@@ -187,11 +184,11 @@ _hurd_critical_section_lock (void)
#ifdef __LIBC_NO_TLS
if (__LIBC_NO_TLS ())
/* TLS is currently initializing, no need to enter critical section. */
- return NULL;
+ return 0;
#endif
ss = THREAD_SELF->_hurd_sigstate;
- if (ss == NULL)
+ if (! ss)
{
/* The thread variable is unset; this must be the first time we've
asked for it. In this case, the critical section flag cannot
@@ -202,7 +199,7 @@ _hurd_critical_section_lock (void)
if (! __spin_try_lock (&ss->critical_section_lock))
/* We are already in a critical section, so do nothing. */
- return NULL;
+ return 0;
/* With the critical section lock held no signal handler will run.
Return our sigstate pointer; this will be passed to
@@ -219,7 +216,7 @@ extern void _hurd_critical_section_unlock (void *our_lock);
_HURD_SIGNAL_H_EXTERN_INLINE void
_hurd_critical_section_unlock (void *our_lock)
{
- if (our_lock == NULL)
+ if (! our_lock)
/* The critical section lock was held when we began. Do nothing. */
return;
else
@@ -19,8 +19,7 @@
#ifndef _HURD_SIGPREEMPT_H
#define _HURD_SIGPREEMPT_H 1
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
#include <errno.h>
#include <bits/types/error_t.h>
#include <signal.h> /* For sighandler_t, SIG_ERR. */
@@ -17,20 +17,16 @@
<http://www.gnu.org/licenses/>. */
#ifndef _HURD_USERLINK_H
-
#define _HURD_USERLINK_H 1
-#include <features.h>
-#define __need_NULL
-#include <stddef.h>
+#include <features.h>
+#include <setjmp.h>
#if defined __USE_EXTERN_INLINES && defined _LIBC
# if IS_IN (libc)
# include <hurd/signal.h>
# endif
#endif
-#include <setjmp.h>
-
/* This structure records a link in two doubly-linked lists.
We call these the per-resource user list and the per-thread
@@ -156,11 +152,11 @@ _hurd_userlink_move (struct hurd_userlink *new_link,
{
*new_link = *link;
- if (new_link->resource.next != NULL)
+ if (new_link->resource.next)
new_link->resource.next->resource.prevp = &new_link->resource.next;
*new_link->resource.prevp = new_link;
- if (new_link->thread.next != NULL)
+ if (new_link->thread.next)
new_link->thread.next->thread.prevp = &new_link->thread.next;
*new_link->thread.prevp = new_link;
}
@@ -180,13 +176,13 @@ extern int _hurd_userlink_clear (struct hurd_userlink **chainp);
_HURD_USERLINK_H_EXTERN_INLINE int
_hurd_userlink_clear (struct hurd_userlink **chainp)
{
- if (*chainp == NULL)
+ if (! *chainp)
return 1;
/* Detach the chain of current users from the cell. The last user to
remove his link from that chain will deallocate the old resource. */
- (*chainp)->resource.prevp = NULL;
- *chainp = NULL;
+ (*chainp)->resource.prevp = 0;
+ *chainp = 0;
return 0;
}
# endif
@@ -24,12 +24,10 @@
#include <features.h>
#include <bits/types/__mbstate_t.h>
+#include <bits/types/size_t.h>
+#include <bits/types/wchar_t.h>
#include <bits/types/wint_t.h>
-#define __need_size_t
-#define __need_wchar_t
-#include <stddef.h>
-
/* ISO 10646 value used to signal invalid value. */
#define __UNKNOWN_10646_CHAR ((wchar_t) 0xfffd)
@@ -19,8 +19,7 @@
#define _ICONV_H 1
#include <features.h>
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
__BEGIN_DECLS
@@ -54,7 +54,6 @@
#include <string.h>
#include <wchar.h>
#include <sys/param.h> /* For MIN. */
-#define __need_size_t
#include <stddef.h>
#include <libc-diag.h>
@@ -140,8 +140,6 @@
#include <assert.h>
#include <iconv/gconv_int.h>
#include <string.h>
-#define __need_size_t
-#define __need_NULL
#include <stddef.h>
#ifndef STATIC_GCONV
new file mode 100644
@@ -0,0 +1 @@
+#include <stdlib/bits/NULL.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <stdlib/bits/types/__va_list.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <stdlib/bits/types/ptrdiff_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <stdlib/bits/types/size_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <stdlib/bits/types/va_list.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <stdlib/bits/types/wchar_t.h>
@@ -19,8 +19,7 @@
#ifndef _SET_HOOKS_H
#define _SET_HOOKS_H 1
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
#include <sys/cdefs.h>
#include <libc-symbols.h>
@@ -81,9 +81,7 @@ libc_hidden_proto (__isoc99_vfscanf)
extern FILE *__new_tmpfile (void);
extern FILE *__old_tmpfile (void);
-# define __need_size_t
-# include <stddef.h>
-
+# include <bits/types/size_t.h>
# include <bits/types/wint_t.h>
/* Generate a unique file name (and possibly open it). */
@@ -18,12 +18,7 @@
# include <config.h>
#endif
-#ifdef _LIBC
-# define __need_NULL
-# include <stddef.h>
-#else
-# include <stdlib.h> /* Just for NULL. */
-#endif
+#include <stddef.h> /* Just for NULL. */
#include "gettextP.h"
#ifdef _LIBC
@@ -95,10 +95,6 @@ extern char *bind_textdomain_codeset (const char *__domainname,
/* Optimized version of the function above. */
#if defined __OPTIMIZE__ && !defined __cplusplus
-/* We need NULL for `gettext'. */
-# define __need_NULL
-# include <stddef.h>
-
/* We need LC_MESSAGES for `dgettext'. */
# include <locale.h>
@@ -106,12 +102,12 @@ extern char *bind_textdomain_codeset (const char *__domainname,
`__builtin_constant_p' predicate in dcgettext would always return
false. */
-# define gettext(msgid) dgettext (NULL, msgid)
+# define gettext(msgid) dgettext (0, msgid)
# define dgettext(domainname, msgid) \
dcgettext (domainname, msgid, LC_MESSAGES)
-# define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n)
+# define ngettext(msgid1, msgid2, n) dngettext (0, msgid1, msgid2, n)
# define dngettext(domainname, msgid1, msgid2, n) \
dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
@@ -18,12 +18,7 @@
# include <config.h>
#endif
-#ifdef _LIBC
-# define __need_NULL
-# include <stddef.h>
-#else
-# include <stdlib.h> /* Just for NULL. */
-#endif
+#include <stddef.h> /* Just for NULL. */
#include "gettextP.h"
#ifdef _LIBC
@@ -31,6 +31,7 @@
#endif
#include <bits/types.h>
+#include <bits/types/size_t.h>
struct _IO_FILE;
struct _IO_marker;
@@ -41,10 +41,8 @@
# error "Someone forgot to include stdio-lock.h"
#endif
-#define __need_wchar_t
-#include <stddef.h>
-
#include <bits/types/__mbstate_t.h>
+#include <bits/types/wchar_t.h>
#include <bits/types/wint_t.h>
#include <gconv.h>
@@ -28,33 +28,22 @@
__BEGIN_DECLS
-#define __need_size_t
-#define __need_NULL
-#include <stddef.h>
-
-#define __need___va_list
-#include <stdarg.h>
-
#include <bits/types.h>
#include <bits/types/__fpos_t.h>
#include <bits/types/__fpos64_t.h>
#include <bits/types/__FILE.h>
+#include <bits/types/__va_list.h>
#include <bits/types/FILE.h>
#include <bits/types/struct_FILE.h>
+#include <bits/types/size_t.h>
+#include <bits/NULL.h>
#ifdef __USE_GNU
# include <bits/types/cookie_io_functions_t.h>
#endif
#if defined __USE_XOPEN || defined __USE_XOPEN2K8
-# ifdef __GNUC__
-# ifndef _VA_LIST_DEFINED
-typedef __gnuc_va_list va_list;
-# define _VA_LIST_DEFINED
-# endif
-# else
-# include <stdarg.h>
-# endif
+# include <bits/types/va_list.h>
#endif
#if defined __USE_UNIX98 || defined __USE_XOPEN2K
@@ -24,9 +24,8 @@
#include <features.h>
-#define __need_NULL
-#include <stddef.h>
#include <bits/locale.h>
+#include <bits/NULL.h>
__BEGIN_DECLS
@@ -20,8 +20,11 @@
#define _MALLOC_H 1
#include <features.h>
-#include <stddef.h>
-#include <stdio.h>
+
+#include <bits/NULL.h>
+#include <bits/types/size_t.h>
+#include <bits/types/ptrdiff_t.h>
+#include <bits/types/FILE.h>
#ifdef _LIBC
# define __MALLOC_HOOK_VOLATILE
@@ -20,6 +20,7 @@
related to allocation failures, notably switching to a different
arena, and falling back to mmap (via sysmalloc). */
+#include <stddef.h>
#include <errno.h>
#include <malloc.h>
#include <pthread.h>
@@ -22,6 +22,7 @@
#include <array_length.h>
#include <malloc.h>
#include <stdlib.h>
+#include <stdio.h>
#include <support/support.h>
#include <support/xthread.h>
@@ -19,8 +19,7 @@
#ifndef __iovec_defined
#define __iovec_defined 1
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
/* Structure for scatter/gather I/O. */
struct iovec
@@ -21,11 +21,7 @@
#include <features.h>
-#define __need___va_list
-#include <stdarg.h>
-#ifndef __GNUC_VA_LIST
-# define __gnuc_va_list void *
-#endif
+#include <bits/types/__va_list.h>
__BEGIN_DECLS
@@ -21,8 +21,7 @@
#include <features.h>
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
__BEGIN_DECLS
@@ -20,13 +20,11 @@
#define _SYS_MMAN_H 1
#include <features.h>
+
#include <bits/types.h>
-
-#define __need_size_t
-#include <stddef.h>
-
-#include <bits/types/off_t.h>
#include <bits/types/mode_t.h>
+#include <bits/types/off_t.h>
+#include <bits/types/size_t.h>
#include <bits/mman.h>
@@ -19,13 +19,13 @@
#ifndef _SYS_PARAM_H
#define _SYS_PARAM_H 1
-#define __need_NULL
-#include <stddef.h>
+#include <features.h>
#include <sys/types.h>
#include <limits.h>
#include <endian.h> /* Define BYTE_ORDER et al. */
#include <signal.h> /* Define NSIG. */
+#include <bits/NULL.h>
/* This file defines some things in system-specific ways. */
#include <bits/param.h>
@@ -33,8 +33,7 @@
#define _SYSLOG_H 1
#include <features.h>
-#define __need___va_list
-#include <stdarg.h>
+#include <bits/types/__va_list.h>
/* This file defines _PATH_LOG. */
#include <bits/syslog-path.h>
@@ -29,8 +29,7 @@ __BEGIN_DECLS
a different purpose. */
#if defined __USE_XOPEN || defined __USE_XOPEN2K8
-# define __need_size_t
-# include <stddef.h>
+#include <bits/types/size_t.h>
typedef size_t __gsize_t;
#elif defined __SIZE_TYPE__
typedef __SIZE_TYPE__ __gsize_t;
@@ -22,18 +22,15 @@
#include <features.h>
/* Get type definitions. */
+#include <bits/NULL.h>
#include <bits/types.h>
-
-#define __need_size_t
-#define __need_NULL
-#include <stddef.h>
-
+#include <bits/types/pid_t.h>
+#include <bits/types/size_t.h>
#include <bits/types/time_t.h>
#include <bits/types/struct_timespec.h>
#ifndef __USE_XOPEN2K
# include <time.h>
#endif
-#include <bits/types/pid_t.h>
/* Get system specific constant and data structure definitions. */
#include <bits/sched.h>
@@ -28,9 +28,6 @@ __BEGIN_DECLS
#include <bits/types.h>
-#define __need_size_t
-#include <stddef.h>
-
#include <bits/types/blkcnt_t.h>
#include <bits/types/clockid_t.h>
#include <bits/types/dev_t.h>
@@ -42,6 +39,7 @@ __BEGIN_DECLS
#include <bits/types/nlink_t.h>
#include <bits/types/off_t.h>
#include <bits/types/pid_t.h>
+#include <bits/types/size_t.h>
#include <bits/types/ssize_t.h>
#include <bits/types/time_t.h>
#include <bits/types/timer_t.h>
@@ -214,13 +214,11 @@ __BEGIN_DECLS
/* All functions that are not declared anywhere else. */
+#include <bits/NULL.h>
#include <bits/types.h>
+#include <bits/types/size_t.h>
#include <bits/types/ssize_t.h>
-#define __need_size_t
-#define __need_NULL
-#include <stddef.h>
-
#if defined __USE_XOPEN || defined __USE_XOPEN2K
/* The Single Unix specification says that some more types are
available here. */
@@ -19,8 +19,7 @@
#define _WORDEXP_H 1
#include <features.h>
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
__BEGIN_DECLS
@@ -27,9 +27,7 @@
__BEGIN_DECLS
#include <bits/types.h>
-
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
#if defined __USE_XOPEN || defined __USE_XOPEN2K
/* The Single Unix specification says that some more types are
@@ -491,14 +491,6 @@ def ObsoleteTypedefChecker(reporter, fname):
# but we are not ready to enforce that yet.
UNIVERSAL_ALLOWED_INCLUDES = {
"features.h",
-
- # Technically these should only ever be included with __need
- # macros active, but some headers deliberately break this rule
- # when they think they're dealing with freestanding headers from a
- # non-GNU compiler, so enforcing it would be more trouble than
- # it's worth.
- "stddef.h",
- "stdarg.h",
}
# Specific headers are allowed to include specific other headers.
@@ -575,7 +567,7 @@ HEADER_ALLOWED_INCLUDES = {
"link.h": [ "dlfcn.h", "elf.h", "sys/types.h" ],
"mntent.h": [ "paths.h" ],
"nss.h": [ "stdint.h" ],
- "obstack.h": [ "string.h" ],
+ "obstack.h": [ "stddef.h", "string.h" ],
"proc_service.h": [ "sys/procfs.h" ],
"pty.h": [ "sys/ioctl.h", "termios.h" ],
"sgtty.h": [ "sys/ioctl.h" ],
@@ -619,7 +611,6 @@ HEADER_ALLOWED_INCLUDES = {
"sys/timex.h": [ "sys/time.h" ],
"sys/ttychars.h": [ "sys/ttydefaults.h" ],
"sys/ucontext.h": [ "sys/procfs.h" ],
- "sys/user.h": [ "sys/types.h" ],
"sys/vfs.h": [ "sys/statfs.h" ],
"sys/xattr.h": [ "sys/types.h" ],
@@ -696,6 +687,12 @@ HEADER_ALLOWED_INCLUDES = {
"bits/types/res_state.h": [ "netinet/in.h", "sys/types.h" ],
"bits/utmp.h": [ "paths.h", "sys/time.h", "sys/types.h" ],
"bits/utmpx.h": [ "paths.h", "sys/time.h" ],
+
+ "bits/types/__va_list.h": [ "stdarg.h" ],
+ "bits/types/ptrdiff_t.h": [ "stddef.h" ],
+ "bits/types/size_t.h": [ "stddef.h" ],
+ "bits/types/wchar_t.h": [ "stddef.h" ],
+ "bits/NULL.h": [ "stddef.h" ],
}
# As above, but each group of whitelist entries is only used for
@@ -28,10 +28,8 @@
#include <paths.h>
-#define __need_size_t
-#include <stddef.h>
-
#include <bits/types/FILE.h>
+#include <bits/types/size_t.h>
/* Paths to the user database files. */
#define SHADOW _PATH_SHADOW
@@ -17,7 +17,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#define __need_NULL
#include <stddef.h>
#include <signal.h>
@@ -289,9 +289,7 @@ extern int sigreturn (struct sigcontext *__scp) __THROW;
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
-# define __need_size_t
-# include <stddef.h>
-
+# include <bits/types/size_t.h>
# include <bits/types/stack_t.h>
# if defined __USE_XOPEN || defined __USE_XOPEN2K8
/* This will define `ucontext_t' and `mcontext_t'. */
@@ -17,7 +17,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#define __need_NULL
#include <stddef.h>
#include <signal.h>
@@ -23,9 +23,8 @@
__BEGIN_DECLS
+#include <bits/types/size_t.h>
#include <bits/types/struct_iovec.h>
-#define __need_size_t
-#include <stddef.h>
/* This operating system-specific header file defines the SOCK_*, PF_*,
AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr',
@@ -23,12 +23,9 @@
__BEGIN_DECLS
#include <bits/types/FILE.h>
-
-#define __need_size_t
-#define __need_wchar_t
-#include <stddef.h>
-
-#include <stdarg.h>
+#include <bits/types/size_t.h>
+#include <bits/types/wchar_t.h>
+#include <bits/types/__va_list.h>
struct printf_info
@@ -89,7 +86,7 @@ typedef int printf_arginfo_function (const struct printf_info *__info,
/* Type of a function to get a value of a user-defined from the
variable argument list. */
-typedef void printf_va_arg_function (void *__mem, va_list *__ap);
+typedef void printf_va_arg_function (void *__mem, __gnuc_va_list *__ap);
/* Register FUNC to be called to format SPEC specifiers; ARGINFO must be
@@ -15,7 +15,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#define __need_size_t
#include <stddef.h>
#include <stdio.h>
#include <errno.h>
@@ -23,6 +23,7 @@
#include <locale.h>
#include <printf.h>
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -29,7 +29,9 @@ headers := stdlib.h bits/stdlib.h bits/stdlib-ldbl.h bits/stdlib-float.h \
ucontext.h sys/ucontext.h bits/indirect-return.h \
alloca.h fmtmsg.h \
bits/stdlib-bsearch.h sys/random.h bits/stdint-intn.h \
- bits/stdint-uintn.h bits/time64.h \
+ bits/stdint-uintn.h bits/time64.h bits/NULL.h \
+ bits/types/ptrdiff_t.h bits/types/size_t.h bits/types/wchar_t.h \
+ bits/types/__va_list.h bits/types/va_list.h
routines := \
atof atoi atol atoll \
@@ -20,8 +20,7 @@
#include <features.h>
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
__BEGIN_DECLS
new file mode 100644
@@ -0,0 +1,8 @@
+#ifndef _BITS_NULL_H
+#define _BITS_NULL_H 1
+
+/* We rely on the compiler's stddef.h to define NULL for us. */
+#define __need_NULL
+#include <stddef.h>
+
+#endif
new file mode 100644
@@ -0,0 +1,9 @@
+#ifndef ____va_list_defined
+#define ____va_list_defined 1
+
+/* We rely on the compiler's stdarg.h to define __gnuc_va_list for us. */
+#define __need___va_list
+#include <stdarg.h>
+#undef __need___va_list
+
+#endif
new file mode 100644
@@ -0,0 +1,9 @@
+#ifndef __ptrdiff_t_defined
+#define __ptrdiff_t_defined 1
+
+/* We rely on the compiler's stddef.h to define ptrdiff_t for us. */
+#define __need_ptrdiff_t
+#include <stddef.h>
+#undef __need_ptrdiff_t
+
+#endif
new file mode 100644
@@ -0,0 +1,9 @@
+#ifndef __size_t_defined
+#define __size_t_defined 1
+
+/* We rely on the compiler's stddef.h to define size_t for us. */
+#define __need_size_t
+#include <stddef.h>
+#undef __need_size_t
+
+#endif
new file mode 100644
@@ -0,0 +1,15 @@
+/* This guard macro needs to match the one used by at least gcc and
+ clang's stdarg.h to indicate that va_list, specifically, has been
+ defined. */
+#ifndef _VA_LIST
+
+#include <bits/types/__va_list.h>
+
+/* Check again, __va_list.h may not have been able to avoid including
+ all of stdarg.h. */
+# ifndef _VA_LIST
+typedef __gnuc_va_list va_list;
+# endif
+# define _VA_LIST
+
+#endif
new file mode 100644
@@ -0,0 +1,9 @@
+#ifndef __wchar_t_defined
+#define __wchar_t_defined 1
+
+/* We rely on the compiler's stddef.h to define wchar_t for us. */
+#define __need_wchar_t
+#include <stddef.h>
+#undef __need_wchar_t
+
+#endif
@@ -32,8 +32,7 @@
#elif defined __WCHAR_TYPE__
typedef __WCHAR_TYPE__ __gwchar_t;
#else
-# define __need_wchar_t
-# include <stddef.h>
+#include <bits/types/wchar_t.h>
typedef wchar_t __gwchar_t;
#endif
@@ -22,9 +22,8 @@
#include <features.h>
/* Get needed types. */
-#define __need_size_t
-#include <stddef.h>
#include <bits/types.h>
+#include <bits/types/size_t.h>
#include <bits/types/ssize_t.h>
__BEGIN_DECLS
@@ -20,20 +20,17 @@
*/
#ifndef _STDLIB_H
+#define _STDLIB_H 1
#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
#include <bits/libc-header-start.h>
-/* Get size_t, wchar_t and NULL from <stddef.h>. */
-#define __need_size_t
-#define __need_wchar_t
-#define __need_NULL
-#include <stddef.h>
+#include <bits/types/size_t.h>
+#include <bits/types/wchar_t.h>
+#include <bits/NULL.h>
__BEGIN_DECLS
-#define _STDLIB_H 1
-
#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H
/* XPG requires a few symbols from <sys/wait.h> being defined. */
# include <bits/waitflags.h>
@@ -27,10 +27,8 @@
__BEGIN_DECLS
-/* Get size_t and NULL from <stddef.h>. */
-#define __need_size_t
-#define __need_NULL
-#include <stddef.h>
+#include <bits/types/size_t.h>
+#include <bits/NULL.h>
/* Tell the caller that we provide correct C++ prototypes. */
#if defined __cplusplus && __GNUC_PREREQ (4, 4)
@@ -19,8 +19,7 @@
#define _STRINGS_H 1
#include <features.h>
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
/* Tell the caller that we provide correct C++ prototypes. */
#if defined __cplusplus && __GNUC_PREREQ (4, 4)
@@ -23,6 +23,7 @@
#include <limits.h>
#include <malloc.h>
#include <stdbool.h>
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -38,8 +38,7 @@
#include <features.h>
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
__BEGIN_DECLS
@@ -22,8 +22,6 @@
#include <features.h>
#include <stdbool.h>
-#define __need_size_t
-#define __need_NULL
#include <stddef.h>
#include <string.h>
#include <stdint.h>
@@ -19,11 +19,9 @@
#ifndef _BITS_TYPES_STRUCT___PTHREAD_ATTR
#define _BITS_TYPES_STRUCT___PTHREAD_ATTR 1
+#include <bits/types/size_t.h>
#include <bits/types/struct_sched_param.h>
-#define __need_size_t
-#include <stddef.h>
-
enum __pthread_detachstate;
enum __pthread_inheritsched;
enum __pthread_contentionscope;
@@ -24,12 +24,11 @@
# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
#endif
-#define __need_size_t
-#include <stddef.h>
-#include <bits/wordsize.h>
#include <sys/types.h>
+#include <bits/types/size_t.h>
#include <bits/types/socklen_t.h>
+#include <bits/wordsize.h>
/* Types of sockets. */
enum __socket_type
@@ -20,7 +20,6 @@
#define _LIBC_LOCK_H 1
#include <pthread.h>
-#define __need_NULL
#include <stddef.h>
@@ -20,7 +20,6 @@
#define _LIBC_LOCKP_H 1
#include <pthread.h>
-#define __need_NULL
#include <stddef.h>
@@ -17,11 +17,8 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#define __need_NULL
#include <stddef.h>
#include <signal.h>
-#include <string.h> /* For the real memset prototype. */
#include <sigsetops.h>
int
@@ -15,11 +15,8 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#define __need_NULL
#include <stddef.h>
#include <signal.h>
-#include <string.h> /* For the real memset prototype. */
#include <sigsetops.h>
/* Set the disposition for SIG. */
@@ -20,7 +20,6 @@
#include <assert.h>
#include <errno.h>
#include <signal.h>
-#define __need_NULL
#include <stddef.h>
#include <sys/wait.h>
#include <sys/types.h>
@@ -19,6 +19,8 @@
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
+#include <features.h>
+
struct user_regs_struct
{
unsigned long long regs[31];
@@ -18,13 +18,15 @@
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
+#include <features.h>
+#include <bits/types/size_t.h>
+
+#include <asm/reg.h>
+
/* The whole purpose of this file is for gdb/strace and gdb/strace
only. Don't read too much into it. Don't use it for anything other
than gdb/strace unless you know what you are doing. */
-#include <asm/reg.h>
-#include <stddef.h>
-
struct user
{
unsigned long int regs[EF_SIZE / 8 + 32]; /* integer and fp regs */
@@ -18,6 +18,8 @@
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
+#include <features.h>
+
/* The whole purpose of this file is for GDB and GDB only. Don't read
too much into it. Don't use it for anything other than GDB unless
you know what you are doing. */
@@ -24,14 +24,17 @@
#ifndef sigcontext_struct
/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
- we need sigcontext. */
+ we need sigcontext. FIXME: Is this workaround still necessary?
+ 2.1.1 was many years ago. */
# define sigcontext_struct sigcontext
# include <asm/sigcontext.h>
-/* The Linux kernel headers redefine NULL wrongly, so cleanup afterwards. */
-# define __need_NULL
-# include <stddef.h>
+/* The Linux kernel headers redefine NULL wrongly, so cleanup afterwards.
+ FIXME: This won't work if bits/NULL.h or stddef.h has already been
+ included. Is this workaround still necessary? Current (4.19) uapi
+ headers do not redefine NULL. */
+#include <bits/NULL.h>
#endif
#endif /* bits/sigcontext.h */
@@ -23,10 +23,9 @@
# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
#endif
-#define __need_size_t
-#include <stddef.h>
#include <sys/types.h>
+#include <bits/types/size_t.h>
#include <bits/types/socklen_t.h>
/* Get the architecture-dependent definition of enum __socket_type. */
@@ -19,8 +19,7 @@
#ifndef __stack_t_defined
#define __stack_t_defined 1
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
/* Structure describing a signal stack. */
typedef struct
@@ -23,11 +23,10 @@
# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
#endif
-#define __need_size_t
-#include <stddef.h>
-#include <bits/sigstack.h>
+#include <bits/types/size_t.h>
#include <bits/types/struct_sigstack.h>
#include <bits/types/stack_t.h>
+#include <bits/sigstack.h>
#include <bits/ss_flags.h>
struct __ia64_fpreg
@@ -19,7 +19,7 @@
#define _SYS_USER_H 1
#include <features.h>
-#include <sys/types.h>
+#include <bits/types/size_t.h>
/* This definition comes directly from the kernel headers. If
anything changes in them this header has to be changed, too. */
@@ -18,6 +18,8 @@
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
+#include <features.h>
+
/* The whole purpose of this file is for GDB and GDB only. Don't read
too much into it. Don't use it for anything other than GDB unless
you know what you are doing. */
@@ -19,6 +19,8 @@
#ifndef _SYS_USER_H
# define _SYS_USER_H 1
+#include <features.h>
+
/* The whole purpose of this file is for GDB and GDB only. Don't read
too much into it. Don't use it for anything other than GDB unless
you know what you are doing. */
@@ -19,8 +19,7 @@
#ifndef __stack_t_defined
#define __stack_t_defined 1
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
/* Structure describing a signal stack. */
typedef struct
@@ -18,8 +18,10 @@
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
+#include <features.h>
+#include <bits/types/size_t.h>
+
#include <sgidefs.h>
-#include <stddef.h>
/* The whole purpose of this file is for GDB and GDB only. Don't read
too much into it. Don't use it for anything other than GDB unless
@@ -19,6 +19,8 @@
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
+#include <features.h>
+
/* The whole purpose of this file is for GDB and GDB only. Don't read
too much into it. Don't use it for anything other than GDB unless
you know what you are doing. */
@@ -16,10 +16,10 @@
<http://www.gnu.org/licenses/>. */
#ifndef _SYS_USER_H
-
#define _SYS_USER_H 1
-#include <stddef.h>
+
#include <features.h>
+#include <bits/types/size_t.h>
#include <asm/ptrace.h>
@@ -18,6 +18,8 @@
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
+#include <features.h>
+
/* The whole purpose of this file is for GDB and GDB only. Don't read
too much into it. Don't use it for anything other than GDB unless
you know what you are doing. */
@@ -26,9 +26,7 @@
#define _SCSI_SG_H 1
#include <features.h>
-#define __need_size_t
-#include <stddef.h>
-
+#include <bits/types/size_t.h>
/* New interface introduced in the 3.x SG drivers follows */
@@ -18,8 +18,11 @@
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
+#include <features.h>
+#include <bits/types/size_t.h>
+
#include <asm/ptrace.h>
-#include <stddef.h>
+
/* asm/ptrace.h polutes the namespace. */
#undef PTRACE_GETREGS
@@ -18,7 +18,8 @@
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
-#include <stddef.h>
+#include <features.h>
+#include <bits/types/size_t.h>
struct sunos_regs
{
@@ -21,8 +21,8 @@
#warning "The <sys/sysctl.h> header is deprecated and will be removed."
#include <features.h>
-#define __need_size_t
-#include <stddef.h>
+#include <bits/types/size_t.h>
+
/* Prevent more kernel headers than necessary to be included. */
#ifndef _LINUX_KERNEL_H
# define _LINUX_KERNEL_H 1
@@ -18,6 +18,8 @@
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
+#include <features.h>
+
/* The whole purpose of this file is for GDB and GDB only. Don't read
too much into it. Don't use it for anything other than GDB unless
you know what you are doing. */
@@ -20,20 +20,18 @@
#include <features.h>
-#define __need_size_t
-#include <stddef.h>
-
/* Get common definition of System V style IPC. */
#include <sys/ipc.h>
-/* Get system dependent definition of `struct msqid_ds' and more. */
-#include <bits/msq.h>
-
/* Define types required by the standard. */
#include <bits/types/time_t.h>
#include <bits/types/pid_t.h>
+#include <bits/types/size_t.h>
#include <bits/types/ssize_t.h>
+/* Get system dependent definition of `struct msqid_ds' and more. */
+#include <bits/msq.h>
+
/* The following System V style IPC functions implement a message queue
system. The definition is found in XPG2. */
@@ -20,19 +20,18 @@
#include <features.h>
-#define __need_size_t
-#include <stddef.h>
-
/* Get common definition of System V style IPC. */
#include <sys/ipc.h>
-/* Get system dependent definition of `struct semid_ds' and more. */
-#include <bits/sem.h>
-
+/* Define types required by the standard. */
+#include <bits/types/size_t.h>
#ifdef __USE_GNU
# include <bits/types/struct_timespec.h>
#endif
+/* Get system dependent definition of `struct semid_ds' and more. */
+#include <bits/sem.h>
+
/* The following System V style IPC functions implement a semaphore
handling. The definition is found in XPG2. */
@@ -20,21 +20,19 @@
#include <features.h>
-#define __need_size_t
-#include <stddef.h>
-
/* Get common definition of System V style IPC. */
#include <sys/ipc.h>
-/* Get system dependent definition of `struct shmid_ds' and more. */
-#include <bits/shm.h>
-
/* Define types required by the standard. */
+#include <bits/types/size_t.h>
#include <bits/types/time_t.h>
#ifdef __USE_XOPEN
# include <bits/types/pid_t.h>
#endif
+/* Get system dependent definition of `struct shmid_ds' and more. */
+#include <bits/shm.h>
+
__BEGIN_DECLS
/* The following System V style IPC functions implement a shared memory
@@ -24,17 +24,15 @@
#include <features.h>
-#define __need_size_t
-#define __need_NULL
-#include <stddef.h>
-
/* This defines CLOCKS_PER_SEC, which is the number of processor clock
ticks per second, and possibly a number of other constants. */
#include <bits/time.h>
-/* Many of the typedefs and structs whose official home is this header
- may also need to be defined by other headers. */
+/* Typedefs and structs required to be defined by this header.
+ Many are also defined by other headers. */
+#include <bits/NULL.h>
#include <bits/types/clock_t.h>
+#include <bits/types/size_t.h>
#include <bits/types/time_t.h>
#include <bits/types/struct_tm.h>
@@ -25,10 +25,8 @@
#include <features.h>
-#define __need_size_t
-#include <stddef.h>
-
#include <bits/types.h>
+#include <bits/types/size_t.h>
#include <bits/types/mbstate_t.h>
#ifndef __USE_ISOCXX11
@@ -27,20 +27,16 @@
#include <bits/libc-header-start.h>
/* Gather machine dependent type support. */
-#include <bits/floatn.h>
-
-#define __need_size_t
-#define __need_wchar_t
-#define __need_NULL
-#include <stddef.h>
-
-#define __need___va_list
-#include <stdarg.h>
-
-#include <bits/wchar.h>
-#include <bits/types/wint_t.h>
-#include <bits/types/mbstate_t.h>
#include <bits/types/__FILE.h>
+#include <bits/types/__va_list.h>
+#include <bits/types/mbstate_t.h>
+#include <bits/types/size_t.h>
+#include <bits/types/wchar_t.h>
+#include <bits/types/wint_t.h>
+
+#include <bits/NULL.h>
+#include <bits/floatn.h>
+#include <bits/wchar.h>
#if defined __USE_UNIX98 || defined __USE_XOPEN2K
# include <bits/types/FILE.h>
@@ -17,7 +17,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#define __need_wchar_t
#include <stddef.h>
#include <locale.h>
@@ -17,7 +17,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#define __need_wchar_t
#include <stddef.h>
#include <locale.h>
@@ -17,7 +17,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#define __need_wchar_t
#include <stddef.h>
#include <locale.h>
@@ -17,7 +17,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#define __need_wchar_t
#include <stddef.h>
#include <locale.h>