From patchwork Wed Jan 24 05:57:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jasmine Tang X-Patchwork-Id: 191378 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp797016dyi; Tue, 23 Jan 2024 21:58:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZOTG3M7qTI5Y/0Q38BCFkscXB+yczTzkDl0JFD+XswguuN+wK3vRnU6jN7Y1jRjYQLsLu X-Received: by 2002:a05:622a:18a7:b0:42a:5fae:fe73 with SMTP id v39-20020a05622a18a700b0042a5faefe73mr187674qtc.54.1706075915964; Tue, 23 Jan 2024 21:58:35 -0800 (PST) Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id j13-20020ac85f8d000000b0042a5326b2a7si2366860qta.709.2024.01.23.21.58.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 21:58:35 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b="A9yVd/s4"; arc=fail (body hash mismatch); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AB9653858C62 for ; Wed, 24 Jan 2024 05:58:35 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com [IPv6:2607:f8b0:4864:20::b29]) by sourceware.org (Postfix) with ESMTPS id 7679B3858D1E for ; Wed, 24 Jan 2024 05:57:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7679B3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7679B3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b29 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706075876; cv=none; b=S71HCnVXs0+4qac3Q9vZ5CTldLuy3mKn2bCFnkp4xXWLRNzWnLH/ngmN3blZgR4MpayK6CcX/RR3c1cP87VBEGyerzZ6B3eMVSUT8BzB0fG+DspMsRh9HyTEZHb3jpJRs6sjKi2g3TbnQhA3/kNvj/r2CNMCUuHZZWFUYQ5garg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706075876; c=relaxed/simple; bh=QF9+PWf9PestEiHSo7x/MM0vlty9XU3jTvktLdd3W3s=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=RTXdv21LYa/MPYkRNGS2dXbLfxkx8ImaqtBjHCLzS5z9SNaQ5VPebjpJRVPCrSjwXWKzffpkH36rzaI8cE7gTxRVtCwgBdArGRoImUmARLab0hnHxxJtJYnhGTpoGHz721OziHRto1gnmAcHqRfZtuPTZ7pIlKLvcIWYWF/E9S0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb29.google.com with SMTP id 3f1490d57ef6-dc22ade26d8so3949164276.1 for ; Tue, 23 Jan 2024 21:57:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706075873; x=1706680673; darn=gcc.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=zQxUu9oIaIKpKUpW5MuoWE8+uKkWiv1csfUaEZ4n5tM=; b=A9yVd/s4t/P/Q/wsS3Vvh811XxtFb9Vn+XiDu9LFJZcDjkB10dFd4qec5UIxhskXOU m7V6rfbleSIowI/S8p8o7NEieGhtIePigEtZLznVDICUiO7ER9/VzQQBYHCZeZmruqlP 3WQaze7XCg+NAx15yCM4WlZsqdXbt4zKNdgaPYOyYTl4QcLAnAbXlWYMm3WoRP1m5LYV tDLISZrcpv9JjBgANL3doRCxmybpKaite6d4EeHb+epWZl/5TX2NXzSUDBYN5yO3WaFx FGCzZ1G465ij0jTeEVFFsbI/uxaGweD3MNWAiQ0VNlrSJ1tmK1kd8A1tTwgbChUJH0MH 79JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706075873; x=1706680673; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=zQxUu9oIaIKpKUpW5MuoWE8+uKkWiv1csfUaEZ4n5tM=; b=fYj1KJmGCMky72gMocGyHgxO+QJ5WNKQIW6F9N/OzSg3f2FPqizUCikcjtd/Ge8zRS k0zR46vywr1ybSHcSfhE4R47o0VZ203Cje56n/rw+YkosD+iByg8L/wEUy6R++f/fh0W 4Hoj1c2UX3Ld/snrpwUn24YyTZh4KuAL1xad9E788bzG/u1tH7F1nu4xHgznsyhjt9AB lfCOZ+cOJbROjfYThi5+HCuEZmBCcxdEGYlfWUjFl6p/hrfju/FpvFEKqf7GIkxLK/RC n0LtNJr8uHdJfbg2mjoRAc00e/5/ZN8OslstcOO/Wz1TP9DABGNoS2J1kmJJsVKPAO4C Dqsw== X-Gm-Message-State: AOJu0YyAai3O6Gv+BbwKGqZffJnmhUiEHzfXSjn1iZYy83MlByLq/flT pUYnT9Wqv7e8bJu4OSbeuf++TqnqEejL2uItbcskBqUwAckzfHLTdeZY4jyegit32XuxFOlSLtD DaYk/bqgNC+D465z7IHhMTqOw2HTJMRLgVS5V5g== X-Received: by 2002:a25:ce0e:0:b0:dbe:9509:141c with SMTP id x14-20020a25ce0e000000b00dbe9509141cmr189573ybe.30.1706075873517; Tue, 23 Jan 2024 21:57:53 -0800 (PST) MIME-Version: 1.0 From: Jasmine Tang Date: Tue, 23 Jan 2024 21:57:41 -0800 Message-ID: Subject: [patch] PR 81271: gcc/cp/lex.c:116: wrong condition ? To: gcc-patches@gcc.gnu.org X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_KAM_HTML_FONT_INVALID, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788950259966688789 X-GMAIL-MSGID: 1788950259966688789 Change the style from & to && to reflect boolean result with boolean operation (instead of bitwise operation) David Binderman 2017-07-01 13:24:44 UTC trunk/gcc/cp/lex.c:116]: (style) Boolean result is used in bitwise operation. Clarify expression with parentheses. Source code is gcc_checking_assert (!IDENTIFIER_KIND_BIT_2 (id) & !IDENTIFIER_KIND_BIT_1 (id) & !IDENTIFIER_KIND_BIT_0 (id)); Maybe better code gcc_checking_assert (!IDENTIFIER_KIND_BIT_2 (id) && !IDENTIFIER_KIND_BIT_1 (id) && !IDENTIFIER_KIND_BIT_0 (id)); From 10b501ffa8a11c7f10fd6e6ab5d9a876a321fe13 Mon Sep 17 00:00:00 2001 From: Jasmine Date: Tue, 23 Jan 2024 21:18:13 -0800 Subject: [PATCH] Fix compiler warning: Boolean result is used in bitwise operation --- gcc/cp/lex.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/cp/lex.cc b/gcc/cp/lex.cc index 1110db7f8d0..8d94ae1e7b1 100644 --- a/gcc/cp/lex.cc +++ b/gcc/cp/lex.cc @@ -136,8 +136,8 @@ void set_identifier_kind (tree id, cp_identifier_kind kind) { gcc_checking_assert (!IDENTIFIER_KIND_BIT_2 (id) - & !IDENTIFIER_KIND_BIT_1 (id) - & !IDENTIFIER_KIND_BIT_0 (id)); + && !IDENTIFIER_KIND_BIT_1 (id) + && !IDENTIFIER_KIND_BIT_0 (id)); IDENTIFIER_KIND_BIT_2 (id) |= (kind >> 2) & 1; IDENTIFIER_KIND_BIT_1 (id) |= (kind >> 1) & 1; IDENTIFIER_KIND_BIT_0 (id) |= (kind >> 0) & 1; -- 2.34.1