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

Osier Yang jyang at redhat.com
Tue Apr 16 13:44:06 UTC 2013


On 15/04/13 23:18, Eric Blake wrote:
> 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.

Yeah, that was what I tended to do, posted v2, including the syntax-check
rules for libvirt-{qemu,lxc}.h too.

>
>> +	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)$$
>>




More information about the libvir-list mailing list