summaryrefslogtreecommitdiff
path: root/kconfig/zconf.l
diff options
context:
space:
mode:
authorChris Packham <judge.packham@gmail.com>2020-12-10 07:33:11 (GMT)
committerChris Packham <judge.packham@gmail.com>2021-02-02 07:06:32 (GMT)
commit07ae8dd48dfb19a7b89bc4c208bc5778c79ce446 (patch)
tree888ba269c7ed39b49015489ffdcc9da15d7ad2c8 /kconfig/zconf.l
parent51cb8939f830584b5b0db4f018dfa73e311308f6 (diff)
kconfig: Sync with upstream v4.16
This commit introduces the following upstream changes: 5ae6fcc4bb82 kconfig: fix line number in recursive inclusion error message 1a90ce36c6ef kconfig: Update ncurses package names for menuconfig bf0bbdcf1003 kconfig: Don't leak choice names during parsing f4bc1eefc160 kconfig: set SYMBOL_AUTO to the symbol marked with defconfig_list cd81fc82b93f kconfig: add xstrdup() helper 523ca58b7db2 kconfig: remove const qualifier from sym_expand_string_value() d717f24d8c68 kconfig: add xrealloc() helper 9e3e10c72536 kconfig: send error messages to stderr f3ff6fb5db68 kconfig: echo stdin to stdout if either is redirected d2a04648a5db kconfig: remove check_stdin() cd58a91def2a kconfig: remove 'config*' pattern from .gitignnore 4f208f392103 kconfig: show '?' prompt even if no help text is available cb67ab2cd2b8 kconfig: do not write choice values when their dependency becomes n 1b9eda2e4892 kconfig: Warn if help text is blank cedd55d49dee kconfig: Remove silentoldconfig from help and docs; fix kconfig/conf's help 1ccb27143360 kconfig: make "Selected by:" and "Implied by:" readable 312ee68752fa kconfig: announce removal of oldnoconfig if used d0fd0428ecf0 kconfig: fix make xconfig when gettext is missing b53688014e33 kconfig: Clarify menu and 'if' dependency propagation 9d1a9e8bc18b kconfig: Document 'if' flattening logic d3465af60f44 kconfig: Clarify choice dependency propagation 3e41ba05b6d6 kconfig: Document SYMBOL_OPTIONAL logic 765f4cdef6f8 kconfig: use default 'yy' prefix for lexer and parser 84dd95d4f87a kconfig: make conf_unsaved a local variable of conf_read() 5a3dc717b3c7 kconfig: make xfgets() really static 52e58a3caeba kconfig: make input_mode static 6479f327dea6 kconfig: Warn if there is more than one help text b92d804a5179 kconfig: drop 'boolean' keyword df60f4b92d3d kconfig: Remove menu_end_entry() 0735f7e5def2 kconfig: Document important expression functions 05cccce58045 kconfig: Document automatic submenu creation code 7cf33f88e294 kconfig: Fix choice symbol expression leak 5b1374b3b3c2 kconfig: Fix expr_free() E_NOT leak ae7440ef0c80 kconfig: Fix automatic menu creation mem leak 0724a7c32a54 kconfig: Don't leak main menus during parsing bc28fe1d5ede kconfig: Don't leak 'option' arguments during parsing 24161a6711c9 kconfig: Don't leak 'source' filenames during parsing 26e47a3c11a2 kconfig: Don't leak symbol names during parsing 29c833061c1d kconfig: generate lexer and parser during build instead of shipping e3b03bf29d6b kconfig: display recursive dependency resolution hint just once f77850d3fe0c kconfig: Clean up modules handling and fix crash fa8cedaef814 kconfig: Clarify expression rewriting 9a826842ff2f kconfig: Rename menu_check_dep() to rewrite_m() c873443430eb kconfig: Sync zconf.y with zconf.tab.c_shipped 52aede4ba5ef kconfig: Document the 'symbol' struct 33ca1a248663 kconfig: Document the 'menu' struct 2c37e08464a8 kconfig: Warn if choice default is not in choice Signed-off-by: Chris Packham <judge.packham@gmail.com>
Diffstat (limited to 'kconfig/zconf.l')
-rw-r--r--kconfig/zconf.l51
1 files changed, 25 insertions, 26 deletions
diff --git a/kconfig/zconf.l b/kconfig/zconf.l
index c410d25..88b650e 100644
--- a/kconfig/zconf.l
+++ b/kconfig/zconf.l
@@ -52,7 +52,7 @@ static void append_string(const char *str, int size)
if (new_size > text_asize) {
new_size += START_STRSIZE - 1;
new_size &= -START_STRSIZE;
- text = realloc(text, new_size);
+ text = xrealloc(text, new_size);
text_asize = new_size;
}
memcpy(text + text_size, str, size);
@@ -106,11 +106,11 @@ n [A-Za-z0-9_-]
current_pos.file = current_file;
current_pos.lineno = current_file->lineno;
if (id && id->flags & TF_COMMAND) {
- zconflval.id = id;
+ yylval.id = id;
return id->token;
}
alloc_string(yytext, yyleng);
- zconflval.string = text;
+ yylval.string = text;
return T_WORD;
}
. warn_ignored_character(*yytext);
@@ -142,11 +142,11 @@ n [A-Za-z0-9_-]
({n}|[/.])+ {
const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
if (id && id->flags & TF_PARAM) {
- zconflval.id = id;
+ yylval.id = id;
return id->token;
}
alloc_string(yytext, yyleng);
- zconflval.string = text;
+ yylval.string = text;
return T_WORD;
}
#.* /* comment */
@@ -161,7 +161,7 @@ n [A-Za-z0-9_-]
<STRING>{
[^'"\\\n]+/\n {
append_string(yytext, yyleng);
- zconflval.string = text;
+ yylval.string = text;
return T_WORD_QUOTE;
}
[^'"\\\n]+ {
@@ -169,7 +169,7 @@ n [A-Za-z0-9_-]
}
\\.?/\n {
append_string(yytext + 1, yyleng - 1);
- zconflval.string = text;
+ yylval.string = text;
return T_WORD_QUOTE;
}
\\.? {
@@ -178,13 +178,15 @@ n [A-Za-z0-9_-]
\'|\" {
if (str == yytext[0]) {
BEGIN(PARAM);
- zconflval.string = text;
+ yylval.string = text;
return T_WORD_QUOTE;
} else
append_string(yytext, 1);
}
\n {
- printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
+ fprintf(stderr,
+ "%s:%d:warning: multi-line strings not supported\n",
+ zconf_curname(), zconf_lineno());
current_file->lineno++;
BEGIN(INITIAL);
return T_EOL;
@@ -261,7 +263,7 @@ void zconf_starthelp(void)
static void zconf_endhelp(void)
{
- zconflval.string = text;
+ yylval.string = text;
BEGIN(INITIAL);
}
@@ -294,7 +296,7 @@ void zconf_initscan(const char *name)
{
yyin = zconf_fopen(name);
if (!yyin) {
- printf("can't find file %s\n", name);
+ fprintf(stderr, "can't find file %s\n", name);
exit(1);
}
@@ -315,8 +317,8 @@ void zconf_nextfile(const char *name)
current_buf->state = YY_CURRENT_BUFFER;
yyin = zconf_fopen(file->name);
if (!yyin) {
- printf("%s:%d: can't open file \"%s\"\n",
- zconf_curname(), zconf_lineno(), file->name);
+ fprintf(stderr, "%s:%d: can't open file \"%s\"\n",
+ zconf_curname(), zconf_lineno(), file->name);
exit(1);
}
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
@@ -325,20 +327,17 @@ void zconf_nextfile(const char *name)
for (iter = current_file->parent; iter; iter = iter->parent ) {
if (!strcmp(current_file->name,iter->name) ) {
- printf("%s:%d: recursive inclusion detected. "
- "Inclusion path:\n current file : '%s'\n",
- zconf_curname(), zconf_lineno(),
- zconf_curname());
- iter = current_file->parent;
- while (iter && \
- strcmp(iter->name,current_file->name)) {
- printf(" included from: '%s:%d'\n",
- iter->name, iter->lineno-1);
+ fprintf(stderr,
+ "%s:%d: recursive inclusion detected. "
+ "Inclusion path:\n current file : '%s'\n",
+ zconf_curname(), zconf_lineno(),
+ zconf_curname());
+ iter = current_file;
+ do {
iter = iter->parent;
- }
- if (iter)
- printf(" included from: '%s:%d'\n",
- iter->name, iter->lineno+1);
+ fprintf(stderr, " included from: '%s:%d'\n",
+ iter->name, iter->lineno - 1);
+ } while (strcmp(iter->name, current_file->name));
exit(1);
}
}