xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Roberto Bagnara <roberto.bagnara@bugseng.com>,
	Stefano Stabellini <sstabellini@kernel.org>
Cc: julien@xen.org, andrew.cooper3@citrix.com, roger.pau@citrix.com,
	bertrand.marquis@arm.com,
	Stefano Stabellini <stefano.stabellini@amd.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2] docs/misra: new rules addition
Date: Mon, 12 Jun 2023 11:50:32 +0200	[thread overview]
Message-ID: <e831ef81-85e3-3b5c-f899-e9dbb83b8296@suse.com> (raw)
In-Reply-To: <6525d690-e487-ead8-34d6-55219ccfbfa2@bugseng.com>

On 12.06.2023 11:34, Roberto Bagnara wrote:
> On 12/06/23 09:33, Jan Beulich wrote:
>> On 09.06.2023 19:45, Stefano Stabellini wrote:
>>> @@ -143,6 +163,12 @@ existing codebase are work-in-progress.
>>>        - Octal constants shall not be used
>>>        -
>>>   
>>> +   * - `Rule 7.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_07_02.c>`_
>>> +     - Required
>>> +     - A "u" or "U" suffix shall be applied to all integer constants
>>> +       that are represented in an unsigned type
>>> +     -
>>
>> I continue to consider "represented in" problematic here without
>> further qualification.
> 
> We should distinguish two things here.  The headline of Rule 7.2
> is non negotiable: it is simply as it is.

I understand this, and ...

>  As all headlines,
> it is a compromise between conciseness and mnemonic value.
> If what is wanted there is not the headline, then you can add
> "implicitly" before "represented".  Or you may leave the headline
> and add an explanatory note afterwards.

... such a note is what my comment was heading towards.

>>> @@ -314,6 +340,11 @@ existing codebase are work-in-progress.
>>>          used following a subsequent call to the same function
>>>        -
>>>   
>>> +   * - Rule 21.21
>>> +     - Required
>>> +     - The Standard Library function system of <stdlib.h> shall not be used
>>> +     -
>>
>> Still no "inapplicable" note (whichever way it would be worded to also
>> please Roberto)?
> 
> I am not the one to be pleased ;-)
> 
> But really, I don't follow: when you say the rule is inapplicable
> your reasoning is, IIUC, "nobody would even dream using system() in Xen".
> Which is exactly what the rule is asking.  If Xen adopts the rule,
> tooling will make sure system() is not used, and seeing that the rule
> is applied, assessors will be pleased.

My point is that "not using functions of stdlib.h" is ambiguous: It may
mean functions implemented in an external library (which the hypervisor
doesn't use), or it may mean functions of identical name (and purpose).
The full text goes even further and forbids the use of these
identifiers (plural; see next paragraph), so it's clearly not only
about an external library, and we also can't put it off as inapplicable.
(I wouldn't be surprised if we had a local variable or label named
"exit" or "abort".)

Btw - I can't find a rule 21.21 in my two (slightly different) copies
of the doc, nor one with this headline and a different number. What I
have is "21.8 The Standard Library functions abort, exit and system of
<stdlib.h> shall not be used". (I further wonder why neither of the two
docs allows me to copy-and-paste a line out of it.)

Jan


  reply	other threads:[~2023-06-12  9:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 17:45 [PATCH v2] docs/misra: new rules addition Stefano Stabellini
2023-06-12  7:33 ` Jan Beulich
2023-06-12  9:34   ` Roberto Bagnara
2023-06-12  9:50     ` Jan Beulich [this message]
2023-06-12 15:15       ` Roberto Bagnara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e831ef81-85e3-3b5c-f899-e9dbb83b8296@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=julien@xen.org \
    --cc=roberto.bagnara@bugseng.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=stefano.stabellini@amd.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).