checkpatch: add a fixer for missing newline at eof

Remove the trailing error message from the fixed lines.

Link: https://lkml.kernel.org/r/20201017142546.28988-1-trix@redhat.com
Signed-off-by: Tom Rix <trix@redhat.com>
Acked-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Tom Rix 2020-12-15 20:44:40 -08:00 коммит произвёл Linus Torvalds
Родитель 7ebe1d173c
Коммит 47ca69b858
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -3418,8 +3418,11 @@ sub process {
# check for adding lines without a newline.
if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) {
WARN("MISSING_EOF_NEWLINE",
"adding a line without newline at end of file\n" . $herecurr);
if (WARN("MISSING_EOF_NEWLINE",
"adding a line without newline at end of file\n" . $herecurr) &&
$fix) {
fix_delete_line($fixlinenr+1, "No newline at end of file");
}
}
# check we are in a valid source file C or perl if not then ignore this hunk