diff --git a/scripts/kconfig/lexer.l b/scripts/kconfig/lexer.l index 240109f965aeb72362226845a4364294924c607a..6a08f5f147a48865535d5a12d585de580f2b4842 100644 --- a/scripts/kconfig/lexer.l +++ b/scripts/kconfig/lexer.l @@ -21,6 +21,11 @@ #define START_STRSIZE 16 +static const char *kconfig_white_list[] = { + "vendor/Kconfig", + "net/newip/Kconfig", +}; + static struct { struct file *file; int lineno; @@ -401,20 +406,35 @@ void zconf_initscan(const char *name) yylineno = 1; } +static bool zconf_in_whitelist(const char *path) +{ + int i; + for (i = 0; i < sizeof(kconfig_white_list) / sizeof(kconfig_white_list[0]); i++) { + if(strcmp(kconfig_white_list[i], path) == 0) + return true; + } + return false; +} + void zconf_nextfile(const char *name) { struct file *iter; struct file *file = file_lookup(name); - struct buffer *buf = xmalloc(sizeof(*buf)); - memset(buf, 0, sizeof(*buf)); - - current_buf->state = YY_CURRENT_BUFFER; - yyin = zconf_fopen(file->name); - if (!yyin) { + struct buffer *buf = NULL; + FILE *yyin_tmp = zconf_fopen(file->name); + if (!yyin_tmp) { + if (zconf_in_whitelist(name) == true) + return; fprintf(stderr, "%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), file->name); exit(1); } + + buf = xmalloc(sizeof(*buf)); + memset(buf, 0, sizeof(*buf)); + current_buf->state = YY_CURRENT_BUFFER; + yyin = yyin_tmp; + yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); buf->parent = current_buf; current_buf = buf; diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y index 421bb2fa6e51228a7d7d1762c79c9570c38e5b65..190f1117f35a2e7aa0c3ea4bcb4c98d1e4e96620 100644 --- a/scripts/kconfig/parser.y +++ b/scripts/kconfig/parser.y @@ -10,7 +10,6 @@ #include #include #include -#include #include "lkc.h" @@ -21,18 +20,11 @@ int cdebug = PRINTD; -static const char *kconfig_white_list[] = { - "vendor/Kconfig", - "net/newip/Kconfig", - "net/newip/hooks/Kconfig", -}; - static void yyerror(const char *err); static void zconfprint(const char *err, ...); static void zconf_error(const char *err, ...); static bool zconf_endtoken(const char *tokenname, const char *expected_tokenname); -static bool zconf_in_whitelist(const char *path); struct symbol *symbol_hash[SYMBOL_HASHSIZE]; @@ -375,9 +367,7 @@ menu_option_list: source_stmt: T_SOURCE T_WORD_QUOTE T_EOL { printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2); - if (access(($2), F_OK) == 0 || zconf_in_whitelist($2) == false) { - zconf_nextfile($2); - } + zconf_nextfile($2); free($2); }; @@ -494,16 +484,6 @@ assign_val: %% -static bool zconf_in_whitelist(const char *path) -{ - int i; - for (i = 0; i < sizeof(kconfig_white_list) / sizeof(kconfig_white_list[0]); i++) { - if(strcmp(kconfig_white_list[i], path) == 0) - return true; - } - return false; -} - void conf_parse(const char *name) { struct symbol *sym;