diff options
| author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2009-11-19 23:00:32 +0100 | 
|---|---|---|
| committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2009-11-19 23:00:32 +0100 | 
| commit | 8793e73bdbc8c9b4c4ad218bc9159eecf36ebcaa (patch) | |
| tree | 1187b38dbcb694e05ab4f23b288e2479cf541bd0 | |
| parent | ed4533ecdc7c39e8c6e7f1f3d4a0c00a8c1845a5 (diff) | |
SUSv4: disable isascii, toascii, _toupper, _tolower
[__]isascii need to be defined all the time for the build.
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| -rw-r--r-- | include/ctype.h | 33 | ||||
| -rw-r--r-- | libc/sysdeps/linux/common/bits/uClibc_ctype.h | 2 | ||||
| -rw-r--r-- | test/ctype/ctype.c | 2 | 
3 files changed, 25 insertions, 12 deletions
diff --git a/include/ctype.h b/include/ctype.h index 2d62847fe..dcfeb1b3e 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -66,7 +66,8 @@ libc_hidden_proto(tolower)  extern int toupper(int __c) __THROW;  libc_hidden_proto(toupper) -#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN +#if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) && \ +	defined __UCLIBC_SUSV4_LEGACY__  /* Return nonzero iff C is in the ASCII set     (i.e., is no more than 7 bits wide).  */  extern int isascii(int __c) __THROW; @@ -203,11 +204,12 @@ libc_hidden_proto(__ctype_tolower)  #endif /* __UCLIBC_HAS_XLOCALE__ */ - +#ifdef __UCLIBC_SUSV4_LEGACY__  #define	__isascii(c)	(((c) & ~0x7f) == 0)	/* If C is a 7 bit value.  */  #define	__toascii(c)	((c) & 0x7f)		/* Mask off high bits.  */ +#endif -#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc) +#ifdef _LIBC  /* These are uClibc-specific. */  #define __isdigit_char(C)    (((unsigned char)((C) - '0')) <= 9)  #define __isdigit_int(C)     (((unsigned int)((C) - '0')) <= 9) @@ -278,13 +280,12 @@ __NTH (toupper (int __c))  #  define toupper(c)	__tobody(c, toupper, __UCLIBC_CTYPE_TOUPPER, (c))  # endif /* Optimizing gcc */ -# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN +# if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) \ +	&& defined __UCLIBC_SUSV4_LEGACY__  #  define isascii(c)	__isascii (c)  #  define toascii(c)	__toascii (c) -#  if defined __UCLIBC_SUSV4_LEGACY__ -#    define _tolower(c)	((int) (__UCLIBC_CTYPE_TOLOWER)[(int) (c)]) -#    define _toupper(c)	((int) (__UCLIBC_CTYPE_TOUPPER)[(int) (c)]) -#   endif +#  define _tolower(c)	((int) (__UCLIBC_CTYPE_TOLOWER)[(int) (c)]) +#  define _toupper(c)	((int) (__UCLIBC_CTYPE_TOUPPER)[(int) (c)])  # endif  #endif /* not __cplusplus */ @@ -334,8 +335,8 @@ libc_hidden_proto(isxdigit_l)  extern int isblank_l(int, __locale_t) __THROW;  libc_hidden_proto(isblank_l) -# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN - +# if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) \ +	&& defined __UCLIBC_SUSV4_LEGACY__  /* Return nonzero iff C is in the ASCII set     (i.e., is no more than 7 bits wide).  */  extern int isascii_l (int __c) __THROW; @@ -378,7 +379,8 @@ libc_hidden_proto(toupper_l)  #  define __isxdigit_l(c,l)	__isctype_l((c), _ISxdigit, (l))  #  define __isblank_l(c,l)	__isctype_l((c), _ISblank, (l)) -#  if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN +#  if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) \ +	&& defined __UCLIBC_SUSV4_LEGACY__  #   define __isascii_l(c,l)	((l), __isascii (c))  #   define __toascii_l(c,l)	((l), __toascii (c))  #  endif @@ -396,7 +398,8 @@ libc_hidden_proto(toupper_l)  #  define isxdigit_l(c,l)	__isxdigit_l ((c), (l))  #  define isblank_l(c,l)	__isblank_l ((c), (l)) -#  if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN +#  if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) \ +	&& defined __UCLIBC_SUSV4_LEGACY__  #   define isascii_l(c,l)	__isascii_l ((c), (l))  #   define toascii_l(c,l)	__toascii_l ((c), (l))  #  endif @@ -409,4 +412,10 @@ __END_DECLS  #endif /* __UCLIBC_HAS_CTYPE_TABLES__ */ +/* We define {__,}isascii for internal use only */ +#if defined _LIBC && !defined __UCLIBC_SUSV4_LEGACY__ +# define __isascii(c) (((c) & ~0x7f) == 0) +# define isascii(c) __isascii (c) +#endif +  #endif /* ctype.h  */ diff --git a/libc/sysdeps/linux/common/bits/uClibc_ctype.h b/libc/sysdeps/linux/common/bits/uClibc_ctype.h index 43371286b..22d2df03a 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_ctype.h +++ b/libc/sysdeps/linux/common/bits/uClibc_ctype.h @@ -103,12 +103,14 @@ __BEGIN_DECLS  /* Now some non-ansi/iso c99 macros. */ +#ifndef __UCLIBC_SUSV4_LEGACY__  #define __isascii(c) (((c) & ~0x7f) == 0)  #define __toascii(c) ((c) & 0x7f)  /* Works correctly *only* on lowercase letters! */  #define _toupper(c) ((c) ^ 0x20)  /* Works correctly *only* on letters (of any case) and numbers */  #define _tolower(c) ((c) | 0x20) +#endif  __END_DECLS diff --git a/test/ctype/ctype.c b/test/ctype/ctype.c index 352b2d2c8..f38f722b2 100644 --- a/test/ctype/ctype.c +++ b/test/ctype/ctype.c @@ -56,6 +56,7 @@ int main( int argc, char **argv) +#ifdef __UCLIBC_SUSV4_LEGACY__  	/* isascii() */  	{  		int buffer[]={ 'a', 'z', 'A', 'Z', '\n', -1}; @@ -71,6 +72,7 @@ int main( int argc, char **argv)  			TEST( isascii(c)==0);  		}  	} +#endif  	/* iscntrl() */  | 
