Re: git: 8b83d7e0ee54 - main - Make -Wunused-but-set-variable a fatal error for clang 13+ for kernel builds.
- Reply: Mateusz Guzik : "Re: git: 8b83d7e0ee54 - main - Make -Wunused-but-set-variable a fatal error for clang 13+ for kernel builds."
- In reply to: John Baldwin : "git: 8b83d7e0ee54 - main - Make -Wunused-but-set-variable a fatal error for clang 13+ for kernel builds."
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 19 Apr 2022 07:02:21 UTC
On Mon, 18 Apr 2022 23:11:52 GMT
John Baldwin <jhb@FreeBSD.org> wrote:
> The branch main has been updated by jhb:
>
> URL:
> https://cgit.FreeBSD.org/src/commit/?id=8b83d7e0ee54416b0ee58bd85f9c0ae7fb3357a1
>
> commit 8b83d7e0ee54416b0ee58bd85f9c0ae7fb3357a1
> Author: John Baldwin <jhb@FreeBSD.org>
> AuthorDate: 2022-04-18 23:06:27 +0000
> Commit: John Baldwin <jhb@FreeBSD.org>
> CommitDate: 2022-04-18 23:06:27 +0000
>
> Make -Wunused-but-set-variable a fatal error for clang 13+ for kernel
> builds.
> Reviewed by: imp, emaste
> Differential Revision: https://reviews.freebsd.org/D34949
> ---
> sys/conf/kern.mk | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
> index f97be774ea10..b86149ab4618 100644
> --- a/sys/conf/kern.mk
> +++ b/sys/conf/kern.mk
> @@ -42,9 +42,6 @@ CWARNEXTRA?= -Wno-error=tautological-compare
> -Wno-error=empty-body \ -Wno-error=pointer-sign
> CWARNEXTRA+= -Wno-error=shift-negative-value
> CWARNEXTRA+= -Wno-address-of-packed-member
> -.if ${COMPILER_VERSION} >= 130000
> -CWARNFLAGS+= -Wno-error=unused-but-set-variable
> -.endif
> .endif # clang
>
> .if ${COMPILER_TYPE} == "gcc"
>
Hello,
this setting results in a kernel build failure:
[...]
/usr/src/sys/dev/uart/uart_core.c:348:6: error: variable 'rxp' set but not used
[-Werror,-Wunused-but-set-variable] int rxp;
[...]
and, when having set
makeoptions WITH_EXTRA_TCP_STACKS=YES
in the kernel definition/configuration:
[...]
--- rack_bbr_common.o ---
/usr/src/sys/modules/tcp/bbr/../../../netinet/tcp_stacks/rack_bbr_common.c:399:16:
error: variable 'inp' set but not used [-Werror,-Wunused-but-set-variable]
struct inpcb *inp;
[...]
Kind regards,
Oliver