diff options
Diffstat (limited to 'wcsmbs/wchar.h')
-rw-r--r-- | wcsmbs/wchar.h | 119 |
1 files changed, 28 insertions, 91 deletions
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h index 79be9fc41d..d389428daa 100644 --- a/wcsmbs/wchar.h +++ b/wcsmbs/wchar.h @@ -21,82 +21,32 @@ */ #ifndef _WCHAR_H +#define _WCHAR_H 1 -#if !defined __need_mbstate_t && !defined __need_wint_t -# define _WCHAR_H 1 -# define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION -# include <bits/libc-header-start.h> -#endif +#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION +#include <bits/libc-header-start.h> -#ifdef _WCHAR_H -/* Get FILE definition. */ -# define __need___FILE -# if defined __USE_UNIX98 || defined __USE_XOPEN2K -# define __need_FILE -# endif -# include <stdio.h> -/* Get va_list definition. */ -# define __need___va_list -# include <stdarg.h> +#define __need_size_t +#define __need_wchar_t +#define __need_NULL +#include <stddef.h> -# include <bits/wchar.h> +#define __need___va_list +#include <stdarg.h> -/* Get size_t, wchar_t, wint_t and NULL from <stddef.h>. */ -# define __need_size_t -# define __need_wchar_t -# define __need_NULL -#endif -#if defined _WCHAR_H || defined __need_wint_t || !defined __WINT_TYPE__ -# undef __need_wint_t -# define __need_wint_t -# include <stddef.h> - -/* We try to get wint_t from <stddef.h>, but not all GCC versions define it - there. So define it ourselves if it remains undefined. */ -# ifndef _WINT_T -/* Integral type unchanged by default argument promotions that can - hold any value corresponding to members of the extended character - set, as well as at least one value that does not correspond to any - member of the extended character set. */ -# define _WINT_T -typedef unsigned int wint_t; -# endif +#include <bits/wchar.h> +#include <bits/types/wint_t.h> +#include <bits/types/mbstate_t.h> +#include <bits/types/__FILE.h> -/* Tell the caller that we provide correct C++ prototypes. */ -# if defined __cplusplus && __GNUC_PREREQ (4, 4) -# define __CORRECT_ISO_CPP_WCHAR_H_PROTO -# endif +#if defined __USE_UNIX98 || defined __USE_XOPEN2K +# include <bits/types/FILE.h> #endif -#if (defined _WCHAR_H || defined __need_mbstate_t) && !defined ____mbstate_t_defined -# define ____mbstate_t_defined 1 -/* Conversion state information. */ -typedef struct -{ - int __count; - union - { -# ifdef __WINT_TYPE__ - __WINT_TYPE__ __wch; -# else - wint_t __wch; -# endif - char __wchb[4]; - } __value; /* Value so far. */ -} __mbstate_t; +/* Tell the caller that we provide correct C++ prototypes. */ +#if defined __cplusplus && __GNUC_PREREQ (4, 4) +# define __CORRECT_ISO_CPP_WCHAR_H_PROTO #endif -#undef __need_mbstate_t - - -/* The rest of the file is only used if used if __need_mbstate_t is not - defined. */ -#ifdef _WCHAR_H - -# ifndef __mbstate_t_defined -/* Public type. */ -typedef __mbstate_t mbstate_t; -# define __mbstate_t_defined 1 -# endif #ifndef WCHAR_MIN /* These constants might also be defined in <inttypes.h>. */ @@ -108,13 +58,18 @@ typedef __mbstate_t mbstate_t; # define WEOF (0xffffffffu) #endif -/* For XPG4 compliance we have to define the stuff from <wctype.h> here - as well. */ -#if defined __USE_XOPEN && !defined __USE_UNIX98 -# include <wctype.h> +/* All versions of XPG prior to the publication of ISO C99 required + the bulk of <wctype.h>'s declarations to appear in this header + (because <wctype.h> did not exist prior to C99). In POSIX.1-2001 + those declarations were marked as XSI extensions; in -2008 they + were additionally marked as obsolescent. _GNU_SOURCE mode + anticipates the removal of these declarations in the next revision + of POSIX. */ +#if (defined __USE_XOPEN && !defined __USE_GNU \ + && !(defined __USE_XOPEN2K && !defined __USE_XOPEN2KXSI)) +# include <bits/wctype-wchar.h> #endif - __BEGIN_DECLS /* This incomplete type is defined in <time.h> but needed here because @@ -823,17 +778,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, __locale_t __loc) __THROW; # endif -/* The X/Open standard demands that most of the functions defined in - the <wctype.h> header must also appear here. This is probably - because some X/Open members wrote their implementation before the - ISO C standard was published and introduced the better solution. - We have to provide these definitions for compliance reasons but we - do this nonsense only if really necessary. */ -#if defined __USE_UNIX98 && !defined __USE_GNU -# define __need_iswxxx -# include <wctype.h> -#endif - /* Define some macros helping to catch buffer overflows. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function # include <bits/wchar2.h> @@ -845,11 +789,4 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, __END_DECLS -#endif /* _WCHAR_H defined */ - #endif /* wchar.h */ - -/* Undefine all __need_* constants in case we are included to get those - constants but the whole file was already read. */ -#undef __need_mbstate_t -#undef __need_wint_t |