From nobody Wed Apr 27 16:18:45 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 03A1B19901C5; Wed, 27 Apr 2022 16:18:48 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) (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 4KpP7p6zwYz4S72; Wed, 27 Apr 2022 16:18:46 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-d39f741ba0so2434663fac.13; Wed, 27 Apr 2022 09:18:46 -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=Z1M8Iuow0Bdb6q4q76hPBly4CpKVQka5NlpYHzIpFak=; b=FGsKJ0YrAJDXF7FIMqy3OXh+WFsB51oq0G5ylLpFa1lmPTKfqjvCyVG/OOEQW9d786 +GZUhFKBtTJ6haMMELwlVnhXFXn/U+fwbcXOlynsEBYc9+UYXil5CVghevk1Y3LF1qq3 2xLAgR8VDQ2kQjqCIl15syrs/WmAN7+CV0DDL/2HvoR+xsvLlOVpgeyRlE9L/kzcGcIf VMqgzmZB2T217ABvia1b0P57IXOrHGLFhs4ppbn6tlHfWA4jbkf0Kuu+VLr4EdOACTvj ENAzmBIRffdFefcDUO1V+CtdDs0pcmbJIHIf4ALwpFmedI3nHOB2WueHHVXOS0fKKJLw a72g== 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=Z1M8Iuow0Bdb6q4q76hPBly4CpKVQka5NlpYHzIpFak=; b=o8x5vQ3SDSfitWFb1O0bTSBupQabXjm3SIrai5d6GmoUavsrD9seFrb7Bhye5nUlL8 qfxDWnkhOBnyRAvmi0Dhvyi5SUOCrUfN836xNunJMsga58SjV8PTxf7ugeWxuKnwuX2v BBx+M93zsnIBb0FswBMScTIbOe4CLu0PyfO6APJNjuozPImHYkXuW6eQeOzqwBK3oOGb ikejuEmHCItL2r7zPaxhNE7w45p1tmku2REb2k3EyGUfuT0DSCq9concAjofAS5BgQrR KLAprgJB74LjmqKS6V5UuvaSGvXOYzYoMaqF/LjH/CiP2avT9dDHla2klwgOHIDK9ltD VW/w== X-Gm-Message-State: AOAM5301jBZHCCFN3HFOyCNJN4S9Ux6n4fLzBNnCZqg9ea7SDSa97kI6 WxTNV2mt1plE2dhqnidyLEVM8olpye73kb06lXjeN7B8 X-Google-Smtp-Source: ABdhPJxF2lFFQdopc9k86itZCN2ggGc8EXnRmF38osBdCIXAWSKBI/KP55aMmla7ukpfRe4kuRd+nzcDlnX/6J3512U= X-Received: by 2002:a05:6870:d288:b0:e9:257d:db3f with SMTP id d8-20020a056870d28800b000e9257ddb3fmr8671708oae.96.1651076326112; Wed, 27 Apr 2022 09:18:46 -0700 (PDT) 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 Received: by 2002:a8a:d82:0:b0:422:d8ed:35a0 with HTTP; Wed, 27 Apr 2022 09:18:45 -0700 (PDT) In-Reply-To: <73612e5c-d6d7-0c5e-9cea-046839164bc5@FreeBSD.org> References: <202204271330.23RDUHwN063641@gitrepo.freebsd.org> <0dbcc859-69b1-4850-11c3-f8a4acf5bde9@FreeBSD.org> <73612e5c-d6d7-0c5e-9cea-046839164bc5@FreeBSD.org> From: Mateusz Guzik Date: Wed, 27 Apr 2022 18:18:45 +0200 Message-ID: Subject: Re: git: b40c0db6f6d6 - main - Patch up __diagused for when only one of INVARIANTS or WITNESS is defined To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4KpP7p6zwYz4S72 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=FGsKJ0Yr; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2001:4860:4864:20::2a as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ip6:2001:4860:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_DN_SOME(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2001:4860:4864:20::2a:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MLMMJ_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; 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]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-ThisMailContainsUnwantedMimeParts: N 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. -- Mateusz Guzik