ada-valprint.c: Inline print_record inside ada_val_print_struct_union
authorJoel Brobecker <brobecker@adacore.com>
Thu, 19 Dec 2013 15:11:49 +0000 (19:11 +0400)
committerJoel Brobecker <brobecker@adacore.com>
Tue, 7 Jan 2014 04:17:39 +0000 (08:17 +0400)
The function print_record is a fairly small and straightforward
function which is only called from one location. So this patch
inlines the code at the point of call.

One small advantage is that the context of use of this patch has
now become such that we can assume that TYPE is not a typedef,
nor an enum. So thhe call to ada_check_typedef is unnecessary,
and this patch removes it.

gdb/ChangeLog:

        * ada-valprint.c (print_record): Delete, implementation inlined...
        (ada_val_print_struct_union): ... here.  Remove call to
        ada_check_typedef in inlined implementation.

gdb/ChangeLog
gdb/ada-valprint.c

index 4be753dbe932c58fb46876d5161acae60245f3b2..4c1978c898d5e5f96964a36ee7a11f7fd85bc4a0 100644 (file)
@@ -1,3 +1,9 @@
+2014-01-07  Joel Brobecker  <brobecker@adacore.com>
+
+       * ada-valprint.c (print_record): Delete, implementation inlined...
+       (ada_val_print_struct_union): ... here.  Remove call to
+       ada_check_typedef in inlined implementation.
+
 2014-01-07  Joel Brobecker  <brobecker@adacore.com>
 
        * ada-valprint.c (ada_val_print_gnat_array): New function,
index 1111d90719c6b8c40f2d3b59138757cf6756f2bb..22ec9c0040db60fed162fdd0762ba17ffee0c97d 100644 (file)
@@ -750,28 +750,6 @@ print_field_values (struct type *type, const gdb_byte *valaddr,
   return comma_needed;
 }
 
-static void
-print_record (struct type *type, const gdb_byte *valaddr,
-             int offset,
-             struct ui_file *stream, int recurse,
-             const struct value *val,
-             const struct value_print_options *options)
-{
-  type = ada_check_typedef (type);
-
-  fprintf_filtered (stream, "(");
-
-  if (print_field_values (type, valaddr, offset,
-                         stream, recurse, val, options,
-                         0, type, offset) != 0 && options->prettyformat)
-    {
-      fprintf_filtered (stream, "\n");
-      print_spaces_filtered (2 * recurse, stream);
-    }
-
-  fprintf_filtered (stream, ")");
-}
-
 /* Implement Ada val_print-ing for GNAT arrays (Eg. fat pointers,
    thin pointers, etc).  */
 
@@ -1006,8 +984,18 @@ ada_val_print_struct_union
       return;
     }
 
-  print_record (type, valaddr, offset_aligned,
-               stream, recurse, original_value, options);
+  fprintf_filtered (stream, "(");
+
+  if (print_field_values (type, valaddr, offset_aligned,
+                         stream, recurse, original_value, options,
+                         0, type, offset_aligned) != 0
+      && options->prettyformat)
+    {
+      fprintf_filtered (stream, "\n");
+      print_spaces_filtered (2 * recurse, stream);
+    }
+
+  fprintf_filtered (stream, ")");
 }
 
 /* Implement Ada val_print'ing for the case where TYPE is
This page took 0.029914 seconds and 4 git commands to generate.