[PATCH]: Don't define ctype is* and to* macro if C++

Danny Smith danny_r_smith_2001@yahoo.co.nz
Wed Jun 6 01:30:00 GMT 2001


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


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!



More information about the Newlib mailing list