]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Don’t rely on stddef.h or stdarg.h for individual type definitions.
authorZack Weinberg <zackw@panix.com>
Wed, 29 May 2019 18:23:32 +0000 (14:23 -0400)
committerZack Weinberg <zackw@panix.com>
Wed, 8 Jan 2020 18:42:38 +0000 (13:42 -0500)
In the course of developing earlier patches in this series I
discovered that clang’s stddef.h does not implement the __need_*
convention correctly: in C++, under some circumstances __need_NULL
will also cause a definition of nullptr_t, and when the “modules”
feature is enabled, all of the __need macros are ignored and all of
stddef.h is exposed.  (I’m not sure how to actually make either of
these things happen, I discovered the problem by reading the file.)

Worse, clang’s stdarg.h does not implement __need___va_list *at all*;
including its stdarg.h will always expose all of its definitions.

These are bugs in clang but it seems prudent to work around them, and
the simplest way to do so is to have the bits/types/ headers
introduced in the previous patch make definitions themselves, when
possible.  For size_t, ptrdiff_t, and wchar_t, we can use the
predefined macros __SIZE_TYPE__, __PTRDIFF_TYPE__, and __WCHAR_TYPE__,
when available, falling back to the old approach.  For __gnuc_va_list,
we have a whitelist of compilers known to provide __builtin_va_list,
falling back to the old approach.  NULL and va_list are defined
ab initio.

An additional complication is that we must be able to tell stddef.h
and stdarg.h _not_ to define again things we have already defined.  It
appears to me, based on inspection of clang, GCC, and icc stddef.h and
stdarg.h, that we can use the macros _SIZE_T, _PTRDIFF_T, _WCHAR_T,
_VA_LIST, and __GNUC_VA_LIST to accomplish this.

Since we are no longer relying on stdarg.h to define an
implementation-namespace alias for us, I thought it would make sense
also to stop calling it __gnuc_va_list.  The bulk of this patch is
a mechanical substitution of __va_list for __gnuc_va_list throughout
our headers.

Copyright boilerplate is added to stdlib/bits/NULL.h and stdlib/bits/types/*.h
because they now contain enough commentary and code that they could
plausibly be copyrightable.

* stdlib/bits/NULL.h: Do not use stddef.h to define NULL.
Define NULL ab initio if not already defined, as `((void *)0)` for C,
and either `__null` or 0 for C++, depending on compiler support.

* stdlib/bits/types/__va_list.h: If __builtin_va_list is known to
be available, use it to define __va_list without including
stdarg.h.  Otherwise use __need___va_list to request a definition
of __gnuc_va_list and nothing else from stdarg.h, then use that to
define __va_list.
* stdlib/bits/types/va_list.h: Use __va_list, not __gnuc_va_list,
to define va_list.  Improve commentary.

* stdlib/bits/types/ptrdiff_t.h: If __PTRDIFF_TYPE__ is defined,
use it to define ptrdiff_t without including stddef.h.  Otherwise
use __need_ptrdiff_t to request a definition of ptrdiff_t and
nothing else from stddef.h.  Use _PTRDIFF_T as guard macro to
match behavior of common stddef.h implementations.
* stdlib/bits/types/size_t.h: Similarly for size_t, with
__SIZE_TYPE__, __need_size_t, and _SIZE_T.
* stdlib/bits/types/wchar_t.h: Similarly for wchar_t, with
__WCHAR_TYPE__, __need_wchar_t, and _WCHAR_T.  If __cplusplus
is defined, do nothing; wchar_t is built-in in C++.

* conform/data/stdio.h-data, conform/data/wchar.h-data
* include/err.h, include/stdio.h, include/syslog.h, include/wchar.h
* libio/bits/stdio.h, libio/bits/stdio2.h, libio/iolibio.h
* libio/libio.h, libio/stdio.h, libio/vwprintf.c, misc/bits/syslog.h
* misc/err.c, misc/err.h, misc/syslog.h, stdio-common/printf.h
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
* sysdeps/ieee754/ldbl-opt/nldbl-compat.h
* wcsmbs/bits/wchar2.h, wcsmbs/wchar.h:
Replace all uses of __gnuc_va_list with __va_list.

        * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
        bits/NULL.h is no longer allowed to include stddef.h.

28 files changed:
conform/data/stdio.h-data
conform/data/wchar.h-data
include/err.h
include/stdio.h
include/syslog.h
include/wchar.h
libio/bits/stdio.h
libio/bits/stdio2.h
libio/iolibio.h
libio/libio.h
libio/stdio.h
libio/vwprintf.c
misc/bits/syslog.h
misc/err.c
misc/err.h
misc/syslog.h
scripts/check-obsolete-constructs.py
stdio-common/printf.h
stdlib/bits/NULL.h
stdlib/bits/types/__va_list.h
stdlib/bits/types/ptrdiff_t.h
stdlib/bits/types/size_t.h
stdlib/bits/types/va_list.h
stdlib/bits/types/wchar_t.h
sysdeps/ieee754/ldbl-opt/nldbl-compat.c
sysdeps/ieee754/ldbl-opt/nldbl-compat.h
wcsmbs/bits/wchar2.h
wcsmbs/wchar.h

index 3ef246066108993b0527fe95282c42c1a490a17f..60ebea4ee45fbd444196b2b7eeba754d9598db1a 100644 (file)
@@ -41,7 +41,7 @@ type fpos_t
 #if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type va_list
 #else
-#define va_list __gnuc_va_list
+#define va_list __va_list
 #endif
 type size_t
 #if defined XOPEN2K8 || defined POSIX2008
index e414651a330bc273cb6df06bc8b7c3afecf235ca..424c59c81922d8f04311ba305f4d510c76ef021d 100644 (file)
@@ -59,17 +59,17 @@ function wint_t towlower (wint_t)
 function wint_t towupper (wint_t)
 # endif
 function wint_t ungetwc (wint_t, FILE*)
-function int vfwprintf (FILE*, const wchar_t*, __gnuc_va_list)
+function int vfwprintf (FILE*, const wchar_t*, __va_list)
 # ifndef UNIX98
-function int vfwscanf (FILE*, const wchar_t*, __gnuc_va_list)
+function int vfwscanf (FILE*, const wchar_t*, __va_list)
 # endif
-function int vwprintf (const wchar_t*, __gnuc_va_list)
+function int vwprintf (const wchar_t*, __va_list)
 # ifndef UNIX98
-function int vwscanf (const wchar_t*, __gnuc_va_list)
+function int vwscanf (const wchar_t*, __va_list)
 # endif
-function int vswprintf (wchar_t*, size_t, const wchar_t*, __gnuc_va_list)
+function int vswprintf (wchar_t*, size_t, const wchar_t*, __va_list)
 # ifndef UNIX98
-function int vswscanf (const wchar_t*, const wchar_t*, __gnuc_va_list)
+function int vswscanf (const wchar_t*, const wchar_t*, __va_list)
 # endif
 # if defined XOPEN2K8 || defined POSIX2008
 function {wchar_t*} wcpcpy (wchar_t*, const wchar_t*)
index 7c05cd1dbb2134850dfb6514dbfb13f5374ed012..573a0f8ef2eef6326e896d9404af78a84bfc0ca9 100644 (file)
@@ -3,12 +3,10 @@
 
 /* Prototypes for internal err.h functions.  */
 void
