[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1523595999-27433-17-git-send-email-yamada.masahiro@socionext.com>
Date: Fri, 13 Apr 2018 14:06:25 +0900
From: Masahiro Yamada <yamada.masahiro@...ionext.com>
To: linux-kbuild@...r.kernel.org
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Sam Ravnborg <sam@...nborg.org>,
Ulf Magnusson <ulfalizer@...il.com>,
Nicholas Piggin <npiggin@...il.com>,
Kees Cook <keescook@...omium.org>,
Emese Revfy <re.emese@...il.com>, x86@...nel.org,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH 16/30] kconfig: add 'info' and 'warning' built-in functions
Add 'info' and 'warning' functions as in Make.
They print messages during parsing Kconfig files, which is useful
when debugging Kconfig at least.
Signed-off-by: Masahiro Yamada <yamada.masahiro@...ionext.com>
---
Changes in v3: None
Changes in v2: None
scripts/kconfig/preprocess.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c
index 85972fb..f8d06d9 100644
--- a/scripts/kconfig/preprocess.c
+++ b/scripts/kconfig/preprocess.c
@@ -203,6 +203,19 @@ static char *join_args(int argc, char *argv[])
return out;
}
+static char *do_info(int argc, char *argv[])
+{
+ char *msg;
+
+ msg = join_args(argc, argv);
+
+ printf("%s\n", msg);
+
+ free(msg);
+
+ return xstrdup("");
+}
+
static char *do_shell(int argc, char *argv[])
{
FILE *p;
@@ -244,8 +257,23 @@ static char *do_shell(int argc, char *argv[])
return xstrdup(buf);
}
+static char *do_warning(int argc, char *argv[])
+{
+ char *msg;
+
+ msg = join_args(argc, argv);
+
+ fprintf(stderr, "%s:%d: %s\n", current_file->name, yylineno, msg);
+
+ free(msg);
+
+ return xstrdup("");
+}
+
static const struct function function_table[] = {
+ { .name = "info", .func = do_info },
{ .name = "shell", .func = do_shell },
+ { .name = "warning", .func = do_warning },
};
static char *function_call(const char *name, int argc, char *argv[])
--
2.7.4
Powered by blists - more mailing lists