[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH 09/13] xen/common: address violations of MISRA C:2012 Directive 4.10


  • To: Simone Ballarin <simone.ballarin@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 31 Aug 2023 13:10:28 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DRL3thwZf131cX3oc6B6n8VjvL8CShdV9Y5a+u6UwZY=; b=asYDcAA7DJXJd5qPWEuUI/m4oXRZiRR+yasCGp2ktvRPkx+aIevojgX/LfWbWoVXf8Mg35/abDnNUjFoYD6QsZ+7ukOSmk9D5lM8BQXh6uH8SXdTIdFBP38m1xzj4LLoY6Zi2Iqz/TQU8VOuS/mqczze4PIl4FJEQvT0TgM/CXKQL6j82o4Qv+7Ih8AuJ0TY6IOQY4ySgLu0KyfnwICH2RhJnFMP9cp1oBrw7x0ycqrUPwZDJsLYtO3fno1wP9hVXIl7KZbSyQ8N2goslJonBEqux8I05m2/hDG64TeJN64tV9p+zTZD6ZAsxxM6SmUG2U1EaqteM433kAHHVN0awg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BnwsmqH70zCmEaqLIHQmGKEfIkhMp+TBGu4ny6l8s27dl/zpJBM19iEBp7yugIzeZCu8344WEHUz5NNZp4D8lOIZkm/D9kqnSQi8linvtOo5RchByHCZQjukt41qZh+5I16pC0uG7JbuOeyXFKmIWdcFNu/gL9DeX1iAtEqm7nB+fSWp1sYuQMeTXAa7wcpVYmhzP5bEsq7oFEBxdCKlK5uP6VgFRRRJCprcihfHam21oMy18GKZ6e1IEO72PQP9lGrht5zfecsi8Y//+lsaTbjF4VtrSc3ciJbl7n199EEkdVLPv7MC1wMPg+SdDmBrz9jEf+CR4IuT/86jUNAL3w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: consulting@xxxxxxxxxxx, sstabellini@xxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 31 Aug 2023 11:10:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 31.08.2023 12:08, Simone Ballarin wrote:
> 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 <simone.ballarin@xxxxxxxxxxx>
>>> ---
>>>   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."

That's completely misleading terminology then.

> 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?

Counter question: Why only add guards to some of them? (My personal
answer is "Because it's extra clutter.")

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.