-__vwarnx_internal (const char *format, __gnuc_va_list ap,
-                  unsigned int mode_flags);
+__vwarnx_internal (const char *format, __va_list ap, unsigned int mode_flags);
 
 void
-__vwarn_internal (const char *format, __gnuc_va_list ap,
-                  unsigned int mode_flags);
+__vwarn_internal (const char *format, __va_list ap, unsigned int mode_flags);
 
 # ifndef _ISOMAC
 
index 5cd38eaeedfdd92bfd4a81902442cc2a97f30ed0..f60fa28a46c9bdeaf98f1603c9e7a535dd3c49c1 100644 (file)
@@ -18,40 +18,39 @@ libc_hidden_proto (__snprintf)
 #  endif
 extern int __vfscanf (FILE *__restrict __s,
                      const char *__restrict __format,
-                     __gnuc_va_list __arg)
+                     __va_list __arg)
      __attribute__ ((__format__ (__scanf__, 2, 0)));
 libc_hidden_proto (__vfscanf)
-extern int __vscanf (const char *__restrict __format,
-                    __gnuc_va_list __arg)
+extern int __vscanf (const char *__restrict __format, __va_list __arg)
      __attribute__ ((__format__ (__scanf__, 1, 0)));
 extern __ssize_t __getline (char **__lineptr, size_t *__n,
                             FILE *__stream) attribute_hidden;
 extern int __vsscanf (const char *__restrict __s,
                      const char *__restrict __format,
-                     __gnuc_va_list __arg)
+                     __va_list __arg)
      __attribute__ ((__format__ (__scanf__, 2, 0)));
 
 extern int __sprintf_chk (char *, int, size_t, const char *, ...) __THROW;
 extern int __snprintf_chk (char *, size_t, int, size_t, const char *, ...)
      __THROW;
 extern int __vsprintf_chk (char *, int, size_t, const char *,
-                          __gnuc_va_list) __THROW;
+                          __va_list) __THROW;
 extern int __vsnprintf_chk (char *, size_t, int, size_t, const char *,
-                           __gnuc_va_list) __THROW;
+                           __va_list) __THROW;
 extern int __printf_chk (int, const char *, ...);
 extern int __fprintf_chk (FILE *, int, const char *, ...);
-extern int __vprintf_chk (int, const char *, __gnuc_va_list);
-extern int __vfprintf_chk (FILE *, int, const char *, __gnuc_va_list);
+extern int __vprintf_chk (int, const char *, __va_list);
+extern int __vfprintf_chk (FILE *, int, const char *, __va_list);
 extern char *__fgets_unlocked_chk (char *buf, size_t size, int n, FILE *fp);
 extern char *__fgets_chk (char *buf, size_t size, int n, FILE *fp);
 extern int __asprintf_chk (char **, int, const char *, ...) __THROW;
-extern int __vasprintf_chk (char **, int, const char *, __gnuc_va_list) __THROW;
+extern int __vasprintf_chk (char **, int, const char *, __va_list) __THROW;
 extern int __dprintf_chk (int, int, const char *, ...);
-extern int __vdprintf_chk (int, int, const char *, __gnuc_va_list);
+extern int __vdprintf_chk (int, int, const char *, __va_list);
 extern int __obstack_printf_chk (struct obstack *, int, const char *, ...)
      __THROW;
 extern int __obstack_vprintf_chk (struct obstack *, int, const char *,
-                                 __gnuc_va_list) __THROW;
+                                 __va_list) __THROW;
 
 extern int __isoc99_fscanf (FILE *__restrict __stream,
                            const char *__restrict __format, ...) __wur;
@@ -60,12 +59,12 @@ extern int __isoc99_sscanf (const char *__restrict __s,
                            const char *__restrict __format, ...) __THROW;
 extern int __isoc99_vfscanf (FILE *__restrict __s,
                             const char *__restrict __format,
-                            __gnuc_va_list __arg) __wur;
+                            __va_list __arg) __wur;
 extern int __isoc99_vscanf (const char *__restrict __format,
-                           __gnuc_va_list __arg) __wur;
+                           __va_list __arg) __wur;
 extern int __isoc99_vsscanf (const char *__restrict __s,
                             const char *__restrict __format,
-                            __gnuc_va_list __arg) __THROW;
+                            __va_list __arg) __THROW;
 libc_hidden_proto (__isoc99_sscanf)
 libc_hidden_proto (__isoc99_vsscanf)
 libc_hidden_proto (__isoc99_vfscanf)
