diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-03-23 02:00:14 +0900 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-03-26 02:04:07 +0900 |
commit | 18492685e479fd4d8e1dca836f57c11b6800f083 (patch) | |
tree | aab2d26d2fef07d1b5009645ca16c766e4f7c90d /scripts/kconfig/lkc.h | |
parent | 379a8eb8eb1a55344e1cf976fa589a12c68b60a7 (diff) |
kconfig: use yylineno option instead of manual lineno increments
Tracking the line number by hand is error-prone since you need to
increment it in every \n matching pattern.
If '%option yylineno' is set, flex defines 'yylineno' to contain the
current line number and automatically updates it each time it reads a
\n character. This is much more convenient although the lexer does
not initializes yylineno, so you need to set it to 1 each time you
start reading a new file, and restore it you go back to the previous
file.
I tested this with DEBUG_PARSE, and confirmed the same dump message
was produced.
I removed the perf-report option. Otherwise, I see the following
message:
%option yylineno entails a performance penalty ONLY on rules that
can match newline characters
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/kconfig/lkc.h')
-rw-r--r-- | scripts/kconfig/lkc.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 2d5ec2d0e952..f4394af6e4b8 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -68,6 +68,7 @@ struct kconf_id { enum symbol_type stype; }; +extern int yylineno; void zconfdump(FILE *out); void zconf_starthelp(void); FILE *zconf_fopen(const char *name); |