[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen: let ASSERT_UNREACHABLE() WARN() in non-debug builds
- To: Juergen Gross <jgross@xxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Wed, 24 Aug 2022 13:12:57 +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=UMrf3yloA/3QfrN9lyiqU4EGCX0ikSHLqQ+S+QQd0R4=; b=kwQS5LojM1HuykIgWJOKt2hmQrNnrvBQ+akc//wrnOvZYDHKQfo7eFZ8eEO1VHWqkymfAqvySo6TxtNc8VXPGJiDlZMZU36tcQjYm6UVs6779N1HlyPCM8hWehSGqEsxYYFS4xR0TtFLl7Zj/XjdHzR1RlyZzVbtpwEWtcMe+0mYqWCtrI+mRf0g2OmQHKRAq6F+ImU4uMxpi4VHP+NeGCRp9nEFikjsbOdE8ewrrEbFeaJFSu4eRWQz0nIYiqd05QxS+GSNb2IJHMnAj3enjWVNpf9lBUVrLPW4ZDnueiJtjYOoefTu+55emkwcOICbYVb5VFqriOMh9ebHmNY/cQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AkyyevrtTAsiS6Pbn1aueBt0Oh7GmlTe14AHclI88RMIUUCP+OhGfPFG10G+zezwug33+Wg1sAhss67ndLoU4TWErYsIliGefp1JbnC0nv2iEkasme4eRDEQ1aGpdmy3sR7bm2bx1Sq0lqCKzhdqjiwzKh5TJahL5vmttYeZOOPPS+mxQH/8PwksK5ICTk4fV/mZX6PpjbAZYf4TYZLhDa49BuzqjgwP/d1dE0XRpmgT9vV35rbIG4yqhOuM/JiCxsAV9NXuu3XPM9Zlcxww/2hPtHTkxjn/vnzyK7q1TzsXHQdhXT/Iuc6lc68xgSoOamr85XPZLvm3p173RD5vzA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Henry.Wang@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Wed, 24 Aug 2022 11:13:11 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 24.08.2022 12:45, Juergen Gross wrote:
> On 24.08.22 12:35, Jan Beulich wrote:
>> On 24.08.2022 12:22, Juergen Gross wrote:
>>> Hitting an ASSERT_UNREACHABLE() is always wrong, so even in production
>>> builds a warning seems to be appropriate when hitting one.
>>
>> I disagree, for two reasons: This violates the implication of NDEBUG
>> meaning ASSERT() and friends expand to no actual code. Plus if doing so
>
> This is something we can change IMHO.
>
>> for ASSERT_UNREACHABLE(), why would we not do the same for ASSERT()?
>
> There are multiple reasons to have ASSERT()s. Some serve as a kind of
> documentation (e.g. to document that the programmer thought of a special
> case not being possible), or they are meant to catch hard to diagnose
> bugs rather early instead of letting them hit later in a situation where
> it wouldn't be clear what caused them. Adding a WARN() for all of these
> cases isn't really appropriate, especially as this might impact
> performance due to added tests, which isn't the case for theoretically
> unreachable code.
>
>> There's a reason we have ASSERT() and friends and, independently,
>> WARN_ON() / BUG_ON() et al.
>
> We might want to introduce something like ASSERT_OR_WARN(). I'm sure
> this could be useful in some cases.
I'm curious why in such cases it can't just be WARN_ON().
Jan
|