@@ -131,8 +130,7 @@ extern int __fxprintf (FILE *__fp, const char *__fmt, ...)
      __attribute__ ((__format__ (__printf__, 2, 3))) attribute_hidden;
 extern int __fxprintf_nocancel (FILE *__fp, const char *__fmt, ...)
      __attribute__ ((__format__ (__printf__, 2, 3))) attribute_hidden;
-int __vfxprintf (FILE *__fp, const char *__fmt, __gnuc_va_list,
-                unsigned int)
+int __vfxprintf (FILE *__fp, const char *__fmt, __va_list, unsigned int)
   attribute_hidden;
 
 /* Read the next line from FP into BUFFER, of LENGTH bytes.  LINE will
index 5dc6e76b7e4949835f30c2f9fdf0b7ec04140e27..cd8b6b876b414ba630bc91b701318bb5b8afdb12 100644 (file)
@@ -6,7 +6,7 @@ libc_hidden_proto (syslog)
 
 /* __vsyslog_internal uses the same mode_flags bits as
    __v*printf_internal; see libio/libioP.h.  */
-extern void __vsyslog_internal (int pri, const char *fmt, __gnuc_va_list ap,
+extern void __vsyslog_internal (int pri, const char *fmt, __va_list ap,
                                unsigned int mode_flags)
      attribute_hidden
      __attribute__ ((__format__ (__printf__, 2, 0)));
index c792b3894370145849b9f36b8ca15ff6c731246e..da802ebacd3c01910e45e73d80f1cfc297975f15 100644 (file)
@@ -204,7 +204,7 @@ extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n,
 
 extern int __vfwscanf (__FILE *__restrict __s,
                       const wchar_t *__restrict __format,
-                      __gnuc_va_list __arg)
+                      __va_list __arg)
      attribute_hidden
      /* __attribute__ ((__format__ (__wscanf__, 2, 0)) */;
 extern int __fwprintf (__FILE *__restrict __s,
@@ -213,12 +213,12 @@ extern int __fwprintf (__FILE *__restrict __s,
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 extern int __vfwprintf_chk (FILE *__restrict __s, int __flag,
                            const wchar_t *__restrict __format,
-                           __gnuc_va_list __arg)
+                           __va_list __arg)
      /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
 extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
                            int __flag, size_t __s_len,
                            const wchar_t *__restrict __format,
-                           __gnuc_va_list __arg)
+                           __va_list __arg)
      /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
 
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
@@ -229,12 +229,12 @@ extern int __isoc99_swscanf (const wchar_t *__restrict __s,
      __THROW;
 extern int __isoc99_vfwscanf (__FILE *__restrict __s,
                              const wchar_t *__restrict __format,
-                             __gnuc_va_list __arg);
+                             __va_list __arg);
 extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-                            __gnuc_va_list __arg);
+                            __va_list __arg);
 extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
                              const wchar_t *__restrict __format,
-                             __gnuc_va_list __arg) __THROW;
+                             __va_list __arg) __THROW;
 libc_hidden_proto (__isoc99_vswscanf)
 libc_hidden_proto (__isoc99_vfwscanf)
 
index da62908fd7060acabf57c462dfb357d08908d1cb..eaa7857f1279b50a50b267ca46f40a134434918f 100644 (file)
@@ -36,7 +36,7 @@
 # if !(__USE_FORTIFY_LEVEL > 0 && defined __fortify_function)
 /* Write formatted output to stdout from argument list ARG.  */
 __STDIO_INLINE int
-vprintf (const char *__restrict __fmt, __gnuc_va_list __arg)
+vprintf (const char *__restrict __fmt, __va_list __arg)
 {
   return vfprintf (stdout, __fmt, __arg);
 }
index 60bc81735e265eb61b5600e57eb9a303f00ed7c9..03fcf115c7081f5a5a421fad05441d98b7b2e3ff 100644 (file)
@@ -27,7 +27,7 @@ extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
                          const char *__restrict __format, ...) __THROW;
 extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
                           const char *__restrict __format,
-                          __gnuc_va_list __ap) __THROW;
+                          __va_list __ap) __THROW;
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -44,7 +44,7 @@ __NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...))
 
 __fortify_function int
 __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt,
-                __gnuc_va_list __ap))
+                __va_list __ap))
 {
   return __builtin___vsprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
                                   __bos (__s), __fmt, __ap);
@@ -57,7 +57,7 @@ extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
                           ...) __THROW;
 extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
                            size_t __slen, const char *__restrict __format,
-                           __gnuc_va_list __ap) __THROW;
+                           __va_list __ap) __THROW;
 
 # ifdef __va_arg_pack
 __fortify_function int
@@ -75,7 +75,7 @@ __NTH (snprintf (char *__restrict __s, size_t __n,
 
 __fortify_function int
 __NTH (vsnprintf (char *__restrict __s, size_t __n,
-                 const char *__restrict __fmt, __gnuc_va_list __ap))
+                 const char *__restrict __fmt, __va_list __ap))
 {
   return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
                                    __bos (__s), __fmt, __ap);
@@ -89,9 +89,9 @@ extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
                          const char *__restrict __format, ...);
 extern int __printf_chk (int __flag, const char *__restrict __format, ...);
 extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
-                          const char *__restrict __format, __gnuc_va_list __ap);
+                          const char *__restrict __format, __va_list __ap);
 extern int __vprintf_chk (int __flag, const char *__restrict __format,
-                         __gnuc_va_list __ap);
+                         __va_list __ap);
 
 # ifdef __va_arg_pack
 __fortify_function int
@@ -114,7 +114,7 @@ printf (const char *__restrict __fmt, ...)
 # endif
 
 __fortify_function int
