Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools headers: Update linux/ctype.h with the kernel sources

To pick up the changes in:

caabdd0f59a9771e ("ctype.h: remove duplicate isdigit() helper")

Addressing this perf build warning:

Warning: Kernel ABI header at 'tools/include/linux/ctype.h' differs from latest version at 'include/linux/ctype.h'
diff -u tools/include/linux/ctype.h include/linux/ctype.h

And we need to continue using the combination of:

inline __isdigit()
#define isdigit() __isdigit

When the __has_builtin() thing isn't available, as it is a builtin in
older systems with it as a builtin but with compilers not hacinv
__has_builtin(), rendering the __has_builtin() check useless otherwise.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+12 -5
+12 -5
tools/include/linux/ctype.h
··· 2 2 #ifndef _LINUX_CTYPE_H 3 3 #define _LINUX_CTYPE_H 4 4 5 + #include <linux/compiler.h> 6 + 5 7 /* 6 8 * NOTE! This ctype does not handle EOF like the standard C 7 9 * library is required to. ··· 25 23 #define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0) 26 24 #define isalpha(c) ((__ismask(c)&(_U|_L)) != 0) 27 25 #define iscntrl(c) ((__ismask(c)&(_C)) != 0) 28 - static inline int __isdigit(int c) 29 - { 30 - return '0' <= c && c <= '9'; 31 - } 32 - #define isdigit(c) __isdigit(c) 33 26 #define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0) 34 27 #define islower(c) ((__ismask(c)&(_L)) != 0) 35 28 #define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) ··· 36 39 37 40 #define isascii(c) (((unsigned char)(c))<=0x7f) 38 41 #define toascii(c) (((unsigned char)(c))&0x7f) 42 + 43 + #if __has_builtin(__builtin_isdigit) 44 + #define isdigit(c) __builtin_isdigit(c) 45 + #else 46 + static inline int __isdigit(int c) 47 + { 48 + return '0' <= c && c <= '9'; 49 + } 50 + #define isdigit(c) __isdigit(c) 51 + #endif 39 52 40 53 static inline unsigned char __tolower(unsigned char c) 41 54 {