From patchwork Tue Jul 23 08:15:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alessandro Zucchelli X-Patchwork-Id: 13739687 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 56D6DC3DA49 for ; Tue, 23 Jul 2024 08:16:53 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.762734.1173020 (Exim 4.92) (envelope-from ) id 1sWAhQ-0006Qy-FN; Tue, 23 Jul 2024 08:16:44 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 762734.1173020; Tue, 23 Jul 2024 08:16:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAhQ-0006Qm-CH; Tue, 23 Jul 2024 08:16:44 +0000 Received: by outflank-mailman (input) for mailman id 762734; Tue, 23 Jul 2024 08:16:42 +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 1sWAgl-0008AN-4q for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:16:03 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id cc2013c5-48cb-11ef-bbfe-fd08da9f4363; Tue, 23 Jul 2024 10:16:01 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id 3F21C4EE0743; Tue, 23 Jul 2024 10:15:59 +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: cc2013c5-48cb-11ef-bbfe-fd08da9f4363 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Maria Celeste Cesario , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini , Alessandro Zucchelli Subject: [XEN PATCH v5 12/17] xen: address violations of MISRA C:2012 Directive 4.10 Date: Tue, 23 Jul 2024 10:15:04 +0200 Message-Id: <42fbbb9ffb85893d049c80812b547ffb10ccda7e.1721720583.git.alessandro.zucchelli@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Maria Celeste Cesario Modify creation rule for asm-offsets.h to conform to the new standard and to not generate conflicting guards between architectures (which is a violation of the directive). Modify generic-y creation rule to generate code without violations and to conform to the new standard. Mechanical change. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin Signed-off-by: Nicola Vetrini Signed-off-by: Alessandro Zucchelli Reviewed-by: Stefano Stabellini --- Changes in v5: - edit inclusion guards of autogenerated files Commit introduced in v3 --- xen/build.mk | 7 ++++--- xen/scripts/Makefile.asm-generic | 8 +++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/xen/build.mk b/xen/build.mk index 0f490ca71b..32624d3097 100644 --- a/xen/build.mk +++ b/xen/build.mk @@ -47,6 +47,7 @@ asm-offsets.s: arch/$(SRCARCH)/$(ARCH)/asm-offsets.c arch/$(SRCARCH)/include/asm/asm-offsets.h: asm-offsets.s @(set -e; \ + guard=$$(echo ASM__${SRCARCH}__ASM_OFFSETS_H | tr a-z A-Z); \ echo "/*"; \ echo " * DO NOT MODIFY."; \ echo " *"; \ @@ -54,12 +55,12 @@ arch/$(SRCARCH)/include/asm/asm-offsets.h: asm-offsets.s echo " *"; \ echo " */"; \ echo ""; \ - echo "#ifndef __ASM_OFFSETS_H__"; \ - echo "#define __ASM_OFFSETS_H__"; \ + echo "#ifndef $$guard"; \ + echo "#define $$guard"; \ echo ""; \ sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \ echo ""; \ - echo "#endif") <$< >$@ + echo "#endif /* $$guard */") <$< >$@ build-dirs := $(patsubst %/built_in.o,%,$(filter %/built_in.o,$(ALL_OBJS) $(ALL_LIBS))) diff --git a/xen/scripts/Makefile.asm-generic b/xen/scripts/Makefile.asm-generic index b0d356bfa3..2d2fd9f76e 100644 --- a/xen/scripts/Makefile.asm-generic +++ b/xen/scripts/Makefile.asm-generic @@ -32,7 +32,13 @@ old-headers := $(wildcard $(obj)/*.h) unwanted := $(filter-out $(generic-y) $(generated-y),$(old-headers)) quiet_cmd_wrap = WRAP $@ - cmd_wrap = echo "\#include " > $@ +cmd_wrap = \ + guard=$$(echo ASM_GENERIC__${SRCARCH}__$*_H | tr a-z A-Z); \ + echo "\#ifndef $$guard" >$@.new; \ + echo "\#define $$guard" >>$@.new; \ + echo "\#include " >>$@.new; \ + echo "\#endif /* $$guard */" >>$@.new; \ + mv -f $@.new $@ quiet_cmd_remove = REMOVE $(unwanted) cmd_remove = rm -f $(unwanted)