diff options
Diffstat (limited to 'scripts/kconfig/lex.zconf.c_shipped')
-rw-r--r-- | scripts/kconfig/lex.zconf.c_shipped | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped index fdc7113b08d1..d9182916f724 100644 --- a/scripts/kconfig/lex.zconf.c_shipped +++ b/scripts/kconfig/lex.zconf.c_shipped | |||
@@ -2363,37 +2363,45 @@ 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 | ||
2369 | void zconf_nextfile(const char *name) | 2368 | void 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)); |
2374 | 2374 | ||
2375 | current_buf->state = YY_CURRENT_BUFFER; | 2375 | current_buf->state = YY_CURRENT_BUFFER; |
2376 | zconfin = zconf_fopen(name); | 2376 | zconfin = zconf_fopen(file->name); |
2377 | if (!zconfin) { | 2377 | if (!zconfin) { |
2378 | printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name); | 2378 | printf("%s:%d: can't open file \"%s\"\n", |
2379 | zconf_curname(), zconf_lineno(), file->name); | ||
2379 | exit(1); | 2380 | exit(1); |
2380 | } | 2381 | } |
2381 | zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE)); | 2382 | zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE)); |
2382 | buf->parent = current_buf; | 2383 | buf->parent = current_buf; |
2383 | current_buf = buf; | 2384 | current_buf = buf; |
2384 | 2385 | ||
2385 | if (file->flags & FILE_BUSY) { | 2386 | for (iter = current_file->parent; iter; iter = iter->parent ) { |
2386 | printf("%s:%d: do not source '%s' from itself\n", | 2387 | if (!strcmp(current_file->name,iter->name) ) { |
2387 | zconf_curname(), zconf_lineno(), name); | 2388 | printf("%s:%d: recursive inclusion detected. " |
2388 | exit(1); | 2389 | "Inclusion path:\n current file : '%s'\n", |
2389 | } | 2390 | zconf_curname(), zconf_lineno(), |
2390 | if (file->flags & FILE_SCANNED) { | 2391 | zconf_curname()); |
2391 | printf("%s:%d: file '%s' is already sourced from '%s'\n", | 2392 | iter = current_file->parent; |
2392 | zconf_curname(), zconf_lineno(), name, | 2393 | while (iter && \ |
2393 | file->parent->name); | 2394 | strcmp(iter->name,current_file->name)) { |
2394 | 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 | } | ||
2395 | } | 2404 | } |
2396 | file->flags |= FILE_BUSY; | ||
2397 | file->lineno = 1; | 2405 | file->lineno = 1; |
2398 | file->parent = current_file; | 2406 | file->parent = current_file; |
2399 | current_file = file; | 2407 | current_file = file; |
@@ -2403,8 +2411,6 @@ static void zconf_endfile(void) | |||
2403 | { | 2411 | { |
2404 | struct buffer *parent; | 2412 | struct buffer *parent; |
2405 | 2413 | ||
2406 | current_file->flags |= FILE_SCANNED; | ||
2407 | current_file->flags &= ~FILE_BUSY; | ||
2408 | current_file = current_file->parent; | 2414 | current_file = current_file->parent; |
2409 | 2415 | ||
2410 | parent = current_buf->parent; | 2416 | parent = current_buf->parent; |
@@ -2422,7 +2428,7 @@ int zconf_lineno(void) | |||
2422 | return current_pos.lineno; | 2428 | return current_pos.lineno; |
2423 | } | 2429 | } |
2424 | 2430 | ||
2425 | char *zconf_curname(void) | 2431 | const char *zconf_curname(void) |
2426 | { | 2432 | { |
2427 | return current_pos.file ? current_pos.file->name : "<none>"; | 2433 | return current_pos.file ? current_pos.file->name : "<none>"; |
2428 | } | 2434 | } |