Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 2/7] Use CORE_ADDR_MAX in various "breaks" arrays
Date: Wed, 08 Aug 2018 23:20:00 -0000	[thread overview]
Message-ID: <20180808232016.12777-3-tom@tromey.com> (raw)
In-Reply-To: <20180808232016.12777-1-tom@tromey.com>

Code like this:

  CORE_ADDR breaks[2] = {-1, -1};

... gives a warning with -Wnarrowing.  This patch changes all
instances of this to use CORE_ADDR_MAX instead.

gdb/ChangeLog
2018-08-08  Tom Tromey  <tom@tromey.com>

	* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Use
	CORE_ADDR_MAX.
	* mips-tdep.c (mips_deal_with_atomic_sequence)
	(micromips_deal_with_atomic_sequence): Use CORE_ADDR_MAX.
	* arch/arm-get-next-pcs.c (thumb_deal_with_atomic_sequence_raw)
	(arm_deal_with_atomic_sequence_raw): Use CORE_ADDR_MAX.
	* alpha-tdep.c (alpha_deal_with_atomic_sequence): Use
	CORE_ADDR_MAX.
	* aarch64-tdep.c (aarch64_software_single_step): Use
	CORE_ADDR_MAX.
---
 gdb/ChangeLog               | 13 +++++++++++++
 gdb/aarch64-tdep.c          |  2 +-
 gdb/alpha-tdep.c            |  2 +-
 gdb/arch/arm-get-next-pcs.c |  4 ++--
 gdb/mips-tdep.c             |  4 ++--
 gdb/rs6000-tdep.c           |  2 +-
 6 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 5c6eb98545..62f680e15c 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -2472,7 +2472,7 @@ aarch64_software_single_step (struct regcache *regcache)
   const int insn_size = 4;
   const int atomic_sequence_length = 16; /* Instruction sequence length.  */
   CORE_ADDR pc = regcache_read_pc (regcache);
-  CORE_ADDR breaks[2] = { -1, -1 };
+  CORE_ADDR breaks[2] = { CORE_ADDR_MAX, CORE_ADDR_MAX };
   CORE_ADDR loc = pc;
   CORE_ADDR closing_insn = 0;
   uint32_t insn = read_memory_unsigned_integer (loc, insn_size,
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 53943e1d77..e649bd2102 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -767,7 +767,7 @@ static const int stq_c_opcode = 0x2f;
 static std::vector<CORE_ADDR>
 alpha_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  CORE_ADDR breaks[2] = {-1, -1};
+  CORE_ADDR breaks[2] = {CORE_ADDR_MAX, CORE_ADDR_MAX};
   CORE_ADDR loc = pc;
   CORE_ADDR closing_insn; /* Instruction that closes the atomic sequence.  */
   unsigned int insn = alpha_read_insn (gdbarch, loc);
diff --git a/gdb/arch/arm-get-next-pcs.c b/gdb/arch/arm-get-next-pcs.c
index 1e63267038..3178bf311c 100644
--- a/gdb/arch/arm-get-next-pcs.c
+++ b/gdb/arch/arm-get-next-pcs.c
@@ -49,7 +49,7 @@ static std::vector<CORE_ADDR>
 thumb_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
 {
   int byte_order_for_code = self->byte_order_for_code;
-  CORE_ADDR breaks[2] = {-1, -1};
+  CORE_ADDR breaks[2] = {CORE_ADDR_MAX, CORE_ADDR_MAX};
   CORE_ADDR pc = regcache_read_pc (self->regcache);
   CORE_ADDR loc = pc;
   unsigned short insn1, insn2;
@@ -187,7 +187,7 @@ static std::vector<CORE_ADDR>
 arm_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
 {
   int byte_order_for_code = self->byte_order_for_code;
-  CORE_ADDR breaks[2] = {-1, -1};
+  CORE_ADDR breaks[2] = {CORE_ADDR_MAX, CORE_ADDR_MAX};
   CORE_ADDR pc = regcache_read_pc (self->regcache);
   CORE_ADDR loc = pc;
   unsigned int insn;
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 37a12a9f55..5e0a60625b 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -3910,7 +3910,7 @@ mips_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr)
 static std::vector<CORE_ADDR>
 mips_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  CORE_ADDR breaks[2] = {-1, -1};
+  CORE_ADDR breaks[2] = {CORE_ADDR_MAX, CORE_ADDR_MAX};
   CORE_ADDR loc = pc;
   CORE_ADDR branch_bp; /* Breakpoint at branch instruction's destination.  */
   ULONGEST insn;
@@ -4013,7 +4013,7 @@ micromips_deal_with_atomic_sequence (struct gdbarch *gdbarch,
 {
   const int atomic_sequence_length = 16; /* Instruction sequence length.  */
   int last_breakpoint = 0; /* Defaults to 0 (no breakpoints placed).  */
-  CORE_ADDR breaks[2] = {-1, -1};
+  CORE_ADDR breaks[2] = {CORE_ADDR_MAX, CORE_ADDR_MAX};
   CORE_ADDR branch_bp = 0; /* Breakpoint at branch instruction's
 			      destination.  */
   CORE_ADDR loc = pc;
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index e78de49b2e..5a3e65f211 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -989,7 +989,7 @@ ppc_deal_with_atomic_sequence (struct regcache *regcache)
   struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR pc = regcache_read_pc (regcache);
-  CORE_ADDR breaks[2] = {-1, -1};
+  CORE_ADDR breaks[2] = {CORE_ADDR_MAX, CORE_ADDR_MAX};
   CORE_ADDR loc = pc;
   CORE_ADDR closing_insn; /* Instruction that closes the atomic sequence.  */
   int insn = read_memory_integer (loc, PPC_INSN_SIZE, byte_order);
-- 
2.13.6


  reply	other threads:[~2018-08-08 23:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-08 23:20 [PATCH 0/7] Remove -Wno-narrowing Tom Tromey
2018-08-08 23:20 ` Tom Tromey [this message]
2018-08-09 18:08   ` [PATCH 2/7] Use CORE_ADDR_MAX in various "breaks" arrays Pedro Alves
2018-08-08 23:20 ` [PATCH 6/7] Avoid -Wnarrowing warnings in gdbserver Tom Tromey
2018-08-08 23:20 ` [PATCH 5/7] Avoid -Wnarrowing warnings in ppc64-tdep.c Tom Tromey
2018-08-08 23:20 ` [PATCH 1/7] Change completion_tracker to use char type Tom Tromey
2018-08-09 17:38   ` Pedro Alves
2018-08-09 18:42     ` Tom Tromey
2018-08-09 18:50       ` Pedro Alves
2018-08-08 23:20 ` [PATCH 3/7] Avoid -Wnarrowing warnings in struct tramp_frame instances Tom Tromey
2018-08-09 18:08   ` Pedro Alves
2018-08-09 18:17     ` Tom Tromey
2018-08-08 23:20 ` [PATCH 4/7] Fix two -Wnarrowing warnings in xtensa-tdep.h Tom Tromey
2018-08-09 18:09   ` Pedro Alves
2018-08-08 23:20 ` [PATCH 7/7] Remove -Wno-narrowing from warnings.m4 Tom Tromey
2018-08-09 18:10   ` Pedro Alves
2018-08-27 17:46     ` Tom Tromey
2018-08-27 18:00       ` 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=20180808232016.12777-3-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