mirror of https://gitee.com/openkylin/libvirt.git
syntax-check: Only allows to include public headers in external tools
With this patch, include public headers in "" form is only allowed for "internal.h". And only the external tools (examples|tools|python |include/libvirt) can include the public headers in <> form.
This commit is contained in:
parent
1d69c6334b
commit
9969ade669
19
cfg.mk
19
cfg.mk
|
@ -747,9 +747,17 @@ sc_prohibit_duplicate_header:
|
|||
fi;
|
||||
|
||||
# Don't include "libvirt/*.h" in "" form.
|
||||
sc_prohibit_include_public_headers:
|
||||
sc_prohibit_include_public_headers_quote:
|
||||
@prohibit='# *include *"libvirt/.*\.h"' \
|
||||
in_vc_files='\.[chx]$$' \
|
||||
in_vc_files='\.[ch]$$' \
|
||||
halt='Do not include libvirt/*.h in internal source' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Don't include "libvirt/*.h" in <> form. Except for external tools,
|
||||
# e.g. Python binding, examples and tools subdirectories.
|
||||
sc_prohibit_include_public_headers_brackets:
|
||||
@prohibit='# *include *<libvirt/.*\.h>' \
|
||||
in_vc_files='\.[ch]$$' \
|
||||
halt='Do not include libvirt/*.h in internal source' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
|
@ -907,5 +915,8 @@ exclude_file_name_regexp--sc_correct_id_types = \
|
|||
|
||||
exclude_file_name_regexp--sc_m4_quote_check = m4/virt-lib.m4
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_include_public_headers = \
|
||||
^(src/internal\.h$$|python/|tools/|examples/|include/libvirt/libvirt-(qemu|lxc)\.h$$)
|
||||
exclude_file_name_regexp--sc_prohibit_include_public_headers_quote = \
|
||||
^src/internal\.h$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_include_public_headers_brackets = \
|
||||
^(python/|tools/|examples/|include/libvirt/(virterror|libvirt-(qemu|lxc))\.h$$)
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#ifndef __VIR_LXC_H__
|
||||
# define __VIR_LXC_H__
|
||||
|
||||
# include "libvirt/libvirt.h"
|
||||
# include <libvirt/libvirt.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#ifndef __VIR_QEMU_H__
|
||||
# define __VIR_QEMU_H__
|
||||
|
||||
# include "libvirt/libvirt.h"
|
||||
# include <libvirt/libvirt.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#undef HAVE_PTHREAD_H
|
||||
|
||||
#include <Python.h>
|
||||
#include "libvirt/libvirt-lxc.h"
|
||||
#include "libvirt/virterror.h"
|
||||
#include <libvirt/libvirt-lxc.h>
|
||||
#include <libvirt/virterror.h>
|
||||
#include "typewrappers.h"
|
||||
#include "libvirt-lxc.h"
|
||||
#include "viralloc.h"
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#define VIR_ENUM_SENTINELS
|
||||
|
||||
#include <Python.h>
|
||||
#include "libvirt/libvirt.h"
|
||||
#include "libvirt/virterror.h"
|
||||
#include <libvirt/libvirt.h>
|
||||
#include <libvirt/virterror.h>
|
||||
#include "typewrappers.h"
|
||||
#include "libvirt.h"
|
||||
#include "viralloc.h"
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#undef HAVE_PTHREAD_H
|
||||
|
||||
#include <Python.h>
|
||||
#include "libvirt/libvirt-qemu.h"
|
||||
#include "libvirt/virterror.h"
|
||||
#include <libvirt/libvirt-qemu.h>
|
||||
#include <libvirt/virterror.h>
|
||||
#include "typewrappers.h"
|
||||
#include "libvirt-qemu.h"
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#include <Python.h>
|
||||
#include <stdbool.h>
|
||||
#include "libvirt/libvirt.h"
|
||||
#include "libvirt/virterror.h"
|
||||
#include <libvirt/libvirt.h>
|
||||
#include <libvirt/virterror.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
# ifdef ATTRIBUTE_UNUSED
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "internal.h"
|
||||
|
||||
#include <libvirt/libvirt.h>
|
||||
#include <libvirt/virterror.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
static void shunloadError(void *userData ATTRIBUTE_UNUSED,
|
||||
virErrorPtr error ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
|
|
@ -60,8 +60,8 @@
|
|||
#include "virutil.h"
|
||||
#include "viralloc.h"
|
||||
#include "virxml.h"
|
||||
#include "libvirt/libvirt-qemu.h"
|
||||
#include "libvirt/libvirt-lxc.h"
|
||||
#include <libvirt/libvirt-qemu.h>
|
||||
#include <libvirt/libvirt-lxc.h>
|
||||
#include "virfile.h"
|
||||
#include "configmake.h"
|
||||
#include "virthread.h"
|
||||
|
|
Loading…
Reference in New Issue