* alpha-tdep.c, c-exp.y, h8500-tdep.c, f-exp.y, f-valprint.c,
authorPer Bothner <per@bothner.com>
Thu, 30 Nov 1995 01:43:37 +0000 (01:43 +0000)
committerPer Bothner <per@bothner.com>
Thu, 30 Nov 1995 01:43:37 +0000 (01:43 +0000)
findvar.c, hppa-tdep.c, infcmd.c, language.c, printcmd.c,
  rs6000-tdep.c, symmisc.c, symtab.c:
Add check_typedef/CHECK_TYPEDEF as needed.

gdb/ChangeLog
gdb/alpha-tdep.c
gdb/c-exp.y
gdb/f-exp.y
gdb/f-valprint.c
gdb/h8500-tdep.c
gdb/hppa-tdep.c
gdb/language.c
gdb/rs6000-tdep.c
gdb/symtab.c

index b064c1c3c5047daa8163ca54a89107f3eb2ac90b..7c7b9948cd231c42c6ff6b105df0b137b2aaee83 100644 (file)
@@ -23,6 +23,11 @@ Wed Nov 29 13:35:18 1995  Per Bothner  <bothner@kalessin.cygnus.com>
        * gdbtypes.c, ch-lang.c, ch-typeprint.c (numerous places):
        Add check_typedef/CHECK_TYPEDEF as needed.
 
+       * alpha-tdep.c, c-exp.y, h8500-tdep.c, f-exp.y, f-valprint.c,
+       findvar.c, hppa-tdep.c, infcmd.c, language.c, printcmd.c,
+       rs6000-tdep.c, symmisc.c, symtab.c:
+       Add check_typedef/CHECK_TYPEDEF as needed.
+       
        * top.c (command_line_input):  Only strip out an initial #-comment.
        Looking for internal comments is language-specific (breaks Scheme).
        
index ce1c8ed26d07fad229c47b852485e6d7fdb1e423..622ee44de4c5b5243e04ae56ef1d8b609f2293be 100644 (file)
@@ -729,21 +729,25 @@ alpha_push_arguments (nargs, args, sp, struct_return, struct_addr)
   for (i = 0, m_arg = alpha_args; i < nargs; i++, m_arg++)
     {
       value_ptr arg = args[i];
+      struct type *arg_type = check_typedef (VALUE_TYPE (arg));
       /* Cast argument to long if necessary as the compiler does it too.  */
-      switch (TYPE_CODE (VALUE_TYPE (arg)))
+      switch (TYPE_CODE (arg_type))
        {
        case TYPE_CODE_INT:
        case TYPE_CODE_BOOL:
        case TYPE_CODE_CHAR:
        case TYPE_CODE_RANGE:
        case TYPE_CODE_ENUM:
-         if (TYPE_LENGTH (VALUE_TYPE (arg)) < TYPE_LENGTH (builtin_type_long))
-           arg = value_cast (builtin_type_long, arg);
+         if (TYPE_LENGTH (arg_type) < TYPE_LENGTH (builtin_type_long))
+           {
+             arg_type = builtin_type_long;
+             arg = value_cast (arg_type, arg);
+           }
          break;
        default:
          break;
        }
-      m_arg->len = TYPE_LENGTH (VALUE_TYPE (arg));
+      m_arg->len = TYPE_LENGTH (arg_type);
       m_arg->offset = accumulate_size;
       accumulate_size = (accumulate_size + m_arg->len + 7) & ~7;
       m_arg->contents = VALUE_CONTENTS(arg);
index 21096e01fc73fa2264cee1cfb7a15b87d7d8e2a7..f6bd88fe530ca5a4f80a9d9f1439152e45243af1 100644 (file)
@@ -497,6 +497,7 @@ exp :       VARIABLE
 exp    :       SIZEOF '(' type ')'     %prec UNARY
                        { write_exp_elt_opcode (OP_LONG);
                          write_exp_elt_type (builtin_type_int);
+                         CHECK_TYPEDEF ($3);
                          write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
                          write_exp_elt_opcode (OP_LONG); }
        ;
index ee97015ef6b9696f9fe4f3c35b1f1821fdf1de99..6b6aa989b28a7b19692f5553b5f4a6fc16302003 100644 (file)
@@ -418,6 +418,7 @@ exp :       VARIABLE
 exp    :       SIZEOF '(' type ')'     %prec UNARY
                        { write_exp_elt_opcode (OP_LONG);
                          write_exp_elt_type (builtin_type_f_integer);
+                         CHECK_TYPEDEF ($3);
                          write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
                          write_exp_elt_opcode (OP_LONG); }
        ;
index 2b2d47b2b4dfae7ff7e5068362464430052a4b56..1143b9d406bddc266ee827c09fed269f63e6b0d0 100644 (file)
@@ -211,7 +211,7 @@ f77_get_dynamic_length_of_aggregate (type)
   /* Patch in a valid length value. */ 
   
   TYPE_LENGTH (type) =
-    (upper_bound - lower_bound + 1) * TYPE_LENGTH (TYPE_TARGET_TYPE (type));
+    (upper_bound - lower_bound + 1) * TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type)));
 }       
 
 /* Function that sets up the array offset,size table for the array 
@@ -376,6 +376,7 @@ f_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
   LONGEST val;
   CORE_ADDR addr;
   
+  CHECK_TYPEDEF (type);
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_STRING: 
@@ -403,7 +404,7 @@ f_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
       else
        {
          addr = unpack_pointer (type, valaddr);
-         elttype = TYPE_TARGET_TYPE (type);
+         elttype = check_typedef (TYPE_TARGET_TYPE (type));
          
          if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
            {
index 0eb34eea35358e498de97e312487f796119a509a..38a4859d0d3de363eb0996996a0842ceb2541599 100644 (file)
@@ -572,14 +572,14 @@ h8500_set_trapped_internalvar (var, newval, bitpos, bitsize, offset)
   struct type *type;
   enum type_code newval_type_code;
 
-  type = VALUE_TYPE (newval);
+  type = check_typedef (VALUE_TYPE (newval));
   newval_type_code = TYPE_CODE (type);
 
   if ((newval_type_code != TYPE_CODE_INT
        && newval_type_code != TYPE_CODE_PTR)
       || TYPE_LENGTH (type) != sizeof (new_regval))
     error ("Illegal type (%s) for assignment to $%s\n",
-          TYPE_NAME (type), var->name);
+          TYPE_NAME (VALUE_TYPE (newval)), var->name);
 
   new_regval = *(long *) VALUE_CONTENTS_RAW (newval);
 
index 62531a34f11189d8a317a6aa6b5314203189b7be..27f4eb42bd5c03f6778bec3ef51344890388ca22 100644 (file)
@@ -1729,27 +1729,28 @@ target_write_pc (v, pid)
    alignment required by their fields. */
 
 static int
