Commit 72367933 authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 0bcc547e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -261,6 +261,10 @@ n [A-Za-z0-9_-]
<<EOF>>	{
	BEGIN(INITIAL);

	if (prev_token != T_EOL && prev_token != T_HELPTEXT)
		fprintf(stderr, "%s:%d:warning: no new line at end of file\n",
			current_file->name, yylineno);

	if (current_file) {
		zconf_endfile();
		return T_EOL;
+1 −1

File changed.

Contains only whitespace changes.