2004-07-28 Andrew Cagney <cagney@gnu.org>

* gdbtypes.h (struct builtin_type): Rename true_char to
	builtin_true_char.
	* gdbtypes.c (gdbtypes_post_init): Update.
	* c-lang.c (arch_info): New function.
	(enum c_primitive_types): New enum.
	(c_language_defn): Instead of string_char_type and
	primitive_type_vector set la_language_arch_info.
This commit is contained in:
Andrew Cagney 2004-07-28 14:32:19 +00:00
parent ccde110023
commit 685419e2ae
4 changed files with 64 additions and 5 deletions

View file

@ -1,3 +1,13 @@
2004-07-28 Andrew Cagney <cagney@gnu.org>
* gdbtypes.h (struct builtin_type): Rename true_char to
builtin_true_char.
* gdbtypes.c (gdbtypes_post_init): Update.
* c-lang.c (arch_info): New function.
(enum c_primitive_types): New enum.
(c_language_defn): Instead of string_char_type and
primitive_type_vector set la_language_arch_info.
2004-07-28 Andrew Cagney <cagney@gnu.org>
* language.h (struct language_arch_info): Fix typo

View file

@ -535,11 +535,60 @@ struct type **const (c_builtin_types[]) =
0
};
enum c_primitive_types {
c_primitive_type_int,
c_primitive_type_long,
c_primitive_type_short,
c_primitive_type_char,
c_primitive_type_float,
c_primitive_type_double,
c_primitive_type_void,
c_primitive_type_long_long,
c_primitive_type_signed_char,
c_primitive_type_unsigned_char,
c_primitive_type_unsigned_short,
c_primitive_type_unsigned_int,
c_primitive_type_unsigned_long,
c_primitive_type_unsigned_long_long,
c_primitive_type_long_double,
c_primitive_type_complex,
c_primitive_type_double_complex,
nr_c_primitive_types
};
static void
c_language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai)
{
const struct builtin_type *builtin = builtin_type (gdbarch);
lai->string_char_type = builtin->builtin_true_char;
lai->primitive_type_vector
= GDBARCH_OBSTACK_CALLOC (gdbarch, nr_c_primitive_types + 1,
struct type *);
lai->primitive_type_vector [c_primitive_type_int] = builtin->builtin_int;
lai->primitive_type_vector [c_primitive_type_long] = builtin->builtin_long;
lai->primitive_type_vector [c_primitive_type_short] = builtin->builtin_short;
lai->primitive_type_vector [c_primitive_type_char] = builtin->builtin_char;
lai->primitive_type_vector [c_primitive_type_float] = builtin->builtin_float;
lai->primitive_type_vector [c_primitive_type_double] = builtin->builtin_double;
lai->primitive_type_vector [c_primitive_type_void] = builtin->builtin_void;
lai->primitive_type_vector [c_primitive_type_long_long] = builtin->builtin_long_long;
lai->primitive_type_vector [c_primitive_type_signed_char] = builtin->builtin_signed_char;
lai->primitive_type_vector [c_primitive_type_unsigned_char] = builtin->builtin_unsigned_char;
lai->primitive_type_vector [c_primitive_type_unsigned_short] = builtin->builtin_unsigned_short;
lai->primitive_type_vector [c_primitive_type_unsigned_int] = builtin->builtin_unsigned_int;
lai->primitive_type_vector [c_primitive_type_unsigned_long] = builtin->builtin_unsigned_long;
lai->primitive_type_vector [c_primitive_type_unsigned_long_long] = builtin->builtin_unsigned_long_long;
lai->primitive_type_vector [c_primitive_type_long_double] = builtin->builtin_long_double;
lai->primitive_type_vector [c_primitive_type_complex] = builtin->builtin_complex;
lai->primitive_type_vector [c_primitive_type_double_complex] = builtin->builtin_double_complex;
};
const struct language_defn c_language_defn =
{
"c", /* Language name */
language_c,
c_builtin_types,
NULL,
range_check_off,
type_check_off,
case_sensitive_on,
@ -567,9 +616,9 @@ const struct language_defn c_language_defn =
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
&builtin_type_char, /* Type of string elements */
NULL,
default_word_break_characters,
NULL, /* FIXME: la_language_arch_info. */
c_language_arch_info,
LANG_MAGIC
};

View file

@ -3380,7 +3380,7 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
(TYPE_FLAG_NOSIGN
| (TARGET_CHAR_SIGNED ? 0 : TYPE_FLAG_UNSIGNED)),
"char", (struct objfile *) NULL);
builtin_type->true_char =
builtin_type->builtin_true_char =
init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0,
"true character", (struct objfile *) NULL);

View file

@ -968,7 +968,7 @@ struct builtin_type
/* We use this for the '/c' print format, because c_char is just a
one-byte integral type, which languages less laid back than C
will print as ... well, a one-byte integral type. */
struct type *true_char;
struct type *builtin_true_char;
/* Implicit size/sign (based on the the architecture's ABI). */
struct type *builtin_void;