gdb: remove LA_VALUE_PRINT macro
authorAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 14 Aug 2020 14:05:48 +0000 (15:05 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 23 Oct 2020 09:57:14 +0000 (10:57 +0100)
Remove the LA_VALUE_PRINT macro, and replace its uses with direct
calls to the value_print member function on an appropriate language.

In the global 'value_print' function, we call the value_print method
on the current_language, this is a direct inline replacement of the
old LA_VALUE_PRINT macro.

However, in ada-lang.c, and language.c the macro was being used
within the print_array_index member function of a language class.  In
these cases we now call the value_print member function of the current
language class.

In theory, when we are inside (for example) the
ada_language::print_array_index function the current_language should
always be set to Ada, so this change should have no effect.  However,
if we ever could get into ada_language::print_array_index with the
current language set to something else (which I think would have been
a bug) then we would now see a change in behaviour.  I couldn't find
any cases where this happened though.

There should be no user visible changes after this commit, but it is
not impossible in some edge cases.

gdb/ChangeLog:

* ada-lang.c (ada_language::print_array_index): Call value_print
directly.
* language.c (language_defn::print_array_index): Likewise.
* language.h (LA_VALUE_PRINT): Delete.
* valprint.c (value_print): Call value_print on the
current_language directly.

gdb/ChangeLog
gdb/ada-lang.c
gdb/language.c
gdb/language.h
gdb/valprint.c

index c517470c9d9b4abbbb5e59ba0ff6d17ea7453d8e..ec1bdca6ea70cd289ac7cc103feaf7935a25d698 100644 (file)
@@ -1,3 +1,12 @@
+2020-10-23  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * ada-lang.c (ada_language::print_array_index): Call value_print
+       directly.
+       * language.c (language_defn::print_array_index): Likewise.
+       * language.h (LA_VALUE_PRINT): Delete.
+       * valprint.c (value_print): Call value_print on the
+       current_language directly.
+
 2020-10-23  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * language.h (LA_PRINT_TYPEDEF): Delete.
index be6d0e1d0192a059e46766a1d9b00da20335889f..3a74de15bf6857880dc5ec9e4f7a5c1f9d86b459 100644 (file)
@@ -13721,7 +13721,7 @@ public:
   {
     struct value *index_value = val_atr (index_type, index);
 
-    LA_VALUE_PRINT (index_value, stream, options);
+    value_print (index_value, stream, options);
     fprintf_filtered (stream, " => ");
   }
 
index ffc1e85503a91ff10224ca64a5b7046943f4a5fe..4053cb76885900ddaa14964786061d3bc23c2479 100644 (file)
@@ -622,7 +622,7 @@ language_defn::print_array_index (struct type *index_type, LONGEST index,
   struct value *index_value = value_from_longest (index_type, index);
 
   fprintf_filtered (stream, "[");
-  LA_VALUE_PRINT (index_value, stream, options);
+  value_print (index_value, stream, options);
   fprintf_filtered (stream, "] = ");
 }
 
index 3452149c9ca760570549b69c381639833d83ae80..c85f90f8b4bdee9d9fbd1ded95ac767b68b1f376 100644 (file)
@@ -644,9 +644,6 @@ extern enum language set_language (enum language);
 #define LA_PRINT_TYPE(type,varstring,stream,show,level,flags)          \
   (current_language->print_type(type,varstring,stream,show,level,flags))
 
-#define LA_VALUE_PRINT(val,stream,options) \
-  (current_language->value_print (val,stream,options))
-
 #define LA_PRINT_CHAR(ch, type, stream) \
   (current_language->printchar (ch, type, stream))
 #define LA_PRINT_STRING(stream, elttype, string, length, encoding, force_ellipses, options) \
index dd70a1a3933957998ed6de8ec3560c2ba47635a7..880d04f8c1dc05fc9f78c71be7f10a2698a8815a 100644 (file)
@@ -1138,7 +1138,7 @@ value_print (struct value *val, struct ui_file *stream,
        return;
     }
 
-  LA_VALUE_PRINT (val, stream, options);
+  current_language->value_print (val, stream, options);
 }
 
 static void
This page took 0.040219 seconds and 4 git commands to generate.