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

Re: [PATCH] docs/misra: add Rule 7.4 and 9.4


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 10 Jul 2023 08:21:41 +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=Ozj+ldin6Zd4u8amLEQvs/aJ5J70foMberS7POJ0u1U=; b=R81ffrog/zoOKz36RoVDHJKkeOiNGomhMFt24V8g2lCctOlQuNHEZ6LKJautiWvUjItiu551hszVbYVvHrPxuBOSL6tyIuq1eGyWRXvmI9zsv2IB3N9mbopbNjbvrmw33lmToFpq+mjsA/ulYHugZ26K/z0nfGMka+xTxEqbTh9E2lCKj4wntMCExoUxnRd0aA3C9qgt2A+7GXLiJJijKD4IQXLB9u3RRD+sYtmTPmy8pf2P6mQMW+0bY3exoULwizlrogMUT/o+rI8BysVfJvI59iRCXjff/sEPsVEKdzkGGjW0TQPVk2QB5TYASFevQWlxKiGVY5JcySwIlG1egA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JJDA/w2eGeYYDUzO55He5fPNfUxZPFh8nwH3R+mZiWVnChVc94NFXvwT5jwOmBOfe609thc8jzrjTaguJcBJS3wuhuDqmk/ybyFEYXj/2Rlhw+NsFm/QBple9gnmvYr2jEvyAluyECkdydVswA3z+plORc87lfEPYPHZUFaeR9qipMlYb8S7QNyEheo8Vo/5mNbGTc3jPr6/dyt+/euextyY0VZRsBCS71TnV84N8pay1QC8+JppVd8duoWycVEO4ob99hGVb89cwHnCPdJOt+nZT3mElJLOz2yWaaoeZYO7k1zoqgf25z67T+N7abgF68ERAjV8ee+UF1fsmaOJyw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: andrew.cooper3@xxxxxxxxxx, roger.pau@xxxxxxxxxx, julien@xxxxxxx, george.dunlap@xxxxxxxxxx, bertrand.marquis@xxxxxxx, Stefano Stabellini <stefano.stabellini@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 10 Jul 2023 06:21:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 07.07.2023 23:10, Stefano Stabellini wrote:
> On Fri, 7 Jul 2023, Jan Beulich wrote:
>> On 07.07.2023 00:46, Stefano Stabellini wrote:
>>> --- a/docs/misra/rules.rst
>>> +++ b/docs/misra/rules.rst
>>> @@ -203,6 +203,13 @@ maintainers if you want to suggest a change.
>>>       - The lowercase character l shall not be used in a literal suffix
>>>       -
>>>  
>>> +   * - `Rule 7.4 
>>> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_07_04.c>`_
>>> +     - Required
>>> +     - A string literal shall not be assigned to an object unless the
>>> +       objects type is pointer to const-qualified char
>>> +     - Assigning a string literal to any object with type
>>> +       "pointer to const-qualified void" is allowed
>>
>> I guess this is relevant also in a few other cases: Considering the
>> significant difference between title and actual text of the rule, and
>> further assuming people looking here won't always pull out the full
>> doc (they may not even have a copy of it), I think it is important to
>> also mention in a remark that despite the title all "character types"
>> are permitted, as long as string element type and character type match.
>> Since the compiler won't allow mismatches when the lhs type isn't void,
>> mandating no use of casts to "satisfy" the rule may be a way to express
>> our intentions.
> 
> What about:
> 
>    * - `Rule 7.4 
> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_07_04.c>`_
>      - Required
>      - A string literal shall not be assigned to an object unless the
>        objects type is pointer to const-qualified char
>      - All "character types" are permitted, as long as the string
>        element type and the character type match. (There should be no
>        casts.) Assigning a string literal to any object with type
>        "pointer to const-qualified void" is allowed.

SGTM.

Jan



 


Rackspace

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