Fix Python3.9 related runtime problems
[deliverable/binutils-gdb.git] / gdb / eval.c
index 7c45df0b3db050cc537404fd3f226600c2be6a42..20533abf93d0f72aa5100e711d06e1b5f8fedf6b 100644 (file)
@@ -295,11 +295,10 @@ evaluate_struct_tuple (struct value *struct_val,
 
       fieldno++;
       /* Skip static fields.  */
-      while (fieldno < TYPE_NFIELDS (struct_type)
-            && field_is_static (&TYPE_FIELD (struct_type,
-                                             fieldno)))
+      while (fieldno < struct_type->num_fields ()
+            && field_is_static (&struct_type->field (fieldno)))
        fieldno++;
-      if (fieldno >= TYPE_NFIELDS (struct_type))
+      if (fieldno >= struct_type->num_fields ())
        error (_("too many initializers"));
       field_type = TYPE_FIELD_TYPE (struct_type, fieldno);
       if (field_type->code () == TYPE_CODE_UNION
@@ -682,9 +681,9 @@ fake_method::fake_method (type_instance_flags flags,
      neither an objfile nor a gdbarch.  As a result we must manually
      allocate memory for auxiliary fields, and free the memory ourselves
      when we are done with it.  */
-  TYPE_NFIELDS (type) = num_types;
-  TYPE_FIELDS (type) = (struct field *)
-    xzalloc (sizeof (struct field) * num_types);
+  type->set_num_fields (num_types);
+  type->set_fields
+    ((struct field *) xzalloc (sizeof (struct field) * num_types));
 
   while (num_types-- > 0)
     TYPE_FIELD_TYPE (type, num_types) = param_types[num_types];
@@ -692,7 +691,7 @@ fake_method::fake_method (type_instance_flags flags,
 
 fake_method::~fake_method ()
 {
-  xfree (TYPE_FIELDS (&m_type));
+  xfree (m_type.fields ());
 }
 
 /* Helper for evaluating an OP_VAR_VALUE.  */
@@ -989,13 +988,13 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,
       function_name = NULL;
       if (type->code () == TYPE_CODE_NAMESPACE)
        {
-         function = cp_lookup_symbol_namespace (TYPE_NAME (type),
+         function = cp_lookup_symbol_namespace (type->name (),
                                                 name,
                                                 get_selected_block (0),
                                                 VAR_DOMAIN).symbol;
          if (function == NULL)
            error (_("No symbol \"%s\" in namespace \"%s\"."),
-                  name, TYPE_NAME (type));
+                  name, type->name ());
 
          tem = 1;
          /* arg2 is left as NULL on purpose.  */
@@ -1058,7 +1057,7 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,
            type = TYPE_TARGET_TYPE (type);
          if (type && type->code () == TYPE_CODE_FUNC)
            {
-             for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++)
+             for (; tem <= nargs && tem <= type->num_fields (); tem++)
                {
                  argvec[tem] = evaluate_subexp (TYPE_FIELD_TYPE (type,
                                                                  tem - 1),
@@ -2327,9 +2326,9 @@ evaluate_subexp_standard (struct type *expect_type,
          if (type->code () != TYPE_CODE_ARRAY
              && type->code () != TYPE_CODE_PTR)
            {
-             if (TYPE_NAME (type))
+             if (type->name ())
                error (_("cannot subscript something of type `%s'"),
-                      TYPE_NAME (type));
+                      type->name ());
              else
                error (_("cannot subscript requested type"));
            }
@@ -2370,7 +2369,7 @@ evaluate_subexp_standard (struct type *expect_type,
              else
                {
                  error (_("cannot subscript something of type `%s'"),
-                        TYPE_NAME (value_type (arg1)));
+                        value_type (arg1)->name ());
                }
            }
 
@@ -2392,9 +2391,9 @@ evaluate_subexp_standard (struct type *expect_type,
                  break;
 
                default:
-                 if (TYPE_NAME (type))
+                 if (type->name ())
                    error (_("cannot subscript something of type `%s'"),
-                          TYPE_NAME (type));
+                          type->name ());
                  else
                    error (_("cannot subscript requested type"));
                }
This page took 0.027989 seconds and 4 git commands to generate.