]> xenbits.xensource.com Git - libvirt.git/commitdiff
maint: prohibit newline at end of diagnostic
authorJim Meyering <meyering@redhat.com>
Thu, 20 May 2010 09:13:41 +0000 (11:13 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 20 May 2010 13:44:44 +0000 (15:44 +0200)
* cfg.mk (sc_prohibit_newline_at_end_of_diagnostic): New rule.
Idea proposed by Jiri Denemark.

cfg.mk

diff --git a/cfg.mk b/cfg.mk
index 04719d434c312d0c1818799fa63ee72880f39c3a..1ef73e2e82b304d727aa5bd5411aad64f54120dd 100644 (file)
--- 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                    \