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

[XEN PATCH v5 15/17] xen/build: address violation of MISRA C Directive 4.10



This addresses violations of MISRA C:2012 Rule 4.10 which states as
following: Precautions shall be taken in order to prevent the contents
of a header file being included more than once.

Changes are made for autogenerated header files: include/xen/compile.h
and include/xen/hypercall-defs.h.

No functional change.

Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@xxxxxxxxxxx>

---
Changes in v5:
- edit inclusion guards for autogenerated header files
---
 xen/build.mk         | 6 +++++-
 xen/include/Makefile | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/build.mk b/xen/build.mk
index 32624d3097..ebb2d06b3c 100644
--- a/xen/build.mk
+++ b/xen/build.mk
@@ -18,6 +18,8 @@ quiet_cmd_compile.h = UPD     $@
 define cmd_compile.h
     if [ ! -r $@ -o -O $@ ]; then \
        cat .banner; \
+       echo '#ifndef XEN__COMPILE_H' > $(dot-target).tmp; \
+       echo '#define XEN__COMPILE_H' >> $(dot-target).tmp; \
        sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \
            -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \
            -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
@@ -28,8 +30,9 @@ define cmd_compile.h
            -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
            -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
            -e 's!@@changeset@@!$(shell $(srctree)/tools/scmversion $(XEN_ROOT) 
|| echo "unavailable")!g' \
-           < $< > $(dot-target).tmp; \
+           < $< >> $(dot-target).tmp; \
        sed -rf $(srctree)/tools/process-banner.sed < .banner >> 
$(dot-target).tmp; \
+       echo '#endif /* XEN__COMPILE_H */' >> $(dot-target).tmp; \
        mv -f $(dot-target).tmp $@; \
     fi
 endef
@@ -40,6 +43,7 @@ include/xen/compile.h: include/xen/compile.h.in .banner FORCE
 
 targets += include/xen/compile.h
 
+
 -include $(wildcard .asm-offsets.s.d)
 asm-offsets.s: arch/$(SRCARCH)/$(ARCH)/asm-offsets.c
        $(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
diff --git a/xen/include/Makefile b/xen/include/Makefile
index 1ff9468eeb..35df93c82e 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -119,7 +119,10 @@ $(obj)/compat/xlat.h: $(addprefix 
$(obj)/compat/.xlat/,$(xlat-y)) FORCE
 
 quiet_cmd_genhyp = GEN     $@
 define cmd_genhyp
-    awk -f $(srctree)/scripts/gen_hypercall.awk <$< >$@
+    echo "#ifndef XEN__HYPERCALL_DEFS_H" >$@; \
+    echo "#define XEN__HYPERCALL_DEFS_H" >>$@; \
+    awk -f $(srctree)/scripts/gen_hypercall.awk <$< >>$@; \
+    echo "#endif /* XEN__HYPERCALL_DEFS_H */" >>$@
 endef
 
 all: $(obj)/xen/hypercall-defs.h
-- 
2.34.1




 


Rackspace

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