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

Re: [XEN PATCH v2 13/13] xen: fix violations of MISRA C:2012 Rule 7.2


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 6 Jul 2023 10:34:24 +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=+NOxynQXX1tQdQGDdvVqQcs6GJKWsm6hgQHCMdod6QA=; b=CPUx/hgjLzITknFjNeDQSHo7SpTEkDfdE/dDZFAWzSN/nPg4MHDnlykm/2aJGX9HvpQX/v82bZQpiorn5nzRbINsPz/9cbEIS4NqcpPZvb6jY27HmI6Ey4v8RAEt8BiywbbA1ZVC04UuA8J94R9GDBdmaDWeYLybyVEd3XlO1hoSAnV9jF2ArQSGntV7Y/jAor16/qRzx6vTkZxa7UpMglqTu1D3tdHWLyRwB9dDYGaB6syqgb4SIJlwYII24Xd/vdKQoDXnXIe/il8dgiV0CbHh3aQ2KQMWf8Qb9QXnZV4cHQ7TzDtqeqUuXJDfDe8iVLxqwQumfkqy+iOzYBPlbg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=htPfyuXSQvh2yhZRXeqPAxaGer0VuqIOV/S/EqE522NtiL/xvgwScWOllecDWCrXoS46slUsO7nnGtgLvrYKycXHkeKgGG9k2tIrIqdwTYX9bosaIUBuYdBGnx7FoATHnDaQwIXPtku9AApCb3Q/etYDShumMNO2MvBphS15uRWu+JdFb+QQaPPtnrL8qnvwF0s7xCODUZ9XjD2Bxr8UKiUlIiq8vmI/uUN2zKRigkSWNNpud5c9ZGkY6i5Bd6bueZQCpLdTjxH8NoJbtGJJy1PciZo6UNHsnL00kdr8BGkkBJEoFIwIHxxewWWvpp5nCL+TgG+35mz2RlWPhEjtWQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, consulting@xxxxxxxxxxx, Gianluca Luparini <gianluca.luparini@xxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Xenia Ragiadakou <Xenia.Ragiadakou@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, Simone Ballarin <simone.ballarin@xxxxxxxxxxx>
  • Delivery-date: Thu, 06 Jul 2023 08:35:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 06.07.2023 01:49, Stefano Stabellini wrote:
>> --- a/xen/include/xen/bitops.h
>> +++ b/xen/include/xen/bitops.h
>> @@ -227,11 +227,11 @@ static inline __u32 ror32(__u32 word, unsigned int 
>> shift)
>>  }
>>  
>>  /* base-2 logarithm */
>> -#define __L2(_x)  (((_x) & 0x00000002) ?   1 : 0)
>> -#define __L4(_x)  (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x))
>> -#define __L8(_x)  (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x))
>> -#define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x))
>> -#define ilog2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x))
>> +#define __L2(_x)  (((_x) & 0x00000002U) ?   1 : 0)
>> +#define __L4(_x)  (((_x) & 0x0000000cU) ? ( 2 + __L2( (_x)>> 2)) : __L2( 
>> _x))
>> +#define __L8(_x)  (((_x) & 0x000000f0U) ? ( 4 + __L4( (_x)>> 4)) : __L4( 
>> _x))
>> +#define __L16(_x) (((_x) & 0x0000ff00U) ? ( 8 + __L8( (_x)>> 8)) : __L8( 
>> _x))
>> +#define ilog2(_x) (((_x) & 0xffff0000U) ? (16 + __L16((_x)>>16)) : 
>> __L16(_x))
> 
> Jan, would you want to replace _x with x here as well?

Yes.

> If so, I think it would be best if done in a separate patch (keep
> mechanical changes mechanical) and keep this patch as is:

It was done in one go in patch 9, so I don't see why doing it here
as well would do any harm. Additionally missing blanks before >>
should be inserted at this occasion, and perhaps excess ones dropped
from the first of the changed lines (or further ones added to align
toe colons). While with that the lines still stay just below the 80
chars limit, dropping the leading underscores would get us a little
father away from that boundary.

Jan



 


Rackspace

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