From: Jasmine Tang <tanghocle456@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: [patch] PR 81271: gcc/cp/lex.c:116: wrong condition ?
Date: Tue, 23 Jan 2024 21:57:41 -0800 [thread overview]
Message-ID: <CAP8tkpCH+FNXEFuRd2xzT_iDz-G5cCwQVg+qnwy9pph7JPo6Hw@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 592 bytes --]
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));
[-- Attachment #2: 0001-Fix-compiler-warning-Boolean-result-is-used-in-bitwi.patch --]
[-- Type: text/x-patch, Size: 896 bytes --]
From 10b501ffa8a11c7f10fd6e6ab5d9a876a321fe13 Mon Sep 17 00:00:00 2001
From: Jasmine <tanghocle456@gmail.com>
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
next reply other threads:[~2024-01-24 5:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 5:57 Jasmine Tang [this message]
2024-01-24 20:52 ` Jason Merrill
2024-01-24 6:02 Jasmine Tang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAP8tkpCH+FNXEFuRd2xzT_iDz-G5cCwQVg+qnwy9pph7JPo6Hw@mail.gmail.com \
--to=tanghocle456@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).