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

Re: [PATCH] misra: remove default case in single-clause switch


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Tue, 5 Aug 2025 11:46:42 +0000
  • Accept-language: en-US, uk-UA, ru-RU
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=+XFxl0p7WqvW6dsnhOQFeWIJBDpElqTY5n6pcYajung=; b=hBpjDoR7yg+f2NWqfF2BiPGRG+NY98MZyma6kcFJ63VaJZYrlWTz2MFJ/Kj+n9sCJ3LDXJLrYdlqH9YdVflPW9NkzFea+TEQRI/5XtU7lzchTaS0zHWW4vKDk8whb/K2ujNB4bknFkQMhztnztGhRKNMbzydlSEOaExQpN8yn0v7U5gsn1TzjCg14PEuE2hCYdeF2NJU+zL4sMDVSmlrW5SsTYMhby5mefOP7gvh28oaCip6EhL3epX/JU/ZdIyMzcCpWjYeJfw+UiftmfHZhF6VX56nq2dm82SBZPpPdN63HyJ5jMPpc25RoV7z0X8H43tHqo2RlF1ZYSwlY+xpww==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IcTJNrMNkihHIwLp4FzrEQLxsQScUb1fkVWpB0bY2Sh7IkUnOz3w6TkIxOZ31whWxg5W53mwgRSIQXp+A1cbWDQcmRKa8mIcygqaunsLanJFy1f+XkpXMfPBqXFilp9nheBwazCPjBTBJqcQ25On2PUtjKpF07O9Ch9+FxzDjmkYlD0/RHwYwzF8s9+gfgZt884ZJJQlRcf+m8BTQgihJU4fGt8WZRR58hphLCNmfqHcnfq0crNVvd4L326mgvlfdLqIT0POyCRF9BV0JJqI8AH0FdHNRF2r212Jf+RejxwBl1sZjrhVBsR8oeJ2VhsW3lGsSyXakO9MciH7hg86NA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 05 Aug 2025 11:53:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcBWXfPSyq9APrf0Os3CWQrCUztbRTt4iAgAA65QA=
  • Thread-topic: [PATCH] misra: remove default case in single-clause switch


On 8/5/25 11:15, Jan Beulich wrote:
> On 04.08.2025 19:33, Dmytro Prokopchuk1 wrote:
>> MISRA Rule 16.4: Every switch statement shall have a default label.
>> The default clause must contain either a statement or a comment
>> prior to its terminating break statement.
>>
>> However, there is a documented deviation for this rule in Xen:
>> 'docs/misra/deviations.rst':
>> * - R16.4
>>    - A switch statement with a single clause and no default label
>>      may replace an equivalent if statement to improve readability.
>>    - Tagged as `deliberate` for ECLAIR.
>>
>> This change removes empty default cases in single-clause switches
>> to avoid violations of the rule where the `default` clause lacks
>> a suitable comment or statement.
>>
>> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
> 
> It's all CPU notifiers that you alter, and iirc the outcome of earlier
> discussion was that particularly for those we _want_ to add commentary,
> clarifying why only the given subset of notification need handling in
> the particular case. It may also well be that the (at least) one case
> of the possibly missing handling of some other notification still is
> unaddressed (and might hence be wrongly hidden by the adjustment done
> here, if it's in one of the function that are being altered).
> 
> Jan

I understood.

Thank you, Jan.

Dmytro

 


Rackspace

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