-vprintf (const char *__restrict __fmt, __gnuc_va_list __ap)
+vprintf (const char *__restrict __fmt, __va_list __ap)
 {
 #ifdef __USE_EXTERN_INLINES
   return __vfprintf_chk (stdout, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
@@ -125,7 +125,7 @@ vprintf (const char *__restrict __fmt, __gnuc_va_list __ap)
 
 __fortify_function int
 vfprintf (FILE *__restrict __stream,
-         const char *__restrict __fmt, __gnuc_va_list __ap)
+         const char *__restrict __fmt, __va_list __ap)
 {
   return __vfprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
 }
@@ -134,7 +134,7 @@ vfprintf (FILE *__restrict __stream,
 extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
                          ...) __attribute__ ((__format__ (__printf__, 3, 4)));
 extern int __vdprintf_chk (int __fd, int __flag,
-                          const char *__restrict __fmt, __gnuc_va_list __arg)
+                          const char *__restrict __fmt, __va_list __arg)
      __attribute__ ((__format__ (__printf__, 3, 0)));
 
 #  ifdef __va_arg_pack
@@ -150,7 +150,7 @@ dprintf (int __fd, const char *__restrict __fmt, ...)
 #  endif
 
 __fortify_function int
-vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
+vdprintf (int __fd, const char *__restrict __fmt, __va_list __ap)
 {
   return __vdprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
 }
@@ -162,7 +162,7 @@ extern int __asprintf_chk (char **__restrict __ptr, int __flag,
                           const char *__restrict __fmt, ...)
      __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
 extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
-                           const char *__restrict __fmt, __gnuc_va_list __arg)
+                           const char *__restrict __fmt, __va_list __arg)
      __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
 extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
                                 int __flag, const char *__restrict __format,
@@ -171,7 +171,7 @@ extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
 extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
                                  int __flag,
                                  const char *__restrict __format,
-                                 __gnuc_va_list __args)
+                                 __va_list __args)
      __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
 
 #  ifdef __va_arg_pack
@@ -208,14 +208,14 @@ __NTH (obstack_printf (struct obstack *__restrict __obstack,
 
 __fortify_function int
 __NTH (vasprintf (char **__restrict __ptr, const char *__restrict __fmt,
-                 __gnuc_va_list __ap))
+                 __va_list __ap))
 {
   return __vasprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
 }
 
 __fortify_function int
 __NTH (obstack_vprintf (struct obstack *__restrict __obstack,
-                       const char *__restrict __fmt, __gnuc_va_list __ap))
+                       const char *__restrict __fmt, __va_list __ap))
 {
   return __obstack_vprintf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt,
                                __ap);
index 95618336558dc80f99e0d3c2780dffded705aaed..d956c016303a6e2615df132d45490fa170900425 100644 (file)
@@ -50,7 +50,7 @@ libc_hidden_proto (_IO_setvbuf)
 extern int _IO_sscanf (const char*, const char*, ...) __THROW;
 extern int _IO_sprintf (char *, const char*, ...) __THROW;
 extern int _IO_ungetc (int, FILE*) __THROW;
-extern int _IO_vsscanf (const char *, const char *, __gnuc_va_list) __THROW;
+extern int _IO_vsscanf (const char *, const char *, __va_list) __THROW;
 
 #define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN))
 #define _IO_fseek(__fp, __offset, __whence) \
index 37bc8f25c1f6e03865793a471f7105cefc21e0de..263a8cc88b83eb70547c9855fe3a7ac604c96355 100644 (file)
@@ -212,7 +212,7 @@ extern int _IO_ftrylockfile (FILE *) __THROW;
   (((_fp)->_flags2 & _IO_FLAGS2_NEED_LOCK) != 0)
 
 extern int _IO_vfscanf (FILE * __restrict, const char * __restrict,
-                       __gnuc_va_list, int *__restrict);
+                       __va_list, int *__restrict);
 extern __ssize_t _IO_padn (FILE *, int, __ssize_t);
 extern size_t _IO_sgetn (FILE *, void *, size_t);
 
@@ -253,7 +253,7 @@ weak_extern (_IO_stdin_used);
      __result; })
 
 extern int _IO_vfwscanf (FILE * __restrict, const wchar_t * __restrict,
-                        __gnuc_va_list, int *__restrict);
+                        __va_list, int *__restrict);
 extern __ssize_t _IO_wpadn (FILE *, wint_t, __ssize_t);
 extern void _IO_free_wbackup_area (FILE *) __THROW;
 
index 1a2cd4046bd5f33494e937db882ab64ded0f2ca4..eebb579d046dd0831cc2c0f792ca4aed73c043bc 100644 (file)
@@ -317,15 +317,15 @@ extern int sprintf (char *__restrict __s,
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
-                    __gnuc_va_list __arg);
+                    __va_list __arg);
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
+extern int vprintf (const char *__restrict __format, __va_list __arg);
 /* Write formatted output to S from argument list ARG.  */
 extern int vsprintf (char *__restrict __s, const char *__restrict __format,
-                    __gnuc_va_list __arg) __THROWNL;
+                    __va_list __arg) __THROWNL;
 
 #if defined __USE_ISOC99 || defined __USE_UNIX98
 /* Maximum chars of output to write in MAXLEN.  */
@@ -334,7 +334,7 @@ extern int snprintf (char *__restrict __s, size_t __maxlen,
      __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
 
 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
-                     const char *__restrict __format, __gnuc_va_list __arg)
+                     const char *__restrict __format, __va_list __arg)
      __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
 #endif
 
@@ -342,7 +342,7 @@ extern int vsnprintf (char *__restrict __s, size_t __maxlen,
 /* Write formatted output to a string dynamically allocated with `malloc'.
    Store the address of the string in *PTR.  */
 extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
-                     __gnuc_va_list __arg)
+                     __va_list __arg)
      __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
 extern int __asprintf (char **__restrict __ptr,
                       const char *__restrict __fmt, ...)
