Skip to contentSkip to conversation

compat: add header guard to xlat.h

PATCH In review Jan Beulich 2 participants 2 messages Jun 3, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compat: add header guard to xlat.h

This is to conform with Misra C:2012 Directive 4.10.

xen/include/Makefile +8 -3
@@ -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,$^) >[email protected]; \
-	mv -f [email protected] $@
+define cmd_xlat_h
+    echo "#ifndef COMPAT_XLAT_H" >[email protected]; \
+    echo "#define COMPAT_XLAT_H" >>[email protected]; \
+    cat $(filter %.h,$^) >>[email protected]; \
+    echo "" >>[email protected]; \
+    echo "#endif /* COMPAT_XLAT_H */" >>[email protected]; \
+    mv -f [email protected] $@
+endef
 
 $(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) FORCE
 	$(call if_changed,xlat_h)