2004-07-28 Andrew Cagney <cagney@gnu.org>
authorAndrew Cagney <cagney@redhat.com>
Wed, 28 Jul 2004 14:32:19 +0000 (14:32 +0000)
committerAndrew Cagney <cagney@redhat.com>
Wed, 28 Jul 2004 14:32:19 +0000 (14:32 +0000)
* 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
gdb/c-lang.c
gdb/gdbtypes.c
gdb/gdbtypes.h

index 0247736ac4786aea3e7e0e6a2215d82535fb9724..f5d626d5127b319b8546d2afa29980254c4bc2b1 100644 (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
index a9b3ab0e4ac8c3d82ce1e64639567ee8f0bc1bef..0ced3ba99ad7af860226f02bef710f2e5a8f52b8 100644 (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
 };
 
index c6d481271592d6af2d445e8f90233d219f14d035..0436719b65480c2daaa443aa551fdd70b1ff48c8 100644 (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);
index 3d8fbca073ef4cd915a80b7c3998a034f4eb136a..6a724071c632ecf7f04c1cbff8d20116839716d2 100644 (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;