[PATCH 1/7] Change completion_tracker to use char type

Tom Tromey tom@tromey.com
Wed Aug 8 23:20:00 GMT 2018


This changes completion_tracker to use the char type for the quote
char.  This avoids some narrowing warnings at the places where
quote_char() is called.

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

	* completer.h (completion_tracker::set_quote_char): Change
	parameter type to "char".
	(completion_tracker::quote_char): Return "char".  Now const.
	(completion_tracker::m_quote_char): Now "char".
---
 gdb/ChangeLog   | 7 +++++++
 gdb/completer.h | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/gdb/completer.h b/gdb/completer.h
index 2bdfa26f6c..9f10bf0ea8 100644
--- a/gdb/completer.h
+++ b/gdb/completer.h
@@ -329,13 +329,13 @@ public:
   /* Set the quote char to be appended after a unique completion is
      added to the input line.  Set to '\0' to clear.  See
      m_quote_char's description.  */
-  void set_quote_char (int quote_char)
+  void set_quote_char (char quote_char)
   { m_quote_char = quote_char; }
 
   /* The quote char to be appended after a unique completion is added
      to the input line.  Returns '\0' if no quote char has been set.
      See m_quote_char's description.  */
-  int quote_char () { return m_quote_char; }
+  char quote_char () const { return m_quote_char; }
 
   /* Tell the tracker that the current completer wants to provide a
      custom word point instead of a list of a break chars, in the
@@ -450,7 +450,7 @@ private:
       before tab: "b 'function("
       after tab:  "b 'function()' "
   */
-  int m_quote_char = '\0';
+  char m_quote_char = '\0';
 
   /* If true, the completer has its own idea of "word" point, and
      doesn't want to rely on readline computing it based on brkchars.
-- 
2.13.6



More information about the Gdb-patches mailing list