* [PATCH] kconfig: fix line number in recursive inclusion error message
@ 2018-03-02 7:05 Masahiro Yamada
2018-03-02 9:43 ` Ulf Magnusson
2018-03-03 15:34 ` Masahiro Yamada
0 siblings, 2 replies; 3+ messages in thread
From: Masahiro Yamada @ 2018-03-02 7:05 UTC (permalink / raw)
To: linux-kbuild
Cc: Sam Ravnborg, Ulf Magnusson, Randy Dunlap, Masahiro Yamada, linux-kernel
When recursive inclusion is detected, the line number of the last
'included from:' is wrong.
[Test Case]
Kconfig:
-------->8--------
source "Kconfig2"
-------->8--------
Kconfig2:
-------->8--------
source "Kconfig3"
-------->8--------
Kconfig3:
-------->8--------
source "Kconfig"
-------->8--------
[Result]
$ make allyesconfig
scripts/kconfig/conf --allyesconfig Kconfig
Kconfig:1: recursive inclusion detected. Inclusion path:
current file : 'Kconfig'
included from: 'Kconfig3:1'
included from: 'Kconfig2:1'
included from: 'Kconfig:3'
scripts/kconfig/Makefile:89: recipe for target 'allyesconfig' failed
make[1]: *** [allyesconfig] Error 1
Makefile:512: recipe for target 'allyesconfig' failed
make: *** [allyesconfig] Error 2
where we expect
current file : 'Kconfig'
included from: 'Kconfig3:1'
included from: 'Kconfig2:1'
included from: 'Kconfig:1'
The 'iter->lineno+1' in the second fpinrtf() should be 'iter->lineno-1'.
I refactored the code to merge two fprintf().
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
scripts/kconfig/zconf.l | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index 02de6fe..88b650e 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -332,16 +332,12 @@ void zconf_nextfile(const char *name)
"Inclusion path:\n current file : '%s'\n",
zconf_curname(), zconf_lineno(),
zconf_curname());
- iter = current_file->parent;
- while (iter && \
- strcmp(iter->name,current_file->name)) {
- fprintf(stderr, " included from: '%s:%d'\n",
- iter->name, iter->lineno-1);
+ iter = current_file;
+ do {
iter = iter->parent;
- }
- if (iter)
fprintf(stderr, " included from: '%s:%d'\n",
- iter->name, iter->lineno+1);
+ iter->name, iter->lineno - 1);
+ } while (strcmp(iter->name, current_file->name));
exit(1);
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kconfig: fix line number in recursive inclusion error message
2018-03-02 7:05 [PATCH] kconfig: fix line number in recursive inclusion error message Masahiro Yamada
@ 2018-03-02 9:43 ` Ulf Magnusson
2018-03-03 15:34 ` Masahiro Yamada
1 sibling, 0 replies; 3+ messages in thread
From: Ulf Magnusson @ 2018-03-02 9:43 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Linux Kbuild mailing list, Sam Ravnborg, Randy Dunlap,
Linux Kernel Mailing List
On Fri, Mar 2, 2018 at 8:05 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> When recursive inclusion is detected, the line number of the last
> 'included from:' is wrong.
>
> [Test Case]
>
> Kconfig:
> -------->8--------
> source "Kconfig2"
> -------->8--------
>
> Kconfig2:
> -------->8--------
> source "Kconfig3"
> -------->8--------
>
> Kconfig3:
> -------->8--------
> source "Kconfig"
> -------->8--------
>
> [Result]
>
> $ make allyesconfig
> scripts/kconfig/conf --allyesconfig Kconfig
> Kconfig:1: recursive inclusion detected. Inclusion path:
> current file : 'Kconfig'
> included from: 'Kconfig3:1'
> included from: 'Kconfig2:1'
> included from: 'Kconfig:3'
> scripts/kconfig/Makefile:89: recipe for target 'allyesconfig' failed
> make[1]: *** [allyesconfig] Error 1
> Makefile:512: recipe for target 'allyesconfig' failed
> make: *** [allyesconfig] Error 2
>
> where we expect
>
> current file : 'Kconfig'
> included from: 'Kconfig3:1'
> included from: 'Kconfig2:1'
> included from: 'Kconfig:1'
>
> The 'iter->lineno+1' in the second fpinrtf() should be 'iter->lineno-1'.
> I refactored the code to merge two fprintf().
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
> scripts/kconfig/zconf.l | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
> index 02de6fe..88b650e 100644
> --- a/scripts/kconfig/zconf.l
> +++ b/scripts/kconfig/zconf.l
> @@ -332,16 +332,12 @@ void zconf_nextfile(const char *name)
> "Inclusion path:\n current file : '%s'\n",
> zconf_curname(), zconf_lineno(),
> zconf_curname());
> - iter = current_file->parent;
> - while (iter && \
> - strcmp(iter->name,current_file->name)) {
> - fprintf(stderr, " included from: '%s:%d'\n",
> - iter->name, iter->lineno-1);
> + iter = current_file;
> + do {
> iter = iter->parent;
> - }
> - if (iter)
> fprintf(stderr, " included from: '%s:%d'\n",
> - iter->name, iter->lineno+1);
> + iter->name, iter->lineno - 1);
> + } while (strcmp(iter->name, current_file->name));
> exit(1);
> }
> }
> --
> 2.7.4
>
Much neater.
Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
Cheers,
Ulf
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kconfig: fix line number in recursive inclusion error message
2018-03-02 7:05 [PATCH] kconfig: fix line number in recursive inclusion error message Masahiro Yamada
2018-03-02 9:43 ` Ulf Magnusson
@ 2018-03-03 15:34 ` Masahiro Yamada
1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2018-03-03 15:34 UTC (permalink / raw)
To: Linux Kbuild mailing list
Cc: Sam Ravnborg, Ulf Magnusson, Randy Dunlap, Masahiro Yamada,
Linux Kernel Mailing List
2018-03-02 16:05 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> When recursive inclusion is detected, the line number of the last
> 'included from:' is wrong.
>
> [Test Case]
>
> Kconfig:
> -------->8--------
> source "Kconfig2"
> -------->8--------
>
> Kconfig2:
> -------->8--------
> source "Kconfig3"
> -------->8--------
>
> Kconfig3:
> -------->8--------
> source "Kconfig"
> -------->8--------
>
> [Result]
>
> $ make allyesconfig
> scripts/kconfig/conf --allyesconfig Kconfig
> Kconfig:1: recursive inclusion detected. Inclusion path:
> current file : 'Kconfig'
> included from: 'Kconfig3:1'
> included from: 'Kconfig2:1'
> included from: 'Kconfig:3'
> scripts/kconfig/Makefile:89: recipe for target 'allyesconfig' failed
> make[1]: *** [allyesconfig] Error 1
> Makefile:512: recipe for target 'allyesconfig' failed
> make: *** [allyesconfig] Error 2
>
> where we expect
>
> current file : 'Kconfig'
> included from: 'Kconfig3:1'
> included from: 'Kconfig2:1'
> included from: 'Kconfig:1'
>
> The 'iter->lineno+1' in the second fpinrtf() should be 'iter->lineno-1'.
> I refactored the code to merge two fprintf().
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
Applied to linux-kbuild/fixes.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-03 15:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-02 7:05 [PATCH] kconfig: fix line number in recursive inclusion error message Masahiro Yamada
2018-03-02 9:43 ` Ulf Magnusson
2018-03-03 15:34 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).