diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-01-04 11:28:03 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-01-04 11:28:03 -0800 |
commit | a66b9a819ee8b6063df59b257a43d6dc109c9e87 (patch) | |
tree | cfb120a98c686578be2af4bde0dfd94bae4cc265 | |
parent | 7bf99d43e2326052ae969d4b979f22933bba6230 (diff) | |
download | klibc-a66b9a819ee8b6063df59b257a43d6dc109c9e87.tar.gz |
ctype.h: shut up new gcc warningklibc-1.5.15
Newer versions of gcc apparently considers it a warning offence if a
function with "extern inline" includes a "static inline" function,
even with "always_inline" attribute. Thus, use __must_inline and
change __must_inline to be extern inline (it shouldn't matter since it
is always inlined...)
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | usr/include/ctype.h | 59 | ||||
-rw-r--r-- | usr/include/klibc/compiler.h | 3 |
2 files changed, 32 insertions, 30 deletions
diff --git a/usr/include/ctype.h b/usr/include/ctype.h index b20548971cbb6..dfe1c46504359 100644 --- a/usr/include/ctype.h +++ b/usr/include/ctype.h @@ -8,6 +8,7 @@ #define _CTYPE_H #include <klibc/extern.h> +#include <klibc/compiler.h> /* * This relies on the following definitions: @@ -46,69 +47,69 @@ __extern int tolower(int); extern const unsigned char __ctypes[]; -static inline int __ctype_isalnum(int __c) +__must_inline int __ctype_isalnum(int __c) { return __ctypes[__c + 1] & (__ctype_upper | __ctype_lower | __ctype_digit); } -static inline int __ctype_isalpha(int __c) +__must_inline int __ctype_isalpha(int __c) { return __ctypes[__c + 1] & (__ctype_upper | __ctype_lower); } -static inline int __ctype_isascii(int __c) +__must_inline int __ctype_isascii(int __c) { return !(__c & ~0x7f); } -static inline int __ctype_isblank(int __c) +__must_inline int __ctype_isblank(int __c) { return (__c == '\t') || (__c == ' '); } -static inline int __ctype_iscntrl(int __c) +__must_inline int __ctype_iscntrl(int __c) { return __ctypes[__c + 1] & __ctype_cntrl; } -static inline int __ctype_isdigit(int __c) +__must_inline int __ctype_isdigit(int __c) { return ((unsigned)__c - '0') <= 9; } -static inline int __ctype_isgraph(int __c) +__must_inline int __ctype_isgraph(int __c) { return __ctypes[__c + 1] & (__ctype_upper | __ctype_lower | __ctype_digit | __ctype_punct); } -static inline int __ctype_islower(int __c) +__must_inline int __ctype_islower(int __c) { return __ctypes[__c + 1] & __ctype_lower; } -static inline int __ctype_isprint(int __c) +__must_inline int __ctype_isprint(int __c) { return __ctypes[__c + 1] & __ctype_print; } -static inline int __ctype_ispunct(int __c) +__must_inline int __ctype_ispunct(int __c) { return __ctypes[__c + 1] & __ctype_punct; } -static inline int __ctype_isspace(int __c) +__must_inline int __ctype_isspace(int __c) { return __ctypes[__c + 1] & __ctype_space; } -static inline int __ctype_isupper(int __c) +__must_inline int __ctype_isupper(int __c) { return __ctypes[__c + 1] & __ctype_upper; } -static inline int __ctype_isxdigit(int __c) +__must_inline int __ctype_isxdigit(int __c) { return __ctypes[__c + 1] & __ctype_xdigit; } @@ -117,12 +118,12 @@ static inline int __ctype_isxdigit(int __c) #define _toupper(__c) ((__c) & ~32) #define _tolower(__c) ((__c) | 32) -static inline int __ctype_toupper(int __c) +__must_inline int __ctype_toupper(int __c) { return __ctype_islower(__c) ? _toupper(__c) : __c; } -static inline int __ctype_tolower(int __c) +__must_inline int __ctype_tolower(int __c) { return __ctype_isupper(__c) ? _tolower(__c) : __c; } @@ -139,18 +140,18 @@ static inline int __ctype_tolower(int __c) #endif __CTYPEFUNC(isalnum) - __CTYPEFUNC(isalpha) - __CTYPEFUNC(isascii) - __CTYPEFUNC(isblank) - __CTYPEFUNC(iscntrl) - __CTYPEFUNC(isdigit) - __CTYPEFUNC(isgraph) - __CTYPEFUNC(islower) - __CTYPEFUNC(isprint) - __CTYPEFUNC(ispunct) - __CTYPEFUNC(isspace) - __CTYPEFUNC(isupper) - __CTYPEFUNC(isxdigit) - __CTYPEFUNC(toupper) - __CTYPEFUNC(tolower) +__CTYPEFUNC(isalpha) +__CTYPEFUNC(isascii) +__CTYPEFUNC(isblank) +__CTYPEFUNC(iscntrl) +__CTYPEFUNC(isdigit) +__CTYPEFUNC(isgraph) +__CTYPEFUNC(islower) +__CTYPEFUNC(isprint) +__CTYPEFUNC(ispunct) +__CTYPEFUNC(isspace) +__CTYPEFUNC(isupper) +__CTYPEFUNC(isxdigit) +__CTYPEFUNC(toupper) +__CTYPEFUNC(tolower) #endif /* _CTYPE_H */ diff --git a/usr/include/klibc/compiler.h b/usr/include/klibc/compiler.h index aba9a75ca79c9..816a4eed78724 100644 --- a/usr/include/klibc/compiler.h +++ b/usr/include/klibc/compiler.h @@ -21,9 +21,10 @@ #endif /* How to declare a function that *must* be inlined */ +/* Use "extern inline" even in the gcc3+ case to avoid warnings in ctype.h */ #ifdef __GNUC__ # if __GNUC__ >= 3 -# define __must_inline static __inline__ __attribute__((always_inline)) +# define __must_inline extern __inline__ __attribute__((always_inline)) # else # define __must_inline extern __inline__ # endif |