[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XEN PATCH 10/11] xen/sched: add ASSERT_UNREACHABLE() to address MISRA C:2012 Rule 2.1
- To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 7 Aug 2023 10:50:38 +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=aYwG75RdvN5ed9YDpfIalpoJSJXCbFx7UtoQRKyDjOQ=; b=OTqhXw1Drvm87/DeV9ZnOMHUes68UT8CwtTwcqvpEq2Mi14zgDuOxT0OepRT921XLe7nGNI41Zdb5PYQ+tvWWt0ge8fylCez8pEuKnsVD3PS1CbMSnOY14OTwmD/glcJcLH8/qFrvSLLQaj0vxW3BCFO6EIVaL1ITxOf/Ci+TmLx05qm6DABxJ8ummOC7HVnnhDBu0NkCyIhtwWI8qMMCnOZUv9X1pz2BcpuVDfMR223qVjlkvIc68uwuu3nxAxaod32y/3w0rzikA7h2vLPqWB0yMQoJ+mrm44UY7pHXRHDJRh5tWuDbSKZ9KPv87yPYnrOYojQ0jY/3HNz3o9vsA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WnBYKO04nSaRNyukKv1hlGfmO5rNHF4aPTgebARiTSptoSDErd52tBHdyoWjyw11J0PO46l/8/KeHJIi7280a2BHIuyaIBlnomlq3FFIBhwTuTjifsC1hynSBTMToGyRcREUifRj810dUw3p2PrjyNLuYX3FzIeeVgkkLYE6dua2VvIvJ1ZkpVEiECOsdhbCsrSE/59CxL4VUa5kvpoaoKK1IFRO8xpRfs2UyVafxYkSoavRP7TGSvqOpsNIou36+3dwS7ioHwfIyCs1jHq3fiTKMkSQVflLJRWeKxiFujV4hS+1vjIju1BQUY45B6EEmZA2h1AEhgp2W7971S/2ng==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: sstabellini@xxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, George Dunlap <george.dunlap@xxxxxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Mon, 07 Aug 2023 08:50:52 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 07.08.2023 10:13, Nicola Vetrini wrote:
> On 03/08/2023 11:17, Jan Beulich wrote:
>> On 02.08.2023 16:38, Nicola Vetrini wrote:
>>> --- a/xen/common/sched/core.c
>>> +++ b/xen/common/sched/core.c
>>> @@ -2233,6 +2233,7 @@ static bool sched_tasklet_check_cpu(unsigned int
>>> cpu)
>>> /* fallthrough */
>>> case TASKLET_enqueued|TASKLET_scheduled:
>>> return true;
>>> + ASSERT_UNREACHABLE();
>>> break;
>>
>> What use is "break" after "return"? IOW rather than adding code here,
>> imo a line wants removing.
>
> The "return false" after the switch would still be unreachable. The
> reasoning behind preserving the break
> is mainly MISRA Rule 16.3: "An unconditional break statement shall
> terminate every switch-clause", which has
> not yet been considered for adoption, but might be in future
> discussions, leading to putting back the break here.
Well, adding such bogus "break"s is going to face my opposition, and
it is in direct conflict with the "no unreachable code" rule here.
Jan
|