From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH] Fix windows-nat.c for -Wnarrowing
Date: Wed, 29 Aug 2018 17:43:00 -0000 [thread overview]
Message-ID: <20180829174253.18507-1-tom@tromey.com> (raw)
Sergio pointed out that the Windows builder was failing due to the
-Wnarrowing patch, with:
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '3221225477' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
{-1, GDB_SIGNAL_UNKNOWN}};
^
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '3221225725' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '2147483651' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '2147483652' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '3221225614' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
Looking into this, I found two things.
First, in struct xlate_exception, it is better to have "them" be of
type DWORD, as that's the type actually in use.
Second, struct xlate_exception and xlate are not used in this file,
because the code in windows_nat_target::resume is #if'd out.
This patch changes the type of "them", but also similarly #if's out
this object.
Tested by rebuilding using the mingw toolchain on x86-64 Fedora 28.
gdb/ChangeLog
2018-08-29 Tom Tromey <tom@tromey.com>
* windows-nat.c (struct xlate_exception) <them>: Change type to
DWORD.
(xlate): Fix formatting.
(struct xlate_exception, xlate): Comment out.
---
gdb/ChangeLog | 7 +++++++
gdb/windows-nat.c | 12 ++++++++----
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a30dacee4a3..0c4327f0637 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2018-08-29 Tom Tromey <tom@tromey.com>
+
+ * windows-nat.c (struct xlate_exception) <them>: Change type to
+ DWORD.
+ (xlate): Fix formatting.
+ (struct xlate_exception, xlate): Comment out.
+
2018-08-29 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/23555
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index aea502638e0..404646c94b0 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -280,17 +280,19 @@ static const int *mappings;
a segment register or not. */
static segment_register_p_ftype *segment_register_p;
+/* See windows_nat_target::resume to understand why this is commented
+ out. */
+#if 0
/* This vector maps the target's idea of an exception (extracted
from the DEBUG_EVENT structure) to GDB's idea. */
struct xlate_exception
{
- int them;
+ DWORD them;
enum gdb_signal us;
};
-static const struct xlate_exception
- xlate[] =
+static const struct xlate_exception xlate[] =
{
{EXCEPTION_ACCESS_VIOLATION, GDB_SIGNAL_SEGV},
{STATUS_STACK_OVERFLOW, GDB_SIGNAL_SEGV},
@@ -298,8 +300,10 @@ static const struct xlate_exception
{DBG_CONTROL_C, GDB_SIGNAL_INT},
{EXCEPTION_SINGLE_STEP, GDB_SIGNAL_TRAP},
{STATUS_FLOAT_DIVIDE_BY_ZERO, GDB_SIGNAL_FPE},
- {-1, GDB_SIGNAL_UNKNOWN}};
+ {-1, GDB_SIGNAL_UNKNOWN}
+};
+#endif /* 0 */
struct windows_nat_target final : public x86_nat_target<inf_child_target>
{
--
2.17.1
next reply other threads:[~2018-08-29 17:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-29 17:43 Tom Tromey [this message]
2018-08-29 18:39 ` Pedro Alves
2018-08-29 18:58 ` Tom Tromey
2018-08-29 19:01 ` Tom Tromey
2018-08-29 19:09 ` Pedro Alves
2018-08-29 19:31 ` Tom Tromey
2018-08-29 19:16 ` Eli Zaretskii
2018-08-29 19:22 ` Tom Tromey
2018-08-29 19:29 ` Eli Zaretskii
2018-08-29 19:33 ` Eli Zaretskii
2018-08-29 19:35 ` Tom Tromey
2018-08-29 19:38 ` Eli Zaretskii
2018-08-29 19:34 ` Tom Tromey
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=20180829174253.18507-1-tom@tromey.com \
--to=tom@tromey.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