* gdbtypes.h (struct language_defn): Add forward declaration.
authorUlrich Weigand <uweigand@de.ibm.com>
Wed, 17 Jun 2009 18:46:26 +0000 (18:46 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Wed, 17 Jun 2009 18:46:26 +0000 (18:46 +0000)
(lookup_typename): Add LANGUAGE and GDBARCH parameters.
(lookup_unsigned_typename): Likewise.
(lookup_signed_typename): Likewise.
* gdbtypes.c (lookup_typename): Add LANGUAGE and GDBARCH parameters.
Use them instead of current_language and current_gdbarch.
(lookup_unsigned_typename): Add LANGUAGE and GDBARCH parameters.
Pass them to lookup_typename.
(lookup_signed_typename): Likewise.

* c-exp.y: Pass parse_language and parse_gdbarch to
lookup_unsigned_typename and lookup_signed_typename.
* objc-exp.y: Likewise.
* m2-exp.y: Pass parse_language and parse_gdbarch to lookup_typename.

* c-lang.c (evaluate_subexp_c): Pass expression language and
gdbarch to lookup_typename.
* printcmd.c (printf_command): Pass current language and
gdbarch to lookup_typename.
* python/python-type.c (typy_lookup_typename): Likewise.
Include "language.h".

gdb/ChangeLog
gdb/c-exp.y
gdb/c-lang.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/m2-exp.y
gdb/objc-exp.y
gdb/printcmd.c
gdb/python/python-type.c

index 230c564c2e779e2a24f78baa3e6c5a69ca16eaa2..2c277d72015148ddf487b10de8c59dfc32b99547 100644 (file)
@@ -1,3 +1,27 @@
+2009-06-17  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * gdbtypes.h (struct language_defn): Add forward declaration.
+       (lookup_typename): Add LANGUAGE and GDBARCH parameters.
+       (lookup_unsigned_typename): Likewise.
+       (lookup_signed_typename): Likewise.
+       * gdbtypes.c (lookup_typename): Add LANGUAGE and GDBARCH parameters.
+       Use them instead of current_language and current_gdbarch.
+       (lookup_unsigned_typename): Add LANGUAGE and GDBARCH parameters.
+       Pass them to lookup_typename.
+       (lookup_signed_typename): Likewise.
+
+       * c-exp.y: Pass parse_language and parse_gdbarch to
+       lookup_unsigned_typename and lookup_signed_typename.
+       * objc-exp.y: Likewise.
+       * m2-exp.y: Pass parse_language and parse_gdbarch to lookup_typename.
+
+       * c-lang.c (evaluate_subexp_c): Pass expression language and
+       gdbarch to lookup_typename.
+       * printcmd.c (printf_command): Pass current language and
+       gdbarch to lookup_typename.
+       * python/python-type.c (typy_lookup_typename): Likewise.
+       Include "language.h".
+
 2009-06-17  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * sparc64-nat.c (sparc64_gregset_supplies_p): Add GDBARCH parameter.
index d8b39752591afbf810c69e34c426f2861a43405c..75851d0c5097d07f89b10b73be7149ced838e954 100644 (file)
@@ -969,11 +969,15 @@ typebase  /* Implements (approximately): (type-qualifier)* type-specifier */
                        { $$ = lookup_enum (copy_name ($2),
                                            expression_context_block); }
        |       UNSIGNED typename
-                       { $$ = lookup_unsigned_typename (TYPE_NAME($2.type)); }
+                       { $$ = lookup_unsigned_typename (parse_language,
+                                                        parse_gdbarch,
+                                                        TYPE_NAME($2.type)); }
        |       UNSIGNED
                        { $$ = parse_type->builtin_unsigned_int; }
        |       SIGNED_KEYWORD typename
-                       { $$ = lookup_signed_typename (TYPE_NAME($2.type)); }
+                       { $$ = lookup_signed_typename (parse_language,
+                                                      parse_gdbarch,
+                                                      TYPE_NAME($2.type)); }
        |       SIGNED_KEYWORD
                        { $$ = parse_type->builtin_int; }
                 /* It appears that this rule for templates is never
index 0d3b50a119b854314893b70df968b47c9a15eb0f..109d4a169b9d746bd53ff971f817ec7a78009095 100644 (file)
@@ -908,13 +908,16 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp,
                                              exp->gdbarch);
            break;
          case C_WIDE_STRING:
-           type = lookup_typename ("wchar_t", NULL, 0);
+           type = lookup_typename (exp->language_defn, exp->gdbarch,
+                                   "wchar_t", NULL, 0);
            break;
          case C_STRING_16:
-           type = lookup_typename ("char16_t", NULL, 0);
+           type = lookup_typename (exp->language_defn, exp->gdbarch,
+                                   "char16_t", NULL, 0);
            break;
          case C_STRING_32:
-           type = lookup_typename ("char32_t", NULL, 0);
+           type = lookup_typename (exp->language_defn, exp->gdbarch,
+                                   "char32_t", NULL, 0);
            break;
          default:
            internal_error (__FILE__, __LINE__, "unhandled c_string_type");
index 63f2e357263db16b48585bf85033445391201dc9..17df58e13f2e30b8734cb4eb5a9d9f7bd3c0fd40 100644 (file)
@@ -1036,7 +1036,9 @@ type_name_no_tag (const struct type *type)
    suitably defined.  */
 
 struct type *
-lookup_typename (char *name, struct block *block, int noerr)
+lookup_typename (const struct language_defn *language,
+                struct gdbarch *gdbarch, char *name,
+                struct block *block, int noerr)
 {
   struct symbol *sym;
   struct type *tmp;
@@ -1044,9 +1046,7 @@ lookup_typename (char *name, struct block *block, int noerr)
   sym = lookup_symbol (name, block, VAR_DOMAIN, 0);
   if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF)
     {
-      tmp = language_lookup_primitive_type_by_name (current_language,
-                                                   current_gdbarch,
-                                                   name);
+      tmp = language_lookup_primitive_type_by_name (language, gdbarch, name);
       if (tmp)
        {
          return tmp;
@@ -1064,28 +1064,30 @@ lookup_typename (char *name, struct block *block, int noerr)
 }
 
 struct type *
-lookup_unsigned_typename (char *name)
+lookup_unsigned_typename (const struct language_defn *language,
+                         struct gdbarch *gdbarch, char *name)
 {
   char *uns = alloca (strlen (name) + 10);
 
   strcpy (uns, "unsigned ");
   strcpy (uns + 9, name);
-  return (lookup_typename (uns, (struct block *) NULL, 0));
+  return lookup_typename (language, gdbarch, uns, (struct block *) NULL, 0);
 }
 
 struct type *
-lookup_signed_typename (char *name)
+lookup_signed_typename (const struct language_defn *language,
+                       struct gdbarch *gdbarch, char *name)
 {
   struct type *t;
   char *uns = alloca (strlen (name) + 8);
 
   strcpy (uns, "signed ");
   strcpy (uns + 7, name);
-  t = lookup_typename (uns, (struct block *) NULL, 1);
+  t = lookup_typename (language, gdbarch, uns, (struct block *) NULL, 1);
   /* If we don't find "signed FOO" just try again with plain "FOO".  */
   if (t != NULL)
     return t;
-  return lookup_typename (name, (struct block *) NULL, 0);
+  return lookup_typename (language, gdbarch, name, (struct block *) NULL, 0);
 }
 
 /* Lookup a structure type named "struct NAME",
index 522d26f77a2b6e60087120732c4b98b8d14247b0..f23aedeef1f69a1cb5cd23c535216b7a22014b54 100644 (file)
@@ -29,6 +29,7 @@
 struct field;
 struct block;
 struct value_print_options;
+struct language_defn;
 
 /* Some macros for char-based bitfields.  */
 
@@ -1180,9 +1181,11 @@ extern struct type *create_string_type (struct type *, struct type *);
 
 extern struct type *create_set_type (struct type *, struct type *);
 
-extern struct type *lookup_unsigned_typename (char *);
+extern struct type *lookup_unsigned_typename (const struct language_defn *,
+                                             struct gdbarch *,char *);
 
-extern struct type *lookup_signed_typename (char *);
+extern struct type *lookup_signed_typename (const struct language_defn *,
+                                           struct gdbarch *,char *);
 
 extern struct type *check_typedef (struct type *);
 
@@ -1195,7 +1198,9 @@ extern void check_stub_method_group (struct type *, int);
 
 extern char *gdb_mangle_name (struct type *, int, int);
 
-extern struct type *lookup_typename (char *, struct block *, int);
+extern struct type *lookup_typename (const struct language_defn *,
+                                    struct gdbarch *, char *,
+                                    struct block *, int);
 
 extern struct type *lookup_template_type (char *, struct type *,
                                          struct block *);
index 0c3c6576e606a109c16a2021f1fc64aed6591b0a..6c387aca30cf74c843df5310267a9acc7a0ef3a1 100644 (file)
@@ -643,7 +643,8 @@ variable:   NAME
 
 type
        :       TYPENAME
-                       { $$ = lookup_typename (copy_name ($1),
+                       { $$ = lookup_typename (parse_language, parse_gdbarch,
+                                               copy_name ($1),
                                                expression_context_block, 0); }
 
        ;
@@ -1026,7 +1027,8 @@ yylex ()
     sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, 0);
     if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
       return BLOCKNAME;
-    if (lookup_typename (copy_name (yylval.sval), expression_context_block, 1))
+    if (lookup_typename (parse_language, parse_gdbarch,
+                        copy_name (yylval.sval), expression_context_block, 1))
       return TYPENAME;
 
     if(sym)
index 746b7457f8d0971fd693d6a6946b76ce9e8e5966..1a31f5edc825995306e4420a050899116148a8da 100644 (file)
@@ -898,11 +898,15 @@ typebase  /* Implements (approximately): (type-qualifier)* type-specifier.  */
                        { $$ = lookup_enum (copy_name ($2),
                                            expression_context_block); }
        |       UNSIGNED typename
-                       { $$ = lookup_unsigned_typename (TYPE_NAME($2.type)); }
+                       { $$ = lookup_unsigned_typename (parse_language,
+                                                        parse_gdbarch,
+                                                        TYPE_NAME($2.type)); }
        |       UNSIGNED
                        { $$ = parse_type->builtin_unsigned_int; }
        |       SIGNED_KEYWORD typename
-                       { $$ = lookup_signed_typename (TYPE_NAME($2.type)); }
+                       { $$ = lookup_signed_typename (parse_language,
+                                                      parse_gdbarch,
+                                                      TYPE_NAME($2.type)); }
        |       SIGNED_KEYWORD
                        { $$ = parse_type->builtin_int; }
        |       TEMPLATE name '<' type '>'
index 9678a7348b15238888cf5df18adf0d4ecac36ef9..c95b156a58d166ebcb2268357174f32300b0fa25 100644 (file)
@@ -2271,7 +2271,9 @@ printf_command (char *arg, int from_tty)
              gdb_byte *str;
              CORE_ADDR tem;
              int j;
-             struct type *wctype = lookup_typename ("wchar_t", NULL, 0);
+             struct type *wctype = lookup_typename (current_language,
+                                                    current_gdbarch,
+                                                    "wchar_t", NULL, 0);
              int wcwidth = TYPE_LENGTH (wctype);
              gdb_byte *buf = alloca (wcwidth);
              struct obstack output;
@@ -2309,7 +2311,9 @@ printf_command (char *arg, int from_tty)
            break;
          case wide_char_arg:
            {
-             struct type *wctype = lookup_typename ("wchar_t", NULL, 0);
+             struct type *wctype = lookup_typename (current_language,
+                                                    current_gdbarch,
+                                                    "wchar_t", NULL, 0);
              struct type *valtype;
              struct obstack output;
              struct cleanup *inner_cleanup;
index 577ebd2204f8c0f2a7fe140719c6841c8ee31d97..0874a99e568c941831b1f8b16c690fa28a401a4b 100644 (file)
@@ -26,6 +26,7 @@
 #include "cp-support.h"
 #include "demangle.h"
 #include "objfiles.h"
+#include "language.h"
 
 typedef struct pyty_type_object
 {
@@ -373,7 +374,8 @@ typy_lookup_typename (char *type_name)
       else if (!strncmp (type_name, "enum ", 5))
        type = lookup_enum (type_name + 5, NULL);
       else
-       type = lookup_typename (type_name, NULL, 0);
+       type = lookup_typename (current_language, current_gdbarch,
+                               type_name, NULL, 0);
     }
   if (except.reason < 0)
     {