[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v4 2/4] xen: introduce a C99 headers check



Introduce a C99 headers check, for non-ANSI compliant headers. No
headers are added to the check yet.

In addition to the usual -include stdint.h, also add -include string.h
to the C99 check to get the declaration of memcpy and size_t.

For the same reasons, also add -include string.h to the C++ check.

Signed-off-by: Stefano Stabellini <stefano@xxxxxxxxxxx>
CC: JBeulich@xxxxxxxx
CC: konrad.wilk@xxxxxxxxxx
---

It is actually string.h, not stddef.h, that provides the declaration of
memcpy.

---
 xen/include/Makefile | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/xen/include/Makefile b/xen/include/Makefile
index aca7f20..a46485b 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -90,11 +90,12 @@ compat/xlat.h: $(addprefix compat/.xlat/,$(xlat-y)) Makefile
 
 ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH))
 
-all: headers.chk headers++.chk
+all: headers.chk headers99.chk headers++.chk
 
 PUBLIC_HEADERS := $(filter-out public/arch-% public/dom0_ops.h, $(wildcard 
public/*.h public/*/*.h) $(public-y))
 
-PUBLIC_ANSI_HEADERS := $(filter-out public/%ctl.h public/xsm/% 
public/%hvm/save.h, $(PUBLIC_HEADERS))
+PUBLIC_C99_HEADERS :=
+PUBLIC_ANSI_HEADERS := $(filter-out public/%ctl.h public/xsm/% 
public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS))
 
 headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile
        for i in $(filter %.h,$^); do \
@@ -104,18 +105,26 @@ headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile
        done >$@.new
        mv $@.new $@
 
+headers99.chk: $(PUBLIC_C99_HEADERS) Makefile
+       for i in $(filter %.h,$^); do \
+           $(CC) -x c -std=c99 -Wall -Werror -include stdint.h \
+                 -include string.h -S -o /dev/null $$i || exit 1; \
+           echo $$i; \
+       done >$@.new
+       mv $@.new $@
+
 headers++.chk: $(PUBLIC_HEADERS) Makefile
        if $(CXX) -v >/dev/null 2>&1; then \
            for i in $(filter %.h,$^); do \
                echo '#include "'$$i'"' \
                | $(CXX) -x c++ -std=gnu++98 -Wall -Werror -D__XEN_TOOLS__ \
-                 -include stdint.h -include public/xen.h -S -o /dev/null - \
+                 -include stdint.h -include string.h -include public/xen.h \
+                 -S -o /dev/null - \
                || exit 1; \
                echo $$i; \
            done ; \
        fi >$@.new
        mv $@.new $@
-
 endif
 
 ifeq ($(XEN_TARGET_ARCH),x86_64)
@@ -128,5 +137,5 @@ all: $(BASEDIR)/include/asm-x86/cpuid-autogen.h
 endif
 
 clean::
-       rm -rf compat headers.chk headers++.chk
+       rm -rf compat headers.chk headers99.chk headers++.chk
        rm -f $(BASEDIR)/include/asm-x86/cpuid-autogen.h
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.