From: Jim Meyering Date: Thu, 20 May 2010 09:13:41 +0000 (+0200) Subject: maint: prohibit newline at end of diagnostic X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=97d5c95d8e24be393ca5248182ca05933950127d;p=libvirt.git maint: prohibit newline at end of diagnostic * cfg.mk (sc_prohibit_newline_at_end_of_diagnostic): New rule. Idea proposed by Jiri Denemark. --- diff --git a/cfg.mk b/cfg.mk index 04719d434c..1ef73e2e82 100644 --- a/cfg.mk +++ b/cfg.mk @@ -389,6 +389,20 @@ sc_libvirt_unmarked_diagnostics: { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \ exit 1; } || : +# Like the above, but prohibit a newline at the end of a diagnostic. +# This is subject to false positives partly because it naively looks for +# `\n"', which may not be the end of the string, and also because it takes +# two lines of context (the -A2) after the line with the function name. +# FIXME: this rule might benefit from a separate function list, in case +# there are functions to which this one applies but that do not get marked +# diagnostics. +sc_prohibit_newline_at_end_of_diagnostic: + @grep -A2 -nE \ + '\<$(func_re) *\(' $$($(VC_LIST_EXCEPT)) \ + | grep '\\n"' \ + && { echo '$(ME): newline at end of message(s)' 1>&2; \ + exit 1; } || : + # Disallow trailing blank lines. sc_prohibit_trailing_blank_lines: @$(VC_LIST_EXCEPT) | xargs perl -ln -0777 -e \