]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
cfg.mk: Introduce syntax-check rule to prefer VIR_CLASS_NEW
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 13 Apr 2018 14:41:17 +0000 (16:41 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 18 Apr 2018 08:04:55 +0000 (10:04 +0200)
Now that we have macro that does some checks lets forbid raw
usage of virClassNew() in favor of VIR_CLASS_NEW().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
cfg.mk

diff --git a/cfg.mk b/cfg.mk
index 4078bc2c63ffd1672c21f28dd866a00212c741fb..902178dd1c3af7635afff7d417897fb9a83c8f9b 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -321,6 +321,11 @@ sc_prohibit_internal_functions:
        halt='use VIR_ macros instead of internal functions' \
          $(_sc_search_regexp)
 
+sc_prohibit_raw_virclassnew:
+       @prohibit='virClassNew *\(' \
+       halt='use VIR_CLASS_NEW instead of virClassNew' \
+         $(_sc_search_regexp)
+
 # Avoid raw malloc and free, except in documentation comments.
 sc_prohibit_raw_allocation:
        @prohibit='^.[^*].*\<((m|c|re)alloc|free) *\([^)]' \
@@ -1188,6 +1193,9 @@ exclude_file_name_regexp--sc_prohibit_gethostname = ^src/util/vir(util|log)\.c$$
 exclude_file_name_regexp--sc_prohibit_internal_functions = \
   ^src/(util/(viralloc|virutil|virfile)\.[hc]|esx/esx_vi\.c)$$
 
+exclude_file_name_regexp--sc_prohibit_raw_virclassnew = \
+  ^src/util/virobject\.[hc]$$
+
 exclude_file_name_regexp--sc_prohibit_newline_at_end_of_diagnostic = \
   ^src/rpc/gendispatch\.pl$$