@@ -354,8 +354,7 @@ extern int asprintf (char **__restrict __ptr,
 
 #ifdef __USE_XOPEN2K8
 /* Write formatted output to a file descriptor.  */
-extern int vdprintf (int __fd, const char *__restrict __fmt,
-                    __gnuc_va_list __arg)
+extern int vdprintf (int __fd, const char *__restrict __fmt, __va_list __arg)
      __attribute__ ((__format__ (__printf__, 2, 0)));
 extern int dprintf (int __fd, const char *__restrict __fmt, ...)
      __attribute__ ((__format__ (__printf__, 2, 3)));
@@ -408,19 +407,19 @@ extern int __isoc99_sscanf (const char *__restrict __s,
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
-                   __gnuc_va_list __arg)
+                   __va_list __arg)
      __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
 
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
+extern int vscanf (const char *__restrict __format, __va_list __arg)
      __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
 
 /* Read formatted input from S into argument list ARG.  */
 extern int vsscanf (const char *__restrict __s,
-                   const char *__restrict __format, __gnuc_va_list __arg)
+                   const char *__restrict __format, __va_list __arg)
      __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
 
 /* Same redirection as above for the v*scanf family.  */
@@ -428,26 +427,26 @@ extern int vsscanf (const char *__restrict __s,
 #  if defined __REDIRECT && !defined __LDBL_COMPAT
 extern int __REDIRECT (vfscanf,
                       (FILE *__restrict __s,
-                       const char *__restrict __format, __gnuc_va_list __arg),
+                       const char *__restrict __format, __va_list __arg),
                       __isoc99_vfscanf)
      __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
 extern int __REDIRECT (vscanf, (const char *__restrict __format,
-                               __gnuc_va_list __arg), __isoc99_vscanf)
+                               __va_list __arg), __isoc99_vscanf)
      __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
 extern int __REDIRECT_NTH (vsscanf,
                           (const char *__restrict __s,
                            const char *__restrict __format,
-                           __gnuc_va_list __arg), __isoc99_vsscanf)
+                           __va_list __arg), __isoc99_vsscanf)
      __attribute__ ((__format__ (__scanf__, 2, 0)));
 #  elif !defined __REDIRECT
 extern int __isoc99_vfscanf (FILE *__restrict __s,
                             const char *__restrict __format,
-                            __gnuc_va_list __arg) __wur;
+                            __va_list __arg) __wur;
 extern int __isoc99_vscanf (const char *__restrict __format,
-                           __gnuc_va_list __arg) __wur;
+                           __va_list __arg) __wur;
 extern int __isoc99_vsscanf (const char *__restrict __s,
                             const char *__restrict __format,
-                            __gnuc_va_list __arg) __THROW;
+                            __va_list __arg) __THROW;
 #   define vfscanf __isoc99_vfscanf
 #   define vscanf __isoc99_vscanf
 #   define vsscanf __isoc99_vsscanf
@@ -806,7 +805,7 @@ extern int obstack_printf (struct obstack *__restrict __obstack,
      __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
 extern int obstack_vprintf (struct obstack *__restrict __obstack,
                            const char *__restrict __format,
-                           __gnuc_va_list __args)
+                           __va_list __args)
      __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
 #endif /* Use GNU.  */
 
index aef6d67ec39959ecb1bb21ea602bc3eda1c65b63..df13647b0cfb8c440c405913a2f6d725b9830d70 100644 (file)
@@ -23,7 +23,7 @@
 /* Write formatted output to stdout according to the
    format string FORMAT, using the argument list in ARG.  */
 int
-__vwprintf (const wchar_t *format, __gnuc_va_list arg)
+__vwprintf (const wchar_t *format, __va_list arg)
 {
   return __vfwprintf_internal (stdout, format, arg, 0);
 }
index 0f0b628a33c59dd515b863b910e0c46691032f07..c15e50a1c198015b177af655449e9b9a24dffd86 100644 (file)
@@ -41,11 +41,11 @@ syslog (int __pri, const char *__fmt, ...)
 
 #ifdef __USE_MISC
 extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt,
-                          __gnuc_va_list __ap)
+                          __va_list __ap)
      __attribute__ ((__format__ (__printf__, 3, 0)));
 
 __fortify_function void
-vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
+vsyslog (int __pri, const char *__fmt, __va_list __ap)
 {
   __vsyslog_chk (__pri,  __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
 }
index aea734e98f0b5f72c3cb913eebf53e56a8730c18..9ea433e96193a2c2c67f0e15c4261bcd06f9faf5 100644 (file)
@@ -38,7 +38,7 @@ extern char *__progname;
 }
 
 void
