From owner-svn-src-head@freebsd.org Sat Feb 1 17:55:24 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C95921FE0C7 for ; Sat, 1 Feb 2020 17:55:24 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4891vw4Pxcz3LgW for ; Sat, 1 Feb 2020 17:55:24 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1580579723; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=vAuMdNHgG3UEoB2ED7fsmYwD+x2y2el6XGvTGu+F58Sd6wlx8jT69RkI+hxFsIyTm7NXo+ibsOBXF OC1nGgUEchsB0XK6xtQZnk/41d+R3n409fXYsKFA1QhVu947w8AiK1DE5/x4nLTZc2V64DCQAr1k8D Vtf2rf14JdI7O66MRpgSvC3lfaq3/cCW+EsY6aEADqyE6MhgcprTgrsxShf5eQsfdVuYiYUa7jyjlU MN61HFxVv/RtM7rTHTmqjO+k3ypRfpfzVNtOHT2XbS/MWbUeLcLoGfiBqEvYVVpF8mRSkFpI2drCpC tEqnn48qndQvGWGFoo74zdv38tvBsnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=ZapvYz5ZX8Yc1oggwsiu2knH3v9HUBqqhI7YG2cx08s=; b=fTz3E0vitPacqpim6mKJtdGw+zuHGvBWPXim7S5ee+n40KtjIWK83Qd8Ie/s5iTqa1QjqKpRFhTYJ xK5gF9xMnWtGeCnoXlglj+qEW+5BpOrIDpkG694GdSQdMOM1i6P++bVrBmQkrtv319wpy2Z0V679Ut XLJcfFGWgemTeZB2txNC4R5rpPRBEar3fKhWSVEKZ/M72qJhbJBfqjbozpl8V3JcZFm8S2yjHoKy87 9yTblGo4Gp933V1C0NeCVTv6dh1S+GvqmYHRFXT5JHi5qXFVJtIe+xzvkNvdqoqNZrCdjD5DK49gdT vU36ne4TNUCROBlt+EN9HW13dInZXYw== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=ZapvYz5ZX8Yc1oggwsiu2knH3v9HUBqqhI7YG2cx08s=; b=Gs8jlaaYZUZfePSiM2F4AOooioQS15OrxXKU+ukhEJIReXq+KrpvmAkWADke0a34l7EpWBQNcZu4s ukD8Tsgr3OdNZDgACk/hLPLDZjMqImXuul3YDJ/bCtMQGFQZoYNOENcjUZBq/hMDOOVUggCMMhHrjf AzmUGu3kgelV5Tjl1e+vPTbPL2ZVRYIJk2SGvC193+Q9RTlGxzMt9dZ2chCIBJYas7EvUZt+tZSGGt tlRiAkWFp6Jyv2oR7j2RQ9QNxQs148N+ae9r+5nlpbBEtAFnkhdTtJZJxYx+S2OQ6qpsh30YWrdbEB te9GD8l4XnsRcwHYr1wdjklCXleGRJw== X-MHO-RoutePath: aGlwcGll X-MHO-User: 01e02ec1-451c-11ea-b80d-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 01e02ec1-451c-11ea-b80d-052b4a66b6b2; Sat, 01 Feb 2020 17:55:21 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 011HtHZu029965; Sat, 1 Feb 2020 10:55:17 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r357349 - in head/sys: conf modules/tpm From: Ian Lepore To: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sat, 01 Feb 2020 10:55:17 -0700 In-Reply-To: <202001311936.00VJaEDP056807@repo.freebsd.org> References: <202001311936.00VJaEDP056807@repo.freebsd.org> Content-Type: text/plain; charset="ASCII" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4891vw4Pxcz3LgW X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.95 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.97)[-0.973,0]; NEURAL_HAM_LONG(-0.98)[-0.982,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Feb 2020 17:55:24 -0000 On Fri, 2020-01-31 at 19:36 +0000, Dimitry Andric wrote: > Author: dim > Date: Fri Jan 31 19:36:14 2020 > New Revision: 357349 > URL: https://svnweb.freebsd.org/changeset/base/357349 > > Log: > Merge r357348 from the clang 10.0.0 import branch: > > Disable new clang 10.0.0 warnings about converting the result of shift > operations to a boolean in tpm(4): > > sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a boolean; did you mean '(1 << (0)) != 0'? [-Werror,-Wint-in-bool-context] > WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD); > ^ > sys/dev/tpm/tpm_crb.c:73:34: note: expanded from macro 'TPM_CRB_CTRL_CANCEL_CMD' > #define TPM_CRB_CTRL_CANCEL_CMD BIT(0) > ^ > sys/dev/tpm/tpm20.h:60:19: note: expanded from macro 'BIT' > #define BIT(x) (1 << (x)) > ^ > > Such warnings can be useful in C++ contexts, but not so much in kernel > drivers, where this type of bit twiddling is commonplace. So disable it > for this case. > I think the point of the compiler warning about shift in a boolean context is the same as warning about assignment in a boolean context. I.e, if (a << 3) might be a typo for if (a < 3) in the same way as "a = 3" might have been intended to be "a == 3". When this type of bit twiddling is used in drivers, it's almost always combined with an & or | operator, which I assume the compiler then won't complain about (or you would have seen thousands of warnings while compiling in dev/*). -- Ian