Bug #3721
closedsys/ctype.h should pragma inline isxdigit
0%
Description
The file sys/ctype.h contains what appears to be a typographical error resulting from over-vigorous copying and pasting, resulting in isdigit being inlined twice and isxdigit not at all.
Witness:
static boolean_t isdigit(char c) { return (ISDIGIT(c)); } #pragma inline(isdigit) static boolean_t isxdigit(char c) { return (ISXDIGIT(c)); } #pragma inline(isdigit)
Updated by Ian Collins about 9 years ago
Is the pragma necessary at all? Studio or gcc would inline these in an optimised build either way.
Updated by Rich Lowe about 9 years ago
For our own uses we intentionally try to prevent the compiler making inlining decisions we haven't directed. More than likely it does matter, in the sense that it really does affect whether it is inlined -- whether there's a noticable result is probably a bit more up in the air.
Note that GCC will ignore that pragma anyway.
Updated by Ian Collins about 9 years ago
Testing with the current Studio C compiler, the pragma is ignored. The function is inlined from -XO4. If the function is declared "static inline" it is inlined by Studio from -XO3. It is always inlined by gcc from -O1.
So the best fix appears to be "static inline".
Updated by Gary Mills about 6 years ago
The typographical error seems to have been corrected.
This bug can be closed.
Updated by Garrett D'Amore about 6 years ago
Fixed here:
commit 6b1aed11aada50610fd9f5a9e033c24ca7ee5f0c
Author: Richard PALO <richard@NetBSD.org>
Date: Sat Sep 5 13:08:15 2015 +0200
6201 cleanup issues between sys/ctype.h and sys/kobj_lex.h when both included
Reviewed by: Josef Sipek <jeffpc@josefsipek.net>
Approved by: Richard Lowe <richlowe@richlowe.net>