From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 2/2] gdb: fix -Wsingle-bit-bitfield-constant-conversion warning in z80-tdep.c
Date: Fri, 5 May 2023 11:48:50 -0400 [thread overview]
Message-ID: <20230505154850.48685-3-simon.marchi@efficios.com> (raw)
In-Reply-To: <20230505154850.48685-1-simon.marchi@efficios.com>
When building with clang 16, I see:
/home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:338:32: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
info->prologue_type.load_args = 1;
^ ~
/home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:345:36: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
info->prologue_type.critical = 1;
^ ~
/home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:351:37: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
info->prologue_type.interrupt = 1;
^ ~
/home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:367:36: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
info->prologue_type.fp_sdcc = 1;
^ ~
/home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:375:35: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
info->prologue_type.fp_sdcc = 1;
^ ~
/home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:380:35: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
info->prologue_type.fp_sdcc = 1;
^ ~
Fix that by using "unsigned int" as the bitfield's underlying type.
(cherry picked from commit 07f285934886016ddd82cac99a3873e68b499d5c)
Change-Id: I3550a0112f993865dc70b18f02ab11bb5012693d
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30423
---
gdb/z80-tdep.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
index aa296c7169f6..2af6198ff3fc 100644
--- a/gdb/z80-tdep.c
+++ b/gdb/z80-tdep.c
@@ -98,11 +98,11 @@ struct z80_unwind_cache
struct
{
- int called:1; /* there is return address on stack */
- int load_args:1; /* prologues loads args using POPs */
- int fp_sdcc:1; /* prologue saves and adjusts frame pointer IX */
- int interrupt:1; /* __interrupt handler */
- int critical:1; /* __critical function */
+ unsigned int called : 1; /* there is return address on stack */
+ unsigned int load_args : 1; /* prologues loads args using POPs */
+ unsigned int fp_sdcc : 1; /* prologue saves and adjusts frame pointer IX */
+ unsigned int interrupt : 1; /* __interrupt handler */
+ unsigned int critical : 1; /* __critical function */
} prologue_type;
/* Table indicating the location of each and every register. */
--
2.40.1
next prev parent reply other threads:[~2023-05-05 15:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-05 15:48 [PATCH 0/2] Cherry-pick patches to build with Clang 16 to gdb-13-branch Simon Marchi
2023-05-05 15:48 ` [PATCH 1/2] gdbsupport: ignore -Wenum-constexpr-conversion in enum-flags.h Simon Marchi
2023-05-05 15:48 ` Simon Marchi [this message]
2023-05-05 19:14 ` [PATCH 0/2] Cherry-pick patches to build with Clang 16 to gdb-13-branch Tom Tromey
2023-05-05 19:27 ` Simon Marchi
-- strict thread matches above, loose matches on Subject: below --
2023-02-23 17:35 [PATCH 1/2] gdbsupport: ignore -Wenum-constexpr-conversion in enum-flags.h Simon Marchi
2023-02-23 17:35 ` [PATCH 2/2] gdb: fix -Wsingle-bit-bitfield-constant-conversion warning in z80-tdep.c Simon Marchi
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=20230505154850.48685-3-simon.marchi@efficios.com \
--to=simon.marchi@efficios.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).