The isspace(3) man page is out of date
Keith Thompson <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <CAAHpriOJtTzYvQfE1Y1PSwi8PddS05M+pq-PxebdAndATr0PTg@mail.gmail.com> |
The isspace(3) man page incorrectly states that isspace(c) is defined only when isascii(c) is true or c is EOF. In fact, ISO C (going back to C89/C90) requires isspace(c) to work correctly when c is either within the range of unsigned char or equal to EOF (almost certainly 0..255 or -1 for systems supported by newlib). The implementation of isspace() is correct; this is only a documentation issue. The other is*() functions work correctly and are documented correctly. The following patch fixes this by copying the wording from isalpha(). I have *not* updated it to clarify just what "whitespace" means, but it would probably be a good idea. commit 932bca35395f3fc920b8d90b1f4bc07dc13efb93 (HEAD -> isspace-man-page) Author: Keith Thompson <[email protected]> Date: 2026-08-07 14:50:36 -0700 Correct isspace(3) man page (copied wording from isalpha(3)) diff --git newlib/libc/ctype/isspace.c newlib/libc/ctype/isspace.c index 0def2c0ce..784f4d7ae 100644 --- newlib/libc/ctype/isspace.c +++ newlib/libc/ctype/isspace.c @@ -18,7 +18,8 @@ SYNOPSIS DESCRIPTION <<isspace>> is a macro which classifies singlebyte charset values by table lookup. It is a predicate returning non-zero for whitespace -characters, and 0 for other characters. It is defined only when <<isascii>>(<[c]>) is true or <[c]> is EOF. +characters, and 0 for other characters. It is defined only if +<[c]> is representable as an unsigned char or if <[c]> is EOF. <<isspace_l>> is like <<isspace>> but performs the check based on the locale specified by the locale object locale. If <[locale]> is