standards/63371: [patch] isblank() not in C99/SUSv3 namespace

Stefan Farfeleder stefan at fafoe.narf.at
Wed Feb 25 16:00:35 PST 2004


>Number:         63371
>Category:       standards
>Synopsis:       [patch] isblank() not in C99/SUSv3 namespace
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 25 16:00:34 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Stefan Farfeleder
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
>Environment:
System: FreeBSD frog.fafoe.narf.at 5.2-CURRENT FreeBSD 5.2-CURRENT #25: Mon Feb 23 11:19:34 CET 2004 freebsd at frog.fafoe.narf.at:/freebsd/frog/obj/freebsd/frog/src/sys/FROG i386

>Description:
C99 standardised the isblank() macro/function which is currently protected by
the __BSD_VISIBLE macro and thus fails to be visible in a strict C99/SUSv3
compilation environment.

>How-To-Repeat:
$ cat isblank.c
#include <ctype.h>
int main(void) { return isblank('a'); }
$ c99 -D_C99_SOURCE isblank.c    
isblank.c: In function `main':
isblank.c:2: warning: implicit declaration of function `isblank'
$ c99 -D_POSIX_C_SOURCE=200112L isblank.c 
isblank.c: In function `main':
isblank.c:2: warning: implicit declaration of function `isblank'

>Fix:
--- isblank.diff begins here ---
Index: src/include/ctype.h
===================================================================
RCS file: /usr/home/ncvs/src/include/ctype.h,v
retrieving revision 1.24
diff -u -r1.24 ctype.h
--- src/include/ctype.h	9 Sep 2002 05:38:05 -0000	1.24
+++ src/include/ctype.h	25 Feb 2004 23:18:33 -0000
@@ -89,9 +89,12 @@
 int	toascii(int);
 #endif
 
+#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
+int	isblank(int);
+#endif
+
 #if __BSD_VISIBLE
 int	digittoint(int);
-int	isblank(int);
 int	ishexnumber(int);
 int	isideogram(int);
 int	isnumber(int);
@@ -133,9 +136,12 @@
 #define	toascii(c)	((c) & 0x7F)
 #endif
 
+#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
+#define	isblank(c)	__istype((c), _CTYPE_B)
+#endif
+
 #if __BSD_VISIBLE
 #define	digittoint(c)	__maskrune((c), 0xFF)
-#define	isblank(c)	__istype((c), _CTYPE_B)
 #define	ishexnumber(c)	__istype((c), _CTYPE_X)
 #define	isideogram(c)	__istype((c), _CTYPE_I)
 #define	isnumber(c)	__istype((c), _CTYPE_D)
--- isblank.diff ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-standards mailing list