Re: git: 8b83d7e0ee54 - main - Make -Wunused-but-set-variable a fatal error for clang 13+ for kernel builds.

From: Stefan Esser <se_at_FreeBSD.org>
Date: Tue, 19 Apr 2022 14:52:58 UTC
Am 19.04.22 um 14:47 schrieb Mateusz Guzik:
> As of 19447fc4888379e539dfca7e4c62362d6c279357 the amd64 kernel +
> modules build without with a config with these options removed:
> diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
> index 53c6043a0146..98b4be69dc94 100644
> --- a/sys/amd64/conf/GENERIC
> +++ b/sys/amd64/conf/GENERIC
> @@ -69,43 +69,14 @@ options     COMPAT_FREEBSD11        # Compatible
> with FreeBSD11
>  options        COMPAT_FREEBSD12        # Compatible with FreeBSD12
>  options        COMPAT_FREEBSD13        # Compatible with FreeBSD13
>  options        SCSI_DELAY=5000         # Delay (in ms) before probing SCSI
> -options        KTRACE                  # ktrace(1) support
> -options        STACK                   # stack(9) support
>  options        SYSVSHM                 # SYSV-style shared memory
>  options        SYSVMSG                 # SYSV-style message queues
>  options        SYSVSEM                 # SYSV-style semaphores
>  options        _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time
> extensions
>  options        PRINTF_BUFR_SIZE=128    # Prevent printf output being
> interspersed.
>  options        KBD_INSTALL_CDEV        # install a CDEV entry in /dev
> -options        HWPMC_HOOKS             # Necessary kernel hooks for hwpmc(4)
> -options        AUDIT                   # Security event auditing
> -options        CAPABILITY_MODE         # Capsicum capability mode
> -options        CAPABILITIES            # Capsicum capabilities
> -options        MAC                     # TrustedBSD MAC Framework
> -options        KDTRACE_FRAME           # Ensure frames are compiled in
> -options        KDTRACE_HOOKS           # Kernel DTrace hooks
> -options        DDB_CTF                 # Kernel ELF linker loads CTF data
>  options        INCLUDE_CONFIG_FILE     # Include this file in kernel
> -options        RACCT                   # Resource accounting framework
> -options        RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default
> -options        RCTL                    # Resource limits
> -
> -# Debugging support.  Always need this:
> -options        KDB                     # Enable kernel debugger support.
> -options        KDB_TRACE               # Print a stack trace for a panic.
> -# For full debugger support use (turn off in stable branch):
> -options        BUF_TRACKING            # Track buffer history
> -options        DDB                     # Support DDB.
> -options        FULL_BUF_TRACKING       # Track more buffer history
> -options        GDB                     # Support remote GDB.
> -options        DEADLKRES               # Enable the deadlock resolver
> -options        INVARIANTS              # Enable calls of extra sanity checking
> -options        INVARIANT_SUPPORT       # Extra sanity checks of
> internal structures, required by INVARIANTS
> -options        QUEUE_MACRO_DEBUG_TRASH # Trash queue(2) internal
> pointers on invalidation
> -options        WITNESS                 # Enable checks to detect
> deadlocks and cycles
> -options        WITNESS_SKIPSPIN        # Don't run witness on
> spinlocks for speed
> -options        MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
> -options        VERBOSE_SYSINIT=0       # Support
> debug.verbose_sysinit, off by default

My custom kernel built after applying one more change:

diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index b258deab7d2b..8fbd6ed58efa 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -2177,7 +2177,7 @@ softdep_flushfiles(oldmnt, flags, td)
        int flags;
        struct thread *td;
 {
-       struct ufsmount *ump;
+       struct ufsmount *ump __unused;
 #ifdef QUOTA
        int i;
 #endif