minor cleanups to update_current_target
[deliverable/binutils-gdb.git] / gdb / ada-exp.y
index d9fa9acd0ce64c3c9d5d559f212134ae936dec69..4273f1dc4d6492ce1918e212f3c9c65e63531d3a 100644 (file)
@@ -1,5 +1,5 @@
 /* YACC parser for Ada expressions, for GDB.
-   Copyright (C) 1986-2013 Free Software Foundation, Inc.
+   Copyright (C) 1986-2014 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -36,7 +36,7 @@
 %{
 
 #include "defs.h"
-#include "gdb_string.h"
+#include <string.h>
 #include <ctype.h>
 #include "expression.h"
 #include "value.h"
@@ -125,8 +125,6 @@ static int yylex (void);
 
 void yyerror (char *);
 
-static struct stoken string_to_operator (struct stoken);
-
 static void write_int (LONGEST, struct type *);
 
 static void write_object_renaming (const struct block *, const char *, int,
@@ -138,7 +136,7 @@ static void write_name_assoc (struct stoken);
 
 static void write_exp_op_with_string (enum exp_opcode, struct stoken);
 
-static struct block *block_lookup (struct block *, char *);
+static struct block *block_lookup (struct block *, const char *);
 
 static LONGEST convert_char_literal (struct type *, LONGEST);
 
@@ -786,34 +784,6 @@ yyerror (char *msg)
   error (_("Error in expression, near `%s'."), lexptr);
 }
 
-/* The operator name corresponding to operator symbol STRING (adds
-   quotes and maps to lower-case).  Destroys the previous contents of
-   the array pointed to by STRING.ptr.  Error if STRING does not match
-   a valid Ada operator.  Assumes that STRING.ptr points to a
-   null-terminated string and that, if STRING is a valid operator
-   symbol, the array pointed to by STRING.ptr contains at least
-   STRING.length+3 characters.  */
-
-static struct stoken
-string_to_operator (struct stoken string)
-{
-  int i;
-
-  for (i = 0; ada_opname_table[i].encoded != NULL; i += 1)
-    {
-      if (string.length == strlen (ada_opname_table[i].decoded)-2
-         && strncasecmp (string.ptr, ada_opname_table[i].decoded+1,
-                         string.length) == 0)
-       {
-         strncpy (string.ptr, ada_opname_table[i].decoded,
-                  string.length+2);
-         string.length += 2;
-         return string;
-       }
-    }
-  error (_("Invalid operator symbol `%s'"), string.ptr);
-}
-
 /* Emit expression to access an instance of SYM, in block BLOCK (if
  * non-NULL), and with :: qualification ORIG_LEFT_CONTEXT.  */
 static void
@@ -982,6 +952,8 @@ write_object_renaming (const struct block *orig_left_context,
        {
          struct stoken field_name;
          const char *end;
+         char *buf;
+
          renaming_expr += 1;
 
          if (slice_state != SIMPLE_INDEX)
@@ -990,9 +962,10 @@ write_object_renaming (const struct block *orig_left_context,
          if (end == NULL)
            end = renaming_expr + strlen (renaming_expr);
          field_name.length = end - renaming_expr;
-         field_name.ptr = malloc (end - renaming_expr + 1);
-         strncpy (field_name.ptr, renaming_expr, end - renaming_expr);
-         field_name.ptr[end - renaming_expr] = '\000';
+         buf = malloc (end - renaming_expr + 1);
+         field_name.ptr = buf;
+         strncpy (buf, renaming_expr, end - renaming_expr);
+         buf[end - renaming_expr] = '\000';
          renaming_expr = end;
          write_exp_op_with_string (STRUCTOP_STRUCT, field_name);
          break;
@@ -1010,9 +983,9 @@ write_object_renaming (const struct block *orig_left_context,
 }
 
 static struct block*
-block_lookup (struct block *context, char *raw_name)
+block_lookup (struct block *context, const char *raw_name)
 {
-  char *name;
+  const char *name;
   struct ada_symbol_info *syms;
   int nsyms;
   struct symtab *symtab;
@@ -1369,9 +1342,9 @@ write_var_or_type (const struct block *block, struct stoken name0)
            }
          else if (nsyms == 0) 
            {
-             struct minimal_symbol *msym 
+             struct bound_minimal_symbol msym
                = ada_lookup_simple_minsym (encoded_name);
-             if (msym != NULL)
+             if (msym.minsym != NULL)
                {
                  write_exp_msymbol (msym);
                  /* Maybe cause error here rather than later? FIXME? */
@@ -1533,12 +1506,3 @@ _initialize_ada_exp (void)
 {
   obstack_init (&temp_parse_space);
 }
-
-/* FIXME: hilfingr/2004-10-05: Hack to remove warning.  The function
-   string_to_operator is supposed to be used for cases where one
-   calls an operator function with prefix notation, as in 
-   "+" (a, b), but at some point, this code seems to have gone
-   missing. */
-
-struct stoken (*dummy_string_to_ada_operator) (struct stoken) 
-     = string_to_operator;
This page took 0.024743 seconds and 4 git commands to generate.