From nobody Fri Nov 22 08:00:30 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; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1718887869667877.795764548442; Thu, 20 Jun 2024 05:51:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.744460.1151498 (Exim 4.92) (envelope-from ) id 1sKHFW-0007o0-4t; Thu, 20 Jun 2024 12:50:46 +0000 Received: by outflank-mailman (output) from mailman id 744460.1151498; Thu, 20 Jun 2024 12:50:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sKHFW-0007nt-0t; Thu, 20 Jun 2024 12:50:46 +0000 Received: by outflank-mailman (input) for mailman id 744460; Thu, 20 Jun 2024 12:50:45 +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 1sKHFV-0007nn-LP for xen-devel@lists.xenproject.org; Thu, 20 Jun 2024 12:50:45 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b489d3e1-2f03-11ef-b4bb-af5377834399; Thu, 20 Jun 2024 14:50:43 +0200 (CEST) Received: from truciolo.bugseng.com (unknown [78.208.165.219]) by support.bugseng.com (Postfix) with ESMTPSA id 724A54EE0738; Thu, 20 Jun 2024 14:50:41 +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: b489d3e1-2f03-11ef-b4bb-af5377834399 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Simone Ballarin , Doug Goldstein , Stefano Stabellini , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall Subject: [XEN PATCH] automation/eclair: add deviations of MISRA C Rule 5.5 Date: Thu, 20 Jun 2024 14:50:34 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1718887871738100001 Content-Type: text/plain; charset="utf-8" MISRA C Rule 5.5 states that "Identifiers shall be distinct from macro names". Update ECLAIR configuration to deviate: - macros expanding to their own name; - clashes between macros and non-callable entities; - clashes related to the selection of specific implementations of string handling functions. Signed-off-by: Federico Serafini Reviewed-by: Stefano Stabellini --- .../eclair_analysis/ECLAIR/deviations.ecl | 16 ++++++++++++++ docs/misra/deviations.rst | 21 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/= eclair_analysis/ECLAIR/deviations.ecl index e2653f77eb..9ad0e1f90a 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -90,6 +90,22 @@ conform to the directive." -config=3DMC3R1.R5.3,reports+=3D{safe, "any_area(any_loc(any_exp(macro(^re= ad_debugreg$))&&any_exp(macro(^write_debugreg$))))"} -doc_end =20 +-doc_begin=3D"Macros expanding to their own identifier (e.g., \"#define x = x\") are deliberate." +-config=3DMC3R1.R5.5,reports+=3D{deliberate, "all_area(macro(same_id_body(= ))||!macro(!same_id_body()))"} +-doc_end + +-doc_begin=3D"There is no clash between function like macros and not calla= ble objects." +-config=3DMC3R1.R5.5,reports+=3D{deliberate, "all_area(macro(function_like= ())||decl(any()))&&all_area(macro(any())||!decl(kind(function))&&!decl(__fu= nction_pointer_decls))"} +-doc_end + +-doc_begin=3D"Clashes between function names and macros are deliberate for= string handling functions since some architectures may want to use their o= wn arch-specific implementation." +-config=3DMC3R1.R5.5,reports+=3D{deliberate, "all_area(all_loc(file(^xen/a= rch/x86/string\\.c|xen/include/xen/string\\.h|xen/lib/.*$)))"} +-doc_end + +-doc_begin=3D"In libelf, clashes between macros and function names are del= iberate and needed to prevent the use of undecorated versions of memcpy, me= mset and memmove." +-config=3DMC3R1.R5.5,reports+=3D{deliberate, "any_area(decl(kind(function)= )||any_loc(macro(name(memcpy||memset||memmove))))&&any_area(any_loc(file(^x= en/common/libelf/libelf-private\\.h$)))"} +-doc_end + -doc_begin=3D"The type \"ret_t\" is deliberately defined multiple times, depending on the guest." -config=3DMC3R1.R5.6,reports+=3D{deliberate,"any_area(any_loc(text(^.*ret_= t.*$)))"} diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst index 36959aa44a..446c758c11 100644 --- a/docs/misra/deviations.rst +++ b/docs/misra/deviations.rst @@ -98,6 +98,27 @@ Deviations related to MISRA C:2012 Rules: - __emulate_2op and __emulate_2op_nobyte - read_debugreg and write_debugreg =20 + * - R5.5 + - Macros expanding to their own name are allowed. + - Tagged as `deliberate` for ECLAIR. + + * - R5.5 + - Clashes between names of function-like macros and identifiers of + non-callable entities are allowed. + - Tagged as `deliberate` for ECLAIR. + + * - R5.5 + - Clashes between function names and macros are deliberate for string + handling functions since some architectures may want to use their o= wn + arch-specific implementation. + - Tagged as `deliberate` for ECLAIR. + + * - R5.5 + - In libelf, clashes between macros and function names are deliberate= and + needed to prevent the use of undecorated versions of memcpy, memset= and + memmove. + - Tagged as `deliberate` for ECLAIR. + * - R5.6 - The type ret_t is deliberately defined multiple times depending on = the type of guest to service. --=20 2.34.1