]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
update name of several Ada fixed-point type handling functions
authorJoel Brobecker <brobecker@adacore.com>
Fri, 15 May 2020 20:06:42 +0000 (15:06 -0500)
committerJoel Brobecker <brobecker@adacore.com>
Fri, 15 May 2020 20:06:42 +0000 (16:06 -0400)
The purpose of this patch is to prepare for the future where
fixed point types become described using standard DWARF info,
rather than GNAT encodings. For that, we rename a number of
routines manipulating Ada fixed point types to make it explicit
from their new names that they rely on the GNAT encodings to work.
This will allow us, when we introduce support for fixed point types
from standard DWARF to use names that are not ambiguous with
the functions that do similar work, but only for GNAT encodings.

gdb/ChangeLog:

        * ada-lang.h: (ada_is_gnat_encoded_fixed_point_type): Renames
        ada_is_fixed_point_type.  Update all callers.
        (gnat_encoded_fixed_point_delta): Renames ada_delta.  Update
        all callers.
        * ada-lang.c (gnat_encoded_fixed_type_info): Renames fixed_type_info.
        Update all callers.
        * ada-typeprint.c (print_gnat_encoded_fixed_point_type): Renames
        print_fixed_point_type.  Update all callers.
        * ada-valprint.c (ada_value_print_num): Replace call to
        ada_is_fixed_point_type by ada_is_gnat_encoded_fixed_point_type.

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

index 44ccc180d2a1ceb74ea4a0d4e4f032f5685ddf70..f91827e4ce0199c7f841d6b7e0ea3c4cd8732f08 100644 (file)
@@ -1,3 +1,16 @@
+2020-05-15  Joel Brobecker  <brobecker@adacore.com>
+
+       * ada-lang.h: (ada_is_gnat_encoded_fixed_point_type): Renames
+       ada_is_fixed_point_type.  Update all callers.
+       (gnat_encoded_fixed_point_delta): Renames ada_delta.  Update
+       all callers.
+       * ada-lang.c (gnat_encoded_fixed_type_info): Renames fixed_type_info.
+       Update all callers.
+       * ada-typeprint.c (print_gnat_encoded_fixed_point_type): Renames
+       print_fixed_point_type.  Update all callers.
+       * ada-valprint.c (ada_value_print_num): Replace call to
+       ada_is_fixed_point_type by ada_is_gnat_encoded_fixed_point_type.
+
 2020-05-14  Kevin Buettner  <kevinb@redhat.com>
 
        * nat/linux-btrace.c (btrace_this_cpu): Add check for AMD
index 02e3404430175496227f6aaff65d34602b5cfece..e5288e2370c9128bed0864253a5b491cb8266170 100644 (file)
@@ -9460,7 +9460,7 @@ cast_to_fixed (struct type *type, struct value *arg)
     return arg;
 
   struct value *scale = ada_scaling_factor (type);
-  if (ada_is_fixed_point_type (value_type (arg)))
+  if (ada_is_gnat_encoded_fixed_point_type (value_type (arg)))
     arg = cast_from_fixed (value_type (scale), arg);
   else
     arg = value_cast (value_type (scale), arg);
@@ -10008,10 +10008,10 @@ ada_value_cast (struct type *type, struct value *arg2)
   if (type == ada_check_typedef (value_type (arg2)))
     return arg2;
 
-  if (ada_is_fixed_point_type (type))
+  if (ada_is_gnat_encoded_fixed_point_type (type))
     return cast_to_fixed (type, arg2);
 
-  if (ada_is_fixed_point_type (value_type (arg2)))
+  if (ada_is_gnat_encoded_fixed_point_type (value_type (arg2)))
     return cast_from_fixed (type, arg2);
 
   return value_cast (type, arg2);
@@ -10411,9 +10411,9 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
        {
          /* Nothing.  */
        }
-      else if (ada_is_fixed_point_type (value_type (arg1)))
+      else if (ada_is_gnat_encoded_fixed_point_type (value_type (arg1)))
         arg2 = cast_to_fixed (value_type (arg1), arg2);
