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"
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)
{
create_range_type (0,
builtin_type_int,
0, n-1));
- TYPE_FLAGS (array_type) |= TYPE_FLAG_VECTOR;
+ make_vector_type (array_type);
return array_type;
}
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))
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;
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;
}
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,
"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,