From 685419e2aef59a0cdc15b47fcab1fa462d2c6392 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Wed, 28 Jul 2004 14:32:19 +0000 Subject: [PATCH] 2004-07-28 Andrew Cagney * 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. --- gdb/ChangeLog | 10 +++++++++ gdb/c-lang.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++--- gdb/gdbtypes.c | 2 +- gdb/gdbtypes.h | 2 +- 4 files changed, 64 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0247736ac47..f5d626d5127 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2004-07-28 Andrew Cagney + + * 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 * language.h (struct language_arch_info): Fix typo diff --git a/gdb/c-lang.c b/gdb/c-lang.c index a9b3ab0e4ac..0ced3ba99ad 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -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 }; diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index c6d48127159..0436719b654 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -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); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 3d8fbca073e..6a724071c63 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -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; -- 2.30.2