From nobody Wed Apr 27 13:31:48 2022 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4E5DD1AB59C1 for ; Wed, 27 Apr 2022 13:31:56 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-oa1-x33.google.com (mail-oa1-x33.google.com [IPv6:2001:4860:4864:20::33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KpKRH4H81z4pMp for ; Wed, 27 Apr 2022 13:31:55 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-e93bbb54f9so1902432fac.12 for ; Wed, 27 Apr 2022 06:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=f/fRaaPBbd394gdhnhSbzDJdKxRj988axutF2Tzrar8=; b=Z7kiDxg7ujWvZRiiPlw4LTknErHJd1RQU5+Fk1d/se93aM508JNscoG56NEhnT8zDi vgYpprTeLx7RvMft04NxC1JhGWyslFwZn5pd9ARuCupu0bz1JJZffDUX0MELtVvtSYTZ 100XLSah1IrACKbUAsX2BbG15TIzWbqo+m8Oi3cq9A/WycJPd0eGbgfy/mDWy1l1nO0w l9fEZ23UvMvNSvSd00msDBzQO6AesMtpqiDUEu+i/tOtsWnuNNg606fDpGoGM0iTJBYf ZiEeJglAE4HgSaal66YSpwgvaB5RWJ2Swg1Ruq+N8ZoUjrcxjVTfpu5gDzWsOSp1judF wtSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=f/fRaaPBbd394gdhnhSbzDJdKxRj988axutF2Tzrar8=; b=OZvq9GsHCYrh61JrhU3fClQYB189FR/ZQM0xM9a4mr0TnVwxGCCn2Sek0qlR9AcbvM aRwsNTGWgWaCsy2fRrVhRBlY4R9LJR57I1RCI+VCUhkko/wVgQFpahA0+UdrfQ9FgKTg EMnPS2HYyWSJu5yKnaxrocEJ7TAeC0f/0drWJnXA9xdF+A3+I9p4hqD4C58D7k0PsvIF 1IYTSmsAHLKk+09NbH1SAiljsJuq1QIIcttrlPx0lxtMJUxIx7yQRh9c8zu6cNjXMGLb VoneVTMiNBPtvooAGkxrtAaNPeAHRX33lTRVKv6vrQGiWFkO+TtUCPcDpcE5z0Vk9XjE wyUA== X-Gm-Message-State: AOAM5324aoStclv3/mL+Q7EEp+A/0KblP5a8DVAOE/JE22jW26SpLgbV 2Wfm70Aw7lqeE58kXj2eQ+JWIbxh9m0dPDoRaLohAjrs X-Google-Smtp-Source: ABdhPJwy2JqTN73yaUtZs+/FNe8a8kZCghLorbQUui8HdZefor5cVEyvZycEAR4MNjd/wZhe4eDOI649Nn21qhhz4lM= X-Received: by 2002:a05:6870:d288:b0:e9:257d:db3f with SMTP id d8-20020a056870d28800b000e9257ddb3fmr8209478oae.96.1651066309042; Wed, 27 Apr 2022 06:31:49 -0700 (PDT) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Received: by 2002:a8a:d82:0:b0:422:d8ed:35a0 with HTTP; Wed, 27 Apr 2022 06:31:48 -0700 (PDT) In-Reply-To: References: From: Mateusz Guzik Date: Wed, 27 Apr 2022 15:31:48 +0200 Message-ID: Subject: Re: Can't build with INVARIANTS but not WITNESS To: John F Carr Cc: "freebsd-current@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4KpKRH4H81z4pMp X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=Z7kiDxg7; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2001:4860:4864:20::33 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-2.03 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2001:4860:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-0.996]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2001:4860:4864::/48, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; NEURAL_SPAM_MEDIUM(0.97)[0.969]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2001:4860:4864:20::33:from]; MLMMJ_DEST(0.00)[freebsd-current]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On 4/27/22, John F Carr wrote: > 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. > I disagree. The entire point is to not end up with actually unused variables even when is enabled. I patched it up in https://cgit.FreeBSD.org/src/commit/?id=b40c0db6f6d61ed594118d81dc691b9263a7e4d7 . This still allows for actually vars when only one of INVARIANTS or WITNESS is defined, but that's a much smaller problem than allowing it in general. -- Mateusz Guzik