From nobody Fri Feb 11 16:52:07 2022 X-Original-To: dev-commits-src-branches@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 2EDEC19B24AC; Fri, 11 Feb 2022 16:52:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JwKQw1j0Fz4WYr; Fri, 11 Feb 2022 16:52:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644598328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XAmQq2yzkvTooHeIRflc6Ywl47gMilXxdeQ+EEXN4Ys=; b=q1qgU/3QHgonjd5y3CRXdLyWgY56X/2KXL2n1GeLVHis5R0uCdQYRe3lLsIVJDC2XHQWff QBZVicaqQ2u+YdV9iqLkDS+s+cnQuXa6h83FQUj/Me3kvmPRMF9f4AcWDjMjqwVmPRHSuu z61ZRAGK17ejGu7VnBO5uPtosBQbXoyDufzfQR3IH6+yZu79RzWQz+Dei28lPwaIQri3iw XicQ1hfMUkCvwIn1uqp22/WMuaFhbzttHLJsD+7p3bHOQk1QQ5WGKzJRTHNip32V2rrDlw 1xqd9ijyX87Jf3IiaN7kfboAa0eHunXhs+t3ei/GqA9K0vvzPBjZ4NSI8Hd2mQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC7A317DB9; Fri, 11 Feb 2022 16:52:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21BGq74A033798; Fri, 11 Feb 2022 16:52:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21BGq7WK033797; Fri, 11 Feb 2022 16:52:07 GMT (envelope-from git) Date: Fri, 11 Feb 2022 16:52:07 GMT Message-Id: <202202111652.21BGq7WK033797@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 534f4e03ab3c - stable/12 - tty_info: Avoid warning by using logical instead of bitwise operators List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 534f4e03ab3c90e3f40b15ec34b17cd046bb71cf Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644598328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XAmQq2yzkvTooHeIRflc6Ywl47gMilXxdeQ+EEXN4Ys=; b=cJQNISnslaUUVR7w2EoBarMg+UEXA7jLsBDhD081nrxVocVNZCesHwf1vs+HVBUSSsOPO5 iwIPFcKNm7kZLOAMsMHDZe+XaeZScBBFsd3MgR/T6j7/ZoQTE01mXGO1aZ5wu7BJBl5QFq yh7DshISA6etMgORoHMDJQ6P/GgqrTxEjqK5whdDwcay6KTR4Hgl+TjpUo6OVhwtyyQ/8V iv3pI0vEO5m/oLaSPrP5VW7o2n9fd/pBB9BFdADjw2K0EIcSpACJDTJlcL9onGY/ReFEaR Btr1GFMPeN28dZX8jQmZctFkw9tHCPZoBt15QWmvr/eSUQSWooY5pkXol6/PHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644598328; a=rsa-sha256; cv=none; b=Ov8mBZY0x0HAnYLpUcl77C4xYrvYoQEkWhWiQHS+sjWiCC8HJCMJ2F+C2pkntZ3HNAMBpt 5LKmnMyeqrSrcGRm7Y2T5Tf45nznq1V54e67jgP/m9K34OjzABZ9IaFGWRlLuhTpjwveJX icICxyHeuTAEcQiA6bee9fNyQRZDxByVrYfI+UKtl8TE6VLWfVvf89DRlkzJn6qyJiHRnv JjhTHUzFJP9kwYr4PltPNfQ/jcgfj/smMIjjfyKAEEdvms/+YSxbfDz0SryV1OPLO3l3HC ImT3O+72gi8njhyPdp6jGVW2sMmsRylUfOJRJAfSFetPoTJhPgy3ysYEYFV8Cg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=534f4e03ab3c90e3f40b15ec34b17cd046bb71cf commit 534f4e03ab3c90e3f40b15ec34b17cd046bb71cf Author: Dimitry Andric AuthorDate: 2022-02-06 17:41:20 +0000 Commit: Dimitry Andric CommitDate: 2022-02-11 16:45:19 +0000 tty_info: Avoid warning by using logical instead of bitwise operators Since TD_IS_RUNNING() and TS_ON_RUNQ() are defined as logical expressions involving '==', clang 14 warns about them being checked with a bitwise operator instead of a logical one: ``` sys/kern/tty_info.c:124:9: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical] runa = TD_IS_RUNNING(td) | TD_ON_RUNQ(td); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ || sys/sys/proc.h:562:27: note: expanded from macro 'TD_IS_RUNNING' ^ sys/kern/tty_info.c:124:9: note: cast one or both operands to int to silence this warning sys/sys/proc.h:562:27: note: expanded from macro 'TD_IS_RUNNING' ^ sys/kern/tty_info.c:129:9: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical] runb = TD_IS_RUNNING(td2) | TD_ON_RUNQ(td2); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ || sys/sys/proc.h:562:27: note: expanded from macro 'TD_IS_RUNNING' ^ sys/kern/tty_info.c:129:9: note: cast one or both operands to int to silence this warning sys/sys/proc.h:562:27: note: expanded from macro 'TD_IS_RUNNING' ^ ``` Fix this by using logical operators instead. No functional change intended. Reviewed by: cem, emaste, kevans, markj MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D34186 (cherry picked from commit 7d8a4eb943a907a92dd400432c3c3adcbd93dad9) --- sys/kern/tty_info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/tty_info.c b/sys/kern/tty_info.c index aad9fc409887..a5289eb12f3c 100644 --- a/sys/kern/tty_info.c +++ b/sys/kern/tty_info.c @@ -113,12 +113,12 @@ thread_compare(struct thread *td, struct thread *td2) * Fetch running stats, pctcpu usage, and interruptable flag. */ thread_lock(td); - runa = TD_IS_RUNNING(td) | TD_ON_RUNQ(td); + runa = TD_IS_RUNNING(td) || TD_ON_RUNQ(td); slpa = td->td_flags & TDF_SINTR; esta = sched_pctcpu(td); thread_unlock(td); thread_lock(td2); - runb = TD_IS_RUNNING(td2) | TD_ON_RUNQ(td2); + runb = TD_IS_RUNNING(td2) || TD_ON_RUNQ(td2); estb = sched_pctcpu(td2); slpb = td2->td_flags & TDF_SINTR; thread_unlock(td2);