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 1C506C5AD4C for ; Thu, 23 Nov 2023 07:47:05 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.639391.996721 (Exim 4.92) (envelope-from ) id 1r64QA-0001M5-6O; Thu, 23 Nov 2023 07:46:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 639391.996721; Thu, 23 Nov 2023 07:46: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 1r64QA-0001Lw-3e; Thu, 23 Nov 2023 07:46:46 +0000 Received: by outflank-mailman (input) for mailman id 639391; Thu, 23 Nov 2023 07:46:44 +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 1r64Q8-0000Zu-RQ for xen-devel@lists.xenproject.org; Thu, 23 Nov 2023 07:46:44 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 72655763-89d4-11ee-98e2-6d05b1d4d9a1; Thu, 23 Nov 2023 08:46:44 +0100 (CET) Received: from support.bugseng.com (support.bugseng.com [162.55.131.47]) by support.bugseng.com (Postfix) with ESMTPA id CF20C4EE073C; Thu, 23 Nov 2023 08:46:43 +0100 (CET) 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: 72655763-89d4-11ee-98e2-6d05b1d4d9a1 MIME-Version: 1.0 Date: Thu, 23 Nov 2023 08:46:43 +0100 From: Nicola Vetrini To: Andrew Cooper Cc: Xen-devel , Jan Beulich , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Roberto Bagnara , Simone Ballarin Subject: Re: [PATCH 3/3] xen/MISRA: Remove nonstandard inline keywords In-Reply-To: References: <20231122142733.1818331-1-andrew.cooper3@citrix.com> <20231122142733.1818331-4-andrew.cooper3@citrix.com> Message-ID: <46015f0bbb6ab57c0f18d5f7c66a3232@bugseng.com> X-Sender: nicola.vetrini@bugseng.com Organization: BUGSENG s.r.l. Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2023-11-22 17:46, Andrew Cooper wrote: > On 22/11/2023 4:39 pm, Nicola Vetrini wrote: >> On 2023-11-22 15:27, Andrew Cooper wrote: >>> The differences between inline, __inline and __inline__ keywords are >>> a >>> vestigial remnant of older C standards, and in Xen we use inline >>> almost >>> exclusively. >>> >>> Replace __inline and __inline__ with regular inline, and remove their >>> exceptions from the MISRA configuration. >>> >>> Signed-off-by: Andrew Cooper >>> --- >>> CC: Jan Beulich >>> CC: Roger Pau Monné >>> CC: Wei Liu >>> CC: Stefano Stabellini >>> CC: Roberto Bagnara >>> CC: Nicola Vetrini >>> CC: Simone Ballarin >>> >>> I'm entirely guessing at the Eclair configuration. >>> --- >> >> The configuration changes are ok. One observation below. > > Thanks.  Can I take that as an Ack/Reviewed-by ? > I see that Simone already gave one; that should suffice. >>> diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h >>> index 04b8bc18df0e..16d554f2a593 100644 >>> --- a/xen/include/xen/compiler.h >>> +++ b/xen/include/xen/compiler.h >>> @@ -83,7 +82,7 @@ >>>   * inline functions not expanded inline get placed in .init.text. >>>   */ >>>  #include >>> -#define __inline__ __inline__ __init >>> +#define inline inline __init >> >> The violation of Rule 20.4 (A macro shall not be defined with the same >> name as a keyword) is still present due to this macro. > > I was expecting this to come up. > > There's a comment half out of context above, but to expand on it, we > have a feature in the build system where if you say obj-y += foo.init.o > then it gets compiled as normal and then all symbols checked for being > in the relevant .init sections.  It's a safeguard around init-only code > ending up in the runtime image (which is good for other goals of > safety). > > This particular define is necessary to cause out-of-lined static > inlines > to end up in the right section, without having to invent a new > __inline_or_init macro and rewriting half the header files in the > project. > > I think it's going to need a local deviation.  It's deliberate, and all > we're doing is using the inline keyword to hook in an extra __section() > attribute. > > ~Andrew That's fair. I also agree that an exception for this use of inline can be made. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)