Message ID | 08fe3472d3da3035357b72d4684295cbe79b77c1.1721720583.git.alessandro.zucchelli@bugseng.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | xen: address violation of MISRA C:2012 Directive 4.10 | expand |
On Tue, 23 Jul 2024, Alessandro Zucchelli wrote: > This addresses violations of MISRA C:2012 Rule 4.10 which states as > following: Precautions shall be taken in order to prevent the contents > of a header file being included more than once. > > Changes are made for autogenerated header files: include/xen/compile.h > and include/xen/hypercall-defs.h. > > No functional change. > > Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com> > > --- > Changes in v5: > - edit inclusion guards for autogenerated header files > --- > xen/build.mk | 6 +++++- > xen/include/Makefile | 5 ++++- > 2 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/xen/build.mk b/xen/build.mk > index 32624d3097..ebb2d06b3c 100644 > --- a/xen/build.mk > +++ b/xen/build.mk > @@ -18,6 +18,8 @@ quiet_cmd_compile.h = UPD $@ > define cmd_compile.h > if [ ! -r $@ -o -O $@ ]; then \ > cat .banner; \ > + echo '#ifndef XEN__COMPILE_H' > $(dot-target).tmp; \ > + echo '#define XEN__COMPILE_H' >> $(dot-target).tmp; \ > sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \ > -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \ > -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \ > @@ -28,8 +30,9 @@ define cmd_compile.h > -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \ > -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \ > -e 's!@@changeset@@!$(shell $(srctree)/tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \ > - < $< > $(dot-target).tmp; \ > + < $< >> $(dot-target).tmp; \ > sed -rf $(srctree)/tools/process-banner.sed < .banner >> $(dot-target).tmp; \ > + echo '#endif /* XEN__COMPILE_H */' >> $(dot-target).tmp; \ > mv -f $(dot-target).tmp $@; \ > fi > endef > @@ -40,6 +43,7 @@ include/xen/compile.h: include/xen/compile.h.in .banner FORCE > > targets += include/xen/compile.h > > + Spurious change? Could be fixed on commit. Other than this Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > -include $(wildcard .asm-offsets.s.d) > asm-offsets.s: arch/$(SRCARCH)/$(ARCH)/asm-offsets.c > $(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o $@.new -MQ $@ $< > diff --git a/xen/include/Makefile b/xen/include/Makefile > index 1ff9468eeb..35df93c82e 100644 > --- a/xen/include/Makefile > +++ b/xen/include/Makefile > @@ -119,7 +119,10 @@ $(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) FORCE > > quiet_cmd_genhyp = GEN $@ > define cmd_genhyp > - awk -f $(srctree)/scripts/gen_hypercall.awk <$< >$@ > + echo "#ifndef XEN__HYPERCALL_DEFS_H" >$@; \ > + echo "#define XEN__HYPERCALL_DEFS_H" >>$@; \ > + awk -f $(srctree)/scripts/gen_hypercall.awk <$< >>$@; \ > + echo "#endif /* XEN__HYPERCALL_DEFS_H */" >>$@ > endef > > all: $(obj)/xen/hypercall-defs.h > -- > 2.34.1 >
diff --git a/xen/build.mk b/xen/build.mk index 32624d3097..ebb2d06b3c 100644 --- a/xen/build.mk +++ b/xen/build.mk @@ -18,6 +18,8 @@ quiet_cmd_compile.h = UPD $@ define cmd_compile.h if [ ! -r $@ -o -O $@ ]; then \ cat .banner; \ + echo '#ifndef XEN__COMPILE_H' > $(dot-target).tmp; \ + echo '#define XEN__COMPILE_H' >> $(dot-target).tmp; \ sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \ -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \ -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \ @@ -28,8 +30,9 @@ define cmd_compile.h -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \ -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \ -e 's!@@changeset@@!$(shell $(srctree)/tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \ - < $< > $(dot-target).tmp; \ + < $< >> $(dot-target).tmp; \ sed -rf $(srctree)/tools/process-banner.sed < .banner >> $(dot-target).tmp; \ + echo '#endif /* XEN__COMPILE_H */' >> $(dot-target).tmp; \ mv -f $(dot-target).tmp $@; \ fi endef @@ -40,6 +43,7 @@ include/xen/compile.h: include/xen/compile.h.in .banner FORCE targets += include/xen/compile.h + -include $(wildcard .asm-offsets.s.d) asm-offsets.s: arch/$(SRCARCH)/$(ARCH)/asm-offsets.c $(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o $@.new -MQ $@ $< diff --git a/xen/include/Makefile b/xen/include/Makefile index 1ff9468eeb..35df93c82e 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -119,7 +119,10 @@ $(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) FORCE quiet_cmd_genhyp = GEN $@ define cmd_genhyp - awk -f $(srctree)/scripts/gen_hypercall.awk <$< >$@ + echo "#ifndef XEN__HYPERCALL_DEFS_H" >$@; \ + echo "#define XEN__HYPERCALL_DEFS_H" >>$@; \ + awk -f $(srctree)/scripts/gen_hypercall.awk <$< >>$@; \ + echo "#endif /* XEN__HYPERCALL_DEFS_H */" >>$@ endef all: $(obj)/xen/hypercall-defs.h
This addresses violations of MISRA C:2012 Rule 4.10 which states as following: Precautions shall be taken in order to prevent the contents of a header file being included more than once. Changes are made for autogenerated header files: include/xen/compile.h and include/xen/hypercall-defs.h. No functional change. Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com> --- Changes in v5: - edit inclusion guards for autogenerated header files --- xen/build.mk | 6 +++++- xen/include/Makefile | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-)