Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Pedro Alves <palves@redhat.com>
Cc: Tom Tromey <tom@tromey.com>,  gdb-patches@sourceware.org
Subject: Re: [PATCH 1/7] Change completion_tracker to use char type
Date: Thu, 09 Aug 2018 18:42:00 -0000	[thread overview]
Message-ID: <87d0uridpt.fsf@tromey.com> (raw)
In-Reply-To: <f4419039-156c-7fb2-0671-491ed0132351@redhat.com> (Pedro Alves's	message of "Thu, 9 Aug 2018 18:38:39 +0100")

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> See comment about use of int vs char here:
Pedro>  https://sourceware.org/ml/gdb-patches/2017-07/msg00228.html
Pedro> Look for "Why int".

Thanks.  How about just this patch, that adds a couple of casts at the
necessary spots?

Tom

commit 5683b8e5ff3dabcea180e0ce84c236189f047cb0
Author: Tom Tromey <tom@tromey.com>
Date:   Thu Aug 9 12:38:39 2018 -0600

    Avoid -Wnarrowing warnings from quote_char()
    
    This adds a couple of casts to avoid -Wnarrowing warnings coming from
    the use of quote_char().
    
    2018-08-09  Tom Tromey  <tom@tromey.com>
    
            * linespec.c (complete_linespec_component): Add cast to "char".
            * completer.c (completion_tracker::build_completion_result): Add
            cast to "char".

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b405915c43..2a284fbc10 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 2018-08-09  Tom Tromey  <tom@tromey.com>
 
+	* linespec.c (complete_linespec_component): Add cast to "char".
+	* completer.c (completion_tracker::build_completion_result): Add
+	cast to "char".
+
+2018-08-09  Tom Tromey  <tom@tromey.com>
+
 	* riscv-tdep.h: Minor formatting fixes.
 
 2018-08-09  Simon Marchi  <simon.marchi@ericsson.com>
diff --git a/gdb/completer.c b/gdb/completer.c
index 3e87ed454c..1c285262de 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -2032,7 +2032,7 @@ completion_tracker::build_completion_result (const char *text,
       /* We don't rely on readline appending the quote char as
 	 delimiter as then readline wouldn't append the ' ' after the
 	 completion.  */
-      char buf[2] = { quote_char () };
+      char buf[2] = { (char) quote_char () };
 
       match_list[0] = reconcat (match_list[0], match_list[0],
 				buf, (char *) NULL);
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 790ddf4740..dcaaaefaaa 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2894,7 +2894,7 @@ complete_linespec_component (linespec_parser *parser,
 	     new "quote" char.  */
 	  if (tracker.quote_char ())
 	    {
-	      char quote_char_str[2] = { tracker.quote_char () };
+	      char quote_char_str[2] = { (char) tracker.quote_char () };
 
 	      fn = reconcat (fn, fn, quote_char_str, (char *) NULL);
 	      tracker.set_quote_char (':');


  reply	other threads:[~2018-08-09 18:42 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 ` [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 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 [this message]
2018-08-09 18:50       ` 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
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 2/7] Use CORE_ADDR_MAX in various "breaks" arrays Tom Tromey
2018-08-09 18:08   ` Pedro Alves
2018-08-08 23:20 ` [PATCH 5/7] Avoid -Wnarrowing warnings in ppc64-tdep.c Tom Tromey
2018-08-08 23:20 ` [PATCH 6/7] Avoid -Wnarrowing warnings in gdbserver 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=87d0uridpt.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /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