From nobody Thu Nov 21 18:02:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=bugseng.com ARC-Seal: i=1; a=rsa-sha256; t=1724850787; cv=none; d=zohomail.com; s=zohoarc; b=CaNAlSTSR+idIVT4ZNxaEgeOYrMsSnRHHe/kcHZ3ZcuoGY9UsL4nya03rqpCM9yQLGy0ggiO15KfS3hPFBnOrR7nPoNLkTJt/CGkuONn3zlAeDLiuh3z+/IWbur9CU5QccaAZbUQSvrTr6vJooSG7LPNyRgPeCrm5bcIB6bCFwU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724850787; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=m6NVroEDVUGjToh7KGorhEbDAvMlyBs3FvFEIPiAYuA=; b=G326EH9MJc4Bq08gmj1TeCPS9CMZ6+OZZR2CmR14LdZSzaeLzKrhdfLW1S3a4zO4XcWEDUWNKK++4simD3ONg/gWU/6EKY7mQVVi7HRvAWzm+DO9kuwGI6Qgr2uOfiDBDrRmuRzks579YVOKI3Ize0Xk1s9ZgcgTYmzRtW43q0s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1724850787484533.2725384480042; Wed, 28 Aug 2024 06:13:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.784814.1194207 (Exim 4.92) (envelope-from ) id 1sjITn-00041V-HA; Wed, 28 Aug 2024 13:12:55 +0000 Received: by outflank-mailman (output) from mailman id 784814.1194207; Wed, 28 Aug 2024 13:12:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sjITn-00041O-E5; Wed, 28 Aug 2024 13:12:55 +0000 Received: by outflank-mailman (input) for mailman id 784814; Wed, 28 Aug 2024 13:12:54 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sjITl-00041G-L3 for xen-devel@lists.xenproject.org; Wed, 28 Aug 2024 13:12:54 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3aa867a4-653f-11ef-99a0-01e77a169b0f; Wed, 28 Aug 2024 15:12:51 +0200 (CEST) Received: from truciolo.homenet.telecomitalia.it (host-79-46-33-59.retail.telecomitalia.it [79.46.33.59]) by support.bugseng.com (Postfix) with ESMTPSA id 4DD374EE0745; Wed, 28 Aug 2024 15:12:50 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 3aa867a4-653f-11ef-99a0-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bugseng.com; s=mail; t=1724850770; bh=YgUHtBUkddA4AevUOiJ9qiyDHF9U+GGJWoIylf0IYnM=; h=From:To:Cc:Subject:Date:From; b=UjIUas4yOUEIP7DACSCEa0ZB/VA65j1wrrnMY343Nxp8R4LAwT0Pmkwg5sEDlSmRE R9yJFfuvXVDFmT3SUujGWKfH/BubaP/nbOf2PKwFlERTyeWKY+WbuZFUUsWeoQ8RNA 4W6PAqCMeISUDrwy6T1F39BW6PPnGC4IhJddlRrMFSsksAAQI9ALXdVA5F2o+KBI0E hOGPdUbfcMqhaC5RCkC+tINaiSTqNh555FsqANa7Obyr8yPg70NoHFfwu86pKn3Pmt gJr1GWPGzE5h54YBDp5zQYkqvQE121XURYyGaIr7YJzgTtGlr3G6kqAYTrcFo5gwPC L6spIwiiUjarA== From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Simone Ballarin , Doug Goldstein , Stefano Stabellini , Andrew Cooper , Jan Beulich , Julien Grall Subject: [XEN PATCH] xen/bitmap: remove comment-based deviations Date: Wed, 28 Aug 2024 15:12:44 +0200 Message-Id: <4aa692a50a5d08d24560f02fdc36911965fc860b.1724850701.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @bugseng.com) X-ZM-MESSAGEID: 1724850788883116600 Content-Type: text/plain; charset="utf-8" Update ECLAIR configuration of MISRA C:2012 Rule 20.7 ("Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses") to tag as 'safe' the expansions of arguments surrounded by the following tokens: '{', '}' and ';'. Remove redundant comment-based deviations. Signed-off-by: Federico Serafini --- automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++ docs/misra/deviations.rst | 5 +++++ xen/include/xen/bitmap.h | 3 --- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/= eclair_analysis/ECLAIR/deviations.ecl index 1aa8277066..f37329973f 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -565,6 +565,10 @@ of this macro do not lead to developer confusion, and = can thus be deviated." -config=3DMC3R1.R20.7,reports+=3D{safe, "any_area(any_loc(any_exp(macro(^c= ount_args_$))))"} -doc_end =20 +-doc_begin=3D"The expansion of an argument surrounded by tokens '{', '}' a= nd ';' is safe." +-config=3DMC3R1.R20.7,expansion_context+=3D{safe, "left_right(^[\\{;]$,^[;= \\}]$)"} +-doc_end + -doc_begin=3D"Uses of variadic macros that have one of their arguments def= ined as a macro and used within the body for both ordinary parameter expansion and= as an operand to the # or ## operators have a behavior that is well-understood a= nd diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst index d51aa422b5..d529726464 100644 --- a/docs/misra/deviations.rst +++ b/docs/misra/deviations.rst @@ -512,6 +512,11 @@ Deviations related to MISRA C:2012 Rules: refactoring it to add parentheses breaks its functionality. - Tagged as `safe` for ECLAIR. =20 + * - R20.7 + - The expansion of an argument surrounded by tokens '{', '}' and ';' = is + safe. + - Tagged as `safe` for ECLAIR. + * - R20.12 - Variadic macros that use token pasting often employ the gcc extensi= on `ext_paste_comma`, as detailed in `C-language-toolchain.rst`, which= is diff --git a/xen/include/xen/bitmap.h b/xen/include/xen/bitmap.h index 5d668053b0..4b642cd420 100644 --- a/xen/include/xen/bitmap.h +++ b/xen/include/xen/bitmap.h @@ -103,13 +103,10 @@ extern int bitmap_allocate_region(unsigned long *bitm= ap, int pos, int order); #define bitmap_switch(nbits, zero, small, large) \ unsigned int n__ =3D (nbits); \ if (__builtin_constant_p(nbits) && !n__) { \ - /* SAF-7-safe Rule 20.7 non-parenthesized macro argument */ \ zero; \ } else if (__builtin_constant_p(nbits) && n__ <=3D BITS_PER_LONG) { \ - /* SAF-7-safe Rule 20.7 non-parenthesized macro argument */ \ small; \ } else { \ - /* SAF-7-safe Rule 20.7 non-parenthesized macro argument */ \ large; \ } =20 --=20 2.34.1