Fixed longstanding namespace convolution involving rune_t vs wchar_t.
If _ANSI_SOURCE or _POSIX_SOURCE is defined, then <ctype.h> had to be included before <stddef.h> or <stdlib.h> to get rune_t declared. Now rune_t is declared perfectly bogusly in all cases when <ctype.h> is included. This change breaks similar (but more convoluted) convolutions in the stddef.h in gcc distributions. Ports of gcc should avoid using the gcc headers.
This commit is contained in:
parent
5dcde3c31e
commit
7dbb860b71
@ -116,11 +116,11 @@ __END_DECLS
|
||||
#define isspecial(c) __istype((c), _T)
|
||||
#endif
|
||||
|
||||
/* See comments in <machine/ansi.h> about _BSD_RUNE_T_. */
|
||||
/* See comments in <machine/ansi.h> about _BSD_CT_RUNE_T_. */
|
||||
__BEGIN_DECLS
|
||||
unsigned long ___runetype __P((_BSD_RUNE_T_));
|
||||
_BSD_RUNE_T_ ___tolower __P((_BSD_RUNE_T_));
|
||||
_BSD_RUNE_T_ ___toupper __P((_BSD_RUNE_T_));
|
||||
unsigned long ___runetype __P((_BSD_CT_RUNE_T_));
|
||||
_BSD_CT_RUNE_T_ ___tolower __P((_BSD_CT_RUNE_T_));
|
||||
_BSD_CT_RUNE_T_ ___toupper __P((_BSD_CT_RUNE_T_));
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
@ -139,28 +139,28 @@ __END_DECLS
|
||||
#if !defined(_DONT_USE_CTYPE_INLINE_) && \
|
||||
(defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus))
|
||||
static __inline int
|
||||
__istype(_BSD_RUNE_T_ _c, unsigned long _f)
|
||||
__istype(_BSD_CT_RUNE_T_ _c, unsigned long _f)
|
||||
{
|
||||
return (_c < 0 || _c >= _CACHED_RUNES) ? !!(___runetype(_c) & _f) :
|
||||
!!(_CurrentRuneLocale->runetype[_c] & _f);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
__isctype(_BSD_RUNE_T_ _c, unsigned long _f)
|
||||
__isctype(_BSD_CT_RUNE_T_ _c, unsigned long _f)
|
||||
{
|
||||
return (_c < 0 || _c >= _CACHED_RUNES) ? 0 :
|
||||
!!(_DefaultRuneLocale.runetype[_c] & _f);
|
||||
}
|
||||
|
||||
static __inline _BSD_RUNE_T_
|
||||
__toupper(_BSD_RUNE_T_ _c)
|
||||
static __inline _BSD_CT_RUNE_T_
|
||||
__toupper(_BSD_CT_RUNE_T_ _c)
|
||||
{
|
||||
return (_c < 0 || _c >= _CACHED_RUNES) ? ___toupper(_c) :
|
||||
_CurrentRuneLocale->mapupper[_c];
|
||||
}
|
||||
|
||||
static __inline _BSD_RUNE_T_
|
||||
__tolower(_BSD_RUNE_T_ _c)
|
||||
static __inline _BSD_CT_RUNE_T_
|
||||
__tolower(_BSD_CT_RUNE_T_ _c)
|
||||
{
|
||||
return (_c < 0 || _c >= _CACHED_RUNES) ? ___tolower(_c) :
|
||||
_CurrentRuneLocale->maplower[_c];
|
||||
@ -169,10 +169,10 @@ __tolower(_BSD_RUNE_T_ _c)
|
||||
#else /* not using inlines */
|
||||
|
||||
__BEGIN_DECLS
|
||||
int __istype __P((_BSD_RUNE_T_, unsigned long));
|
||||
int __isctype __P((_BSD_RUNE_T_, unsigned long));
|
||||
_BSD_RUNE_T_ __toupper __P((_BSD_RUNE_T_));
|
||||
_BSD_RUNE_T_ __tolower __P((_BSD_RUNE_T_));
|
||||
int __istype __P((_BSD_CT_RUNE_T_, unsigned long));
|
||||
int __isctype __P((_BSD_CT_RUNE_T_, unsigned long));
|
||||
_BSD_CT_RUNE_T_ __toupper __P((_BSD_CT_RUNE_T_));
|
||||
_BSD_CT_RUNE_T_ __tolower __P((_BSD_CT_RUNE_T_));
|
||||
__END_DECLS
|
||||
#endif /* using inlines */
|
||||
|
||||
|
@ -116,11 +116,11 @@ __END_DECLS
|
||||
#define isspecial(c) __istype((c), _T)
|
||||
#endif
|
||||
|
||||
/* See comments in <machine/ansi.h> about _BSD_RUNE_T_. */
|
||||
/* See comments in <machine/ansi.h> about _BSD_CT_RUNE_T_. */
|
||||
__BEGIN_DECLS
|
||||
unsigned long ___runetype __P((_BSD_RUNE_T_));
|
||||
_BSD_RUNE_T_ ___tolower __P((_BSD_RUNE_T_));
|
||||
_BSD_RUNE_T_ ___toupper __P((_BSD_RUNE_T_));
|
||||
unsigned long ___runetype __P((_BSD_CT_RUNE_T_));
|
||||
_BSD_CT_RUNE_T_ ___tolower __P((_BSD_CT_RUNE_T_));
|
||||
_BSD_CT_RUNE_T_ ___toupper __P((_BSD_CT_RUNE_T_));
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
@ -139,28 +139,28 @@ __END_DECLS
|
||||
#if !defined(_DONT_USE_CTYPE_INLINE_) && \
|
||||
(defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus))
|
||||
static __inline int
|
||||
__istype(_BSD_RUNE_T_ _c, unsigned long _f)
|
||||
__istype(_BSD_CT_RUNE_T_ _c, unsigned long _f)
|
||||
{
|
||||
return (_c < 0 || _c >= _CACHED_RUNES) ? !!(___runetype(_c) & _f) :
|
||||
!!(_CurrentRuneLocale->runetype[_c] & _f);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
__isctype(_BSD_RUNE_T_ _c, unsigned long _f)
|
||||
__isctype(_BSD_CT_RUNE_T_ _c, unsigned long _f)
|
||||
{
|
||||
return (_c < 0 || _c >= _CACHED_RUNES) ? 0 :
|
||||
!!(_DefaultRuneLocale.runetype[_c] & _f);
|
||||
}
|
||||
|
||||
static __inline _BSD_RUNE_T_
|
||||
__toupper(_BSD_RUNE_T_ _c)
|
||||
static __inline _BSD_CT_RUNE_T_
|
||||
__toupper(_BSD_CT_RUNE_T_ _c)
|
||||
{
|
||||
return (_c < 0 || _c >= _CACHED_RUNES) ? ___toupper(_c) :
|
||||
_CurrentRuneLocale->mapupper[_c];
|
||||
}
|
||||
|
||||
static __inline _BSD_RUNE_T_
|
||||
__tolower(_BSD_RUNE_T_ _c)
|
||||
static __inline _BSD_CT_RUNE_T_
|
||||
__tolower(_BSD_CT_RUNE_T_ _c)
|
||||
{
|
||||
return (_c < 0 || _c >= _CACHED_RUNES) ? ___tolower(_c) :
|
||||
_CurrentRuneLocale->maplower[_c];
|
||||
@ -169,10 +169,10 @@ __tolower(_BSD_RUNE_T_ _c)
|
||||
#else /* not using inlines */
|
||||
|
||||
__BEGIN_DECLS
|
||||
int __istype __P((_BSD_RUNE_T_, unsigned long));
|
||||
int __isctype __P((_BSD_RUNE_T_, unsigned long));
|
||||
_BSD_RUNE_T_ __toupper __P((_BSD_RUNE_T_));
|
||||
_BSD_RUNE_T_ __tolower __P((_BSD_RUNE_T_));
|
||||
int __istype __P((_BSD_CT_RUNE_T_, unsigned long));
|
||||
int __isctype __P((_BSD_CT_RUNE_T_, unsigned long));
|
||||
_BSD_CT_RUNE_T_ __toupper __P((_BSD_CT_RUNE_T_));
|
||||
_BSD_CT_RUNE_T_ __tolower __P((_BSD_CT_RUNE_T_));
|
||||
__END_DECLS
|
||||
#endif /* using inlines */
|
||||
|
||||
|
@ -39,13 +39,12 @@
|
||||
#ifndef _RUNETYPE_H_
|
||||
#define _RUNETYPE_H_
|
||||
|
||||
#include <machine/ansi.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <machine/ansi.h>
|
||||
|
||||
#ifdef _BSD_WCHAR_T_
|
||||
typedef _BSD_WCHAR_T_ rune_t;
|
||||
typedef _BSD_WCHAR_T_ wchar_t;
|
||||
#undef _BSD_WCHAR_T_
|
||||
#ifdef _BSD_RUNE_T_
|
||||
typedef _BSD_RUNE_T_ rune_t;
|
||||
#undef _BSD_RUNE_T_
|
||||
#endif
|
||||
|
||||
#ifdef _BSD_SIZE_T_
|
||||
@ -53,6 +52,11 @@ typedef _BSD_SIZE_T_ size_t;
|
||||
#undef _BSD_SIZE_T_
|
||||
#endif
|
||||
|
||||
#ifdef _BSD_WCHAR_T_
|
||||
typedef _BSD_WCHAR_T_ wchar_t;
|
||||
#undef _BSD_WCHAR_T_
|
||||
#endif
|
||||
|
||||
#define _CACHED_RUNES (1 <<8 ) /* Must be a power of 2 */
|
||||
#define _CRMASK (~(_CACHED_RUNES - 1))
|
||||
|
||||
|
@ -40,15 +40,19 @@
|
||||
|
||||
typedef _BSD_PTRDIFF_T_ ptrdiff_t;
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
|
||||
#ifdef _BSD_RUNE_T_
|
||||
typedef _BSD_RUNE_T_ rune_t;
|
||||
#undef _BSD_RUNE_T_
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _BSD_SIZE_T_
|
||||
typedef _BSD_SIZE_T_ size_t;
|
||||
#undef _BSD_SIZE_T_
|
||||
#endif
|
||||
|
||||
#ifdef _BSD_WCHAR_T_
|
||||
#ifndef _ANSI_SOURCE
|
||||
typedef _BSD_WCHAR_T_ rune_t;
|
||||
#endif
|
||||
typedef _BSD_WCHAR_T_ wchar_t;
|
||||
#undef _BSD_WCHAR_T_
|
||||
#endif
|
||||
|
@ -38,15 +38,19 @@
|
||||
|
||||
#include <machine/ansi.h>
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
|
||||
#ifdef _BSD_RUNE_T_
|
||||
typedef _BSD_RUNE_T_ rune_t;
|
||||
#undef _BSD_RUNE_T_
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _BSD_SIZE_T_
|
||||
typedef _BSD_SIZE_T_ size_t;
|
||||
#undef _BSD_SIZE_T_
|
||||
#endif
|
||||
|
||||
#ifdef _BSD_WCHAR_T_
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
|
||||
typedef _BSD_WCHAR_T_ rune_t;
|
||||
#endif
|
||||
typedef _BSD_WCHAR_T_ wchar_t;
|
||||
#undef _BSD_WCHAR_T_
|
||||
#endif
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
unsigned long
|
||||
___runetype(c)
|
||||
_BSD_RUNE_T_ c;
|
||||
_BSD_CT_RUNE_T_ c;
|
||||
{
|
||||
#ifdef XPG4
|
||||
int x;
|
||||
@ -62,4 +62,3 @@ ___runetype(c)
|
||||
#endif
|
||||
return(0L);
|
||||
}
|
||||
|
||||
|
@ -37,9 +37,9 @@
|
||||
#include <stdio.h>
|
||||
#include <rune.h>
|
||||
|
||||
_BSD_RUNE_T_
|
||||
_BSD_CT_RUNE_T_
|
||||
___tolower(c)
|
||||
_BSD_RUNE_T_ c;
|
||||
_BSD_CT_RUNE_T_ c;
|
||||
{
|
||||
#ifdef XPG4
|
||||
int x;
|
||||
@ -58,5 +58,3 @@ ___tolower(c)
|
||||
#endif
|
||||
return(c);
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,9 +37,9 @@
|
||||
#include <stdio.h>
|
||||
#include <rune.h>
|
||||
|
||||
_BSD_RUNE_T_
|
||||
_BSD_CT_RUNE_T_
|
||||
___toupper(c)
|
||||
_BSD_RUNE_T_ c;
|
||||
_BSD_CT_RUNE_T_ c;
|
||||
{
|
||||
#ifdef XPG4
|
||||
int x;
|
||||
@ -58,4 +58,3 @@ ___toupper(c)
|
||||
#endif
|
||||
return(c);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user