[PATCH 4/9] gdb: remove LA_EMIT_CHAR macro

Andrew Burgess andrew.burgess@embecosm.com
Fri Nov 20 11:54:59 GMT 2020


Now that every use of the LA_EMIT_CHAR macro is within a language_defn
member function we can simply call the emitchar member function
directly instead of using the LA_EMIT_CHAR macro.

If we are ever inside a language object, for example, cplus_language,
while current_language points at something other than cplus_language
then this commit will result in a change in behaviour.  However, I
believe if we did have such a difference then this would be a bug in
GDB.  AS such I'm going to claim there _should_ be no user visible
changes from this commit.

gdb/ChangeLog:

	* c-lang.c (language_defn::printchar): Call emitchar, not
	LA_EMIT_CHAR.
	* f-lang.h (f_language::printchar): Likewise.
	* language.h (LA_EMIT_CHAR): Delete macro.
	* rust-lang.c (rust_language::printchar): Call emitchar, not
	LA_EMIT_CHAR.
---
 gdb/ChangeLog   | 9 +++++++++
 gdb/c-lang.c    | 2 +-
 gdb/f-lang.h    | 2 +-
 gdb/language.h  | 2 --
 gdb/rust-lang.c | 2 +-
 5 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 5d696b1b356..e983804a9f8 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -178,7 +178,7 @@ language_defn::printchar (int c, struct type *type,
     }
 
   fputc_filtered ('\'', stream);
-  LA_EMIT_CHAR (c, type, stream, '\'');
+  emitchar (c, type, stream, '\'');
   fputc_filtered ('\'', stream);
 }
 
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
index 351f2191c16..51ee6f67d07 100644
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -155,7 +155,7 @@ class f_language : public language_defn
 		  struct ui_file *stream) const override
   {
     fputs_filtered ("'", stream);
-    LA_EMIT_CHAR (ch, chtype, stream, '\'');
+    emitchar (ch, chtype, stream, '\'');
     fputs_filtered ("'", stream);
   }
 
diff --git a/gdb/language.h b/gdb/language.h
index 1b602646651..815b1923d58 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -768,8 +768,6 @@ extern enum language set_language (enum language);
 #define LA_PRINT_STRING(stream, elttype, string, length, encoding, force_ellipses, options) \
   (current_language->printstr (stream, elttype, string, length, \
 			       encoding, force_ellipses,options))
-#define LA_EMIT_CHAR(ch, type, stream, quoter) \
-  (current_language->emitchar (ch, type, stream, quoter))
 
 /* Test a character to decide whether it can be printed in literal form
    or needs to be printed in another representation.  For example,
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 407be569308..4cfe44a1ad7 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -2069,7 +2069,7 @@ class rust_language : public language_defn
 		  struct ui_file *stream) const override
   {
     fputs_filtered ("'", stream);
-    LA_EMIT_CHAR (ch, chtype, stream, '\'');
+    emitchar (ch, chtype, stream, '\'');
     fputs_filtered ("'", stream);
   }
 
-- 
2.25.4



More information about the Gdb-patches mailing list