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 <jbeul...@suse.com> Signed-off-by: Stefano Stabellini <stefano.stabell...@amd.com> --- Changes in v2: - write to $@.new and move the file - change the header guard name --- xen/scripts/Makefile.asm-generic | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/scripts/Makefile.asm-generic b/xen/scripts/Makefile.asm-generic index b0d356bfa3..1e85a92c32 100644 --- a/xen/scripts/Makefile.asm-generic +++ b/xen/scripts/Makefile.asm-generic @@ -32,7 +32,14 @@ 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 = \ + arch=$$(echo $@ | sed -n 's:.*arch/\([^/]*\)/.*:\1:p' | tr a-z A-Z); \ + upper=$$(echo $*.h | tr a-z A-Z | tr '/.' '__'); \ + printf "\#ifndef $${arch}_GENERIC_$${upper}\n" > $@.new; \ + printf "\#define $${arch}_GENERIC_$${upper}\n" >> $@.new; \ + printf "\#include <asm-generic/$*.h>\n" >> $@.new; \ + printf "\#endif /* $${arch}_GENERIC_$${upper} */\n" >> $@.new; \ + mv -f $@.new $@ quiet_cmd_remove = REMOVE $(unwanted) cmd_remove = rm -f $(unwanted) -- 2.25.1