--- /dev/null
+^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
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
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.
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>
extern "C" {
#endif
-#include <config.h>
#include "internal.h"
#include <arpa/inet.h>
#define REMOTE_MESSAGE_MAX 262144
* 'REMOTE_'. This makes names quite long.
*/
-%#include <config.h>
%#include "internal.h"
%#include <arpa/inet.h>