improve iswdigit macro to diagnose errors
authorRich Felker <dalias@aerifal.cx>
Sun, 3 May 2015 01:17:19 +0000 (21:17 -0400)
committerRich Felker <dalias@aerifal.cx>
Sun, 3 May 2015 01:19:08 +0000 (21:19 -0400)
this is analogous to commit 2ca55a93f2a11185d72dcb69006fd2c30b5c3144
for the macros in ctype.h.

include/wchar.h
include/wctype.h

index ad727a8..0167dce 100644 (file)
@@ -175,7 +175,7 @@ wctype_t  wctype(const char *);
 
 #ifndef __cplusplus
 #undef iswdigit
-#define iswdigit(a) ((unsigned)(a)-'0' < 10)
+#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
 #endif
 #endif
 
index 3da1219..bc2420d 100644 (file)
@@ -45,7 +45,7 @@ wctype_t  wctype(const char *);
 
 #ifndef __cplusplus
 #undef iswdigit
-#define iswdigit(a) (((unsigned)(a)-L'0') < 10)
+#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
 #endif
 
 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \