criu: end pr_(err|warn|msg|info|debug) with \n

Unlike pr_perror, pr_err and other macros do not append \n
to the message being printed, so the caller needs to take care of it.

Sometimes it was not done, so let's add this manually.

To make sure it won't happen again, add a line to Makefile under the
linter target to check for such missing \n. NOTE this check is only
done for part of such cases (where the pr_* statement fits in one line
and there's no comment after), but it's better than nothing.

Add comments after pr_msg and pr_info statements where we deliberately
don't add \n, so that the above check ignores them.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2021-04-22 17:57:49 -07:00 committed by Andrei Vagin
parent 96b7178bab
commit f10425e053
10 changed files with 15 additions and 13 deletions

View file

@ -411,6 +411,8 @@ lint:
! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>.*%m'
# Do not use errno with pr_perror or fail
! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>\(".*".*errno'
# End pr_(err|warn|msg|info|debug) with \n
! git --no-pager grep -En '^\s*\<pr_(err|warn|msg|info|debug)\>.*);$$' | grep -v '\\n'
# No EOL whitespace for C files
! git --no-pager grep -E '\s+$$' \*.c \*.h
.PHONY: lint