Can't build with INVARIANTS but not WITNESS
- Reply: Mateusz Guzik : "Re: Can't build with INVARIANTS but not WITNESS"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 27 Apr 2022 12:23:24 UTC
My -CURRENT kernel has INVARIANTS (inherited from GENERIC) but not WITNESS: include GENERIC ident STRIATUS nooptions WITNESS nooptions WITNESS_SKIPSPIN My kernel build fails: /usr/home/jfc/freebsd/src/sys/kern/vfs_lookup.c:102:13: error: variable 'line' set but not used [-Werror,-Wunused-but-set-variable] int flags, line __diagused; ^ /usr/home/jfc/freebsd/src/sys/kern/vfs_lookup.c:101:14: error: variable 'file' set but not used [-Werror,-Wunused-but-set-variable] const char *file __diagused; The problem is, __diagused expands to nothing if INVARIANTS _or_ WITNESS is defined, but the variable in vfs_lookup.c is only used if WITNESS is defined. #if defined(INVARIANTS) || defined(WITNESS) #define __diagused #else #define __diagused __unused #endif I think this code is trying to be too clever and causing more trouble than it prevents. Change the || to &&, or replace __diagused with __unused everywhere.