Date: Thu, 15 Jul 2021 15:16:03 GMT From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: b9296725cf99 - main - Add __diagused Message-ID: <202107151516.16FFG3DU054109@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b9296725cf99696b48926270a553044522d6e344 commit b9296725cf99696b48926270a553044522d6e344 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2021-07-15 14:01:02 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2021-07-15 15:15:54 +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 --- sys/sys/systm.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 5d41c9d53c2c..8080f22266e2 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -637,6 +637,13 @@ void _gone_in_dev(device_t dev, int major, const char *msg); #endif #define gone_in(major, msg) __gone_ok(major, msg) _gone_in(major, msg) #define gone_in_dev(dev, major, msg) __gone_ok(major, msg) _gone_in_dev(dev, major, msg) + +#if defined(INVARIANTS) || defined(WITNESS) +#define __diagused +#else +#define __diagused __unused +#endif + #endif /* _KERNEL */ __NULLABILITY_PRAGMA_POP
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107151516.16FFG3DU054109>