diff mbox

[for-4.9] xen: use a dummy file in C99 header check

Message ID 20170406183336.15351-1-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu April 6, 2017, 6:33 p.m. UTC
The check builds header file as if it is a C file. Clang doesn't like
the idea of having dead code in C file. The check as-is fails on Clang
with unused function warnings.

Use a dummy file like the C++ header check to fix this.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 xen/include/Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Andrew Cooper April 6, 2017, 6:46 p.m. UTC | #1
On 06/04/17 19:33, Wei Liu wrote:
> The check builds header file as if it is a C file. Clang doesn't like
> the idea of having dead code in C file. The check as-is fails on Clang
> with unused function warnings.
>
> Use a dummy file like the C++ header check to fix this.
>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox

Patch

diff --git a/xen/include/Makefile b/xen/include/Makefile
index 65a732a707..cd271dde0a 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -111,9 +111,10 @@  headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile
 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)                                              \
+	    echo "#include "\"$(i)\"                                          \
+	    | $(CC) -x c -std=c99 -Wall -Werror                               \
+	      -include stdint.h $(foreach j, $($(i)-prereq), -include $(j).h) \
+	      -S -o /dev/null -                                               \
 	    || exit $$?; echo $(i) >> $@.new;)
 	mv $@.new $@