[PATCH] compat: add header guard to xlat.h

Jan Beulich posted 1 patch 4 months, 4 weeks ago
Failed in applying to current master (apply log)
[PATCH] compat: add header guard to xlat.h
Posted by Jan Beulich 4 months, 4 weeks ago
This is to conform with Misra C:2012 Directive 4.10.

Reported-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -105,9 +105,14 @@ xlat-y := $(shell sed -ne 's,@arch@,$(co
 xlat-y := $(filter $(patsubst compat/%,%,$(headers-y)),$(xlat-y))
 
 quiet_cmd_xlat_h = GEN     $@
-cmd_xlat_h = \
-	cat $(filter %.h,$^) >$@.new; \
-	mv -f $@.new $@
+define cmd_xlat_h
+    echo "#ifndef COMPAT_XLAT_H" >$@.new; \
+    echo "#define COMPAT_XLAT_H" >>$@.new; \
+    cat $(filter %.h,$^) >>$@.new; \
+    echo "" >>$@.new; \
+    echo "#endif /* COMPAT_XLAT_H */" >>$@.new; \
+    mv -f $@.new $@
+endef
 
 $(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) FORCE
 	$(call if_changed,xlat_h)
Re: [PATCH] compat: add header guard to xlat.h
Posted by Andrew Cooper 4 months, 4 weeks ago
On 03/06/2025 7:44 am, Jan Beulich wrote:
> This is to conform with Misra C:2012 Directive 4.10.
>
> Reported-by: Stefano Stabellini <sstabellini@kernel.org>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>