Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: gdb/ada-exp.y

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/ada-exp.c ('k') | gdb/ada-lang.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/ada-exp.y
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 1a80b0b1fe49d6934c60d4b0ded832e3427cfabb..0a0c1e795ddba29b94a3941368a3e95898d131c5 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -1,6 +1,5 @@
/* YACC parser for Ada expressions, for GDB.
- Copyright (C) 1986, 1989-1991, 1993-1994, 1997, 2000, 2003-2004,
- 2007-2012 Free Software Foundation, Inc.
+ Copyright (C) 1986-2013 Free Software Foundation, Inc.
This file is part of GDB.
@@ -37,7 +36,7 @@
%{
#include "defs.h"
-#include "gdb_string.h"
+#include <string.h>
#include <ctype.h>
#include "expression.h"
#include "value.h"
@@ -126,24 +125,22 @@ 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 (struct block *, const char *, int,
+static void write_object_renaming (const struct block *, const char *, int,
const char *, int);
-static struct type* write_var_or_type (struct block *, struct stoken);
+static struct type* write_var_or_type (const struct block *, struct stoken);
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);
-static void write_ambiguous_var (struct block *, char *, int);
+static void write_ambiguous_var (const struct block *, char *, int);
static struct type *type_int (void);
@@ -787,39 +784,11 @@ 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
-write_var_from_sym (struct block *orig_left_context,
- struct block *block,
+write_var_from_sym (const struct block *orig_left_context,
+ const struct block *block,
struct symbol *sym)
{
if (orig_left_context == NULL && symbol_read_needs_frame (sym))
@@ -867,7 +836,7 @@ write_exp_op_with_string (enum exp_opcode opcode, struct stoken token)
* new encoding entirely (FIXME pnh 7/20/2007). */
static void
-write_object_renaming (struct block *orig_left_context,
+write_object_renaming (const struct block *orig_left_context,
const char *renamed_entity, int renamed_entity_len,
const char *renaming_expr, int max_depth)
{
@@ -881,7 +850,7 @@ write_object_renaming (struct block *orig_left_context,
if (orig_left_context == NULL)
orig_left_context = get_selected_block (NULL);
- name = obsavestring (renamed_entity, renamed_entity_len, &temp_parse_space);
+ name = obstack_copy0 (&temp_parse_space, renamed_entity, renamed_entity_len);
ada_lookup_encoded_symbol (name, orig_left_context, VAR_DOMAIN, &sym_info);
if (sym_info.sym == NULL)
error (_("Could not find renamed variable: %s"), ada_decode (name));
@@ -950,8 +919,8 @@ write_object_renaming (struct block *orig_left_context,
end = renaming_expr + strlen (renaming_expr);
index_name =
- obsavestring (renaming_expr, end - renaming_expr,
- &temp_parse_space);
+ obstack_copy0 (&temp_parse_space, renaming_expr,
+ end - renaming_expr);
renaming_expr = end;
ada_lookup_encoded_symbol (index_name, NULL, VAR_DOMAIN,
@@ -983,6 +952,8 @@ write_object_renaming (struct block *orig_left_context,
{
struct stoken field_name;
const char *end;
+ char *buf;
+
renaming_expr += 1;
if (slice_state != SIMPLE_INDEX)
@@ -991,9 +962,10 @@ write_object_renaming (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;
@@ -1011,9 +983,9 @@ write_object_renaming (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;
@@ -1026,7 +998,7 @@ block_lookup (struct block *context, char *raw_name)
else
name = ada_encode (raw_name);
- nsyms = ada_lookup_symbol_list (name, context, VAR_DOMAIN, &syms, 1);
+ nsyms = ada_lookup_symbol_list (name, context, VAR_DOMAIN, &syms);
if (context == NULL
&& (nsyms == 0 || SYMBOL_CLASS (syms[0].sym) != LOC_BLOCK))
symtab = lookup_symtab (name);
@@ -1161,13 +1133,13 @@ write_selectors (char *sels)
a temporary symbol that is valid until the next call to ada_parse.
*/
static void
-write_ambiguous_var (struct block *block, char *name, int len)
+write_ambiguous_var (const struct block *block, char *name, int len)
{
struct symbol *sym =
obstack_alloc (&temp_parse_space, sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN;
- SYMBOL_LINKAGE_NAME (sym) = obsavestring (name, len, &temp_parse_space);
+ SYMBOL_LINKAGE_NAME (sym) = obstack_copy0 (&temp_parse_space, name, len);
SYMBOL_LANGUAGE (sym) = language_ada;
write_exp_elt_opcode (OP_VAR_VALUE);
@@ -1253,7 +1225,7 @@ get_symbol_field_type (struct symbol *sym, char *encoded_field_name)
identifier). */
static struct type*
-write_var_or_type (struct block *block, struct stoken name0)
+write_var_or_type (const struct block *block, struct stoken name0)
{
int depth;
char *encoded_name;
@@ -1264,7 +1236,7 @@ write_var_or_type (struct block *block, struct stoken name0)
encoded_name = ada_encode (name0.ptr);
name_len = strlen (encoded_name);
- encoded_name = obsavestring (encoded_name, name_len, &temp_parse_space);
+ encoded_name = obstack_copy0 (&temp_parse_space, encoded_name, name_len);
for (depth = 0; depth < MAX_RENAMING_CHAIN_LENGTH; depth += 1)
{
int tail_index;
@@ -1283,7 +1255,7 @@ write_var_or_type (struct block *block, struct stoken name0)
encoded_name[tail_index] = '\0';
nsyms = ada_lookup_symbol_list (encoded_name, block,
- VAR_DOMAIN, &syms, 1);
+ VAR_DOMAIN, &syms);
encoded_name[tail_index] = terminator;
/* A single symbol may rename a package or object. */
@@ -1370,9 +1342,9 @@ write_var_or_type (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? */
@@ -1431,7 +1403,7 @@ write_name_assoc (struct stoken name)
{
struct ada_symbol_info *syms;
int nsyms = ada_lookup_symbol_list (name.ptr, expression_context_block,
- VAR_DOMAIN, &syms, 1);
+ VAR_DOMAIN, &syms);
if (nsyms != 1 || SYMBOL_CLASS (syms[0].sym) == LOC_TYPEDEF)
write_exp_op_with_string (OP_NAME, name);
else
@@ -1534,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;
« no previous file with comments | « gdb/ada-exp.c ('k') | gdb/ada-lang.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698