Date: Fri, 06 Jan 2023 18:05:32 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 268788] When kernel is being built without assertions there are a tons of warnings about unused variable Message-ID: <bug-268788-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268788 Bug ID: 268788 Summary: When kernel is being built without assertions there are a tons of warnings about unused variable Product: Base System Version: 12.4-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: lev@FreeBSD.org sys/sys/bus.h defines __BUS_ACCESSOR macro which create "int e" variable. T= his variable is assigned always bu later used only in KASSERT() "call". If kern= el is being built without assertions, this "e" variable becomes set-but-unused= and generates a tons of warnings with clang included into 12-STABLE and later. Looks like this variable should be #ifdef'ed. Warnings looks like this: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D In file included from /usr/src/sys/dev/mlx5/mlx5_core/mlx5_port.c:29: In file included from /usr/src/sys/dev/mlx5/port.h:31: In file included from /usr/src/sys/dev/mlx5/driver.h:35: In file included from /usr/src/sys/compat/linuxkpi/common/include/linux/pci.h:44: /usr/src/sys/dev/pci/pcivar.h:420:1: warning: variable 'e' set but not used [-Wunused-but-set-variable] PCIB_ACCESSOR(bus, BUS, uint32_t) ^ /usr/src/sys/dev/pci/pcivar.h:417:5: note: expanded from macro 'PCIB_ACCESS= OR' __BUS_ACCESSOR(pcib, var, PCIB, ivar, type) ^ /usr/src/sys/sys/bus.h:814:6: note: expanded from macro '__BUS_ACCESSOR' int e; \ ^ In file included from /usr/src/sys/dev/mlx5/mlx5_core/mlx5_port.c:29: In file included from /usr/src/sys/dev/mlx5/port.h:31: In file included from /usr/src/sys/dev/mlx5/driver.h:35: In file included from /usr/src/sys/compat/linuxkpi/common/include/linux/pci.h:44: /usr/src/sys/dev/pci/pcivar.h:420:1: warning: variable 'e' set but not used [-Wunused-but-set-variable] /usr/src/sys/dev/pci/pcivar.h:417:5: note: expanded from macro 'PCIB_ACCESS= OR' __BUS_ACCESSOR(pcib, var, PCIB, ivar, type) ^ /usr/src/sys/sys/bus.h:826:6: note: expanded from macro '__BUS_ACCESSOR' int e; \ =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-268788-227>