-hppa_alignof (arg)
-     struct type *arg;
+hppa_alignof (type)
+     struct type *type;
 {
   int max_align, align, i;
-  switch (TYPE_CODE (arg))
+  CHECK_TYPEDEf (type);
+  switch (TYPE_CODE (type))
     {
     case TYPE_CODE_PTR:
     case TYPE_CODE_INT:
     case TYPE_CODE_FLT:
-      return TYPE_LENGTH (arg);
+      return TYPE_LENGTH (type);
     case TYPE_CODE_ARRAY:
-      return hppa_alignof (TYPE_FIELD_TYPE (arg, 0));
+      return hppa_alignof (TYPE_FIELD_TYPE (type, 0));
     case TYPE_CODE_STRUCT:
     case TYPE_CODE_UNION:
       max_align = 2;
-      for (i = 0; i < TYPE_NFIELDS (arg); i++)
+      for (i = 0; i < TYPE_NFIELDS (type); i++)
        {
          /* Bit fields have no real alignment. */
-         if (!TYPE_FIELD_BITPOS (arg, i))
+         if (!TYPE_FIELD_BITPOS (type, i))
            {
-             align = hppa_alignof (TYPE_FIELD_TYPE (arg, i));
+             align = hppa_alignof (TYPE_FIELD_TYPE (type, i));
              max_align = max (max_align, align);
            }
        }
index 6dd066ef6cfe46c95d456541b23a48362eb33e40..2504f8630903966f1657b8d7490dee6dbe12e596 100644 (file)
@@ -436,24 +436,26 @@ struct type *
 binop_result_type (v1, v2)
    value_ptr v1, v2;
 {
-   int l1,l2,size,uns;
+   int size,uns;
+   struct type *t1 = check_typedef (VALUE_TYPE (v1));
+   struct type *t2 = check_typedef (VALUE_TYPE (v2));
 
-   l1 = TYPE_LENGTH(VALUE_TYPE(v1));
-   l2 = TYPE_LENGTH(VALUE_TYPE(v2));
+   int l1 = TYPE_LENGTH (t1);
+   int l2 = TYPE_LENGTH (t2);
 
    switch(current_language->la_language)
    {
    case language_c:
    case language_cplus:
-      if (TYPE_CODE(VALUE_TYPE(v1))==TYPE_CODE_FLT)
-        return TYPE_CODE(VALUE_TYPE(v2)) == TYPE_CODE_FLT && l2 > l1 ?
+      if (TYPE_CODE (t1)==TYPE_CODE_FLT)
+        return TYPE_CODE(t2) == TYPE_CODE_FLT && l2 > l1 ?
            VALUE_TYPE(v2) : VALUE_TYPE(v1);
-      else if (TYPE_CODE(VALUE_TYPE(v2))==TYPE_CODE_FLT)
-        return TYPE_CODE(VALUE_TYPE(v1)) == TYPE_CODE_FLT && l1 > l2 ?
+      else if (TYPE_CODE(t2)==TYPE_CODE_FLT)
+        return TYPE_CODE(t1)) == TYPE_CODE_FLT && l1 > l2 ?
            VALUE_TYPE(v1) : VALUE_TYPE(v2);
-      else if (TYPE_UNSIGNED(VALUE_TYPE(v1)) && l1 > l2)
+      else if (TYPE_UNSIGNED(t1) && l1 > l2)
         return VALUE_TYPE(v1);
-      else if (TYPE_UNSIGNED(VALUE_TYPE(v2)) && l2 > l1)
+      else if (TYPE_UNSIGNED(t2) && l2 > l1)
         return VALUE_TYPE(v2);
       else  /* Both are signed.  Result is the longer type */
         return l1 > l2 ? VALUE_TYPE(v1) : VALUE_TYPE(v2);
@@ -548,6 +550,7 @@ local_decimal_format_custom(pre)
    return form;
 }
 \f
+#if 0
 /* This page contains functions that are used in type/range checking.
    They all return zero if the type/range check fails.
 
@@ -569,6 +572,7 @@ int
 simple_type(type)
     struct type *type;
 {
+  CHECK_TYPEDEF (type);
   switch (TYPE_CODE (type)) {
   case TYPE_CODE_INT:
   case TYPE_CODE_CHAR:
@@ -591,6 +595,7 @@ int
 ordered_type (type)
    struct type *type;
 {
+  CHECK_TYPEDEF (type);
   switch (TYPE_CODE (type)) {
   case TYPE_CODE_INT:
   case TYPE_CODE_CHAR:
@@ -609,6 +614,7 @@ int
 same_type (arg1, arg2)
    struct type *arg1, *arg2;
 {
+  CHECK_TYPEDEF (type);
    if (structured_type(arg1) ? !structured_type(arg2) : structured_type(arg2))
       /* One is structured and one isn't */
       return 0;
@@ -627,6 +633,7 @@ int
 integral_type (type)
    struct type *type;
 {
+  CHECK_TYPEDEF (type);
    switch(current_language->la_language)
    {
    case language_c:
@@ -647,6 +654,7 @@ int
 numeric_type (type)
    struct type *type;
 {
+  CHECK_TYPEDEF (type);
   switch (TYPE_CODE (type)) {
   case TYPE_CODE_INT:
   case TYPE_CODE_FLT:
@@ -662,7 +670,8 @@ int
 character_type (type)
    struct type *type;
 {
-   switch(current_language->la_language)
+  CHECK_TYPEDEF (type);
+  switch(current_language->la_language)
    {
    case language_chill:
    case language_m2:
@@ -683,7 +692,8 @@ int
 string_type (type)
    struct type *type;
 {
-   switch(current_language->la_language)
+  CHECK_TYPEDEF (type);
+  switch(current_language->la_language)
    {
    case language_chill:
    case language_m2:
@@ -703,6 +713,7 @@ int
 boolean_type (type)
    struct type *type;
 {
+  CHECK_TYPEDEF (type);
   if (TYPE_CODE (type) == TYPE_CODE_BOOL)
     return 1;
   switch(current_language->la_language)
@@ -724,7 +735,8 @@ int
 float_type (type)
    struct type *type;
 {
-   return TYPE_CODE(type) == TYPE_CODE_FLT;
+  CHECK_TYPEDEF (type);
+  return TYPE_CODE(type) == TYPE_CODE_FLT;
 }
 
 /* Returns non-zero if the value is a pointer type */
@@ -741,6 +753,7 @@ int
 structured_type(type)
    struct type *type;
 {
+  CHECK_TYPEDEF (type);
    switch(current_language->la_language)
    {
    case language_c:
@@ -758,6 +771,7 @@ structured_type(type)
       return (0);
    }
 }
+#endif
 \f
 /* This page contains functions that return info about
    (struct value) values used in GDB. */
index 30702c62cee1c7493aad0f2105b607bef44c69c0..dfbe488aa96460f7f53af70aa5ed375d559d3003 100644 (file)
@@ -694,8 +694,9 @@ push_arguments (nargs, args, sp, struct_return, struct_addr)
   int argno;                                   /* current argument number */
   int argbytes;                                        /* current argument byte */
   char tmp_buffer [50];
-  value_ptr arg;
   int f_argno = 0;                             /* current floating point argno */
+  value_ptr arg;
+  struct type *type;
 
   CORE_ADDR saved_sp, pc;
 
@@ -715,9 +716,10 @@ push_arguments (nargs, args, sp, struct_return, struct_addr)
   for (argno=0, argbytes=0; argno < nargs && ii<8; ++ii) {
 
     arg = args[argno];
-    len = TYPE_LENGTH (VALUE_TYPE (arg));
+    type = check_typedef (VALUE_TYPE (arg);
+    len = TYPE_LENGTH (type);
 
-    if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FLT) {
+    if (TYPE_CODE (type) == TYPE_CODE_FLT) {
 
       /* floating point arguments are passed in fpr's, as well as gpr's.
          There are 13 fpr's reserved for passing parameters. At this point
@@ -769,7 +771,6 @@ ran_out_of_registers_for_arguments:
 
   if ((argno < nargs) || argbytes) {
     int space = 0, jj;
-    value_ptr val;
 
     if (argbytes) {
       space += ((len - argbytes + 3) & -4);
@@ -779,7 +780,7 @@ ran_out_of_registers_for_arguments:
       jj = argno;
 
     for (; jj < nargs; ++jj) {
-      val = args[jj];
+      value_ptr val = args[jj];
       space += ((TYPE_LENGTH (VALUE_TYPE (val))) + 3) & -4;
     }
 
@@ -808,11 +809,12 @@ ran_out_of_registers_for_arguments:
     for (; argno < nargs; ++argno) {
 
       arg = args[argno];
-      len = TYPE_LENGTH (VALUE_TYPE (arg));
+      type = check_typedef (VALUE_TYPE (arg));
+      len = TYPE_LENGTH (type);
 
 
       /* float types should be passed in fpr's, as well as in the stack. */
-      if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FLT && f_argno < 13) {
+      if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13) {
 
         if (len > 8)
           printf_unfiltered (
index ea2d60f7ef9b441eb38d51b39473490b1fb15e03..2b4037d9d26047da1d3946e24ed3715b8b5e6a13 100644 (file)
@@ -1636,7 +1636,7 @@ total_number_of_methods (type)
   int n;
   int count;
 
-  check_stub_type (type);
+  CHECK_TYPEDEF (type);
   count = TYPE_NFN_FIELDS_TOTAL (type);
 
   for (n = 0; n < TYPE_N_BASECLASSES (type); n++)
@@ -1673,7 +1673,7 @@ find_methods (t, name, sym_arr)
                                     (struct symtab **)NULL)))
     {
       int method_counter;
-      /* FIXME: Shouldn't this just be check_stub_type (t)?  */
+      /* FIXME: Shouldn't this just be CHECK_TYPEDEF (t)?  */
       t = SYMBOL_TYPE (sym_class);
       for (method_counter = TYPE_NFN_FIELDS (t) - 1;
           method_counter >= 0;
@@ -1960,8 +1960,9 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
                                     (struct symtab **)NULL);
        
          if (sym_class &&
-             (   TYPE_CODE (SYMBOL_TYPE (sym_class)) == TYPE_CODE_STRUCT
-              || TYPE_CODE (SYMBOL_TYPE (sym_class)) == TYPE_CODE_UNION))
+             (t = check_typedef (SYMBOL_TYPE (sym_class)),
+              (TYPE_CODE (t) == TYPE_CODE_STRUCT
+               || TYPE_CODE (t) == TYPE_CODE_UNION)))
            {
              /* Arg token is not digits => try it as a function name
                 Find the next token(everything up to end or next blank). */
@@ -2015,7 +2016,6 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
 
              sym = 0;
              i1 = 0;           /*  counter for the symbol array */
-             t = SYMBOL_TYPE (sym_class);
              sym_arr = (struct symbol **) alloca(total_number_of_methods (t)
                                                  * sizeof(struct symbol *));
 
This page took 0.043042 seconds and 4 git commands to generate.