Re: [PATCH 4/5] memblock test: fix implicit declaration of function 'isspace'

From: Mike Rapoport
Date: Sun Jul 28 2024 - 01:58:39 EST


On Thu, Jul 25, 2024 at 01:41:56AM +0000, Wei Yang wrote:
> Commit 1e4c64b71c9b ("mm/memblock: Add "reserve_mem" to reserved named
> memory at boot up") introduce usage of isspace().
>
> In kernel source code, memblock.c include the definition by
> debugfs.h/seq_file.h/string_helpers.h/ctype.h. Since it already has
> ctype.h in tools, let complete the include chain to fix the build error.

I think it's enough to include ctype.h in
tools/testing/memblock/linux/kernel.h

> Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
> ---
> tools/include/linux/debugfs.h | 2 ++
> tools/include/linux/seq_file.h | 2 ++
> tools/include/linux/string_helpers.h | 8 ++++++++
> 3 files changed, 12 insertions(+)
> create mode 100644 tools/include/linux/string_helpers.h
>
> diff --git a/tools/include/linux/debugfs.h b/tools/include/linux/debugfs.h
> index 4ba06140b1be..a99b0e0c5414 100644
> --- a/tools/include/linux/debugfs.h
> +++ b/tools/include/linux/debugfs.h
> @@ -2,4 +2,6 @@
> #ifndef _TOOLS_DEBUGFS_H
> #define _TOOLS_DEBUGFS_H
>
> +#include <linux/seq_file.h>
> +
> #endif
> diff --git a/tools/include/linux/seq_file.h b/tools/include/linux/seq_file.h
> index f6bc226af0c1..8614fc2ca695 100644
> --- a/tools/include/linux/seq_file.h
> +++ b/tools/include/linux/seq_file.h
> @@ -1,6 +1,8 @@
> #ifndef _TOOLS_INCLUDE_LINUX_SEQ_FILE_H
> #define _TOOLS_INCLUDE_LINUX_SEQ_FILE_H
>
> +#include <linux/string_helpers.h>
> +
> struct seq_file;
>
> #endif /* _TOOLS_INCLUDE_LINUX_SEQ_FILE_H */
> diff --git a/tools/include/linux/string_helpers.h b/tools/include/linux/string_helpers.h
> new file mode 100644
> index 000000000000..bc11a762be8c
> --- /dev/null
> +++ b/tools/include/linux/string_helpers.h
> @@ -0,0 +1,8 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _TOOLS_INCLUDE_LINUX_STRING_HELPERS_H
> +#define _TOOLS_INCLUDE_LINUX_STRING_HELPERS_H
> +
> +#include <linux/ctype.h>
> +
> +#endif /* _TOOLS_INCLUDE_LINUX_STRING_HELPERS_H */
> +
> --
> 2.34.1
>

--
Sincerely yours,
Mike.