diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-03-23 02:00:13 +0900 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-03-26 02:04:07 +0900 |
commit | 379a8eb8eb1a55344e1cf976fa589a12c68b60a7 (patch) | |
tree | 4dd952c151fb0ce92689a8b94302fac9b3e4de8b /scripts | |
parent | 32a94b8b0c3e5ae575919850c5e49e936b704d45 (diff) | |
download | linux-stable-379a8eb8eb1a55344e1cf976fa589a12c68b60a7.tar.gz linux-stable-379a8eb8eb1a55344e1cf976fa589a12c68b60a7.tar.bz2 linux-stable-379a8eb8eb1a55344e1cf976fa589a12c68b60a7.zip |
kconfig: detect recursive inclusion earlier
Currently, the recursive inclusion is not detected when the offending
file is about to be included; it is detected the offending file is
about to include the *next* file. This is because the detection loop
does not involve the file being included.
Do this check against the file that is about to be included so that
the recursive inclusion is detected before unneeded parsing happens.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/kconfig/zconf.l | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 6f139d2dc65a..29b5d338d6bc 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -325,23 +325,25 @@ void zconf_nextfile(const char *name) buf->parent = current_buf; current_buf = buf; - for (iter = current_file->parent; iter; iter = iter->parent ) { - if (!strcmp(current_file->name,iter->name) ) { + file->parent = current_file; + + for (iter = current_file; iter; iter = iter->parent) { + if (!strcmp(iter->name, file->name)) { fprintf(stderr, "Recursive inclusion detected.\n" "Inclusion path:\n" - " current file : %s\n", zconf_curname()); - iter = current_file; + " current file : %s\n", file->name); + iter = file; do { iter = iter->parent; fprintf(stderr, " included from: %s:%d\n", iter->name, iter->lineno - 1); - } while (strcmp(iter->name, current_file->name)); + } while (strcmp(iter->name, file->name)); exit(1); } } + file->lineno = 1; - file->parent = current_file; current_file = file; } |