Date: Sun, 25 Jul 2021 08:18:10 GMT From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: f0d034474236 - stable/12 - Add __diagused Message-ID: <202107250818.16P8IAHO043693@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f0d0344742365c8fd548a2be6a31f0a9fe9b54a8 commit f0d0344742365c8fd548a2be6a31f0a9fe9b54a8 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2021-07-15 14:01:02 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> 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_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107250818.16P8IAHO043693>