-__vwarnx_internal (const char *format, __gnuc_va_list ap,
+__vwarnx_internal (const char *format, __va_list ap,
                   unsigned int mode_flags)
 {
   flockfile (stderr);
@@ -50,7 +50,7 @@ __vwarnx_internal (const char *format, __gnuc_va_list ap,
 }
 
 void
-__vwarn_internal (const char *format, __gnuc_va_list ap,
+__vwarn_internal (const char *format, __va_list ap,
                   unsigned int mode_flags)
 {
   int error = errno;
@@ -72,14 +72,14 @@ __vwarn_internal (const char *format, __gnuc_va_list ap,
 }
 
 void
-vwarn (const char *format, __gnuc_va_list ap)
+vwarn (const char *format, __va_list ap)
 {
   __vwarn_internal (format, ap, 0);
 }
 libc_hidden_def (vwarn)
 
 void
-vwarnx (const char *format, __gnuc_va_list ap)
+vwarnx (const char *format, __va_list ap)
 {
   __vwarnx_internal (format, ap, 0);
 }
@@ -100,7 +100,7 @@ warnx (const char *format, ...)
 libc_hidden_def (warnx)
 
 void
-verr (int status, const char *format, __gnuc_va_list ap)
+verr (int status, const char *format, __va_list ap)
 {
   vwarn (format, ap);
   exit (status);
@@ -108,7 +108,7 @@ verr (int status, const char *format, __gnuc_va_list ap)
 libc_hidden_def (verr)
 
 void
-verrx (int status, const char *format, __gnuc_va_list ap)
+verrx (int status, const char *format, __va_list ap)
 {
   vwarnx (format, ap);
   exit (status);
index 5503c4e175c7fed2655a6b8619bf98ff056ff86e..506a9f69534e86b250c62ce601ae35ac0c09ef54 100644 (file)
@@ -29,23 +29,23 @@ __BEGIN_DECLS
    and a newline, on stderr.  */
 extern void warn (const char *__format, ...)
      __attribute__ ((__format__ (__printf__, 1, 2)));
-extern void vwarn (const char *__format, __gnuc_va_list)
+extern void vwarn (const char *__format, __va_list)
      __attribute__ ((__format__ (__printf__, 1, 0)));
 
 /* Likewise, but without ": " and the standard error string.  */
 extern void warnx (const char *__format, ...)
      __attribute__ ((__format__ (__printf__, 1, 2)));
-extern void vwarnx (const char *__format, __gnuc_va_list)
+extern void vwarnx (const char *__format, __va_list)
      __attribute__ ((__format__ (__printf__, 1, 0)));
 
 /* Likewise, and then exit with STATUS.  */
 extern void err (int __status, const char *__format, ...)
      __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
-extern void verr (int __status, const char *__format, __gnuc_va_list)
+extern void verr (int __status, const char *__format, __va_list)
      __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
 extern void errx (int __status, const char *__format, ...)
      __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
-extern void verrx (int __status, const char *, __gnuc_va_list)
+extern void verrx (int __status, const char *, __va_list)
      __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
 
 #ifdef __LDBL_COMPAT
index f7b7a6743fd9f4d3b136cfbfbdcf2d123ab54bf6..f7a980bd7410cf5b8fd9dd91885197d067df99fc 100644 (file)
@@ -196,7 +196,7 @@ extern void syslog (int __pri, const char *__fmt, ...)
    cancellation point.  But due to similarity with an POSIX interface
    or due to the implementation it is a cancellation point and
    therefore not marked with __THROW.  */
-extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
+extern void vsyslog (int __pri, const char *__fmt, __va_list __ap)
      __attribute__ ((__format__ (__printf__, 2, 0)));
 #endif
 
index 5d4faac0f0b7b38ae1d766c5bedf60ac98cd6c0b..77253dfb1d4f11d5d1fee62542ff6ad30c679a35 100755 (executable)
@@ -692,7 +692,6 @@ HEADER_ALLOWED_INCLUDES = {
     "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
index 1ac342d0e5fe69ffaac00a3e8915728485ab033b..8e5d75179faf8e687ca1b149aeef900873c58db2 100644 (file)
@@ -86,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, __gnuc_va_list *__ap);
+typedef void printf_va_arg_function (void *__mem, __va_list *__ap);
 
 
 /* Register FUNC to be called to format SPEC specifiers; ARGINFO must be
index 79285bd7b27591cb607de09b43a80a2c61d9ea92..96b75565a17c7b252c816b40637265dcf0ba0fdd 100644 (file)
@@ -1,8 +1,47 @@
-#ifndef _BITS_NULL_H
-#define _BITS_NULL_H 1
+/* Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-/* We rely on the compiler's stddef.h to define NULL for us.  */
-#define __need_NULL
-#include <stddef.h>
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* There is no consensus among compilers as to the proper guard macro
+   for having defined NULL specifically ... except NULL itself.  */
+#ifndef NULL
+
+/* In C, ((void *)0) is the preferred choice for the expansion of
+   NULL, as it cannot be misinterpreted as an integer zero.  */
+#ifndef __cplusplus
+# define NULL ((void *)0)
+
+/* ((void *)0) cannot be used in C++.  In C++2011 and later, nullptr
+   is the preferred alternative, but programs are to be encouraged to
+   migrate away from both bare 0 and NULL to nullptr, so we do not
+   define NULL as nullptr.  Some compilers support an extension
+   keyword __null that will trigger diagnostics when used in a context
+   that expects an integer, but will also be treated as 0 for purposes
+   of diagnostics encouraging migration to nullptr.
+
+   The complexity of this #if is because clang++ always pretends to be
+   G++ and may also pretend to be one of several different Windows
+   compilers.  */
+#elif (defined __GNUG__ || defined __clang__) \
+  && !defined _MSC_VER && !defined __MINGW32__
+# define NULL __null
+
+/* Otherwise a bare 0 will have to do.  */
+#else
+# define NULL 0
+#endif
 
 #endif
index e3c53c3e0560bb1b43998c131b4b6e259233c7ec..ac5ab40fd33320e462bee96b31b06d569bf1feaa 100644 (file)
@@ -1,9 +1,47 @@
+/* Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
 #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
+/* If __builtin_va_list is available, use it.  There is no predefined
+   macro advertising the availability of this type.  It is known to be
+   available in GCC 3.0 and later.  It is also known to be available
+   in all released versions of clang.  */
+#if defined __clang__ || (defined __GNUC__ && __GNUC__ >= 3)
+
+typedef __builtin_va_list __va_list;
 
+#else
+
+/* Depending on the compiler, we may be able to persuade its stdarg.h
+   to define an implementation-namespace alias for va_list and nothing
+   else.  If this feature is not available, exposing everything
+   defined by stdarg.h is better than not defining __va_list at all.  */
+# define __need___va_list
+# include <stdarg.h>
+# undef __need___va_list
+
+# ifdef __GNUC_VA_LIST
+typedef __gnuc_va_list __va_list;
+# else
+typedef va_list __va_list;
+# endif
+#endif
+
+/* This must not be defined until _after_ possibly including stdarg.h.  */
+#define ____va_list_defined 1
 #endif
index 23a8b986d5f7d328ff24832c045b76a66e34fdf6..a1cb9d985aac6e45f8cc0aca3fa6c5736526f909 100644 (file)
@@ -1,9 +1,45 @@
-#ifndef __ptrdiff_t_defined
-#define __ptrdiff_t_defined 1
+/* Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-/* 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
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* The guard macro for this header must match the guard macro used by
+   the compiler's stddef.h for ptrdiff_t specifically.
+   GCC's stddef.h checks a long list of other macros as well as this
+   one, in order to accommodate many different C libraries, but clang's
+   stddef.h only looks for this macro.  Other compilers can reasonably
+   be expected to look for this macro as well.  */
+#ifndef _PTRDIFF_T
+
+#ifdef __PTRDIFF_TYPE__
+
+/* If the predefined macro __PTRDIFF_TYPE__ is available, use it.  */
+typedef __PTRDIFF_TYPE__ ptrdiff_t;
+
+#else
+
+/* Depending on the compiler, we may be able to persuade its stddef.h
+   to define ptrdiff_t and nothing else.  If this feature is not
+   available, exposing everything defined by stddef.h is better than
+   not defining ptrdiff_t at all.  */
+# define __need_ptrdiff_t
+# include <stddef.h>
+# undef __need_ptrdiff_t
+
+#endif
+
+/* This must not be defined until _after_ possibly including stddef.h.  */
+#define _PTRDIFF_T
 #endif
index e151458eb3f831c23be27189dfe8cdc20db85051..827ede397c89ad3b269009521119e6123f184ca9 100644 (file)
@@ -1,9 +1,45 @@
-#ifndef __size_t_defined
-#define __size_t_defined 1
+/* Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-/* 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
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* The guard macro for this header must match the guard macro used by
+   the compiler's stddef.h for size_t specifically.
+   GCC's stddef.h checks a long list of other macros as well as this
+   one, in order to accommodate many different C libraries, but clang's
+   stddef.h only looks for this macro.  Other compilers can reasonably
+   be expected to look for this macro as well.  */
+#ifndef _SIZE_T
+
+#ifdef __SIZE_TYPE__
+
+/* If the predefined macro __SIZE_TYPE__ is available, use it.  */
+typedef __SIZE_TYPE__ size_t;
+
+#else
+
+/* Depending on the compiler, we may be able to persuade its stddef.h
+   to define size_t and nothing else.  If this feature is not
+   available, exposing everything defined by stddef.h is better than
+   not defining size_t at all.  */
+# define __need_size_t
+# include <stddef.h>
+# undef __need_size_t
+
+#endif
+
+/* This must not be defined until _after_ possibly including stddef.h.  */
+#define _SIZE_T
 #endif
index 6f3acac3797c09dfcf24a95fd1849140006eac67..6e1db792804a127f5c9183dd0b88d3c977de2c4c 100644 (file)
@@ -1,6 +1,26 @@
-/* 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.  */
+/* Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* The guard macro for this header must match the guard macro used by
+   the compiler's stdarg.h for va_list specifically.
+   GCC's stdarg.h checks several other macros as well as this one, in
+   order to accommodate many different C libraries, but clang's
+   stdarg.h only looks for this macro.  Other compilers can reasonably
+   be expected to look for this macro as well.  */
 #ifndef _VA_LIST
 
 #include <bits/types/__va_list.h>
@@ -8,8 +28,9 @@
 /* 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;
+typedef __va_list va_list;
 # endif
-# define _VA_LIST
 
+/* This must not be defined until _after_ possibly including stdarg.h.  */
+# define _VA_LIST
 #endif
index 1e44e157cca9622b19dda2e18b2e0fb1465275bb..ba0f94f8035fa2a44f845a399576b00bee173d9a 100644 (file)
@@ -1,9 +1,50 @@
-#ifndef __wchar_t_defined
-#define __wchar_t_defined 1
+/* Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-/* 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
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* The guard macro for this header must match the guard macro used by
+   the compiler's stddef.h for wchar_t specifically.
+   GCC's stddef.h checks a long list of other macros as well as this
+   one, in order to accommodate many different C libraries, but clang's
+   stddef.h only looks for this macro.  Other compilers can reasonably
+   be expected to look for this macro as well.  */
+#ifndef _WCHAR_T
+
+#ifdef __cplusplus
+/* Do nothing; wchar_t is a built-in type and reserved word in C++.  */
+#else
+
+# ifdef __WCHAR_TYPE__
+
+/* If the predefined macro __WCHAR_TYPE__ is available, use it.  */
+typedef __WCHAR_TYPE__ wchar_t;
+
+# else
+
+/* Depending on the compiler, we may be able to persuade its stddef.h
+   to define wchar_t and nothing else.  If this feature is not
+   available, exposing everything defined by stddef.h is better than
+   not defining wchar_t at all.  */
+#  define __need_wchar_t
+#  include <stddef.h>
+#  undef __need_wchar_t
+
+# endif /* not __WCHAR_TYPE__ */
+#endif /* not __cplusplus */
+
+/* This must not be defined until _after_ possibly including stddef.h.  */
+#define _WCHAR_T
 #endif
index ef5ab18fe2ecb625084dbd5d9f3349a5b88ec75d..d5e8833c61fbf35446e87193f8f539786cc2d77e 100644 (file)
@@ -1036,14 +1036,14 @@ __nldbl_errx (int status, const char *format, ...)
 }
 
 void
-__nldbl_verr (int status, const char *format, __gnuc_va_list ap)
+__nldbl_verr (int status, const char *format, __va_list ap)
 {
   __vwarn_internal (format, ap, PRINTF_LDBL_IS_DBL);
   exit (status);
 }
 
 void
-__nldbl_verrx (int status, const char *format, __gnuc_va_list ap)
+__nldbl_verrx (int status, const char *format, __va_list ap)
 {
   __vwarnx_internal (format, ap, PRINTF_LDBL_IS_DBL);
   exit (status);
@@ -1062,13 +1062,13 @@ __nldbl_warnx (const char *format, ...)
 }
 
 void
-__nldbl_vwarn (const char *format, __gnuc_va_list ap)
+__nldbl_vwarn (const char *format, __va_list ap)
 {
   __vwarn_internal (format, ap, PRINTF_LDBL_IS_DBL);
 }
 
 void
-__nldbl_vwarnx (const char *format, __gnuc_va_list ap)
+__nldbl_vwarnx (const char *format, __va_list ap)
 {
   __vwarnx_internal (format, ap, PRINTF_LDBL_IS_DBL);
 }
index c2a01fcb9bad2f813d8093207fb29fce25071065..74ecdf50f8c81462bb33eaf6c369f464b231ffc7 100644 (file)
@@ -103,23 +103,23 @@ extern ssize_t __nldbl___vstrfmon_l (char *, size_t, locale_t, const char *,
 /* These don't use __typeof because they were not declared by the headers,
    since we don't compile with _FORTIFY_SOURCE.  */
 extern int __nldbl___vfprintf_chk (FILE *__restrict, int,
-                                  const char *__restrict, __gnuc_va_list);
+                                  const char *__restrict, __va_list);
 extern int __nldbl___vfwprintf_chk (FILE *__restrict, int,
-                                   const wchar_t *__restrict, __gnuc_va_list);
+                                   const wchar_t *__restrict, __va_list);
 extern int __nldbl___vsprintf_chk (char *__restrict, int, size_t,
-                                  const char *__restrict, __gnuc_va_list)
+                                  const char *__restrict, __va_list)
   __THROW;
 extern int __nldbl___vsnprintf_chk (char *__restrict, size_t, int, size_t,
-                                   const char *__restrict, __gnuc_va_list)
+                                   const char *__restrict, __va_list)
   __THROW;
 extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t,
-                                   const wchar_t *__restrict, __gnuc_va_list)
+                                   const wchar_t *__restrict, __va_list)
   __THROW;
