[binutils-gdb] Avoid -Wnarrowing warnings from quote_char()
Tom Tromey
tromey@sourceware.org
Mon Aug 27 18:09:00 GMT 2018
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=896a7aa6a119ce9d4872de87dabb81176489b1a3
commit 896a7aa6a119ce9d4872de87dabb81176489b1a3
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().
gdb/ChangeLog
2018-08-27 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:
---
gdb/ChangeLog | 6 ++++++
gdb/completer.c | 2 +-
gdb/linespec.c | 2 +-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 99eb36a..52bfeb6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2018-08-27 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-26 Simon Marchi <simon.marchi@polymtl.ca>
* solist.h (struct solist, struct target_so_ops): Fix
diff --git a/gdb/completer.c b/gdb/completer.c
index 3e87ed4..1c28526 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 73fbe4a..fd88007 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 (':');
More information about the Gdb-cvs
mailing list