From: Enze Li <enze.li@hotmail.com>
To: gdb-patches@sourceware.org
Cc: enze.li@gmx.com
Subject: [PATCH] gdb: some int to unsigned int conversion
Date: Sat, 21 Jan 2023 22:56:43 +0800 [thread overview]
Message-ID: <OS3P286MB215243E4429C6C8CD05AB540F0CA9@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM> (raw)
When building GDB with clang 16, I got this,
CXX maint.o
maint.c:1045:23: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
m_space_enabled = 1;
^ ~
maint.c:1057:22: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
m_time_enabled = 1;
^ ~
maint.c:1073:24: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
m_symtab_enabled = 1;
^ ~
3 errors generated.
Work around this by using unsigned int instead.
Tested by rebuilding on x86_64-linux with clang 16 and gcc 12.
---
gdb/maint.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gdb/maint.h b/gdb/maint.h
index 09a68c17befd..71f63b2e39be 100644
--- a/gdb/maint.h
+++ b/gdb/maint.h
@@ -49,9 +49,9 @@ class scoped_command_stats
/* Track whether the stat was enabled at the start of the command
so that we can avoid printing anything if it gets turned on by
the current command. */
- int m_time_enabled : 1;
- int m_space_enabled : 1;
- int m_symtab_enabled : 1;
+ unsigned int m_time_enabled : 1;
+ unsigned int m_space_enabled : 1;
+ unsigned int m_symtab_enabled : 1;
run_time_clock::time_point m_start_cpu_time;
std::chrono::steady_clock::time_point m_start_wall_time;
long m_start_space;
base-commit: 76f8ef8d53792ef89aee7a51b94bc7d1cf324379
--
2.39.0
next reply other threads:[~2023-01-21 14:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-21 14:56 Enze Li [this message]
2023-01-21 17:09 ` Tom Tromey
2023-01-22 6:47 ` Enze Li
2023-01-22 5:54 ` [PATCH v2] gdb: some int to bool conversion Enze Li
2023-01-22 17:38 ` Tom Tromey
2023-01-24 3:21 ` Enze Li
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=OS3P286MB215243E4429C6C8CD05AB540F0CA9@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM \
--to=enze.li@hotmail.com \
--cc=enze.li@gmx.com \
--cc=gdb-patches@sourceware.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).