From nobody Wed Apr 27 15:59:27 2022 X-Original-To: dev-commits-src-all@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 67F441ABBCDC; Wed, 27 Apr 2022 15:59:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 4KpNjY2VsZz3v0k; Wed, 27 Apr 2022 15:59:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651075169; 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=xYT6WaQZQHQZjus1HE+cU3XgeRrMLiMLTSJWcQQyFVU=; b=eiJq63AGytO2hgw71ILqmxYZ4zXf2556AAc0RygmCGX+3SINEhEdmxSigyAvoy9YzKm5qe DtWGykC+PoN2JGD281ybc2jEPdJ7ddsLpGa9QWbLJLT+SjBTGVQIhflavwUQTMJKGSdEUL zSjfcJld6e6F1v77XOA/F1/sv0r5WFBl8Rbst4UOkeonHF62VN5uPcj9sn1ouTY7GtAhBP XQWH6VNFXvqLELiQtmqeoPnV5GKfZpc21c+cdaNyKwfJr3tnc/34wnmzriLMm7+EUQsQSI swql6pvH0BaVm2fwcseq6Vms8IdgseVxcYGxUVUDA7cyB0+CfWiDlu5gzyCtzQ== 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 C072AA702; Wed, 27 Apr 2022 15:59:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <73612e5c-d6d7-0c5e-9cea-046839164bc5@FreeBSD.org> Date: Wed, 27 Apr 2022 08:59:27 -0700 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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> 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=1651075169; 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=xYT6WaQZQHQZjus1HE+cU3XgeRrMLiMLTSJWcQQyFVU=; b=jFraoH/ylKGvjAoRa9FGsVXkOrNx5FikaykRu0P4TKUhEWWQgKTCCrgduLY6tOppU/eGo9 k0jc7ZG5KcxwDT2r4HVCL1rlMFMTw4l4udkP1mmQg/WJJ+znXz3mLUO/0z9NYeClPzrQio jAdba6ypos/MY57BZqVMnjMbX6xKhVzB26MiWCE4ZKDaG61mMieCJteNkBkpwVimuZdxZ0 yAEsFblwTcAxnQp370InOSXdgpul3vuZaDxRdyo9dhABi56iUeFW0AWv+Vb3m5Bq3TSDUg VK7dLLqJJN83TLZl0Ri58KDl0Wb3lEQa6EcHUzek44obWN+KjD5EIL3CTY2NZA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651075169; a=rsa-sha256; cv=none; b=wwq6/BHv1mjebMvM5B948Ng11AEGUZo0uTRiDo4ZqcJUr7CezPbTGlCekL9Y6LR03QPutN p5FJpfY8xZM3k/ga65OOoFJs8PC/Zvd5EOZPnBxx3cRG7uQaxiHak8pJ4Yy5yLM5BgEq4y oux2e8QFIJfJlk8UWPeb3B/Ioix+vID095TNCSJCqNzkvIRnBiMLJ/yVDVAsxr7sspx5VR /1wMDvcAu1q27tAC0TdR+z7NWG9BpBmotZkqr8Ob5d/jjBhaXFKac97Ke6atNsJKlifIaR N6amAm5gYYTetAe2tZnvPczYSb/t6P7duPbQ+8MU0+kygdDwgAJdEcKMkusC4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N 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). -- John Baldwin