From nobody Wed Apr 27 16:30:17 2022 X-Original-To: dev-commits-src-main@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 262AA1992B8D; Wed, 27 Apr 2022 16:30:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KpPP70bPDz4TNp; Wed, 27 Apr 2022 16:30:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651077019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3HAqqstz8T2JsI/oQM9OnZmrgZLbS6p/UTXAZNctUz4=; b=DDraz3C5XJSxddY6NRsuwA/jIfD20FzEsuJK6Si64lff/jeiiArYhndOO+0jEtm0FuCMuV K/ySxPSeWUV7h9I62B+YO4SwWRXFTDuGtDBC37CVbAYz7Pj/en/+idFIIUO4z4UVdpryKM iQ+wc6bfd9N0XUlPAqtmDwTkCW6bLqwQJAz4wofwXczdqxVX0aDqJM8nS0XDazzGThwOTP XLKVu0l22nuY7zALXVL91kUWZ67aZ6C8fcEahpPtUU56otEGDmBtS+lGRobIIIiGWH47nV KLOxsT0y8A29pQcQ0eqFSb7yHLAB/tLADMQxkfpwKH6IdWWLvrPkyK/a+RwSlg== Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 73194A335; Wed, 27 Apr 2022 16:30:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <60c3658a-2a59-dd89-b5c7-0f0318c2597c@FreeBSD.org> Date: Wed, 27 Apr 2022 09:30:17 -0700 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: git: b40c0db6f6d6 - main - Patch up __diagused for when only one of INVARIANTS or WITNESS is defined Content-Language: en-US To: Mateusz Guzik Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202204271330.23RDUHwN063641@gitrepo.freebsd.org> <0dbcc859-69b1-4850-11c3-f8a4acf5bde9@FreeBSD.org> <73612e5c-d6d7-0c5e-9cea-046839164bc5@FreeBSD.org> From: John Baldwin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651077019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3HAqqstz8T2JsI/oQM9OnZmrgZLbS6p/UTXAZNctUz4=; b=IrnVUyWsVm6E4+78FcH2nzQbBJMz4vcvirsJcceGVAui/oCHR+eyACljOdjYaz8zEUbdst BNQO+gC1dH4NKFUG27EDQ65ZvLQkv8Il1Uh2Ml2me/b20UtcS07iBGA4E448IdpQ80cfmv hZi3CFmHNbpf1iMD5otDUbuU8xJlEKCU2BMf7t5fgl4F5KF8TJf604uu4/YzR0DSwC7yzW i6wrX0DkoKC9NKkSxRpi7eLH5zJpqCWXcmzCUG0Pl+zcnS19gKjrdEOPaPC1XiVNVu4d9I bPiF3nbMl47GrGODvoWvfoiK+579WsHQ0scVeQt2QSHV4v4dL9MCqHbvdejhoA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651077019; a=rsa-sha256; cv=none; b=FoV5peZk4h3Mp2/S5YWcpq8+rptvUkQ8C3WLYHG0PbbrIH3dPXM9xU0rE68gpcwLfBvfuu PuS99yd8uDUnWGnChu8qPfekp2Qvw5pQQm64Li07TXOCD6pqwpeXHYkCb2nDqS+H9XSxBC PrT8jUxmfKPbxix6RMPDggWNq8u375NXBR5CZ3rjFvqdd2Gleu6X0Qyp3KVAupE1qbB2a9 SNKAy0merJtfY34czvReOgmNSyKbMyosYLOOVVo5PJvn0HnQ5sfFPcLnfpo2L+RnHUrHS9 GLNOCWr59WoAo+R00BkQu9ewNBdCDTyIM8PDxBBlk7kpbUJgjiASNQu1DWaz1Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 4/27/22 9:18 AM, Mateusz Guzik wrote: > On 4/27/22, John Baldwin wrote: >> On 4/27/22 8:50 AM, Mateusz Guzik wrote: >>> On 4/27/22, John Baldwin wrote: >>>> On 4/27/22 6:30 AM, Mateusz Guzik wrote: >>>>> The branch main has been updated by mjg: >>>>> >>>>> URL: >>>>> https://cgit.FreeBSD.org/src/commit/?id=b40c0db6f6d61ed594118d81dc691b9263a7e4d7 >>>>> >>>>> commit b40c0db6f6d61ed594118d81dc691b9263a7e4d7 >>>>> Author: Mateusz Guzik >>>>> AuthorDate: 2022-04-27 13:29:12 +0000 >>>>> Commit: Mateusz Guzik >>>>> CommitDate: 2022-04-27 13:29:12 +0000 >>>>> >>>>> Patch up __diagused for when only one of INVARIANTS or WITNESS is >>>>> defined >>>>> >>>>> Reported by: John F Carr >>>>> --- >>>>> sys/sys/systm.h | 9 ++++++--- >>>>> 1 file changed, 6 insertions(+), 3 deletions(-) >>>>> >>>>> diff --git a/sys/sys/systm.h b/sys/sys/systm.h >>>>> index f2ffa7e6b815..6ca9ee886562 100644 >>>>> --- a/sys/sys/systm.h >>>>> +++ b/sys/sys/systm.h >>>>> @@ -554,10 +554,13 @@ void _gone_in_dev(device_t dev, int major, const >>>>> char *msg); >>>>> #define gone_in(major, msg) __gone_ok(major, msg) _gone_in(major, >>>>> msg) >>>>> #define gone_in_dev(dev, major, msg) __gone_ok(major, msg) >>>>> _gone_in_dev(dev, major, msg) >>>>> >>>>> -#if defined(INVARIANTS) || defined(WITNESS) >>>>> -#define __diagused >>>>> -#else >>>>> +#if !defined(INVARIANTS) && !defined(WITNESS) >>>>> +#define __diagused __unused >>>>> +#elif ((defined(INVARIANTS) && !defined(WITNESS)) || \ >>>>> + (!defined(INVARIANTS) && defined(WITNESS))) >>>>> #define __diagused __unused >>>>> +#else >>>>> +#define __diagused >>>>> #endif >>>> >>>> Hmm, could this just be: >>>> >>>> #if defined(INVARIANTS) && defined(WITNESS) >>>> #define __diagused >>>> #else >>>> #define __diagused __unused >>>> #endif >>>> >>> >>> it does boil down to it and if you want to make the change I'm not >>> going to stand in the way, but then imo it should get a comment that >>> there is no dedicated macro for invariants or witness only so some >>> warnings are possibly silenced when they should not be >>> >>> however, the point here is that the case of only one of these being >>> defined is distinct from the rest and may warrant special treatment. I >>> wanted to preserve the distinction in the, arguably hairy, >>> conditional. >> >> The other option perhaps is to split out a separate __witness_used as >> I suspect the majority of __diagused cases are for INVARIANTS. In a >> few other places where I didn't want to use bare __unused I added >> option-specific helpers (e.g. __usbdebug_unused). >> > > Ye, that's I wished I did the first time around after the bug report :) > > I just checked and the reported build failure is the only spot when > building GENERIC (without WITNESS) on amd64 so this may be perfectly > feasible. Ok, I can take a stab at doing that then. -- John Baldwin