Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kconfig: fix line number in recursive inclusion detection

The error message shows a wrong line number if the 'source' directive
is wrapped to the following line.

[Test Code]

source \
"Kconfig"

This results in the following error message:

Recursive inclusion detected.
Inclusion path:
current file : Kconfig
included from: Kconfig:2

The correct message should be as follows:

Recursive inclusion detected.
Inclusion path:
current file : Kconfig
included from: Kconfig:1

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

+5 -4
+5 -4
scripts/kconfig/lexer.l
··· 33 33 struct buffer { 34 34 struct buffer *parent; 35 35 YY_BUFFER_STATE state; 36 + int yylineno; 36 37 }; 37 38 38 39 static struct buffer *current_buf; ··· 403 402 struct buffer *buf = xmalloc(sizeof(*buf)); 404 403 405 404 buf->state = YY_CURRENT_BUFFER; 405 + buf->yylineno = yylineno; 406 406 buf->parent = current_buf; 407 407 current_buf = buf; 408 408 yyin = zconf_fopen(file->name); ··· 414 412 } 415 413 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); 416 414 417 - current_file->lineno = yylineno; 415 + current_file->lineno = zconf_lineno(); 418 416 file->parent = current_file; 419 417 420 418 for (iter = current_file; iter; iter = iter->parent) { ··· 427 425 do { 428 426 iter = iter->parent; 429 427 fprintf(stderr, " included from: %s:%d\n", 430 - iter->name, iter->lineno - 1); 428 + iter->name, iter->lineno); 431 429 } while (strcmp(iter->name, file->name)); 432 430 exit(1); 433 431 } ··· 442 440 struct buffer *tmp; 443 441 444 442 current_file = current_file->parent; 445 - if (current_file) 446 - yylineno = current_file->lineno; 447 443 448 444 if (!current_buf) 449 445 return; ··· 449 449 fclose(yyin); 450 450 yy_delete_buffer(YY_CURRENT_BUFFER); 451 451 yy_switch_to_buffer(current_buf->state); 452 + yylineno = current_buf->yylineno; 452 453 tmp = current_buf; 453 454 current_buf = current_buf->parent; 454 455 free(tmp);