From patchwork Mon Jul 1 13:46:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alessandro Zucchelli X-Patchwork-Id: 13718121 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C06F9C2BD09 for ; Mon, 1 Jul 2024 13:47:49 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.751676.1159700 (Exim 4.92) (envelope-from ) id 1sOHNd-0000wP-Mr; Mon, 01 Jul 2024 13:47:41 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 751676.1159700; Mon, 01 Jul 2024 13:47:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sOHNd-0000wI-KF; Mon, 01 Jul 2024 13:47:41 +0000 Received: by outflank-mailman (input) for mailman id 751676; Mon, 01 Jul 2024 13:47:40 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sOHMg-0007ig-H7 for xen-devel@lists.xenproject.org; Mon, 01 Jul 2024 13:46:42 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 58efca8a-37b0-11ef-90a5-e314d9c70b13; Mon, 01 Jul 2024 15:46:41 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-60-221-62.business.telecomitalia.it [79.60.221.62]) by support.bugseng.com (Postfix) with ESMTPSA id 947DA4EE0738; Mon, 1 Jul 2024 15:46:39 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 58efca8a-37b0-11ef-90a5-e314d9c70b13 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Alessandro Zucchelli , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH 16/17] xen/build: address violation of MISRA C Directive 4.10 Date: Mon, 1 Jul 2024 15:46:34 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 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. Added inclusion guards for autogenerated header files: include/xen/compile.h and include/xen/hypercall-defs.h. No functional change. Signed-off-by: Alessandro Zucchelli --- 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 bbd4c2970f..c83882c949 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 INCLUDE_XEN_COMPILE_H' >> $(dot-target).tmp; \ + echo '#define INCLUDE_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 /* INCLUDE_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 eccc2e017a..34e133949c 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -121,7 +121,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