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

[XEN PATCH v3 12/16] xen: address violations of MISRA C:2012 Directive 4.10



From: Maria Celeste Cesario <maria.celeste.cesario@xxxxxxxxxxx>

Modify creation rule for asm-offsets.h to conform to
the new standard and to not generate conflicting guards
between architectures (which is a violation of the directive).
Modify generic-y creation rule to generate code without violations
and to conform to the new standard.

Mechanical change.
---
Commit introduced in v3

Signed-off-by: Maria Celeste Cesario  <maria.celeste.cesario@xxxxxxxxxxx>
Signed-off-by: Simone Ballarin  <simone.ballarin@xxxxxxxxxxx>
---
 xen/build.mk                     |  6 ++++--
 xen/scripts/Makefile.asm-generic | 16 +++++++++++++++-
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/xen/build.mk b/xen/build.mk
index 0f490ca71b..bd8b93e2ae 100644
--- a/xen/build.mk
+++ b/xen/build.mk
@@ -45,6 +45,8 @@ asm-offsets.s: arch/$(SRCARCH)/$(ARCH)/asm-offsets.c
        $(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
        $(call move-if-changed,$@.new,$@)
 
+ARCHDIR = $(shell echo $(SRCARCH) | tr a-z A-Z)
+
 arch/$(SRCARCH)/include/asm/asm-offsets.h: asm-offsets.s
        @(set -e; \
          echo "/*"; \
@@ -54,8 +56,8 @@ arch/$(SRCARCH)/include/asm/asm-offsets.h: asm-offsets.s
          echo " *"; \
          echo " */"; \
          echo ""; \
-         echo "#ifndef __ASM_OFFSETS_H__"; \
-         echo "#define __ASM_OFFSETS_H__"; \
+         echo "#ifndef ASM_$(ARCHDIR)_ASM_OFFSETS_H"; \
+         echo "#define ASM_$(ARCHDIR)_ASM_OFFSETS_H"; \
          echo ""; \
          sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
          echo ""; \
diff --git a/xen/scripts/Makefile.asm-generic b/xen/scripts/Makefile.asm-generic
index b0d356bfa3..3b538bc7a4 100644
--- a/xen/scripts/Makefile.asm-generic
+++ b/xen/scripts/Makefile.asm-generic
@@ -31,8 +31,22 @@ generated-y := $(addprefix $(obj)/, $(generated-y))
 old-headers := $(wildcard $(obj)/*.h)
 unwanted    := $(filter-out $(generic-y) $(generated-y),$(old-headers))
 
+define header_stub
+#ifndef ASM_GENERIC_$(3)_$(2)_H
+#define ASM_GENERIC_$(3)_$(2)_H
+
+#include <asm-generic/$(1).h>
+
+#endif /* ASM_GENERIC_$(3)_$(2)_H */
+endef
+
+arch = $(shell echo $(SRCARCH) | tr a-z A-Z)
+
+header_body = $(call header_stub,$*,$(shell echo "$*" | tr a-z A-Z),$(arch))
+export header_body
+
 quiet_cmd_wrap = WRAP    $@
-      cmd_wrap = echo "\#include <asm-generic/$*.h>" > $@
+      cmd_wrap = echo "$$header_body" > $@
 
 quiet_cmd_remove = REMOVE  $(unwanted)
       cmd_remove = rm -f $(unwanted)
-- 
2.34.1




 


Rackspace

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