This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: [PATCH]: Don't define ctype is* and to* macro if C++
- To: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- Subject: Re: [PATCH]: Don't define ctype is* and to* macro if C++
- From: "J. Johnston" <jjohnstn at cygnus dot com>
- Date: Mon, 11 Jun 2001 17:54:21 -0400
- CC: newlib list <newlib at sources dot redhat dot com>
- Organization: Red Hat Inc.
- References: <20010606083039.10918.qmail@web14502.mail.yahoo.com>
Danny Smith wrote:
>
> islapha, islower, etc are (overloaded) functions in std C++. Defining these
> functions as macros breaks C++ code that uses these functions. See for
> eaxample:
> http://sources.redhat.com/ml/cygwin/2001-06/msg00296.html.
>
> Patch guards these macros with #ifndef __cplusplus
>
> Danny
>
Patch checked in.
Thanks,
-- Jeff J.
> ChangeLog
>
> 2001-05-06 Danny Smith <dannysmith@users.sourceforge.net>
>
> * /libc/include/ctype.h (is* and to* macros): Do not define if C++.
>
> --- ctype.h.orig Wed Apr 25 13:02:04 2001
> +++ ctype.h Wed Jun 06 21:11:32 2001
> @@ -38,6 +38,7 @@ int _EXFUN(_toupper, (int __c));
>
> extern __IMPORT _CONST char _ctype_[];
>
> +#ifndef __cplusplus
> #define isalpha(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L))
> #define isupper(c) ((_ctype_+1)[(unsigned)(c)]&_U)
> #define islower(c) ((_ctype_+1)[(unsigned)(c)]&_L)
> @@ -57,6 +58,7 @@ extern __IMPORT _CONST char _ctype_[];
> # define tolower(c) \
> __extension__ ({ int __x = (c); isupper(__x) ? (__x - 'A' + 'a') : __x;})
> #endif
> +#endif /* __cplusplus */
>
> #ifndef __STRICT_ANSI__
> #define isascii(c) ((unsigned)(c)<=0177)
>
> _____________________________________________________________________________
> http://messenger.yahoo.com.au - Yahoo! Messenger
> - Voice chat, mail alerts, stock quotes and favourite news and lots more!