On 30.10.2012 14:52, Zeeshan Ali (Khattak) wrote: > On Tue, Oct 30, 2012 at 3:42 PM, Michal Privoznik <mprivozn@xxxxxxxxxx> wrote: >> On 30.10.2012 13:50, Zeeshan Ali (Khattak) wrote: >>> From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx> >>> >>> This is meant for including headers needed by many .c files. >>> --- >>> osinfo/Makefile.am | 1 + >>> osinfo/osinfo_db.c | 4 +--- >>> osinfo/osinfo_deployment.c | 4 +--- >>> osinfo/osinfo_deploymentlist.c | 4 +--- >>> osinfo/osinfo_device.c | 4 +--- >>> osinfo/osinfo_devicelink.c | 4 +--- >>> osinfo/osinfo_devicelinkfilter.c | 4 +--- >>> osinfo/osinfo_devicelinklist.c | 4 +--- >>> osinfo/osinfo_devicelist.c | 4 +--- >>> osinfo/osinfo_entity.c | 4 +--- >>> osinfo/osinfo_filter.c | 4 +--- >>> osinfo/osinfo_install_config.c | 4 +--- >>> osinfo/osinfo_install_config_param.c | 4 +--- >>> osinfo/osinfo_install_script.c | 4 +--- >>> osinfo/osinfo_install_scriptlist.c | 4 +--- >>> osinfo/osinfo_list.c | 4 +--- >>> osinfo/osinfo_loader.c | 4 +--- >>> osinfo/osinfo_media.c | 4 +--- >>> osinfo/osinfo_medialist.c | 4 +--- >>> osinfo/osinfo_os.c | 4 +--- >>> osinfo/osinfo_oslist.c | 4 +--- >>> osinfo/osinfo_platform.c | 4 +--- >>> osinfo/osinfo_platformlist.c | 4 +--- >>> osinfo/osinfo_priv.h | 38 ++++++++++++++++++++++++++++++++++++ >>> osinfo/osinfo_product.c | 4 +--- >>> osinfo/osinfo_productfilter.c | 4 +--- >>> osinfo/osinfo_productlist.c | 4 +--- >>> osinfo/osinfo_resources.c | 4 +--- >>> osinfo/osinfo_resourceslist.c | 4 +--- >>> osinfo/osinfo_tree.c | 4 +--- >>> osinfo/osinfo_treelist.c | 4 +--- >>> 31 files changed, 68 insertions(+), 87 deletions(-) >>> create mode 100644 osinfo/osinfo_priv.h >>> >>> diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am >>> index 6ddb956..6461f1f 100644 >>> --- a/osinfo/Makefile.am >>> +++ b/osinfo/Makefile.am >>> @@ -111,6 +111,7 @@ libosinfo_1_0_la_SOURCES = \ >>> osinfo_treelist.c \ >>> osinfo_db.c \ >>> osinfo_loader.c \ >>> + osinfo_priv.h \ >> >> Aaah. TABs, we meet again :) >> >>> $(NULL) >>> >>> if WITH_GOBJECT_INTROSPECTION >>> diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c >>> index d2f0fa2..a2fc12d 100644 >>> --- a/osinfo/osinfo_db.c >>> +++ b/osinfo/osinfo_db.c >>> @@ -22,9 +22,7 @@ >>> * Daniel P. Berrange <berrange@xxxxxxxxxx> >>> */ >>> >>> -#include <config.h> >>> - >>> -#include <osinfo/osinfo.h> >>> +#include <osinfo/osinfo_priv.h> >>> #include <gio/gio.h> >>> #include <string.h> >> >> I am afraid we can't move the include of config.h to osinfo_priv.h as it >> makes syntax-check shout. Or we can then drop check for config.h. > > I think if we are going to add a private header included by all files, > this change makes perfect sense so we should update or remove the > syntax-check. > Okay, I suggest doing this then: diff --git a/cfg.mk b/cfg.mk index 6aaa394..b90abed 100644 --- a/cfg.mk +++ b/cfg.mk @@ -134,8 +134,8 @@ exclude_file_name_regexp--sc_preprocessor_indentation = ^*/*.[ch] exclude_file_name_regexp--sc_prohibit_strcmp = ^*/*.[ch] -exclude_file_name_regexp--sc_require_config_h = python/libvirt-glib.c -exclude_file_name_regexp--sc_require_config_h_first = python/libvirt-glib.c +exclude_file_name_regexp--sc_require_osinfo_priv_h = python/libvirt-glib.c +exclude_file_name_regexp--sc_require_osinfo_priv_h_first = python/libvirt-glib.c exclude_file_name_regexp--sc_trailing_blank = ^test/isodata/.*|docs/object-model.fig diff --git a/maint.mk b/maint.mk index de7a303..6349d7e 100644 --- a/maint.mk +++ b/maint.mk @@ -432,29 +432,29 @@ sc_prohibit_have_config_h: halt='found use of HAVE''_CONFIG_H; remove' \ $(_sc_search_regexp) -# Nearly all .c files must include <config.h>. However, we also permit this +# Nearly all .c files must include <osinfo_priv.h>. However, we also permit this # via inclusion of a package-specific header, if cfg.mk specified one. -# config_h_header must be suitable for grep -E. -config_h_header ?= <config\.h> -sc_require_config_h: - @require='^# *include $(config_h_header)' \ +# osinfo_priv_h_header must be suitable for grep -E. +osinfo_priv_h_header ?= <osinfo/osinfo_priv\.h> +sc_require_osinfo_priv_h: + @require='^# *include $(osinfo_priv_h_header)' \ in_vc_files='\.c$$' \ - halt='the above files do not include <config.h>' \ + halt='the above files do not include <osinfo/osinfo_priv.h>' \ $(_sc_search_regexp) # You must include <config.h> before including any other header file. # This can possibly be via a package-specific header, if given by cfg.mk. -sc_require_config_h_first: +sc_require_osinfo_priv_h_first: @if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then \ fail=0; \ for i in $$($(VC_LIST_EXCEPT) | grep '\.c$$'); do \ grep '^# *include\>' $$i | sed 1q \ - | grep -E '^# *include $(config_h_header)' > /dev/null \ + | grep -E '^# *include $(osinfo_priv_h_header)' > /dev/null \ || { echo $$i; fail=1; }; \ done; \ test $$fail = 1 && \ { echo '$(ME): the above files include some other header' \ - 'before <config.h>' 1>&2; exit 1; } || :; \ + 'before <osinfo_priv.h>' 1>&2; exit 1; } || :; \ else :; \ fi --- You'll need to update a buch of other files as well (under test/ and tools/). make syntax-check will tell you more specifically. Michal