]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
syntax-check: Enforce no linebreaks in VIR_WARN messages
authorPeter Krempa <pkrempa@redhat.com>
Mon, 11 May 2026 12:40:10 +0000 (14:40 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 12 May 2026 11:36:53 +0000 (13:36 +0200)
Since VIR_WARN doesn't use translatable messages, the
'sc_prohibit_error_message_on_multiple_lines' check doesn't catch those.

Introduce another check for VIR_WARN.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
build-aux/syntax-check.mk

index 022e8e6550c5367bdec8cbdcd55a651ee50c2ecd..6e222129442f40ac1c5f29a8e148e103f22acf1c 100644 (file)
@@ -478,6 +478,14 @@ sc_prohibit_error_message_on_multiple_lines:
        halt='found error message on multiple lines' \
        $(_sc_search_regexp)
 
+# Disallow VIR_WARN and other messagess on multiple lines, except when
+# they end with '\n'.
+sc_prohibit_warnings_on_multiple_lines:
+       @prohibit='VIR_WARN\("[^"]*"$$' \
+    exclude='\\n"$$' \
+       halt='found error message on multiple lines' \
+       $(_sc_search_regexp)
+
 # Look for diagnostics that lack a % in the format string, except that we
 # allow VIR_ERROR to do this, and ignore functions that take a single
 # string rather than a format argument.