Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Apr 2022 12:23:24 +0000
From:      John F Carr <jfc@mit.edu>
To:        "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   Can't build with INVARIANTS but not WITNESS
Message-ID:  <E5559D3F-2668-461D-B571-77EB55394866@exchange.mit.edu>

next in thread | raw e-mail | index | archive | help
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 'li=
ne' 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 'fi=
le' 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 defin=
ed.

#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 ever=
ywhere.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E5559D3F-2668-461D-B571-77EB55394866>