-      else if (ada_is_fixed_point_type (value_type (arg2)))
+      else if (ada_is_gnat_encoded_fixed_point_type (value_type (arg2)))
         error
           (_("Fixed-point values must be assigned to fixed-point variables"));
       else
@@ -10433,8 +10433,8 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
         return (value_from_longest
                  (value_type (arg2),
                   value_as_long (arg1) + value_as_long (arg2)));
-      if ((ada_is_fixed_point_type (value_type (arg1))
-           || ada_is_fixed_point_type (value_type (arg2)))
+      if ((ada_is_gnat_encoded_fixed_point_type (value_type (arg1))
+           || ada_is_gnat_encoded_fixed_point_type (value_type (arg2)))
           && value_type (arg1) != value_type (arg2))
         error (_("Operands of fixed-point addition must have the same type"));
       /* Do the addition, and cast the result to the type of the first
@@ -10459,8 +10459,8 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
         return (value_from_longest
                  (value_type (arg2),
                   value_as_long (arg1) - value_as_long (arg2)));
-      if ((ada_is_fixed_point_type (value_type (arg1))
-           || ada_is_fixed_point_type (value_type (arg2)))
+      if ((ada_is_gnat_encoded_fixed_point_type (value_type (arg1))
+           || ada_is_gnat_encoded_fixed_point_type (value_type (arg2)))
           && value_type (arg1) != value_type (arg2))
         error (_("Operands of fixed-point subtraction "
                 "must have the same type"));
@@ -10489,9 +10489,9 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
       else
         {
           type = builtin_type (exp->gdbarch)->builtin_double;
-          if (ada_is_fixed_point_type (value_type (arg1)))
+          if (ada_is_gnat_encoded_fixed_point_type (value_type (arg1)))
             arg1 = cast_from_fixed (type, arg1);
-          if (ada_is_fixed_point_type (value_type (arg2)))
+          if (ada_is_gnat_encoded_fixed_point_type (value_type (arg2)))
             arg2 = cast_from_fixed (type, arg2);
           binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
           return ada_value_binop (arg1, arg2, op);
@@ -10519,7 +10519,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
       arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
       if (noside == EVAL_SKIP)
         goto nosideret;
-      else if (ada_is_fixed_point_type (value_type (arg1)))
+      else if (ada_is_gnat_encoded_fixed_point_type (value_type (arg1)))
         return value_cast (value_type (arg1), value_neg (arg1));
       else
        {
@@ -11391,7 +11391,7 @@ nosideret:
    Otherwise, return NULL.  */
 
 static const char *
-fixed_type_info (struct type *type)
+gnat_encoded_fixed_type_info (struct type *type)
 {
   const char *name = ada_type_name (type);
   enum type_code code = (type == NULL) ? TYPE_CODE_UNDEF : type->code ();
@@ -11406,7 +11406,7 @@ fixed_type_info (struct type *type)
         return tail + 5;
     }
   else if (code == TYPE_CODE_RANGE && TYPE_TARGET_TYPE (type) != type)
-    return fixed_type_info (TYPE_TARGET_TYPE (type));
+    return gnat_encoded_fixed_type_info (TYPE_TARGET_TYPE (type));
   else
     return NULL;
 }
@@ -11414,9 +11414,9 @@ fixed_type_info (struct type *type)
 /* Returns non-zero iff TYPE represents an Ada fixed-point type.  */
 
 int
-ada_is_fixed_point_type (struct type *type)
+ada_is_gnat_encoded_fixed_point_type (struct type *type)
 {
-  return fixed_type_info (type) != NULL;
+  return gnat_encoded_fixed_type_info (type) != NULL;
 }
 
 /* Return non-zero iff TYPE represents a System.Address type.  */
@@ -11443,9 +11443,9 @@ ada_scaling_type (struct type *type)
    delta cannot be determined.  */
 
 struct value *
