From owner-dev-commits-src-branches@freebsd.org Sun Jul 25 08:18:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C360A6559C2; Sun, 25 Jul 2021 08:18:10 +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 4GXbXf4x32z3ljk; Sun, 25 Jul 2021 08:18:10 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 921FF1FDF5; Sun, 25 Jul 2021 08:18:10 +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 16P8IAuR043694; Sun, 25 Jul 2021 08:18:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16P8IAHO043693; Sun, 25 Jul 2021 08:18:10 GMT (envelope-from git) Date: Sun, 25 Jul 2021 08:18:10 GMT Message-Id: <202107250818.16P8IAHO043693@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: f0d034474236 - stable/12 - Add __diagused MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f0d0344742365c8fd548a2be6a31f0a9fe9b54a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jul 2021 08:18:10 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f0d0344742365c8fd548a2be6a31f0a9fe9b54a8 commit f0d0344742365c8fd548a2be6a31f0a9fe9b54a8 Author: Mateusz Guzik AuthorDate: 2021-07-15 14:01:02 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-25 07:05:24 +0000 Add __diagused This can be used for variables which are only used with either INVARIANTS or WITNESS. Without any annotation they run into dead store warnings from cc --analyze and always annotating with __unused may hide bad vars when it should not. Reviewed by: kib, markj Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31185 (cherry picked from commit b9296725cf99696b48926270a553044522d6e344) --- sys/sys/systm.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 37dd13654971..0c1d392fd740 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -583,6 +583,15 @@ void _gone_in_dev(struct device *dev, int major, const char *msg); gone_in_dev((dev), 13, \ "see https://github.com/freebsd/fcp/blob/master/fcp-0101.md") +#ifdef _KERNEL +#if defined(INVARIANTS) || defined(WITNESS) +#define __diagused +#else +#define __diagused __unused +#endif + +#endif /* _KERNEL */ + __NULLABILITY_PRAGMA_POP #endif /* !_SYS_SYSTM_H_ */