[libvirt] [PATCH 06/10] syntax-check: Don't include "libvirt.h" and "virterror.h" in "" form

Eric Blake eblake at redhat.com
Wed Apr 17 03:51:09 UTC 2013


On 04/16/2013 07:41 AM, Osier Yang wrote:
> Directories python/tools/examples should include them in <> form,
> though this patch allows "" form in these directories by excluding
> them, a later patch will do the cleanup.
> ---
>  cfg.mk | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 

> +# Don't include "libvirt/libvirt.h" in "" form.
> +sc_prohibit_include_libvirt_h:
> +	@prohibit='^# *include *"libvirt/libvirt\.h"'			\
> +	in_vc_files='\.[ch]$$'						\
> +	halt='Do not include libvirt/libvirt.h'				\
> +	  $(_sc_search_regexp)
> +
> +# Don't include "libvirt/virterror.h" in "" form.
> +sc_prohibit_include_virterror_h:
> +	@prohibit='^# *include *"libvirt/virterror\.h"'			\

Combine these into one rule, for faster execution of 'make
syntax-check'.  Also, while we generally use #include with # in column
1, C allows it in later columns and a stronger test avoids an anchor
(but if that opens up false negatives, then adding the anchor back in is
fine).

@prohibit='# *include *"libvirt/*\.h"'

> +	in_vc_files='\.[ch]$$'						\

Another case where .[chx] might be better, since we cleaned up .x files.

> +	halt='Do not include libvirt/virterror.h'			\

This halt message needs alteration when you merge the two checks into one.


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

and if you merge the rules, come up with a common name, and then you
only need one exclude rule.  If we are excluding entire directories, we
could write this more compact as:


^(src/internal\.h$$\|python/\|tools/\|examples/\|include/libvirt/libvirt-*\.h$$)

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130416/b5f153a6/attachment-0001.sig>


More information about the libvir-list mailing list