diff --git a/cfg.mk b/cfg.mk index 5f422de21a..ebb6613d9f 100644 --- a/cfg.mk +++ b/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 *' \ + 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$$) diff --git a/include/libvirt/libvirt-lxc.h b/include/libvirt/libvirt-lxc.h index 50218137b0..1901fce4f8 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 # ifdef __cplusplus extern "C" { diff --git a/include/libvirt/libvirt-qemu.h b/include/libvirt/libvirt-qemu.h index 8ec12b4dff..3e79a8ccfa 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 # ifdef __cplusplus extern "C" { diff --git a/python/libvirt-lxc-override.c b/python/libvirt-lxc-override.c index c80668ef45..ead175f250 100644 --- a/python/libvirt-lxc-override.c +++ b/python/libvirt-lxc-override.c @@ -17,8 +17,8 @@ #undef HAVE_PTHREAD_H #include -#include "libvirt/libvirt-lxc.h" -#include "libvirt/virterror.h" +#include +#include #include "typewrappers.h" #include "libvirt-lxc.h" #include "viralloc.h" diff --git a/python/libvirt-override.c b/python/libvirt-override.c index f6573e1afc..3d8490c072 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -20,8 +20,8 @@ #define VIR_ENUM_SENTINELS #include -#include "libvirt/libvirt.h" -#include "libvirt/virterror.h" +#include +#include #include "typewrappers.h" #include "libvirt.h" #include "viralloc.h" diff --git a/python/libvirt-qemu-override.c b/python/libvirt-qemu-override.c index 243692a0fb..8f1ce5e99b 100644 --- a/python/libvirt-qemu-override.c +++ b/python/libvirt-qemu-override.c @@ -17,8 +17,8 @@ #undef HAVE_PTHREAD_H #include -#include "libvirt/libvirt-qemu.h" -#include "libvirt/virterror.h" +#include +#include #include "typewrappers.h" #include "libvirt-qemu.h" diff --git a/python/typewrappers.h b/python/typewrappers.h index af68bcede5..d871d3fcc7 100644 --- a/python/typewrappers.h +++ b/python/typewrappers.h @@ -8,8 +8,8 @@ #include #include -#include "libvirt/libvirt.h" -#include "libvirt/virterror.h" +#include +#include #ifdef __GNUC__ # ifdef ATTRIBUTE_UNUSED diff --git a/tests/shunloadhelper.c b/tests/shunloadhelper.c index 1b025ee539..a8f5aef4e9 100644 --- a/tests/shunloadhelper.c +++ b/tests/shunloadhelper.c @@ -26,12 +26,11 @@ */ #include -#include "internal.h" -#include -#include #include +#include "internal.h" + static void shunloadError(void *userData ATTRIBUTE_UNUSED, virErrorPtr error ATTRIBUTE_UNUSED) { diff --git a/tools/virsh.c b/tools/virsh.c index b7a5cc1f27..4cd93ca717 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -60,8 +60,8 @@ #include "virutil.h" #include "viralloc.h" #include "virxml.h" -#include "libvirt/libvirt-qemu.h" -#include "libvirt/libvirt-lxc.h" +#include +#include #include "virfile.h" #include "configmake.h" #include "virthread.h"