]> xenbits.xensource.com Git - libvirt.git/commitdiff
maint: don't use config.h in .h files
authorEric Blake <eblake@redhat.com>
Fri, 31 May 2013 17:52:51 +0000 (11:52 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 5 Jun 2013 11:53:25 +0000 (05:53 -0600)
Enforce the rule that .h files don't need to (redundantly)
include <config.h>.

* cfg.mk (sc_prohibit_config_h_in_headers): New rule.
(_virsh_includes): Delete; instead, inline a smaller number of
exclusions...
(exclude_file_name_regexp--sc_require_config_h)
(exclude_file_name_regexp--sc_require_config_h_first): ...here.
* daemon/libvirtd.h (includes): Fix offenders.
* src/driver.h (includes): Likewise.
* src/gnutls_1_0_compat.h (includes): Likewise.
* src/libxl/libxl_conf.h (includes): Likewise.
* src/libxl/libxl_driver.h (includes): Likewise.
* src/lxc/lxc_conf.h (includes): Likewise.
* src/lxc/lxc_driver.h (includes): Likewise.
* src/lxc/lxc_fuse.h (includes): Likewise.
* src/network/bridge_driver.h (includes): Likewise.
* src/phyp/phyp_driver.h (includes): Likewise.
* src/qemu/qemu_conf.h (includes): Likewise.
* src/util/virnetlink.h (includes): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
13 files changed:
cfg.mk
daemon/libvirtd.h
src/driver.h
src/gnutls_1_0_compat.h
src/libxl/libxl_conf.h
src/libxl/libxl_driver.h
src/lxc/lxc_conf.h
src/lxc/lxc_driver.h
src/lxc/lxc_fuse.h
src/network/bridge_driver.h
src/phyp/phyp_driver.h
src/qemu/qemu_conf.h
src/util/virnetlink.h

diff --git a/cfg.mk b/cfg.mk
index 4ffa020afb0490fdf087950c89b981349d296080..c093bf24835b3436c63b4c9a710b7d222b3f5334 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -797,6 +797,15 @@ sc_prohibit_include_public_headers_brackets:
        halt='Do not include libvirt/*.h in internal source'            \
          $(_sc_search_regexp)
 
+# <config.h> is only needed in .c files; .h files do not need it since
+# .c files must include config.h before any other .h.
+sc_prohibit_config_h_in_headers:
+       @prohibit='^# *include\>.*config\.h'                            \
+       in_vc_files='\.h$$'                                             \
+       halt='headers should not include <config.h>'                    \
+         $(_sc_search_regexp)
+
+
 # We don't use this feature of maint.mk.
 prev_version_file = /dev/null
 
@@ -937,10 +946,11 @@ exclude_file_name_regexp--sc_prohibit_xmlURI = ^src/util/viruri\.c$$
 
 exclude_file_name_regexp--sc_prohibit_return_as_function = \.py$$
 
-_virsh_includes=(edit|domain-monitor|domain|volume|pool|network|interface|nwfilter|secret|snapshot|host|nodedev)
-exclude_file_name_regexp--sc_require_config_h = ^(examples/|tools/virsh-$(_virsh_includes)\.c$$)
+exclude_file_name_regexp--sc_require_config_h = \
+       ^(examples/|tools/virsh-edit\.c$$)
 
-exclude_file_name_regexp--sc_require_config_h_first = ^(examples/|tools/virsh-$(_virsh_includes)\.c$$)
+exclude_file_name_regexp--sc_require_config_h_first = \
+       ^(examples/|tools/virsh-edit\.c$$)
 
 exclude_file_name_regexp--sc_trailing_blank = \
   (/qemuhelpdata/|/sysinfodata/.*\.data|\.(fig|gif|ico|png)$$)
index c07637a294c910036de87beb255021a98b3bd145..d0afdc8e50e00e0c7d0f7a9f370f3e43da798f13 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * libvirtd.h: daemon data structure definitions
  *
- * Copyright (C) 2006-2012 Red Hat, Inc.
+ * Copyright (C) 2006-2013 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -27,8 +27,6 @@
 
 # define VIR_ENUM_SENTINELS
 
-# include <config.h>
-
 # include <rpc/types.h>
 # include <rpc/xdr.h>
 # include "remote_protocol.h"
index e998adf872be1af33020e5d8407c455bf63193d2..ec5fc537719cff190695599449ccc93a04a04b5b 100644 (file)
@@ -22,8 +22,6 @@
 #ifndef __VIR_DRIVER_H__
 # define __VIR_DRIVER_H__
 
-# include "config.h"
-
 # include <unistd.h>
 
 # include "internal.h"
index 217bc8c43cdbb990d49024bd5bfc6184a4ffed70..b006e2b541408e8cb7a0c30ecb2aca07e747bac5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * gnutls_1_0_compat.h: GnuTLS 1.0 compatibility
  *
- * Copyright (C) 2007 Red Hat, Inc.
+ * Copyright (C) 2007, 2013 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,8 +23,6 @@
 #ifndef LIBVIRT_GNUTLS_1_0_COMPAT_H__
 # define LIBVIRT_GNUTLS_1_0_COMPAT_H__
 
-# include <config.h>
-
 # include <gnutls/gnutls.h>
 
 /* enable backward compatibility macros for gnutls 1.x.y */
index fed878d898a29e57dbf8c86cc71fb492cee6627c..44ecd4105eda768e7bfedd70acbfb4a6ccddd4ed 100644 (file)
@@ -25,8 +25,6 @@
 #ifndef LIBXL_CONF_H
 # define LIBXL_CONF_H
 
-# include <config.h>
-
 # include <libxl.h>
 
 # include "internal.h"
index cb8921f93d5f225a2bd847a94d349d1867719acb..fba6c5a8ba185fe752b7c8dac7bc988914fa4308 100644 (file)
@@ -23,8 +23,6 @@
 #ifndef LIBXL_DRIVER_H
 # define LIBXL_DRIVER_H
 
-# include <config.h>
-
 int libxlRegister(void);
 
 #endif /* LIBXL_DRIVER_H */
index 4332fb9edf57a88eaa2cabdcdcd6e766009de259..5a5b9aa3555ac2f847604f216ea1b16503b00942 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010, 2013 Red Hat, Inc.
  * Copyright IBM Corp. 2008
  *
  * lxc_conf.h: header file for linux container config functions
@@ -25,8 +25,6 @@
 #ifndef LXC_CONF_H
 # define LXC_CONF_H
 
-# include <config.h>
-
 # include "internal.h"
 # include "domain_conf.h"
 # include "domain_event.h"
index 113d1ceb1f5cf7bb6e43c0a472b9865229b81143..656831cce8de11a614560c6f256de1fa18638afb 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef LXC_DRIVER_H
 # define LXC_DRIVER_H
 
-# include <config.h>
-
 /* Function declarations */
 int lxcRegister(void);
 
index a42c39a15b674b56277a06543b002323472cf6f9..b3713af81d381e1fb6675c7435708e2c00735b1a 100644 (file)
@@ -26,7 +26,6 @@
 
 # define FUSE_USE_VERSION 26
 
-# include <config.h>
 # if WITH_FUSE
 #  include <fuse.h>
 # endif
index 4bf64eafb1042d2753d17357cbdab4087f6276f9..50258b571f9acd5a35e5f45ce9f1f316b8e07db0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * network_driver.h: core driver methods for managing networks
  *
- * Copyright (C) 2006-2012 Red Hat, Inc.
+ * Copyright (C) 2006-2013 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -25,8 +25,6 @@
 #ifndef __VIR_NETWORK__DRIVER_H
 # define __VIR_NETWORK__DRIVER_H
 
-# include <config.h>
-
 # include "internal.h"
 # include "network_conf.h"
 # include "domain_conf.h"
index 59a43704c1c6e57ada1d4a0ceb0bac9487956830..ad05b15dafa3fb999a0c45c3f4cf1d707ee0ebb8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010, 2013 Red Hat, Inc.
  * Copyright IBM Corp. 2009
  *
  * phyp_driver.c: ssh layer to access Power Hypervisors
@@ -27,7 +27,6 @@
 
 # include "conf/capabilities.h"
 # include "conf/domain_conf.h"
-# include <config.h>
 # include <libssh2.h>
 
 # define LPAR_EXEC_ERR -1
index 42566b41033657afda32ff20e270f4c74d3b99eb..19893c89a5634ebf40e7d75796033296815b88d6 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef __QEMUD_CONF_H
 # define __QEMUD_CONF_H
 
-# include <config.h>
-
 # include "virebtables.h"
 # include "internal.h"
 # include "capabilities.h"
index 9a69a0b45090784502d51490660c2ddd2796a1b2..8351000ba04be8752fc27d575cd23ebe7a9d80b4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2012 Red Hat, Inc.
+ * Copyright (C) 2010-2013 Red Hat, Inc.
  * Copyright (C) 2010-2012 IBM Corporation
  *
  * This library is free software; you can redistribute it and/or
@@ -20,7 +20,6 @@
 #ifndef __VIR_NETLINK_H__
 # define __VIR_NETLINK_H__
 
-# include "config.h"
 # include "internal.h"
 # include "virmacaddr.h"