-ada_delta (struct type *type)
+gnat_encoded_fixed_point_delta (struct type *type)
 {
-  const char *encoding = fixed_type_info (type);
+  const char *encoding = gnat_encoded_fixed_type_info (type);
   struct type *scale_type = ada_scaling_type (type);
 
   long long num, den;
@@ -11457,13 +11457,13 @@ ada_delta (struct type *type)
                        value_from_longest (scale_type, den), BINOP_DIV);
 }
 
-/* Assuming that ada_is_fixed_point_type (TYPE), return the scaling
-   factor ('SMALL value) associated with the type.  */
+/* Assuming that ada_is_gnat_encoded_fixed_point_type (TYPE), return
+   the scaling factor ('SMALL value) associated with the type.  */
 
 struct value *
 ada_scaling_factor (struct type *type)
 {
-  const char *encoding = fixed_type_info (type);
+  const char *encoding = gnat_encoded_fixed_type_info (type);
   struct type *scale_type = ada_scaling_type (type);
 
   long long num0, den0, num1, den1;
index c0a71091e35515dcd1749636c85f614b67efe472..5ba00518e6db035c03c2e3da39ba90fe73c72de7 100644 (file)
@@ -281,11 +281,11 @@ extern struct type *ada_aligned_type (struct type *);
 extern const gdb_byte *ada_aligned_value_addr (struct type *,
                                               const gdb_byte *);
 
-extern int ada_is_fixed_point_type (struct type *);
+extern int ada_is_gnat_encoded_fixed_point_type (struct type *);
 
 extern int ada_is_system_address_type (struct type *);
 
-extern struct value *ada_delta (struct type *);
+extern struct value *gnat_encoded_fixed_point_delta (struct type *);
 
 extern struct value *ada_scaling_factor (struct type *);
 
index 0ae8f9314514662277fa0d4bb6edd3c47124a594..1b976b1fbdb8150398c30caf47e085e57ed45c40 100644 (file)
@@ -342,9 +342,9 @@ print_enum_type (struct type *type, struct ui_file *stream)
 /* Print representation of Ada fixed-point type TYPE on STREAM.  */
 
 static void
-print_fixed_point_type (struct type *type, struct ui_file *stream)
+print_gnat_encoded_fixed_point_type (struct type *type, struct ui_file *stream)
 {
-  struct value *delta = ada_delta (type);
+  struct value *delta = gnat_encoded_fixed_point_delta (type);
   struct value *small = ada_scaling_factor (type);
 
   if (delta == nullptr)
@@ -1012,8 +1012,8 @@ ada_print_type (struct type *type0, const char *varstring,
        fprintf_filtered (stream, "(false, true)");
        break;
       case TYPE_CODE_INT:
-       if (ada_is_fixed_point_type (type))
-         print_fixed_point_type (type, stream);
+       if (ada_is_gnat_encoded_fixed_point_type (type))
+         print_gnat_encoded_fixed_point_type (type, stream);
        else
          {
            const char *name = ada_type_name (type);
@@ -1030,8 +1030,8 @@ ada_print_type (struct type *type0, const char *varstring,
          }
        break;
       case TYPE_CODE_RANGE:
-       if (ada_is_fixed_point_type (type))
-         print_fixed_point_type (type, stream);
+       if (ada_is_gnat_encoded_fixed_point_type (type))
+         print_gnat_encoded_fixed_point_type (type, stream);
        else if (ada_is_modular_type (type))
          fprintf_filtered (stream, "mod %s", 
                            int_string (ada_modulus (type), 10, 0, 0, 1));
index 4ad4b5409fd6134d7ca124e2d1beabd08df69fe2..e11e47ee59eae35626d4fa8a99a1139bbbce2d3d 100644 (file)
@@ -793,7 +793,7 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
   struct type *type = ada_check_typedef (value_type (val));
   const gdb_byte *valaddr = value_contents_for_printing (val);
 
-  if (ada_is_fixed_point_type (type))
+  if (ada_is_gnat_encoded_fixed_point_type (type))
     {
       struct value *scale = ada_scaling_factor (type);
       val = value_cast (value_type (scale), val);