aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/lex.zconf.c_shipped
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/lex.zconf.c_shipped')
-rw-r--r--scripts/kconfig/lex.zconf.c_shipped33
1 files changed, 19 insertions, 14 deletions
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped
index 6eb039718259..d9182916f724 100644
--- a/scripts/kconfig/lex.zconf.c_shipped
+++ b/scripts/kconfig/lex.zconf.c_shipped
@@ -2363,11 +2363,11 @@ void zconf_initscan(const char *name)
2363 2363
2364 current_file = file_lookup(name); 2364 current_file = file_lookup(name);
2365 current_file->lineno = 1; 2365 current_file->lineno = 1;
2366 current_file->flags = FILE_BUSY;
2367} 2366}
2368 2367
2369void zconf_nextfile(const char *name) 2368void zconf_nextfile(const char *name)
2370{ 2369{
2370 struct file *iter;
2371 struct file *file = file_lookup(name); 2371 struct file *file = file_lookup(name);
2372 struct buffer *buf = malloc(sizeof(*buf)); 2372 struct buffer *buf = malloc(sizeof(*buf));
2373 memset(buf, 0, sizeof(*buf)); 2373 memset(buf, 0, sizeof(*buf));
@@ -2383,18 +2383,25 @@ void zconf_nextfile(const char *name)
2383 buf->parent = current_buf; 2383 buf->parent = current_buf;
2384 current_buf = buf; 2384 current_buf = buf;
2385 2385
2386 if (file->flags & FILE_BUSY) { 2386 for (iter = current_file->parent; iter; iter = iter->parent ) {
2387 printf("%s:%d: do not source '%s' from itself\n", 2387 if (!strcmp(current_file->name,iter->name) ) {
2388 zconf_curname(), zconf_lineno(), name); 2388 printf("%s:%d: recursive inclusion detected. "
2389 exit(1); 2389 "Inclusion path:\n current file : '%s'\n",
2390 } 2390 zconf_curname(), zconf_lineno(),
2391 if (file->flags & FILE_SCANNED) { 2391 zconf_curname());
2392 printf("%s:%d: file '%s' is already sourced from '%s'\n", 2392 iter = current_file->parent;
2393 zconf_curname(), zconf_lineno(), name, 2393 while (iter && \
2394 file->parent->name); 2394 strcmp(iter->name,current_file->name)) {
2395 exit(1); 2395 printf(" included from: '%s:%d'\n",
2396 iter->name, iter->lineno-1);
2397 iter = iter->parent;
2398 }
2399 if (iter)
2400 printf(" included from: '%s:%d'\n",
2401 iter->name, iter->lineno+1);
2402 exit(1);
2403 }
2396 } 2404 }
2397 file->flags |= FILE_BUSY;
2398 file->lineno = 1; 2405 file->lineno = 1;
2399 file->parent = current_file; 2406 file->parent = current_file;
2400 current_file = file; 2407 current_file = file;
@@ -2404,8 +2411,6 @@ static void zconf_endfile(void)
2404{ 2411{
2405 struct buffer *parent; 2412 struct buffer *parent;
2406 2413
2407 current_file->flags |= FILE_SCANNED;
2408 current_file->flags &= ~FILE_BUSY;
2409 current_file = current_file->parent; 2414 current_file = current_file->parent;
2410 2415
2411 parent = current_buf->parent; 2416 parent = current_buf->parent;