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

Re: [XEN PATCH 12/13] xen: 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 14:25:03 +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=S7TPwGutUOSQ9K06LSoWBARhfPG+UbvYvL4AOtrwlhA=; b=O5dLf+xO2Ips8Z6HOD57N0kekF3HSt7mTv8wNg6/cYOCR4Xzwviju4AWE09wnvyed6cAKmCXlOtE9OFxBx51vg/Fjz2gSr/uL7fK5muLpIEgZ322OBlq7DqyhqdvWEtp2dXY3qalUAw7W1/WucdfBXaX5A0CDjoQAtIAlQEJD1BqJWKJZSAXJjMi773O4DcJ3f0PJUvTcr65R29VuqfRCQvuPGBBuD/0iep++8KpbEg0G2xJoF15LG3xN12ik51nJ9JB3eTwYEQQP39jwbsd58dLG033TCKmqUUz2DYTixHvqSaXdltXwfOo3MBTyIoCCuCRptnDg0zyGf9qrxplGg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M6enrpQmeIyBz5Ti2X5CIUusVx6vIU2JUlCKyErg7daaiCfUxzNvYCDZBHFEdPM0rB8fwX1rBmtgJoUNziArin639R0w88aMHGHU2siTp8oYJADi5wm31jdM6oMOrjVUW+CWb1BfvVOeaS8xziGjbbKKcOfdfMAGE9RqdkbGa4RDQFEnKnDjKYXi5/9ckN1PWsl4HLveI8BPnUYlLN1ONbbfk4LnIRsyDRZWU+sYHRfT8b2Pwud/cWggFQW5tWCA3Pp0XI4rS1zMEHMc/1quYuByCDCESvvcFvWShiIAyO9HTvS283K2500gk1ZqVFXeqK6BtlGgdecHCQ3kS0av+g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, consulting@xxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Thu, 31 Aug 2023 12:25:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 31.08.2023 14:18, Simone Ballarin wrote:
> On 29/08/23 00:51, Stefano Stabellini wrote:
>> On Mon, 28 Aug 2023, Simone Ballarin wrote:
>>> Move or amended 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").
>>>
>>> Inclusion guards must appear at the beginning of the headers
>>> (comments are permitted anywhere) and the #if directive cannot
>>> be used for other checks.
>>>
>>> Mechanical change.
>>>
>>> Signed-off-by: Simone Ballarin <simone.ballarin@xxxxxxxxxxx>
>>> ---
>>>   xen/include/xen/err.h       | 4 +++-
>>>   xen/include/xen/pci_ids.h   | 5 +++++
>>>   xen/include/xen/softirq.h   | 4 +++-
>>>   xen/include/xen/unaligned.h | 7 ++++---
>>>   xen/include/xen/vmap.h      | 4 +++-
>>>   5 files changed, 18 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/xen/include/xen/err.h b/xen/include/xen/err.h
>>> index 2f29b57d28..a6323d82d7 100644
>>> --- a/xen/include/xen/err.h
>>> +++ b/xen/include/xen/err.h
>>> @@ -1,5 +1,6 @@
>>> -#if !defined(__XEN_ERR_H__) && !defined(__ASSEMBLY__)
>>> +#if !defined(__XEN_ERR_H__)
>>>   #define __XEN_ERR_H__
>>> +#if !defined(__ASSEMBLY__)
>>
>> The original pattern was also guarding the header file sufficiently,
>> protecting it from double-inclusion. In fact, it is posing stricter
>> restrictions than usual (not laxer). This change is unnecessary?
> 
> The MISRA directive asks to use one of the two following forms:
> 
> <start-of-file>
> #if !defined ( identifier )
> #define identifier
> /* Contents of file */
> #endif
> <end-of-file>
> 
> <start-of-file>
> #ifndef identifier
> #define identifier
> /* Contents of file */
> #endif
> <end-of-file>
> 
> I do not see any reason for deviating, but if you ask that, I can do it.

I do not see a reason why a deviation would be needed here. Misra shouldn't
be more pedantic / restrictive than necessary to achieve its goals. Looking
at the flood of changes we've already seen, pointless changes really
shouldn't be asked for.

Jan



 


Rackspace

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