[libvirt] [PATCH 9/9] cfg.mk: Introduce syntax-check rule to prefer VIR_CLASS_NEW

Michal Privoznik posted 9 patches 7 years, 1 month ago
There is a newer version of this series
[libvirt] [PATCH 9/9] cfg.mk: Introduce syntax-check rule to prefer VIR_CLASS_NEW
Posted by Michal Privoznik 7 years, 1 month ago
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>
---
 cfg.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/cfg.mk b/cfg.mk
index 4078bc2c63..5b7a9728d2 100644
--- 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 macro 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$$
 
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 9/9] cfg.mk: Introduce syntax-check rule to prefer VIR_CLASS_NEW
Posted by Erik Skultety 7 years ago
On Fri, Apr 13, 2018 at 04:47:16PM +0200, Michal Privoznik wrote:
> 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>
> ---
>  cfg.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/cfg.mk b/cfg.mk
> index 4078bc2c63..5b7a9728d2 100644
> --- 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 macro instead of virClassNew' \

s/macro//

Reviewed-by: Erik Skultety <eskultet@redhat.com>

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