提交 1add9c78 编写于 作者: E Eric Blake

maint: don't use config.h in .h files

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: NEric Blake <eblake@redhat.com>
上级 8da9516a
......@@ -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)$$)
......
/*
* 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"
......
......@@ -22,8 +22,6 @@
#ifndef __VIR_DRIVER_H__
# define __VIR_DRIVER_H__
# include "config.h"
# include <unistd.h>
# include "internal.h"
......
/*
* 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 */
......
......@@ -25,8 +25,6 @@
#ifndef LIBXL_CONF_H
# define LIBXL_CONF_H
# include <config.h>
# include <libxl.h>
# include "internal.h"
......
......@@ -23,8 +23,6 @@
#ifndef LIBXL_DRIVER_H
# define LIBXL_DRIVER_H
# include <config.h>
int libxlRegister(void);
#endif /* LIBXL_DRIVER_H */
/*
* 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"
......
......@@ -24,8 +24,6 @@
#ifndef LXC_DRIVER_H
# define LXC_DRIVER_H
# include <config.h>
/* Function declarations */
int lxcRegister(void);
......
......@@ -26,7 +26,6 @@
# define FUSE_USE_VERSION 26
# include <config.h>
# if WITH_FUSE
# include <fuse.h>
# endif
......
/*
* 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"
......
/*
* 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
......
......@@ -24,8 +24,6 @@
#ifndef __QEMUD_CONF_H
# define __QEMUD_CONF_H
# include <config.h>
# include "virebtables.h"
# include "internal.h"
# include "capabilities.h"
......
/*
* 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"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册