-extern int __nldbl___vasprintf_chk (char **, int, const char *, __gnuc_va_list)
+extern int __nldbl___vasprintf_chk (char **, int, const char *, __va_list)
   __THROW;
-extern int __nldbl___vdprintf_chk (int, int, const char *, __gnuc_va_list);
+extern int __nldbl___vdprintf_chk (int, int, const char *, __va_list);
 extern int __nldbl___obstack_vprintf_chk (struct obstack *, int, const char *,
-                                         __gnuc_va_list) __THROW;
+                                         __va_list) __THROW;
 extern void __nldbl___vsyslog_chk (int, int, const char *, va_list);
 
 /* The original declarations of these were hidden by the including
index 86e8e23e76fc13c13620335131911ee768d93616..defd9b2189e270a674884589ed6b20f507ec0ccd 100644 (file)
@@ -303,17 +303,17 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
 extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
                            int __flag, size_t __s_len,
                            const wchar_t *__restrict __format,
-                           __gnuc_va_list __arg)
+                           __va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
 
 extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
                                (wchar_t *__restrict __s, size_t __n,
                                 const wchar_t *__restrict __fmt,
-                                __gnuc_va_list __ap), vswprintf);
+                                __va_list __ap), vswprintf);
 
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
-                 const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
+                 const wchar_t *__restrict __fmt, __va_list __ap))
 {
   if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
@@ -330,9 +330,9 @@ extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
                          ...);
 extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
                            const wchar_t *__restrict __format,
-                           __gnuc_va_list __ap);
+                           __va_list __ap);
 extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-                          __gnuc_va_list __ap);
+                          __va_list __ap);
 
 # ifdef __va_arg_pack
 __fortify_function int
@@ -355,14 +355,14 @@ fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...)
 # endif
 
 __fortify_function int
-vwprintf (const wchar_t *__restrict __fmt, __gnuc_va_list __ap)
+vwprintf (const wchar_t *__restrict __fmt, __va_list __ap)
 {
   return __vwprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap);
 }
 
 __fortify_function int
 vfwprintf (__FILE *__restrict __stream,
-          const wchar_t *__restrict __fmt, __gnuc_va_list __ap)
+          const wchar_t *__restrict __fmt, __va_list __ap)
 {
   return __vfwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
 }
index 71e53c8b4c4f72b439f391bd90d5d461beaa65cd..03572876ebe86b6a802dcf312591af97d1712642 100644 (file)
@@ -593,20 +593,20 @@ extern int swprintf (wchar_t *__restrict __s, size_t __n,
    marked with __THROW.  */
 extern int vfwprintf (__FILE *__restrict __s,
                      const wchar_t *__restrict __format,
-                     __gnuc_va_list __arg)
+                     __va_list __arg)
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwprintf (const wchar_t *__restrict __format,
-                    __gnuc_va_list __arg)
+                    __va_list __arg)
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
 extern int vswprintf (wchar_t *__restrict __s, size_t __n,
                      const wchar_t *__restrict __format,
-                     __gnuc_va_list __arg)
+                     __va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
 
 
@@ -666,19 +666,19 @@ extern int __isoc99_swscanf (const wchar_t *__restrict __s,
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
                     const wchar_t *__restrict __format,
-                    __gnuc_va_list __arg)
+                    __va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-                   __gnuc_va_list __arg)
+                   __va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
                     const wchar_t *__restrict __format,
