return (*type_addr);
}
+/* Allocate a floating-point type of size BITS. */
+
+static struct type *
+dbx_init_float_type (struct objfile *objfile, int bits)
+{
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
+ const struct floatformat **format;
+ struct type *type;
+
+ format = gdbarch_floatformat_for_type (gdbarch, NULL, bits);
+ if (format)
+ type = init_float_type (objfile, bits, NULL, format);
+ else
+ type = init_type (objfile, TYPE_CODE_ERROR, bits / TARGET_CHAR_BIT, NULL);
+
+ return type;
+}
+
/* for all the stabs in a given stab vector, build appropriate types
and fix their symbols in given symbol vector. */
int deftype;
int synonym = 0;
int i;
- char *new_name = NULL;
/* We would like to eliminate nameless symbols, but keep their types.
E.g. stab entry ":t10=*2" should produce a type 10, which is a pointer
else
{
normal:
+ std::string new_name;
+
if (SYMBOL_LANGUAGE (sym) == language_cplus)
{
char *name = (char *) alloca (p - string + 1);
name[p - string] = '\0';
new_name = cp_canonicalize_string (name);
}
- if (new_name != NULL)
+ if (!new_name.empty ())
{
- SYMBOL_SET_NAMES (sym, new_name, strlen (new_name), 1, objfile);
- xfree (new_name);
+ SYMBOL_SET_NAMES (sym,
+ new_name.c_str (), new_name.length (),
+ 1, objfile);
}
else
SYMBOL_SET_NAMES (sym, string, p - string, 1, objfile);
type_name = NULL;
if (current_subfile->language == language_cplus)
{
- char *new_name, *name = (char *) alloca (p - *pp + 1);
+ char *name = (char *) alloca (p - *pp + 1);
memcpy (name, *pp, p - *pp);
name[p - *pp] = '\0';
- new_name = cp_canonicalize_string (name);
- if (new_name != NULL)
+
+ std::string new_name = cp_canonicalize_string (name);
+ if (!new_name.empty ())
{
type_name
= (char *) obstack_copy0 (&objfile->objfile_obstack,
- new_name, strlen (new_name));
- xfree (new_name);
+ new_name.c_str (),
+ new_name.length ());
}
}
if (type_name == NULL)
break;
case 2:
rettype = init_integer_type (objfile, 8, 0, "char");
+ TYPE_NOSIGN (rettype) = 1;
break;
case 3:
rettype = init_integer_type (objfile, 16, 0, "short");
break;
case 12:
/* IEEE single precision (32 bit). */
- rettype = init_float_type (objfile, 32, "float", NULL);
+ rettype = init_float_type (objfile, 32, "float",
+ floatformats_ieee_single);
break;
case 13:
/* IEEE double precision (64 bit). */
- rettype = init_float_type (objfile, 64, "double", NULL);
+ rettype = init_float_type (objfile, 64, "double",
+ floatformats_ieee_double);
break;
case 14:
/* This is an IEEE double on the RS/6000, and different machines with
different sizes for "long double" should use different negative
type numbers. See stabs.texinfo. */
- rettype = init_float_type (objfile, 64, "long double", NULL);
+ rettype = init_float_type (objfile, 64, "long double",
+ floatformats_ieee_double);
break;
case 15:
rettype = init_integer_type (objfile, 32, 0, "integer");
rettype = init_boolean_type (objfile, 32, 1, "boolean");
break;
case 17:
- rettype = init_float_type (objfile, 32, "short real", NULL);
+ rettype = init_float_type (objfile, 32, "short real",
+ floatformats_ieee_single);
break;
case 18:
- rettype = init_float_type (objfile, 64, "real", NULL);
+ rettype = init_float_type (objfile, 64, "real",
+ floatformats_ieee_double);
break;
case 19:
rettype = init_type (objfile, TYPE_CODE_ERROR, 0, "stringptr");
if (details == NF_COMPLEX || details == NF_COMPLEX16
|| details == NF_COMPLEX32)
{
- rettype = init_float_type (objfile, nbits / 2, NULL, NULL);
+ rettype = dbx_init_float_type (objfile, nbits / 2);
return init_complex_type (objfile, NULL, rettype);
}
- return init_float_type (objfile, nbits, NULL, NULL);
+ return dbx_init_float_type (objfile, nbits);
}
/* Read a number from the string pointed to by *PP.
if (n3 == 0 && n2 > 0)
{
struct type *float_type
- = init_float_type (objfile, n2 * TARGET_CHAR_BIT, NULL, NULL);
+ = dbx_init_float_type (objfile, n2 * TARGET_CHAR_BIT);
if (self_subrange)
return init_complex_type (objfile, NULL, float_type);