[libvirt] [PATCH v3 04/35] cfg.mk: single variable declaration per line when using cleanup macro

Sukrit Bhatnagar skrtbhtngr at gmail.com
Sat Jun 30 09:00:08 UTC 2018


Add rule to ensure that each variable declaration made using
a cleanup macro is in its own separate line.

Sometimes a variable might be initialized from a value returned
by a macro or a function, which may take on more than one
parameter, thereby introducing a comma, which might be mistaken
for multiple declarations in a line. This rule takes care of
that too.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr at gmail.com>
---
 cfg.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/cfg.mk b/cfg.mk
index d9e90d5..7949fc8 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1077,6 +1077,14 @@ sc_require_attribute_cleanup_scalar_type_space:
     halt='there must be exactly one space between the type and asterisk inside VIR_AUTOFREE' \
       $(_sc_search_regexp)
 
+# Rule to ensure that there is only one variable declaration in
+# a line when the variable is declared using a cleanup macro.
+sc_require_attribute_cleanup_one_per_line:
+	@prohibit='VIR_AUTO(FREE|PTR)\(.+\) ([^\(]*(, .*)+|[^\(]*\(.*\)(, .*)+);' \
+    in_vc_files='\.[chx]$$' \
+    halt='there must be only one variable declaration per line when using cleanup macro' \
+      $(_sc_search_regexp)
+
 # We don't use this feature of maint.mk.
 prev_version_file = /dev/null
 
-- 
1.8.3.1




More information about the libvir-list mailing list