2009-04-22 Eric Blake <ebb9@byu.net>
Trigger gcc warning if isFoo macros are called with plain char.
* libc/include/ctype.h (isalpha, isupper, islower, isdigit)
(isxdigit, isspace, ispunct, isalnum, isprint, isgraph)
(iscntrl, isblank): Rewrite to let 'gcc -Wall' warn when user
calls macro with a char argument.
--- ctype.h.orig 2009-04-22 13:39:01.702341400 -0600
+++ ctype.h 2009-04-22 15:19:08.381510200 -0600
@@ -45,22 +45,22 @@
extern __IMPORT char *__ctype_ptr__;
#ifndef __cplusplus
-#define isalpha(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_U|_L))
-#define isupper(c) (((__ctype_ptr__)[(unsigned)((c)+1)]&(_U|_L))
==_U)
-#define islower(c) (((__ctype_ptr__)[(unsigned)((c)+1)]&(_U|_L))
==_L)
-#define isdigit(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_N)
-#define isxdigit(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_X|_N))
-#define isspace(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_S)
-#define ispunct(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_P)
-#define isalnum(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_U|_L|_N))
-#define isprint(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_P|_U|_L|_N|_B))
-#define isgraph(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&
(_P|_U|_L|_N))
-#define iscntrl(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_C)
+#define isalpha(c) ((__ctype_ptr__+1)[c]&(_U|_L))
+#define isupper(c) (((__ctype_ptr__+1)[c]&(_U|_L))==_U)
+#define islower(c) (((__ctype_ptr__+1)[c]&(_U|_L))==_L)
+#define isdigit(c) ((__ctype_ptr__+1)[c]&_N)
+#define isxdigit(c) ((__ctype_ptr__+1)[c]&(_X|_N))
+#define isspace(c) ((__ctype_ptr__+1)[c]&_S)
+#define ispunct(c) ((__ctype_ptr__+1)[c]&_P)
+#define isalnum(c) ((__ctype_ptr__+1)[c]&(_U|_L|_N))
+#define isprint(c) ((__ctype_ptr__+1)[c]&(_P|_U|_L|_N|_B))
+#define isgraph(c) ((__ctype_ptr__+1)[c]&(_P|_U|_L|_N))
+#define iscntrl(c) ((__ctype_ptr__+1)[c]&_C)
#if defined(__GNUC__) && \
(!defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901L)
#define isblank(c) \
- __extension__ ({ int __c = (c); ((__ctype_ptr__)[(unsigned)((__c)+1)]
&_B) || (__c) == '\t';})
+ __extension__ ({ int __c = (c); ((__ctype_ptr__+1)[__c]&_B) || (__c)
== '\t';})
#endif