On 06.06.2025 02:08, Stefano Stabellini wrote:
> 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>

Acked-by: Jan Beulich <jbeul...@suse.com>
albeit, as mentioned elsewhere, preferably with ...

> --- 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)

... echo instead of printf (and then respective adjustments to the strings), if
that's technically possible.

Jan

Reply via email to