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

[PATCH] xen: add header guards to generated asm generic headers



MISRA D4.10 requires to have proper header guards in place in all header
files. Add header guards for generated asm generic headers as well.

Suggested-by: Jan Beulich <jbeulich@xxxxxxxx>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>

diff --git a/xen/scripts/Makefile.asm-generic b/xen/scripts/Makefile.asm-generic
index b0d356bfa3..a44844bed0 100644
--- a/xen/scripts/Makefile.asm-generic
+++ b/xen/scripts/Makefile.asm-generic
@@ -32,7 +32,12 @@ old-headers := $(wildcard $(obj)/*.h)
 unwanted    := $(filter-out $(generic-y) $(generated-y),$(old-headers))
 
 quiet_cmd_wrap = WRAP    $@
-      cmd_wrap = echo "\#include <asm-generic/$*.h>" > $@
+      cmd_wrap = \
+       upper=$$(echo $*.h | tr a-z A-Z | tr '/.' '__'); \
+       printf "\#ifndef ASM_GENERIC_$${upper}\n" > $@; \
+       printf "\#define ASM_GENERIC_$${upper}\n" >> $@; \
+       printf "\#include <asm-generic/$*.h>\n" >> $@; \
+       printf "\#endif /* ASM_GENERIC_$${upper} */\n" >> $@
 
 quiet_cmd_remove = REMOVE  $(unwanted)
       cmd_remove = rm -f $(unwanted)



 


Rackspace

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