xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: xen-devel@lists.xenproject.org
Cc: Stefano Stabellini <stefano@aporeto.com>,
	sstabellini@kernel.org, JBeulich@suse.com
Subject: [PATCH v8 2/4] xen: introduce a C99 headers check
Date: Fri, 31 Mar 2017 12:15:17 -0700	[thread overview]
Message-ID: <1490987719-25452-2-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <1490987719-25452-1-git-send-email-sstabellini@kernel.org>

Introduce a C99 headers check, for non-ANSI compliant headers: 9pfs.h
and pvcalls.h.

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 reason, also add -include cstring to the C++ check when
necessary.

Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
CC: JBeulich@suse.com
CC: konrad.wilk@oracle.com
---
 .gitignore           |  3 +--
 xen/include/Makefile | 30 ++++++++++++++++++------------
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/.gitignore b/.gitignore
index 443b12a..0265c1e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -273,8 +273,7 @@ xen/arch/*/efi/boot.c
 xen/arch/*/efi/compat.c
 xen/arch/*/efi/efi.h
 xen/arch/*/efi/runtime.c
-xen/include/headers.chk
-xen/include/headers++.chk
+xen/include/headers*.chk
 xen/include/asm
 xen/include/asm-*/asm-offsets.h
 xen/include/asm-x86/cpuid-autogen.h
diff --git a/xen/include/Makefile b/xen/include/Makefile
index aca7f20..fd57ce4 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,16 +105,21 @@ headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile
 	done >$@.new
 	mv $@.new $@
 
+headers99.chk: $(PUBLIC_C99_HEADERS) Makefile
+	rm -f $@.new
+	$(foreach i, $(filter %.h,$^), $(CC) -x c -std=c99 -Wall -Werror    \
+	    -include stdint.h $(foreach j, $($(i)-prereq), -include $(j).h) \
+	    -S -o /dev/null $(i) || exit $$?; echo $(i) >> $@.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 - \
-	        || exit 1; \
-	        echo $$i; \
-	    done ; \
-	fi >$@.new
+	rm -f $@.new
+	$(CXX) -v >/dev/null 2>&1 || exit 0;                               \
+	$(foreach i, $(filter %.h,$^), echo "#include "\"$(i)\"            \
+	    |$(CXX) -x c++ -std=gnu++98 -Wall -Werror -D__XEN_TOOLS__      \
+	    -include stdint.h -include public/xen.h                        \
+	    $(foreach j, $($(i)-prereq), -include c$(j)) -S -o /dev/null - \
+	    || exit $$?; echo $(i) >> $@.new;)
 	mv $@.new $@
 
 endif
@@ -128,5 +134,5 @@ all: $(BASEDIR)/include/asm-x86/cpuid-autogen.h
 endif
 
 clean::
-	rm -rf compat headers.chk headers++.chk
+	rm -rf compat headers*.chk
 	rm -f $(BASEDIR)/include/asm-x86/cpuid-autogen.h
-- 
1.9.1


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

  reply	other threads:[~2017-03-31 19:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 19:15 [PATCH v8 0/4] new ring macros, 9pfs and pvcalls headers Stefano Stabellini
2017-03-31 19:15 ` [PATCH v8 1/4] ring.h: introduce macros to handle monodirectional rings with multiple req sizes Stefano Stabellini
2017-03-31 19:15   ` Stefano Stabellini [this message]
2017-04-03  8:15     ` [PATCH v8 2/4] xen: introduce a C99 headers check Jan Beulich
2017-04-03 18:25       ` Stefano Stabellini
2017-04-04  7:59         ` Jan Beulich
2017-04-05  0:12       ` Stefano Stabellini
2017-03-31 19:15   ` [PATCH v8 3/4] Introduce the Xen 9pfs transport header Stefano Stabellini
2017-04-04 19:50     ` Konrad Rzeszutek Wilk
2017-03-31 19:15   ` [PATCH v8 4/4] Introduce the pvcalls header Stefano Stabellini
2017-04-04 19:50     ` Konrad Rzeszutek Wilk
2017-04-04 19:49   ` [PATCH v8 1/4] ring.h: introduce macros to handle monodirectional rings with multiple req sizes Konrad Rzeszutek Wilk
2017-04-04 23:47     ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490987719-25452-2-git-send-email-sstabellini@kernel.org \
    --to=sstabellini@kernel.org \
    --cc=JBeulich@suse.com \
    --cc=stefano@aporeto.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).