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

Re: [XEN PATCH v2] xen/string: add missing parameter names


  • To: Federico Serafini <federico.serafini@xxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 4 Aug 2023 09:59:51 +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=jg6HVn7meBYbQ4DOJLd/KhIV5BbPWOw/1QsnOWVKGoU=; b=XrCfjDvehkn22Q3t4sUVSmdVUrfT56oQxdZVQYhr944ODwhrH4rZqhmAaQe33UICE0zRoB41F11RiZCbVvOVdzHX3kIJnUe9l2LBKE7xW8PAH4CjP8Gl81lHnbwD4azV56yQRaWDrG1TgLFqfEIddjt3CmbtdPNzB0cUPNobrGFzgCUmegvr7th2P7Ae8qW/bOJGfnxPwExAoXnnxFqkhlhVQhE3AeaQQm/BrYRAhA8eYaWrQmegtH98oofutl1bHp4Q24lp3psT+UuRGu2vcF3QZH7pFOJvWwHvhNqirZUJ4KevJoXYC4EPKvNZrvoJ3tRTcA0937L2rh1i3yrNFw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GRap6Gi6gERzyP80a0wc6QLEd9hnZyuEFCKlrh3AA9X0GO3u8gE0qLIZS9SrVKjQN86qno5kcv9XVE6+tbR2EEKjvQzDlm5G6CrL4iAbKQV/ZPpWmblfqIFmw0PB6A+AiTNUSR72+3/Iru19P78JVOMIKboIB+ieiGfNjwfRdKFUmiQpSgmyNVltOYuY9NVEqVw+OKVdSUu6LnKT5OV0456ckUGCpFCQdCyf6lA/gOytNddP4PKaUN+tig+pxKJEcXIjU5JY2OTcJqFQAKMBXu1n3dp4Du/PMDts3rZQa58/mvK2kbdZX+A9K6uIgVBqt9CmRDqsE+RJINQ9KGxHbQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Luca Fancellu <Luca.Fancellu@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "consulting@xxxxxxxxxxx" <consulting@xxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 04 Aug 2023 08:00:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 04.08.2023 09:55, Federico Serafini wrote:
> On 03/08/23 21:26, Stefano Stabellini wrote:
>> On Thu, 3 Aug 2023, Julien Grall wrote:
>>> On 03/08/2023 12:52, Luca Fancellu wrote:
>>>>> On 3 Aug 2023, at 12:46, Julien Grall <julien@xxxxxxx> wrote:
>>>>>
>>>>> Hi Luca,
>>>>>
>>>>> On 03/08/2023 11:28, Luca Fancellu wrote:
>>>>>>> On 3 Aug 2023, at 09:26, Federico Serafini
>>>>>>> <federico.serafini@xxxxxxxxxxx> wrote:
>>>>>>>
>>>>>>> Add missing parameter names to address violation of MISRA C:2012
>>>>>>> rule 8.2 ("Function types shall be in prototype form with named
>>>>>>> parameters").
>>>>>>>
>>>>>>> No functional changes.
>>>>>>>
>>>>>>> Signed-off-by: Federico Serafini <federico.serafini@xxxxxxxxxxx>
>>>>>>> ---
>>>>>>> Changes in v2:
>>>>>>>    - memset() adjusted.
>>>>>>> ---
>>>>>>> xen/include/xen/string.h | 42 ++++++++++++++++++++--------------------
>>>>>>> 1 file changed, 21 insertions(+), 21 deletions(-)
>>>>>>>
>>>>>>> +void *memset(void *s, int c, size_t count);
>>>>>>> +void *memcpy(void *dest, const void *src, size_t count);
>>>>>> There is a comment in arch/arm/rm32/lib/memcpy.S with this:
>>>>>> /* Prototype: void *memcpy(void *dest, const void *src, size_t n); */
>>>>>>> +void *memmove(void *dest, const void *src, size_t count);
>>>>>> There is a comment in arch/arm/rm32/lib/memmove.S with this:
>>>>>>    * Prototype: void *memmove(void *dest, const void *src, size_t n);
>>>>>>> +int memcmp(const void *cs, const void *ct, size_t count);
>>>>>>> +void *memchr(const void *s, int c, size_t n);
>>>>>>> +void *memchr_inv(const void *s, int c, size_t n);
>>>>>> @Stefano: would it make sense to remove it as part of this patch or
>>>>>> maybe not?
>>>>>
>>>>> They are a verbatim copy of the Linux code. So I would rather no touch it.
>>>>
>>>> Oh I see! Thank you for pointing that out, then I’m wondering if it’s there
>>>> a reason why we
>>>> are using ‘count’ instead of ’n’ as third parameter name, I know Stefano
>>>> suggested that, so
>>>> It’s just a curiosity. Maybe it’s for clarity?
>>>
>>> I guess because the generic implementation of memset (see xen/lib/memset.c) 
>>> is
>>> using 'count' rather than 'n'.
>>
>> Yep
>>
>>
>>> Given what Andrew said, I would say we should rename the parameter to 'n'.
>>
>> Yes, either way works. I was only trying to be consistent with
>> xen/lib/memset.c. It is also fine to change xen/lib/memset.c instead.
> 
> If you want to be consistent compared to the C99 Standard,
> then other parameter names need to be changed, for example all the `cs`
> and `ct` should become `s1` and `s2`, respectively.
> The same goes for `dest` and `src`.
> If you agree, I can propose a v3 that takes care of that.

Personally I'd prefer if we could limit code churn. Functions that need
touching anyway can certainly be brought in line with names the standard
uses (albeit I don't see a strong need for this). But function which
won't otherwise be touched could easily be left alone.

Jan



 


Rackspace

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