From nobody Tue Feb 08 20:24:37 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 4B34719A2987; Tue, 8 Feb 2022 20:24:38 +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 4JtZHV1SFlz3N8f; Tue, 8 Feb 2022 20:24:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644351878; 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=Z6/r5CAVPk1Uxi1UdrcU9gzDTJvMxNiMxD3Ozs5i+oQ=; b=YewIhkkgWtAoAS0JFJ4+RctSCKxuqVnF84SI6cesy4ggqLt8Pn0gMLBbUQf/pwAr4wCJmx LHRiM2pIztOmDWtCTc6dKn4DnI3sVINohoWCF8h8tn533LlepXGW+HfzpHSVOOEvPFdwyb Iv98jtcUhti24XrWfIdI7OSnfWl7tj3kYg28YO+p6ZTJ2lqxPrB5e0ZPHK8pjygCRZQwUy 5uvQ9iZDi/FG6u1ciLed2zAzM/thXwbwY8nkVo8uNT56D23DbHQckmNVbWp3omr8tAEBnq AUyl2Dc3yQ2MFnVGmCxu6VhO0uWGmTiig4MeY1pFc5TknjmQIkkLkxUgmBjL0w== 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 131021FC6C; Tue, 8 Feb 2022 20:24:38 +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 218KObgM036235; Tue, 8 Feb 2022 20:24:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 218KObfx036234; Tue, 8 Feb 2022 20:24:37 GMT (envelope-from git) Date: Tue, 8 Feb 2022 20:24:37 GMT Message-Id: <202202082024.218KObfx036234@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 7d8a4eb943a9 - main - tty_info: Avoid warning by using logical instead of bitwise operators 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 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7d8a4eb943a907a92dd400432c3c3adcbd93dad9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644351878; 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=Z6/r5CAVPk1Uxi1UdrcU9gzDTJvMxNiMxD3Ozs5i+oQ=; b=sB3BPbJppGGmIhkH3asLPBrMG63Qp83YseyadO4I1DhRqQthLNGGRDgKgY9pJbp/USO4EB 1rbBrArKg8A/hrsTJCItWABhZVr9ETANpL1TN7EJ8yNOuFLvKWK8lq+xLXrerkHgUO1bf0 Td2mMVgjsbaWGAgplTH5vHTnGFj3PyVKC0T4ZdPAid9yIhF9WAyhIoMC1kLV++dUvG7SAD B0ifX93Fw/C8NlOYzd4lzg+sMOUh+GFi5+fwLA40/HDMswMpwHGYrkd1u3KbOgPXw7GxyJ 6nUXsFTIgUHgofbFj3nsqjPzF55utg3o0w73OpcVir3lCoq9Wp6IlMUIiFC2Dg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644351878; a=rsa-sha256; cv=none; b=iKexEfQcL6LyRe4Bvvwo/C7fpiO2QHBfRznYASgiLeyzuZM49jfDVONCnAsPg2rMTnQjX+ CvQs1fB9vETL2XoDSTSGrsMhTxmfpmbtMgMEWlYr8yWCgGARCgQPWUNjrJKQ3uSjWmSUxl OZEv9vkORM/rEfrcTo1qaW4EQEw284b8zqOpsb38TVsZqkzAtWCZfWKi7lC1VMhXgyD9DX DxfdWPYWRXrUwMQ/nOryc9NASURbYeDxlQ2Z4qwYtHfg1Y8MjpH0DmnHvzoZx50Sw53vWC K/Y5kKkg4f7P1uaEOazERNHsAJA4xHHp1PmUgMnFuO3L1FEg53VoHX4ahnEPSw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=7d8a4eb943a907a92dd400432c3c3adcbd93dad9 commit 7d8a4eb943a907a92dd400432c3c3adcbd93dad9 Author: Dimitry Andric AuthorDate: 2022-02-06 17:41:20 +0000 Commit: Dimitry Andric CommitDate: 2022-02-08 20:21:04 +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 --- 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 4cf8be19ebda..60675557e4ed 100644 --- a/sys/kern/tty_info.c +++ b/sys/kern/tty_info.c @@ -121,12 +121,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);