summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/lexer.l
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2024-02-02 16:58:08 +0100
committerMasahiro Yamada <masahiroy@kernel.org>2024-02-19 10:20:40 +0100
commit1d7c4f10baacbc658918f7ddec31e1d1962df6fc (patch)
tree6905e2bbb70bec0a7fb6e980a11aeba69b0c0b68 /scripts/kconfig/lexer.l
parentkconfig: replace current_pos with separate cur_{filename,lineno} (diff)
downloadlinux-1d7c4f10baacbc658918f7ddec31e1d1962df6fc.tar.xz
linux-1d7c4f10baacbc658918f7ddec31e1d1962df6fc.zip
kconfig: remove zconf_curname() and zconf_lineno()
Now zconf_curname() and zconf_lineno() are so simple that they just return cur_filename, cur_lineno, respectively. Remove these functions, and then use cur_filename and cur_lineno directly. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/kconfig/lexer.l')
-rw-r--r--scripts/kconfig/lexer.l20
1 files changed, 5 insertions, 15 deletions
diff --git a/scripts/kconfig/lexer.l b/scripts/kconfig/lexer.l
index 540098435a3b..3b3893f673dc 100644
--- a/scripts/kconfig/lexer.l
+++ b/scripts/kconfig/lexer.l
@@ -23,13 +23,13 @@
#define START_STRSIZE 16
/* The Kconfig file currently being parsed. */
-static const char *cur_filename;
+const char *cur_filename;
/*
* The line number of the current statement. This does not match yylineno.
* yylineno is used by the lexer, while cur_lineno is used by the parser.
*/
-static int cur_lineno;
+int cur_lineno;
static int prev_prev_token = T_EOL;
static int prev_token = T_EOL;
@@ -187,7 +187,7 @@ n [A-Za-z0-9_-]
\n {
fprintf(stderr,
"%s:%d:warning: multi-line strings not supported\n",
- zconf_curname(), zconf_lineno());
+ cur_filename, cur_lineno);
unput('\n');
BEGIN(INITIAL);
yylval.string = text;
@@ -423,12 +423,12 @@ void zconf_nextfile(const char *name)
yyin = zconf_fopen(file->name);
if (!yyin) {
fprintf(stderr, "%s:%d: can't open file \"%s\"\n",
- zconf_curname(), zconf_lineno(), file->name);
+ cur_filename, cur_lineno, file->name);
exit(1);
}
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
- current_file->lineno = zconf_lineno();
+ current_file->lineno = cur_lineno;
file->parent = current_file;
for (iter = current_file; iter; iter = iter->parent) {
@@ -468,13 +468,3 @@ static void zconf_endfile(void)
current_buf = current_buf->parent;
free(tmp);
}
-
-int zconf_lineno(void)
-{
- return cur_lineno;
-}
-
-const char *zconf_curname(void)
-{
- return cur_filename;
-}