summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-12-11 06:00:51 -0500
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-12-15 03:44:35 -0500
commit723679339d087d79e36c0af67f4be84d866fee20 (patch)
tree24ac5bb0dba4d8d6fa092b7c5560f74f275f0a08 /scripts/kconfig
parent0bcc547ec4b03a0b66615694561cce9c5a9a1014 (diff)
kconfig: warn no new line at end of file
It would be nice to warn if a new line is missing at end of file. We could do this by checkpatch.pl for arbitrary files, but new line is rather essential as a statement terminator in Kconfig. The warning message looks like this: kernel/Kconfig.preempt:60:warning: no new line at end of file Currently, kernel/Kconfig.preempt is the only file with no new line at end of file. Fix it. I know there are some false negative cases. For example, no warning is displayed when the last line contains some whitespaces/comments, but no new line. Yet, this commit works well for most cases. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/kconfig')
-rw-r--r--scripts/kconfig/zconf.l4
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index 9038e9736bf0..8e856f9e6da9 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -261,6 +261,10 @@ n [A-Za-z0-9_-]
261<<EOF>> { 261<<EOF>> {
262 BEGIN(INITIAL); 262 BEGIN(INITIAL);
263 263
264 if (prev_token != T_EOL && prev_token != T_HELPTEXT)
265 fprintf(stderr, "%s:%d:warning: no new line at end of file\n",
266 current_file->name, yylineno);
267
264 if (current_file) { 268 if (current_file) {
265 zconf_endfile(); 269 zconf_endfile();
266 return T_EOL; 270 return T_EOL;