Fix latent bug with custom word point completers
[deliverable/binutils-gdb.git] / gdb / ada-exp.y
index f1c587a9d74ab1d4910a2e70fa0687dbb14b1b1d..f7ce27aca3526d6e9669d4f816ea7539739f480c 100644 (file)
@@ -717,7 +717,6 @@ primary     :       '*' primary             %prec '.'
 #define yy_switch_to_buffer ada_yy_switch_to_buffer
 #define yyrestart ada_yyrestart
 #define yytext ada_yytext
-#define yywrap ada_yywrap
 
 static struct obstack temp_parse_space;
 
@@ -745,7 +744,7 @@ ada_parse (struct parser_state *par_state)
 static void
 yyerror (const char *msg)
 {
-  error (_("Error in expression, near `%s'."), lexptr);
+  error (_("Error in expression, near `%s'."), pstate->lexptr);
 }
 
 /* Emit expression to access an instance of SYM, in block BLOCK (if
@@ -757,7 +756,7 @@ write_var_from_sym (struct parser_state *par_state,
                    struct symbol *sym)
 {
   if (symbol_read_needs_frame (sym))
-    innermost_block.update (block, INNERMOST_BLOCK_FOR_SYMBOLS);
+    par_state->block_tracker->update (block, INNERMOST_BLOCK_FOR_SYMBOLS);
 
   write_exp_elt_opcode (par_state, OP_VAR_VALUE);
   write_exp_elt_block (par_state, block);
@@ -1203,7 +1202,7 @@ write_var_or_type (struct parser_state *par_state,
   int name_len;
 
   if (block == NULL)
-    block = expression_context_block;
+    block = par_state->expression_context_block;
 
   encoded_name = ada_encode (name0.ptr);
   name_len = strlen (encoded_name);
@@ -1230,19 +1229,6 @@ write_var_or_type (struct parser_state *par_state,
                                          VAR_DOMAIN, &syms);
          encoded_name[tail_index] = terminator;
 
-         /* A single symbol may rename a package or object. */
-
-         /* This should go away when we move entirely to new version.
-            FIXME pnh 7/20/2007. */
-         if (nsyms == 1)
-           {
-             struct symbol *ren_sym =
-               ada_find_renaming_symbol (syms[0].symbol, syms[0].block);
-
-             if (ren_sym != NULL)
-               syms[0].symbol = ren_sym;
-           }
-
          type_sym = select_possible_type_sym (syms);
 
          if (type_sym != NULL)
@@ -1343,7 +1329,7 @@ write_var_or_type (struct parser_state *par_state,
 
       if (!have_full_symbols () && !have_partial_symbols () && block == NULL)
        error (_("No symbol table is loaded.  Use the \"file\" command."));
-      if (block == expression_context_block)
+      if (block == par_state->expression_context_block)
        error (_("No definition of \"%s\" in current context."), name0.ptr);
       else
        error (_("No definition of \"%s\" in specified context."), name0.ptr);
@@ -1376,7 +1362,8 @@ write_name_assoc (struct parser_state *par_state, struct stoken name)
   if (strchr (name.ptr, '.') == NULL)
     {
       std::vector<struct block_symbol> syms;
-      int nsyms = ada_lookup_symbol_list (name.ptr, expression_context_block,
+      int nsyms = ada_lookup_symbol_list (name.ptr,
+                                         par_state->expression_context_block,
                                          VAR_DOMAIN, &syms);
 
       if (nsyms != 1 || SYMBOL_CLASS (syms[0].symbol) == LOC_TYPEDEF)
@@ -1407,9 +1394,17 @@ convert_char_literal (struct type *type, LONGEST val)
     return val;
 
   xsnprintf (name, sizeof (name), "QU%02x", (int) val);
+  size_t len = strlen (name);
   for (f = 0; f < TYPE_NFIELDS (type); f += 1)
     {
-      if (strcmp (name, TYPE_FIELD_NAME (type, f)) == 0)
+      /* Check the suffix because an enum constant in a package will
+        have a name like "pkg__QUxx".  This is safe enough because we
+        already have the correct type, and because mangling means
+        there can't be clashes.  */
+      const char *ename = TYPE_FIELD_NAME (type, f);
+      size_t elen = strlen (ename);
+
+      if (elen >= len && strcmp (name, ename + elen - len) == 0)
        return TYPE_FIELD_ENUMVAL (type, f);
     }
   return val;
This page took 0.028885 seconds and 4 git commands to generate.