summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1996-05-01 00:40:10 +0000
committerbde <bde@FreeBSD.org>1996-05-01 00:40:10 +0000
commit7dbb860b71d5e74ddb0d45595db60de4bc241b0f (patch)
treeb4f19035144b5bb4ec62efb83042948423f85486
parent5dcde3c31e6bf9d26659951b3186af43009e44d4 (diff)
downloadFreeBSD-src-7dbb860b71d5e74ddb0d45595db60de4bc241b0f.zip
FreeBSD-src-7dbb860b71d5e74ddb0d45595db60de4bc241b0f.tar.gz
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.
-rw-r--r--include/_ctype.h28
-rw-r--r--include/ctype.h28
-rw-r--r--include/runetype.h14
-rw-r--r--include/stddef.h10
-rw-r--r--include/stdlib.h10
-rw-r--r--lib/libc/locale/runetype.c3
-rw-r--r--lib/libc/locale/tolower.c6
-rw-r--r--lib/libc/locale/toupper.c5
8 files changed, 56 insertions, 48 deletions
diff --git a/include/_ctype.h b/include/_ctype.h
index e875705..e14e514 100644
--- a/include/_ctype.h
+++ b/include/_ctype.h
@@ -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 */
diff --git a/include/ctype.h b/include/ctype.h
index e875705..e14e514 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -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 */
diff --git a/include/runetype.h b/include/runetype.h
index 057cc35..e7fdf5d 100644
--- a/include/runetype.h
+++ b/include/runetype.h
@@ -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))
diff --git a/include/stddef.h b/include/stddef.h
index 70af689..38a7736 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -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
diff --git a/include/stdlib.h b/include/stdlib.h
index 3f1d648..069656d 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -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
diff --git a/lib/libc/locale/runetype.c b/lib/libc/locale/runetype.c
index a9bba8e..282f806 100644
--- a/lib/libc/locale/runetype.c
+++ b/lib/libc/locale/runetype.c
@@ -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);
}
-
diff --git a/lib/libc/locale/tolower.c b/lib/libc/locale/tolower.c
index f8d1623..65d5175 100644
--- a/lib/libc/locale/tolower.c
+++ b/lib/libc/locale/tolower.c
@@ -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);
}
-
-
diff --git a/lib/libc/locale/toupper.c b/lib/libc/locale/toupper.c
index 9e60977..d2e4480 100644
--- a/lib/libc/locale/toupper.c
+++ b/lib/libc/locale/toupper.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);
}
-
OpenPOWER on IntegriCloud