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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux