提交 9969ade6 编写于 作者: O Osier Yang

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.
上级 1d69c633
...@@ -747,9 +747,17 @@ sc_prohibit_duplicate_header: ...@@ -747,9 +747,17 @@ sc_prohibit_duplicate_header:
fi; fi;
# Don't include "libvirt/*.h" in "" form. # Don't include "libvirt/*.h" in "" form.
sc_prohibit_include_public_headers: sc_prohibit_include_public_headers_quote:
@prohibit='# *include *"libvirt/.*\.h"' \ @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' \ halt='Do not include libvirt/*.h in internal source' \
$(_sc_search_regexp) $(_sc_search_regexp)
...@@ -907,5 +915,8 @@ exclude_file_name_regexp--sc_correct_id_types = \ ...@@ -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_m4_quote_check = m4/virt-lib.m4
exclude_file_name_regexp--sc_prohibit_include_public_headers = \ exclude_file_name_regexp--sc_prohibit_include_public_headers_quote = \
^(src/internal\.h$$|python/|tools/|examples/|include/libvirt/libvirt-(qemu|lxc)\.h$$) ^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 @@ ...@@ -26,7 +26,7 @@
#ifndef __VIR_LXC_H__ #ifndef __VIR_LXC_H__
# define __VIR_LXC_H__ # define __VIR_LXC_H__
# include "libvirt/libvirt.h" # include <libvirt/libvirt.h>
# ifdef __cplusplus # ifdef __cplusplus
extern "C" { extern "C" {
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#ifndef __VIR_QEMU_H__ #ifndef __VIR_QEMU_H__
# define __VIR_QEMU_H__ # define __VIR_QEMU_H__
# include "libvirt/libvirt.h" # include <libvirt/libvirt.h>
# ifdef __cplusplus # ifdef __cplusplus
extern "C" { extern "C" {
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
#undef HAVE_PTHREAD_H #undef HAVE_PTHREAD_H
#include <Python.h> #include <Python.h>
#include "libvirt/libvirt-lxc.h" #include <libvirt/libvirt-lxc.h>
#include "libvirt/virterror.h" #include <libvirt/virterror.h>
#include "typewrappers.h" #include "typewrappers.h"
#include "libvirt-lxc.h" #include "libvirt-lxc.h"
#include "viralloc.h" #include "viralloc.h"
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
#define VIR_ENUM_SENTINELS #define VIR_ENUM_SENTINELS
#include <Python.h> #include <Python.h>
#include "libvirt/libvirt.h" #include <libvirt/libvirt.h>
#include "libvirt/virterror.h" #include <libvirt/virterror.h>
#include "typewrappers.h" #include "typewrappers.h"
#include "libvirt.h" #include "libvirt.h"
#include "viralloc.h" #include "viralloc.h"
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
#undef HAVE_PTHREAD_H #undef HAVE_PTHREAD_H
#include <Python.h> #include <Python.h>
#include "libvirt/libvirt-qemu.h" #include <libvirt/libvirt-qemu.h>
#include "libvirt/virterror.h" #include <libvirt/virterror.h>
#include "typewrappers.h" #include "typewrappers.h"
#include "libvirt-qemu.h" #include "libvirt-qemu.h"
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#include <Python.h> #include <Python.h>
#include <stdbool.h> #include <stdbool.h>
#include "libvirt/libvirt.h" #include <libvirt/libvirt.h>
#include "libvirt/virterror.h" #include <libvirt/virterror.h>
#ifdef __GNUC__ #ifdef __GNUC__
# ifdef ATTRIBUTE_UNUSED # ifdef ATTRIBUTE_UNUSED
......
...@@ -26,12 +26,11 @@ ...@@ -26,12 +26,11 @@
*/ */
#include <config.h> #include <config.h>
#include "internal.h"
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>
#include <stdlib.h> #include <stdlib.h>
#include "internal.h"
static void shunloadError(void *userData ATTRIBUTE_UNUSED, static void shunloadError(void *userData ATTRIBUTE_UNUSED,
virErrorPtr error ATTRIBUTE_UNUSED) virErrorPtr error ATTRIBUTE_UNUSED)
{ {
......
...@@ -60,8 +60,8 @@ ...@@ -60,8 +60,8 @@
#include "virutil.h" #include "virutil.h"
#include "viralloc.h" #include "viralloc.h"
#include "virxml.h" #include "virxml.h"
#include "libvirt/libvirt-qemu.h" #include <libvirt/libvirt-qemu.h>
#include "libvirt/libvirt-lxc.h" #include <libvirt/libvirt-lxc.h>
#include "virfile.h" #include "virfile.h"
#include "configmake.h" #include "configmake.h"
#include "virthread.h" #include "virthread.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册