This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "gdb_string.h"
memset (TYPE_FIELDS (result_type), 0, 2 * sizeof (struct field));
TYPE_FIELD_BITPOS (result_type, 0) = low_bound;
TYPE_FIELD_BITPOS (result_type, 1) = high_bound;
- TYPE_FIELD_TYPE (result_type, 0) = builtin_type_int; /* FIXME */
- TYPE_FIELD_TYPE (result_type, 1) = builtin_type_int; /* FIXME */
if (low_bound >= 0)
TYPE_FLAGS (result_type) |= TYPE_FLAG_UNSIGNED;
return type;
}
+/* Convert ARRAY_TYPE to a vector type. This may modify ARRAY_TYPE
+ and any array types nested inside it. */
+
+void
+make_vector_type (struct type *array_type)
+{
+ struct type *inner_array, *elt_type;
+ int flags;
+
+ /* Find the innermost array type, in case the array is
+ multi-dimensional. */
+ inner_array = array_type;
+ while (TYPE_CODE (TYPE_TARGET_TYPE (inner_array)) == TYPE_CODE_ARRAY)
+ inner_array = TYPE_TARGET_TYPE (inner_array);
+
+ elt_type = TYPE_TARGET_TYPE (inner_array);
+ if (TYPE_CODE (elt_type) == TYPE_CODE_INT)
+ {
+ flags = TYPE_INSTANCE_FLAGS (elt_type) | TYPE_FLAG_NOTTEXT;
+ elt_type = make_qualified_type (elt_type, flags, NULL);
+ TYPE_TARGET_TYPE (inner_array) = elt_type;
+ }
+
+ TYPE_FLAGS (array_type) |= TYPE_FLAG_VECTOR;
+}
+
struct type *
init_vector_type (struct type *elt_type, int n)
{
array_type = create_array_type (0, elt_type,
create_range_type (0,
- builtin_type_int,
+ builtin_type_int32,
0, n-1));
- TYPE_FLAGS (array_type) |= TYPE_FLAG_VECTOR;
+ make_vector_type (array_type);
return array_type;
}
type = TYPE_TARGET_TYPE (type);
}
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT &&
- TYPE_CODE (type) != TYPE_CODE_UNION)
+ if (TYPE_CODE (type) != TYPE_CODE_STRUCT
+ && TYPE_CODE (type) != TYPE_CODE_UNION)
{
target_terminal_ours ();
gdb_flush (gdb_stdout);
if (base == dclass)
return 1;
- if (TYPE_NAME (base) && TYPE_NAME (dclass) &&
- !strcmp (TYPE_NAME (base), TYPE_NAME (dclass)))
+ if (TYPE_NAME (base) && TYPE_NAME (dclass)
+ && !strcmp (TYPE_NAME (base), TYPE_NAME (dclass)))
return 1;
for (i = 0; i < TYPE_N_BASECLASSES (dclass); i++)
vtable. */
if (TYPE_FIELD_VIRTUAL_BITS (dclass))
for (i = 0; i < TYPE_N_BASECLASSES (dclass); i++)
- if ((!B_TST (TYPE_FIELD_VIRTUAL_BITS (dclass), i)) &&
- (has_vtable (TYPE_FIELD_TYPE (dclass, i))))
+ if ((!B_TST (TYPE_FIELD_VIRTUAL_BITS (dclass), i))
+ && (has_vtable (TYPE_FIELD_TYPE (dclass, i))))
return 1;
/* Well, maybe we don't need a virtual table. */
return NULL;
for (i = 0; i < TYPE_N_BASECLASSES (dclass); i++)
- if (!TYPE_FIELD_VIRTUAL (dclass, i) &&
- has_vtable (TYPE_FIELD_TYPE (dclass, i)))
+ if (!TYPE_FIELD_VIRTUAL (dclass, i)
+ && has_vtable (TYPE_FIELD_TYPE (dclass, i)))
return TYPE_FIELD_TYPE (dclass, i);
return NULL;
This routine merely hands off the argument to virtual_base_list_aux()
and then copies the result into an array to save space. */
-struct type **
+static struct type **
virtual_base_list (struct type *dclass)
{
struct vbase *tmp_vbase;
return i;
}
-
/* Return the index (position) of type BASE, which is a virtual base
class of DCLASS, in the latter's virtual base list. A return of -1
indicates "not found" or a problem. */
int
virtual_base_index (struct type *base, struct type *dclass)
{
- struct type *vbase;
+ struct type *vbase, **vbase_list;
int i;
- if ((TYPE_CODE (dclass) != TYPE_CODE_CLASS) ||
- (TYPE_CODE (base) != TYPE_CODE_CLASS))
+ if ((TYPE_CODE (dclass) != TYPE_CODE_CLASS)
+ || (TYPE_CODE (base) != TYPE_CODE_CLASS))
return -1;
- i = 0;
- vbase = virtual_base_list (dclass)[0];
- while (vbase)
- {
- if (vbase == base)
- break;
- vbase = virtual_base_list (dclass)[++i];
- }
+ vbase_list = virtual_base_list (dclass);
+ for (i = 0, vbase = vbase_list[0];
+ vbase != NULL;
+ vbase = vbase_list[++i])
+ if (vbase == base)
+ break;
+ xfree (vbase_list);
return vbase ? i : -1;
}
-
-
/* Return the index (position) of type BASE, which is a virtual base
class of DCLASS, in the latter's virtual base list. Skip over all
bases that may appear in the virtual base list of the primary base
virtual_base_index_skip_primaries (struct type *base,
struct type *dclass)
{
- struct type *vbase;
+ struct type *vbase, **vbase_list;
int i, j;
struct type *primary;
- if ((TYPE_CODE (dclass) != TYPE_CODE_CLASS) ||
- (TYPE_CODE (base) != TYPE_CODE_CLASS))
+ if ((TYPE_CODE (dclass) != TYPE_CODE_CLASS)
+ || (TYPE_CODE (base) != TYPE_CODE_CLASS))
return -1;
primary = TYPE_RUNTIME_PTR (dclass) ? TYPE_PRIMARY_BASE (dclass) : NULL;
- j = -1;
- i = 0;
- vbase = virtual_base_list (dclass)[0];
- while (vbase)
+ vbase_list = virtual_base_list (dclass);
+ for (i = 0, j = -1, vbase = vbase_list[0];
+ vbase != NULL;
+ vbase = vbase_list[++i])
{
if (!primary
|| (virtual_base_index_skip_primaries (vbase, primary) < 0))
j++;
if (vbase == base)
break;
- vbase = virtual_base_list (dclass)[++i];
}
-
+ xfree (vbase_list);
return vbase ? j : -1;
}
really are the same.
*/
- if (TYPE_NAME (parm) && TYPE_NAME (arg) &&
- !strcmp (TYPE_NAME (parm), TYPE_NAME (arg)))
+ if (TYPE_NAME (parm) && TYPE_NAME (arg)
+ && !strcmp (TYPE_NAME (parm), TYPE_NAME (arg)))
return 0;
/* Check if identical after resolving typedefs. */
init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0,
"true character", (struct objfile *) NULL);
+ builtin_type->builtin_true_unsigned_char =
+ init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED,
+ "true character", (struct objfile *) NULL);
builtin_type->builtin_signed_char =
init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0,
0,
"bool", (struct objfile *) NULL);
+ /* The following three are about decimal floating point types, which
+ are 32-bits, 64-bits and 128-bits respectively. */
+ builtin_type->builtin_decfloat
+ = init_type (TYPE_CODE_DECFLOAT, 32 / 8,
+ 0,
+ "decimal float", (struct objfile *) NULL);
+ builtin_type->builtin_decdouble
+ = init_type (TYPE_CODE_DECFLOAT, 64 / 8,
+ 0,
+ "decimal double", (struct objfile *) NULL);
+ builtin_type->builtin_declong
+ = init_type (TYPE_CODE_DECFLOAT, 128 / 8,
+ 0,
+ "decimal long double", (struct objfile *) NULL);
+
/* Pointer/Address types. */
/* NOTE: on some targets, addresses and pointers are not necessarily
"int0_t", (struct objfile *) NULL);
builtin_type_int8 =
init_type (TYPE_CODE_INT, 8 / 8,
- 0,
+ TYPE_FLAG_NOTTEXT,
"int8_t", (struct objfile *) NULL);
builtin_type_uint8 =
init_type (TYPE_CODE_INT, 8 / 8,
- TYPE_FLAG_UNSIGNED,
+ TYPE_FLAG_UNSIGNED | TYPE_FLAG_NOTTEXT,
"uint8_t", (struct objfile *) NULL);
builtin_type_int16 =
init_type (TYPE_CODE_INT, 16 / 8,