Re: [PATCH 6/6] syntax-check: Don't include libvirt.h and virterror.h

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

 



On 04/15/2013 12:28 AM, Osier Yang wrote:
> Except for "internal.h" and the public headers
> ---
>  cfg.mk | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/cfg.mk b/cfg.mk
> index 9cf4cff..0f07abd 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -736,6 +736,20 @@ sc_prohibit_duplicate_header:
>  	else :;								\
>  	fi
>  
> +# Don't include "libvirt/libvirt.h".
> +sc_prohibit_include_libvirt_h:
> +	@prohibit='^# *include "libvirt/libvirt.h"'			\

This prohibits "libvirt/libvirt.h", but allows <libvirt/libvirt.h>.  The
distinction is important, the "" form searches the current directory
first, while the <> form does not.  Since we are stating that this
header is public, I think you're trying to state that internal files
should never include this file directly (no "" or <> form, but get its
contents through "internal.h" instead), while external tools (python
bindings, tools subdirectory) which should be limited to just the public
API should be using the <> form.

> +	in_vc_files='\.[ch]$$'						\
> +	halt='Do not include libvirt/libvirt.h'				\
> +	  $(_sc_search_regexp)
> +
> +# Don't include "libvirt/virterror.h".
> +sc_prohibit_include_virterror_h:
> +	@prohibit='^# *include "libvirt/virterror.h"'			\
> +	in_vc_files='\.[ch]$$'						\
> +	halt='Do not include libvirt/virterror.h'			\
> +	  $(_sc_search_regexp)
> +
>  # We don't use this feature of maint.mk.
>  prev_version_file = /dev/null
>  
> @@ -888,3 +902,9 @@ exclude_file_name_regexp--sc_correct_id_types = \
>    (^src/locking/lock_protocol.x$$)
>  
>  exclude_file_name_regexp--sc_m4_quote_check = m4/virt-lib.m4
> +
> +exclude_file_name_regexp--sc_prohibit_include_libvirt_h = \
> +    ^(src/internal\.h)|(include/libvirt/libvirt-(lxc|qemu)\.h)|(python/libvirt-override\.c)|(python/typewrappers\.h)$$

I'm wondering if instead of excluding so many files, if we should
instead be converting these files to use the <> include form.  I'm also
wondering if your syntax check needs to check for no "" form anywhere,
and no <> form in daemon or src subdirectories (while still allowing <>
form in tools and python subdirectories).

> +
> +exclude_file_name_regexp--sc_prohibit_include_virterror_h = \
> +    ^(src/internal\.h)|(python/libvirt-|(lxc|qemu)-override\.c)|(python/typewrappers\.h)$$
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]