From e2c8ca5df4d2b07fb124f9b7dfa9d9f62f120a5d Mon Sep 17 00:00:00 2001 From: Jamie Landeg-Jones Date: Sat, 14 May 2022 11:34:13 -0500 Subject: [PATCH] emulators/rtc: Unbreak build with llvm13 rtc.c:112:6: error: variable 'unit' set but not used [-Werror,-Wunused-but-set-variable] int unit; ^ PR: 263616 --- emulators/rtc/files/rtc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/emulators/rtc/files/rtc.c b/emulators/rtc/files/rtc.c index 49c3638965f7..5c3d8cf1c5b2 100644 --- a/emulators/rtc/files/rtc.c +++ b/emulators/rtc/files/rtc.c @@ -109,10 +109,16 @@ static struct rtc_softc * rtc_attach(struct cdev *dev) { struct rtc_softc *sc; +/* Clang 13+ realises that "unit" below isn't actually used if we */ +/* aren't running with DEBUG set. The warning is treated as a */ +/* fatal error by FreeBSD's kmod build system, so wrap its usage */ +/* within DEBUG pre-processor conditionals. - Jamie Landeg-Jones */ +#if DEBUG int unit; unit = dev2unit(dev); DLog(Lenter, "%d %p", unit, dev); +#endif /* DEBUG */ if (dev->si_drv1) { DLog(Lexit, "old %p, %p", dev, dev->si_drv1); return dev->si_drv1;