Skip to content

Commit 23cd954

Browse files
committed
tools headers: Update linux/ctype.h with the kernel sources
To pick up the changes in: caabdd0 ("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>
1 parent ffb9beb commit 23cd954

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

‎tools/include/linux/ctype.h‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#ifndef _LINUX_CTYPE_H
33
#define _LINUX_CTYPE_H
44

5+
#include <linux/compiler.h>
6+
57
/*
68
* NOTE! This ctype does not handle EOF like the standard C
79
* library is required to.
@@ -23,11 +25,6 @@ extern const unsigned char _ctype[];
2325
#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0)
2426
#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0)
2527
#define iscntrl(c) ((__ismask(c)&(_C)) != 0)
26-
static inline int __isdigit(int c)
27-
{
28-
return '0' <= c && c <= '9';
29-
}
30-
#define isdigit(c) __isdigit(c)
3128
#define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0)
3229
#define islower(c) ((__ismask(c)&(_L)) != 0)
3330
#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
@@ -40,6 +37,16 @@ static inline int __isdigit(int c)
4037
#define isascii(c) (((unsigned char)(c))<=0x7f)
4138
#define toascii(c) (((unsigned char)(c))&0x7f)
4239

40+
#if __has_builtin(__builtin_isdigit)
41+
#define isdigit(c) __builtin_isdigit(c)
42+
#else
43+
static inline int __isdigit(int c)
44+
{
45+
return '0' <= c && c <= '9';
46+
}
47+
#define isdigit(c) __isdigit(c)
48+
#endif
49+
4350
static inline unsigned char __tolower(unsigned char c)
4451
{
4552
if (isupper(c))

0 commit comments

Comments
 (0)