From nobody Fri Feb 11 16:51:40 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 7924D19B1B92; Fri, 11 Feb 2022 16:51:45 +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 4JwKQS1jFfz4W4d; Fri, 11 Feb 2022 16:51:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644598305; 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=CnQO2eQQnuJdBpx1y7epCOuyKks+p69i4XiFQbs0aKY=; b=JyzPH+7mtqFiU53rZgl1qwN4Um1SROzpNEekJH5OknFgO3RnUFtSi7zwszoAesxRANjX9k YiAMco0INnhr7taJdMX7XMSS96aIkkofRrnznSdwdEa8zG91FT15q2CSqG4UKZdRX5XajQ 3EHlillbMNEj7/1nXNxS3CEbnDRdAJ1lC0PH0oENG2/dbyGq5RS2t3JYU+dLxaYlGC0Ohw GRAj17VZm4630YZ508OA4P6IHbRdQdAzc8D8IqNKpb0zhDaNw94t00lgD/R3vW0C61YqWs 47gXRT95dw1ZY6WsfP8nDf8O0v9BhrzfRNGtnU7RZoGjW2r5GePkd4flogsTEw== 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 B65D417F43; Fri, 11 Feb 2022 16:51:40 +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 21BGpeZW032658; Fri, 11 Feb 2022 16:51:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21BGpepI032657; Fri, 11 Feb 2022 16:51:40 GMT (envelope-from git) Date: Fri, 11 Feb 2022 16:51:40 GMT Message-Id: <202202111651.21BGpepI032657@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: ae76550171b9 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: ae76550171b9b3f9aa322b741c59f1ae5f540a87 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644598305; 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=CnQO2eQQnuJdBpx1y7epCOuyKks+p69i4XiFQbs0aKY=; b=A2dge91XfFwUSxzJWuiMUyTaoNUeRr/+K1EPg8asnLwZLiIDY+vUX2pddYMXxkHfOuy6zl /yjhQDZ0cC1Uc4KeXTNUwrgvgELZ1YnoQsRptxThh9uDMHgspI05nUJvkT/L0rIpHE8A4c 2dmwxghmEb2A0DKkWIc3cEXi0b8e22bdaGxExeKItKTuKUjB4ZwttOzJF5Y3+S/9M7oC9h xVoT1SJSabBUFuxoHxV5+Ap/x1lP4AK4sJtUbOlkw7F+ca9NO6Q3VakYIJ1h7hBRovtBbJ ZyX2TDCxKud+ofiVktROEIU9GMw82H9JCRhukkZZRK413Zxa54UzYhQxnGr/2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644598305; a=rsa-sha256; cv=none; b=ihq4AYZQsJwumipM/hYRnEjMMvths8UQOzueGqlYSCDyNt4YwVJDLMfiypvUnLjkp4HrTw daVh9afKvMVpNtXe1XO7zFVRt9C0SJRlVM324l47JQko3gOML8lvM+9zRvVmQFd86xcRVN x3d4K1LkWCC7E/2TYI3M+f3ACn520zIMJejYTsjgKVF0o7c/PyR/mQCSdYu9qPwxKTcIkx EMjveMJBixt8/LfGoT0Oc2isDYgSsjZ15UEHPnJFuJWpnjCUnqOSplWJ6PWlxdE5ni/l15 xSkEQDltsZyRJ7dLmIJK0euqzASqma5CzGzRav8YBOcNKeGlA0PKdJsnZgEAug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=ae76550171b9b3f9aa322b741c59f1ae5f540a87 commit ae76550171b9b3f9aa322b741c59f1ae5f540a87 Author: Dimitry Andric AuthorDate: 2022-02-06 17:41:20 +0000 Commit: Dimitry Andric CommitDate: 2022-02-11 16:43:03 +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 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);