Re: [Xen-devel] [PATCH XEN v4 05/23] tools: Arrange to check public headers for ANSI compatiblity

2015-10-29 Thread Wei Liu
On Wed, Oct 21, 2015 at 04:23:12PM +0100, Ian Campbell wrote:
> Using the same rune as we use for the Xen public headers, except we do
> not need stdint.h here and we use -pedantic too.
> 
> Signed-off-by: Ian Campbell 

Acked-by: Wei Liu 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH XEN v4 05/23] tools: Arrange to check public headers for ANSI compatiblity

2015-10-21 Thread Ian Campbell
Using the same rune as we use for the Xen public headers, except we do
not need stdint.h here and we use -pedantic too.

Signed-off-by: Ian Campbell 
---
 .gitignore  | 2 ++
 tools/Rules.mk  | 8 
 tools/libs/evtchn/Makefile  | 4 +++-
 tools/libs/toollog/Makefile | 5 -
 4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index bf382e5..b34dc3c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -86,6 +86,8 @@ tools/config.cache
 config/Tools.mk
 config/Stubdom.mk
 config/Docs.mk
+tools/libs/toollog/headers.chk
+tools/libs/evtchn/headers.chk
 tools/blktap2/daemon/blktapctrl
 tools/blktap2/drivers/img2qcow
 tools/blktap2/drivers/lock-util
diff --git a/tools/Rules.mk b/tools/Rules.mk
index 29d01b4..1ca3fcc 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -176,6 +176,14 @@ INSTALL_PYTHON_PROG = \
 %.opic: %.S
$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $< 
$(APPEND_CFLAGS)
 
+headers.chk:
+   for i in $(filter %.h,$^); do \
+   $(CC) -x c -ansi -Wall -Werror -pedantic $(CFLAGS_xeninclude) \
+ -S -o /dev/null $$i || exit 1; \
+   echo $$i; \
+   done >$@.new
+   mv $@.new $@
+
 subdirs-all subdirs-clean subdirs-install subdirs-distclean: .phony
@set -e; for subdir in $(SUBDIRS) $(SUBDIRS-y); do \
$(MAKE) subdir-$(patsubst subdirs-%,%,$@)-$$subdir; \
diff --git a/tools/libs/evtchn/Makefile b/tools/libs/evtchn/Makefile
index 85ed6dc..892892c 100644
--- a/tools/libs/evtchn/Makefile
+++ b/tools/libs/evtchn/Makefile
@@ -32,8 +32,9 @@ build:
$(MAKE) libs
 
 .PHONY: libs
-libs: $(LIB)
+libs: headers.chk $(LIB)
 
+headers.chk: $(wildcard include/*.h)
 
 libxenevtchn.a: $(LIB_OBJS)
$(AR) rc $@ $^
@@ -63,3 +64,4 @@ TAGS:
 .PHONY: clean
 clean:
rm -rf *.rpm $(LIB) *~ $(DEPS) $(LIB_OBJS) $(PIC_OBJS)
+   rm -f headers.chk
diff --git a/tools/libs/toollog/Makefile b/tools/libs/toollog/Makefile
index bd12403..72c70c9 100644
--- a/tools/libs/toollog/Makefile
+++ b/tools/libs/toollog/Makefile
@@ -27,7 +27,9 @@ build:
$(MAKE) libs
 
 .PHONY: libs
-libs: $(LIB)
+libs: headers.chk $(LIB)
+
+headers.chk: $(wildcard include/*.h)
 
 libxentoollog.a: $(LIB_OBJS)
$(AR) rc $@ $^
@@ -57,3 +59,4 @@ TAGS:
 .PHONY: clean
 clean:
rm -rf *.rpm $(LIB) *~ $(DEPS) $(LIB_OBJS) $(PIC_OBJS)
+   rm -f headers.chk
-- 
2.1.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel