提交 4cea12bb 编写于 作者: J Jim Meyering

enforce the "include <config.h> first" rule

* qemud/Makefile.am: Ensure that the generated remote_protocol.c
includes <config.h> first.
* Makefile.maint (sc_require_config_h_first): New rule, so that
"make syntax-check" enforces this.
* .x-sc_require_config_h_first: New file.
* Makefile.am (.x-sc_require_config_h_first): Add it.
* qemud/remote_protocol.x: Don't include <config.h> here.
* qemud/remote_protocol.c: Regenerate.
上级 e4c7e123
无相关合并请求
^docs/examples/info1\.c$
^docs/examples/suspend\.c$
Wed Dec 17 18:10:51 +0100 2008 Jim Meyering <meyering@redhat.com>
enforce the "include <config.h> first" rule
* qemud/Makefile.am: Ensure that the generated remote_protocol.c
includes <config.h> first.
* Makefile.maint (sc_require_config_h_first): New rule, so that
"make syntax-check" enforces this.
* .x-sc_require_config_h_first: New file.
* Makefile.am (.x-sc_require_config_h_first): Add it.
* qemud/remote_protocol.x: Don't include <config.h> here.
* qemud/remote_protocol.c: Regenerate.
Wed Dec 17 18:10:51 +0100 2008 Jim Meyering <meyering@redhat.com>
let gcc's -Wformat do its job; avoid "make syntax-check" failure
......
......@@ -14,6 +14,7 @@ EXTRA_DIST = \
libvirt.pc libvirt.pc.in \
$(man_MANS) autobuild.sh \
.x-sc_avoid_if_before_free \
.x-sc_require_config_h_first \
.x-sc_prohibit_strcmp \
.x-sc_require_config_h \
autogen.sh
......
......@@ -135,6 +135,21 @@ sc_require_config_h:
else :; \
fi
# You must include <config.h> before including any other header file.
sc_require_config_h_first:
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
fail=0; \
for i in $$($(VC_LIST_EXCEPT) | grep '\.c$$'); do \
grep '^# *include\>' $$i | sed 1q \
| grep '^# *include <config\.h>' > /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; } || :; \
else :; \
fi
# To use this "command" macro, you must first define two shell variables:
# h: the header, enclosed in <> or ""
# re: a regular expression that matches IFF something provided by $h is used.
......
......@@ -33,11 +33,15 @@ EXTRA_DIST = \
if RPCGEN
SUFFIXES = .x
# The subshell ensures that remote_protocol.c ends up
# including <config.h> before "remote_protocol.h".
.x.c:
rm -f $@ $@-t $@-t2
rm -f $@ $@-t $@-t1 $@-t2
rpcgen -c -o $@-t $<
(echo '#include <config.h>'; cat $@-t) > $@-t1
if GLIBC_RPCGEN
perl -w rpcgen_fix.pl $@-t > $@-t2
perl -w rpcgen_fix.pl $@-t1 > $@-t2
rm $@-t1
chmod 444 $@-t2
mv $@-t2 $@
endif
......
#include <config.h>
/*
* Please do not edit this file.
* It was generated using rpcgen.
*/
#include "remote_protocol.h"
#include <config.h>
#include "internal.h"
#include <arpa/inet.h>
......
......@@ -13,7 +13,6 @@
extern "C" {
#endif
#include <config.h>
#include "internal.h"
#include <arpa/inet.h>
#define REMOTE_MESSAGE_MAX 262144
......
......@@ -36,7 +36,6 @@
* 'REMOTE_'. This makes names quite long.
*/
%#include <config.h>
%#include "internal.h"
%#include <arpa/inet.h>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部