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

Re: [PATCH 1/2] docs/misra: introduce rules.rst


  • To: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 26 May 2022 12:15:02 +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=EtY+Ge1WLqy+YFusYrJZ2rj6wWLQgqpFp9BYYuuWpgM=; b=KY2hoGk0CB51cx+BqV9Np9QIHaq28kXoKTD5dmf+EaKzjAjCJNppRkRdVkUR5DEBopFYgMFu77V7+AD3/vmHLdW1rEOL+sM8ObPe20jKSSXZ1rGzH62S1ZHbMZMIjhyA8Hax3x/jGeIarbKGKDGLjSlxD2BEkgw/wRtw/2nYxJ3oQfZ9AmFytfJHonIRDWnFNTCbl2GtEDm8775tibvDTd2/J5S9fHrszVnQpRMz8+idhDwy/Q/VE3xZFmFjhKg1mfbQtPNbgovD/oLq/T8FnXMLIWsnE59ed0nW9kyFXHPq3yebOzbpy+x1KakIlWrOmPJpHYdZuoNfAFYwxZIY8Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F+dgnRmmVlZRserBWSodveC/SNVgyMDPscp0VplqRZNkRRu1aaa0GYx+nmY1RS+PGX0eBGHJE0fLjoTKuQEOimZ9zqFtsZoG58Lzdg7YEK3lbSw8EQCcRFfJkhZGdX5C2s4GwH5LnZjXkRJUpQGUBuZv24UtwEDilC6wErgbETmKIpgVIaNbXKVgZ4g0Xp7SnTW0+Gw4nZFVbOLyzu3B0IxDOs7KZ0B+6s4Ljfwwj8QYijlIaeidnnj31yRbaBQXWtIZyissq65CJEOJ34ph24VJMBFeJwKKGdwrXh5+FUx5g/qoNDp5cawFk7/yIqVzbFHW2QCQ7vt+66KFPIVlSw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>, "George.Dunlap@xxxxxxxxxx" <George.Dunlap@xxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Thu, 26 May 2022 10:15:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.05.2022 11:54, Bertrand Marquis wrote:
> Hi Jan,
> 
>> On 26 May 2022, at 10:43, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>
>> On 26.05.2022 03:02, Stefano Stabellini wrote:
>>> On Wed, 25 May 2022, Julien Grall wrote:
>>>> On 25/05/2022 01:35, Stefano Stabellini wrote:
>>>>> +- Rule: Dir 4.7
>>>>> + - Severity: Required
>>>>> + - Summary: If a function returns error information then that error
>>>>> information shall be tested
>>>>> + - Link:
>>>>> https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/D_04_07.c
>>>>
>>>>
>>>> ... this one. We are using (void) + a comment when the return is ignored on
>>>> purpose. This is technically not-compliant with MISRA but the best we can 
>>>> do
>>>> in some situation.
>>>>
>>>> With your proposed wording, we would technically have to remove them (or 
>>>> not
>>>> introduce new one). So I think we need to document that we are allowing
>>>> deviations so long they are commented.
>>>
>>> Absolutely yes. All of these rules can have deviations as long as they
>>> make sense and they are commented. Note that we still have to work out
>>> a good tagging system so that ECLAIR and cppcheck can recognize the
>>> deviations automatically but for now saying that they need to be
>>> commented is sufficient I think.
>>>
>>> So I'll add the following on top of the file:
>>>
>>> """
>>> It is possible that in specific circumstances it is best not to follow a
>>> rule because it is not possible or because the alternative leads to
>>> better code quality. Those cases are called "deviations". They are
>>> permissible as long as they are documented with an in-code comment.
>>> """
>>
>> Hmm, so you really mean in-code comments. I don't think this will scale
>> well (see e.g. the DCE related intended deviation), and it also goes
>> against the "no special casing for every static analysis tool" concern
>> I did voice on the call.
> 
> On this subject the idea was more to define a “xen” way to document
> deviations in the code and do it in a way so that we could easily substitute
> the “flag” to adapt it for each analyser using tools or command line options.

I think the basic scheme of something like this would want laying out
before doc changes like the one here actually go in, so that it's clear
what the action is if a new deviation needs adding for whatever reason
(and also allowing interested people to start contributing patches to
add respective annotations).

Jan




 


Rackspace

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