From nobody Wed Jun 29 18:32:13 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 047CA87EA2F; Wed, 29 Jun 2022 18:32:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LY96k1YLWz4d8H; Wed, 29 Jun 2022 18:32:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656527534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VunGKYCCKeAuTtJ/Vw07/b/x/0Y3KEiLEEh7sWGVGvs=; b=s9fj1ekSUnxVCXWLsDOdUSqOdmZBQlEUhJ8YeUy10eOLtQ9D0l4d/l0DAbnY2BGB8AkXWz Vr/4vHQHf+dBDhiL5NZo6tunFiFAMlxyHcQb9uR5HsKzdZhBBJcNzlkHKhAYusswOHvF+Y vsYrMVOdm3lK3E4SFWRSvdw1zgQZVsOKhJPYh9H67Cfj6mdR0Wq65FgUIYRSMAfCMHqp/7 r49xukPitYCsAVBFjY+uuymZ4zj/jdGUmMRCb7MFJEm/VfzCXcURmMU3s+kCzRMLWuo0d+ et6eFbifBJLMmKrtafdHop9W6yqQawudlO6TPKX18MoCXBUjMjSPW+N+BsFu5A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB5AB16DCB; Wed, 29 Jun 2022 18:32:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25TIWD1L051713; Wed, 29 Jun 2022 18:32:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25TIWDpc051712; Wed, 29 Jun 2022 18:32:13 GMT (envelope-from git) Date: Wed, 29 Jun 2022 18:32:13 GMT Message-Id: <202206291832.25TIWDpc051712@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 61ae7a355ce7 - main - Add MPASSERT() and MPPASS() macros List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 61ae7a355ce787aecd84dc35a047f458a5b5b1fb Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656527534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VunGKYCCKeAuTtJ/Vw07/b/x/0Y3KEiLEEh7sWGVGvs=; b=XxBv9Qfa4e941D2u8zfgZxjOqRlVGGqvr4Ah4+MfsezOVGCbzicrmn6yOLjNnlkN3fr2GI nzJ36Nd5omhvF8+DZ7ss7mbQgZKCgfGcFsFrZoerJjX60bX0AfkdLFc1Qa2AhxO0iCFoGN ss6DbfE4JyBDTsMwWXtIMg+KQbFDO9foPDN0Xr30VXzXL8Kts5HJrR4zbSbhAHT3Cj9QVg vCz567UbD1lrmW7D/VaNtk+X28Kv3FuOyed3gL2vXF9A16bqSYtLELm0OXWNFFQc9Yyaum kUTEVKpVMLAX5CLdIWozZWYN7v8ERR2Ma8K7LgGciru7Kk7lA4idSop+0Wv7XQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656527534; a=rsa-sha256; cv=none; b=wcLLe2oJmU88wCU2h745TCdtojtuZbDuRgUGskoO+5j44UG0gZ59dPAJjwrANWJ0tOqqLB 5PfZ7BoUPtAMHv27VF6pqXkGF2hsFS/ZPgDTUJvn9VtbJD74YVZNuzJB9nuKb38Ends5yl 7ZASxf7sNwe0cwIOcK8FxFJxtj3orz9W7jWF7jNRi6zTJFEJECg8CMUC547j9q1k0+vaOP KX6DazQFOAQwfgZgdOQv1xOCQW12Tj8+jN3NMD2NmBuhf99WVImmrjzLMJuk8oh2A83KnL 2nyAQ9qphEtGBos496jgBmKXw69v1H69HC+WH35ylI4bpnGzC7Ii+5p9Wd/nrQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=61ae7a355ce787aecd84dc35a047f458a5b5b1fb commit 61ae7a355ce787aecd84dc35a047f458a5b5b1fb Author: Konstantin Belousov AuthorDate: 2022-06-29 11:37:04 +0000 Commit: Konstantin Belousov CommitDate: 2022-06-29 18:31:47 +0000 Add MPASSERT() and MPPASS() macros Suggested by: mjg Reviewed by: imp, mjg Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D35652 --- sys/sys/kassert.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/sys/kassert.h b/sys/sys/kassert.h index bb6847dc404f..d7c1a21385f9 100644 --- a/sys/sys/kassert.h +++ b/sys/sys/kassert.h @@ -46,19 +46,35 @@ extern bool panicked; kassert_panic msg; \ } \ } while (0) +#define MPASSERT(exp, mp, msg) do { \ + if (__predict_false(!(exp))) { \ + printf("MPASSERT mp %p failed: %s not true at %s:%d (%s)\n",\ + (mp), #exp, __FILE__, __LINE__, __func__); \ + kassert_panic msg; \ + } \ +} while (0) #define VNPASS(exp, vp) do { \ const char *_exp = #exp; \ VNASSERT(exp, vp, ("condition %s not met at %s:%d (%s)", \ _exp, __FILE__, __LINE__, __func__)); \ } while (0) +#define MPPASS(exp, mp) do { \ + const char *_exp = #exp; \ + MPASSERT(exp, mp, ("condition %s not met at %s:%d (%s)", \ + _exp, __FILE__, __LINE__, __func__)); \ +} while (0) #define __assert_unreachable() \ panic("executing segment marked as unreachable at %s:%d (%s)\n", \ __FILE__, __LINE__, __func__) #else /* INVARIANTS */ #define VNASSERT(exp, vp, msg) do { \ } while (0) +#define MPASSERT(exp, mp, msg) do { \ +} while (0) #define VNPASS(exp, vp) do { \ } while (0) +#define MPPASS(exp, mp) do { \ +} while (0) #define __assert_unreachable() __unreachable() #endif /* INVARIANTS */