-                    __gnuc_va_list __arg)
+                    __va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 
 /* Same redirection as above for the v*wscanf family.  */
@@ -688,24 +688,24 @@ extern int vswscanf (const wchar_t *__restrict __s,
 #  ifdef __REDIRECT
 extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
                                  const wchar_t *__restrict __format,
-                                 __gnuc_va_list __arg), __isoc99_vfwscanf)
+                                 __va_list __arg), __isoc99_vfwscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-                                __gnuc_va_list __arg), __isoc99_vwscanf)
+                                __va_list __arg), __isoc99_vwscanf)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
                                      const wchar_t *__restrict __format,
-                                     __gnuc_va_list __arg), __isoc99_vswscanf)
+                                     __va_list __arg), __isoc99_vswscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 #  else
 extern int __isoc99_vfwscanf (__FILE *__restrict __s,
                              const wchar_t *__restrict __format,
-                             __gnuc_va_list __arg);
+                             __va_list __arg);
 extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-                            __gnuc_va_list __arg);
+                            __va_list __arg);
 extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
                              const wchar_t *__restrict __format,
-                             __gnuc_va_list __arg) __THROW;
+                             __va_list __arg) __THROW;
 #   define vfwscanf __isoc99_vfwscanf
 #   define vwscanf __isoc99_vwscanf
 #   define vswscanf __isoc99_vswscanf