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

[libvirt] [PATCH 07/10] syntax-check: Include libvirt.h and virterror.h in <> form only in external tools



With this patch, include "libvirt.h" and "virterror.h" in "" form
is only allowed for "internal.h". And only the external tools
(examples|tools|python|include/libvirt) can include the two headers
in <> form.
---
 cfg.mk                         | 30 ++++++++++++++++++++++++++----
 include/libvirt/libvirt-lxc.h  |  2 +-
 include/libvirt/libvirt-qemu.h |  2 +-
 python/libvirt-lxc-override.c  |  4 ++--
 python/libvirt-override.c      |  4 ++--
 python/libvirt-qemu-override.c |  4 ++--
 python/typewrappers.h          |  4 ++--
 tests/shunloadhelper.c         |  2 --
 8 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index cb8079c..98c7e40 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -748,14 +748,30 @@ sc_prohibit_duplicate_header:
 sc_prohibit_include_libvirt_h:
 	@prohibit='^# *include *"libvirt/libvirt\.h"'			\
 	in_vc_files='\.[ch]$$'						\
-	halt='Do not include libvirt/libvirt.h'				\
+	halt='Do not include libvirt/libvirt.h in internal source'	\
 	  $(_sc_search_regexp)
 
 # Don't include "libvirt/virterror.h" in "" form.
 sc_prohibit_include_virterror_h:
 	@prohibit='^# *include *"libvirt/virterror\.h"'			\
 	in_vc_files='\.[ch]$$'						\
-	halt='Do not include libvirt/virterror.h'			\
+	halt='Do not include libvirt/virterror.h in internal source'	\
+	  $(_sc_search_regexp)
+
+# Don't include "libvirt/libvirt.h" in <> form. Except external tools, e.g.
+# python binding, examples and tools subdirectories.
+sc_prohibit_include_libvirt_h_1:
+	@prohibit='^# *include *<libvirt/libvirt\.h>'			\
+	in_vc_files='\.[ch]$$'						\
+	halt='Do not include libvirt/libvirt.h in internal source'	\
+	  $(_sc_search_regexp)
+
+# Don't include "libvirt/virterror.h" in <> form. Except external tools, e.g.
+# python binding, examples and tools subdirectories.
+sc_prohibit_include_virterror_h_1:
+	@prohibit='^# *include *<libvirt/virterror\.h>'			\
+	in_vc_files='\.[ch]$$'						\
+	halt='Do not include libvirt/virterror.h in internal source'	\
 	  $(_sc_search_regexp)
 
 # We don't use this feature of maint.mk.
@@ -913,7 +929,13 @@ 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_libvirt_h = \
-  ^(src/internal\.h)|(include/libvirt/libvirt-(lxc|qemu)\.h)|(python/libvirt-override\.c)|(python/typewrappers\.h)$$
+  ^src/internal\.h$$
 
 exclude_file_name_regexp--sc_prohibit_include_virterror_h = \
-  ^(src/internal\.h)|(python/libvirt-|(lxc|qemu)-override\.c)|(python/typewrappers\.h)$$
+  ^src/internal\.h$$
+
+exclude_file_name_regexp--sc_prohibit_include_libvirt_h_1 = \
+  ^(examples/|tools/|python/|include/libvirt/)
+
+exclude_file_name_regexp--sc_prohibit_include_virterror_h_1 = \
+  ^(examples/|tools/|python/|include/libvirt/)
diff --git a/include/libvirt/libvirt-lxc.h b/include/libvirt/libvirt-lxc.h
index 5021813..1901fce 100644
--- a/include/libvirt/libvirt-lxc.h
+++ b/include/libvirt/libvirt-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" {
diff --git a/include/libvirt/libvirt-qemu.h b/include/libvirt/libvirt-qemu.h
index 8ec12b4..3e79a8c 100644
--- a/include/libvirt/libvirt-qemu.h
+++ b/include/libvirt/libvirt-qemu.h
@@ -26,7 +26,7 @@
 #ifndef __VIR_QEMU_H__
 # define __VIR_QEMU_H__
 
-# include "libvirt/libvirt.h"
+# include <libvirt/libvirt.h>
 
 # ifdef __cplusplus
 extern "C" {
diff --git a/python/libvirt-lxc-override.c b/python/libvirt-lxc-override.c
index c80668e..ead175f 100644
--- a/python/libvirt-lxc-override.c
+++ b/python/libvirt-lxc-override.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"
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index f6573e1..3d8490c 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -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"
diff --git a/python/libvirt-qemu-override.c b/python/libvirt-qemu-override.c
index 243692a..8f1ce5e 100644
--- a/python/libvirt-qemu-override.c
+++ b/python/libvirt-qemu-override.c
@@ -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"
 
diff --git a/python/typewrappers.h b/python/typewrappers.h
index af68bce..d871d3f 100644
--- a/python/typewrappers.h
+++ b/python/typewrappers.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
diff --git a/tests/shunloadhelper.c b/tests/shunloadhelper.c
index 1b025ee..a7bc2cc 100644
--- a/tests/shunloadhelper.c
+++ b/tests/shunloadhelper.c
@@ -28,8 +28,6 @@
 #include <config.h>
 #include "internal.h"
 
-#include <libvirt/libvirt.h>
-#include <libvirt/virterror.h>
 #include <stdlib.h>
 
 static void shunloadError(void *userData ATTRIBUTE_UNUSED,
-- 
1.8.1.4


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