From mboxrd@z Thu Jan 1 00:00:00 1970 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 C6854C83F10 for ; Thu, 31 Aug 2023 10:08:51 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.593707.926765 (Exim 4.92) (envelope-from ) id 1qbeax-0006O0-4d; Thu, 31 Aug 2023 10:08:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 593707.926765; Thu, 31 Aug 2023 10:08:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qbeax-0006Nt-04; Thu, 31 Aug 2023 10:08:11 +0000 Received: by outflank-mailman (input) for mailman id 593707; Thu, 31 Aug 2023 10:08:09 +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 1qbeav-0006Nk-Cc for xen-devel@lists.xenproject.org; Thu, 31 Aug 2023 10:08:09 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 47ba8211-47e6-11ee-9b0d-b553b5be7939; Thu, 31 Aug 2023 12:08:07 +0200 (CEST) Received: from [192.168.8.109] (unknown [151.36.24.215]) by support.bugseng.com (Postfix) with ESMTPSA id DF9614EE0738; Thu, 31 Aug 2023 12:08:05 +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: 47ba8211-47e6-11ee-9b0d-b553b5be7939 Message-ID: Date: Thu, 31 Aug 2023 12:08:05 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [XEN PATCH 09/13] xen/common: address violations of MISRA C:2012 Directive 4.10 Content-Language: en-US To: Jan Beulich Cc: consulting@bugseng.com, sstabellini@kernel.org, Andrew Cooper , George Dunlap , Julien Grall , Wei Liu , xen-devel@lists.xenproject.org References: <00d67696-7895-f4cd-de0d-0c24f937deb9@suse.com> From: Simone Ballarin Organization: BUGSENG In-Reply-To: <00d67696-7895-f4cd-de0d-0c24f937deb9@suse.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 29/08/23 08:50, Jan Beulich wrote: > On 28.08.2023 15:20, Simone Ballarin wrote: >> Add inclusion guards to address violations of >> MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order >> to prevent the contents of a header file being included more than >> once"). >> >> Also C files, if included somewhere, need to comply with the guideline. >> >> Mechanical change. >> >> Signed-off-by: Simone Ballarin >> --- >> xen/common/compat/grant_table.c | 7 +++++++ >> xen/common/coverage/gcc_4_7.c | 5 +++++ >> xen/common/decompress.h | 5 +++++ >> xen/common/event_channel.h | 5 +++++ >> xen/common/multicall.c | 5 +++++ >> 5 files changed, 27 insertions(+) > > As already said in reply to another patch, imo .c files shouldn't gain such > guards. These are commonly referred to as "header guards" for a reason. > This is the MISRA's definition of "header file" (MISRA C:2012 Revision 1, Appendix J): "A header file is any file that is the subject of a #include directive. Note: the filename extension is not significant." So, the guards are required if we want to comply with the directive, otherwise we can raise a deviation. The danger of multi-inclusion also exists for .c files, why do you want to avoid guards for them? >> --- a/xen/common/compat/grant_table.c >> +++ b/xen/common/compat/grant_table.c >> @@ -3,6 +3,10 @@ >> * >> */ >> >> + > > Nit: No double blank lines please. > >> +#ifndef __COMMON_COMPAT_GRANT_TABLE_C__ >> +#define __COMMON_COMPAT_GRANT_TABLE_C__ >> + >> #include >> #include >> >> @@ -331,6 +335,9 @@ int compat_grant_table_op( >> return rc; >> } >> >> + > > Again here (at least). > > Jan -- Simone Ballarin, M.Sc. Field Application Engineer, BUGSENG (https://bugseng.com)