* ada-exp.y (write_object_renaming, write_var_or_type)

(write_ambiguous_var, write_var_from_sym): Make blocks const.
	* ada-lang.c (replace_operator_with_call)
	(find_old_style_renaming_symbol): Make blocks const.
	* ada-lang.h (ada_find_renaming_symbol): Update.
	(struct ada_symbol_info) <block>: Now const.
	* breakpoint.c (watch_command_1): Update.
	* breakpoint.h (struct watchpoint) <exp_valid_block,
	cond_exp_valid_block>: Now const.
	* c-exp.y (classify_inner_name, classify_name): Make block
	argument const.
	* expprint.c (print_subexp_standard) <OP_VAR_VALUE>: Make 'b'
	const.
	* expression.h (innermost_block, parse_exp_1): Update.
	(union exp_element) <block>: Now const.
	* gdbtypes.c (lookup_template_type, lookup_enum, lookup_union)
	(lookup_struct): Make block argument const.
	* gdbtypes.h (lookup_template_type): Update.
	* go-exp.y (classify_name, classify_packaged_name)
	(package_name_p): Make block argument const.
	* objc-lang.c (lookup_struct_typedef): Make block argument const.
	* objc-lang.h (lookup_struct_typedef): Update.
	* parse.c (parse_exp_in_context, parse_exp_1)
	(write_exp_elt_block): Make block arguments const.
	(expression_context_block, innermost_block): Now const.
	* parser-defs.h (write_exp_elt_block): Update.
	(expression_context_block, innermost_block, block_found): Now
	const.
	* printcmd.c (struct display) <block>: Now const.
	* symtab.h (lookup_struct, lookup_union, lookup_enum): Update.
	* valops.c (address_of_variable): Make block argument const.
	* value.h (value_of_variable): Update.
	* varobj.c (struct varobj_root) <valid_block>: Now const.
This commit is contained in:
Tom Tromey 2012-12-03 19:59:14 +00:00
parent e6aea42dfa
commit 270140bd25
22 changed files with 93 additions and 54 deletions

View File

@ -1,3 +1,39 @@
2012-12-03 Tom Tromey <tromey@redhat.com>
* ada-exp.y (write_object_renaming, write_var_or_type)
(write_ambiguous_var, write_var_from_sym): Make blocks const.
* ada-lang.c (replace_operator_with_call)
(find_old_style_renaming_symbol): Make blocks const.
* ada-lang.h (ada_find_renaming_symbol): Update.
(struct ada_symbol_info) <block>: Now const.
* breakpoint.c (watch_command_1): Update.
* breakpoint.h (struct watchpoint) <exp_valid_block,
cond_exp_valid_block>: Now const.
* c-exp.y (classify_inner_name, classify_name): Make block
argument const.
* expprint.c (print_subexp_standard) <OP_VAR_VALUE>: Make 'b'
const.
* expression.h (innermost_block, parse_exp_1): Update.
(union exp_element) <block>: Now const.
* gdbtypes.c (lookup_template_type, lookup_enum, lookup_union)
(lookup_struct): Make block argument const.
* gdbtypes.h (lookup_template_type): Update.
* go-exp.y (classify_name, classify_packaged_name)
(package_name_p): Make block argument const.
* objc-lang.c (lookup_struct_typedef): Make block argument const.
* objc-lang.h (lookup_struct_typedef): Update.
* parse.c (parse_exp_in_context, parse_exp_1)
(write_exp_elt_block): Make block arguments const.
(expression_context_block, innermost_block): Now const.
* parser-defs.h (write_exp_elt_block): Update.
(expression_context_block, innermost_block, block_found): Now
const.
* printcmd.c (struct display) <block>: Now const.
* symtab.h (lookup_struct, lookup_union, lookup_enum): Update.
* valops.c (address_of_variable): Make block argument const.
* value.h (value_of_variable): Update.
* varobj.c (struct varobj_root) <valid_block>: Now const.
2012-11-30 Yao Qi <yao@codesourcery.com>
* breakpoint.c (print_one_breakpoint_location): Indent code.

View File

@ -130,10 +130,10 @@ 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);
@ -143,7 +143,7 @@ static struct block *block_lookup (struct block *, 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);
@ -818,8 +818,8 @@ string_to_operator (struct stoken string)
/* 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 +867,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)
{
@ -1161,7 +1161,7 @@ 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));
@ -1253,7 +1253,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;

View File

@ -128,7 +128,7 @@ static struct value *resolve_subexp (struct expression **, int *, int,
struct type *);
static void replace_operator_with_call (struct expression **, int, int, int,
struct symbol *, struct block *);
struct symbol *, const struct block *);
static int possible_user_operator_p (enum exp_opcode, struct value **);
@ -150,7 +150,7 @@ static enum ada_renaming_category parse_old_style_renaming (struct type *,
const char **);
static struct symbol *find_old_style_renaming_symbol (const char *,
struct block *);
const struct block *);
static struct type *ada_lookup_struct_elt_type (struct type *, char *,
int, int, int *);
@ -3719,7 +3719,7 @@ get_selections (int *choices, int n_choices, int max_results,
static void
replace_operator_with_call (struct expression **expp, int pc, int nargs,
int oplen, struct symbol *sym,
struct block *block)
const struct block *block)
{
/* A new expression, with 6 more elements (3 for funcall, 4 for function
symbol, -oplen for operator being replaced). */
@ -4232,7 +4232,7 @@ lookup_cached_symbol (const char *name, domain_enum namespace,
static void
cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
struct block *block)
const struct block *block)
{
}
@ -4805,7 +4805,7 @@ remove_irrelevant_renamings (struct ada_symbol_info *syms,
for (i = 0; i < nsyms; i += 1)
{
struct symbol *sym = syms[i].sym;
struct block *block = syms[i].block;
const struct block *block = syms[i].block;
const char *name;
const char *suffix;
@ -7195,7 +7195,7 @@ ada_find_any_type (const char *name)
Return symbol if found, and NULL otherwise. */
struct symbol *
ada_find_renaming_symbol (struct symbol *name_sym, struct block *block)
ada_find_renaming_symbol (struct symbol *name_sym, const struct block *block)
{
const char *name = SYMBOL_LINKAGE_NAME (name_sym);
struct symbol *sym;
@ -7217,7 +7217,7 @@ ada_find_renaming_symbol (struct symbol *name_sym, struct block *block)
}
static struct symbol *
find_old_style_renaming_symbol (const char *name, struct block *block)
find_old_style_renaming_symbol (const char *name, const struct block *block)
{
const struct symbol *function_sym = block_linkage_function (block);
char *rename;

View File

@ -90,7 +90,7 @@ struct ada_symbol_info
struct symbol *sym;
/* The block where the symbol was found. */
struct block *block;
const struct block *block;
};
/* Denotes a type of renaming symbol (see ada_parse_renaming). */
@ -342,7 +342,7 @@ extern struct type *ada_find_parallel_type (struct type *,
extern LONGEST get_int_var_value (char *, int *);
extern struct symbol *ada_find_renaming_symbol (struct symbol *name_sym,
struct block *block);
const struct block *block);
extern int ada_prefer_type (struct type *, struct type *);

View File

@ -10750,7 +10750,7 @@ watch_command_1 (char *arg, int accessflag, int from_tty,
volatile struct gdb_exception e;
struct breakpoint *b, *scope_breakpoint = NULL;
struct expression *exp;
struct block *exp_valid_block = NULL, *cond_exp_valid_block = NULL;
const struct block *exp_valid_block = NULL, *cond_exp_valid_block = NULL;
struct value *val, *mark, *result;
struct frame_info *frame;
char *exp_start = NULL;

View File

@ -756,12 +756,12 @@ struct watchpoint
struct expression *exp;
/* The largest block within which it is valid, or NULL if it is
valid anywhere (e.g. consists just of global symbols). */
struct block *exp_valid_block;
const struct block *exp_valid_block;
/* The conditional expression if any. */
struct expression *cond_exp;
/* The largest block within which it is valid, or NULL if it is
valid anywhere (e.g. consists just of global symbols). */
struct block *cond_exp_valid_block;
const struct block *cond_exp_valid_block;
/* Value of the watchpoint the last time we checked it, or NULL when
we do not know the value yet or the value was not readable. VAL
is never lazy. */

View File

@ -2699,7 +2699,7 @@ static struct obstack name_obstack;
in which lookups start; this can be NULL to mean the global
scope. */
static int
classify_name (struct block *block)
classify_name (const struct block *block)
{
struct symbol *sym;
char *copy;
@ -2791,7 +2791,7 @@ classify_name (struct block *block)
in `yylval' is the first component of a name, false otherwise. */
static int
classify_inner_name (struct block *block, int first_name)
classify_inner_name (const struct block *block, int first_name)
{
struct type *type, *new_type;
char *copy;

View File

@ -122,7 +122,7 @@ print_subexp_standard (struct expression *exp, int *pos,
case OP_VAR_VALUE:
{
struct block *b;
const struct block *b;
(*pos) += 3;
b = exp->elts[pc + 1].block;

View File

@ -73,7 +73,7 @@ union exp_element
char string;
struct type *type;
struct internalvar *internalvar;
struct block *block;
const struct block *block;
struct objfile *objfile;
};
@ -100,8 +100,8 @@ extern struct expression *parse_expression (char *);
extern struct type *parse_field_expression (char *, char **);
extern struct expression *parse_exp_1 (char **, CORE_ADDR pc, struct block *,
int);
extern struct expression *parse_exp_1 (char **, CORE_ADDR pc,
const struct block *, int);
/* For use by parsers; set if we want to parse an expression and
attempt to complete a field name. */
@ -110,7 +110,7 @@ extern int in_parse_field;
/* The innermost context required by the stack and register variables
we've encountered so far. To use this, set it to NULL, then call
parse_<whatever>, then look at it. */
extern struct block *innermost_block;
extern const struct block *innermost_block;
/* From eval.c */

View File

@ -1234,7 +1234,7 @@ lookup_signed_typename (const struct language_defn *language,
visible in lexical block BLOCK. */
struct type *
lookup_struct (const char *name, struct block *block)
lookup_struct (const char *name, const struct block *block)
{
struct symbol *sym;
@ -1256,7 +1256,7 @@ lookup_struct (const char *name, struct block *block)
visible in lexical block BLOCK. */
struct type *
lookup_union (const char *name, struct block *block)
lookup_union (const char *name, const struct block *block)
{
struct symbol *sym;
struct type *t;
@ -1280,7 +1280,7 @@ lookup_union (const char *name, struct block *block)
visible in lexical block BLOCK. */
struct type *
lookup_enum (const char *name, struct block *block)
lookup_enum (const char *name, const struct block *block)
{
struct symbol *sym;
@ -1302,7 +1302,7 @@ lookup_enum (const char *name, struct block *block)
struct type *
lookup_template_type (char *name, struct type *type,
struct block *block)
const struct block *block)
{
struct symbol *sym;
char *nam = (char *)

View File

@ -1543,7 +1543,7 @@ extern struct type *lookup_typename (const struct language_defn *,
const struct block *, int);
extern struct type *lookup_template_type (char *, struct type *,
struct block *);
const struct block *);
extern int get_vptr_fieldno (struct type *, struct type **);

View File

@ -1362,7 +1362,7 @@ build_packaged_name (const char *package, int package_len,
to mean the global scope. */
static int
package_name_p (const char *name, struct block *block)
package_name_p (const char *name, const struct block *block)
{
struct symbol *sym;
int is_a_field_of_this;
@ -1402,7 +1402,7 @@ classify_unsafe_function (struct stoken function_name)
The result is one of NAME, NAME_OR_INT, or TYPENAME. */
static int
classify_packaged_name (struct block *block)
classify_packaged_name (const struct block *block)
{
char *copy;
struct symbol *sym;
@ -1430,7 +1430,7 @@ classify_packaged_name (struct block *block)
The result is one of NAME, NAME_OR_INT, or TYPENAME. */
static int
classify_name (struct block *block)
classify_name (const struct block *block)
{
struct type *type;
struct symbol *sym;

View File

@ -82,7 +82,7 @@ static const struct objfile_data *objc_objfile_data;
suitably defined. */
struct symbol *
lookup_struct_typedef (char *name, struct block *block, int noerr)
lookup_struct_typedef (char *name, const struct block *block, int noerr)
{
struct symbol *sym;

View File

@ -46,7 +46,7 @@ extern void start_msglist (void);
extern void add_msglist (struct stoken *str, int addcolon);
extern int end_msglist (void);
struct symbol *lookup_struct_typedef (char *name, struct block *block,
struct symbol *lookup_struct_typedef (char *name, const struct block *block,
int noerr);
#endif

View File

@ -71,9 +71,9 @@ const struct exp_descriptor exp_descriptor_standard =
struct expression *expout;
int expout_size;
int expout_ptr;
struct block *expression_context_block;
const struct block *expression_context_block;
CORE_ADDR expression_context_pc;
struct block *innermost_block;
const struct block *innermost_block;
int arglist_len;
static struct type_stack type_stack;
char *lexptr;
@ -116,7 +116,7 @@ static int prefixify_subexp (struct expression *, struct expression *, int,
int);
static struct expression *parse_exp_in_context (char **, CORE_ADDR,
struct block *, int,
const struct block *, int,
int, int *);
void _initialize_parse (void);
@ -248,7 +248,7 @@ write_exp_elt_sym (struct symbol *expelt)
}
void
write_exp_elt_block (struct block *b)
write_exp_elt_block (const struct block *b)
{
union exp_element tmp;
@ -1097,7 +1097,8 @@ prefixify_subexp (struct expression *inexpr,
If COMMA is nonzero, stop if a comma is reached. */
struct expression *
parse_exp_1 (char **stringptr, CORE_ADDR pc, struct block *block, int comma)
parse_exp_1 (char **stringptr, CORE_ADDR pc, const struct block *block,
int comma)
{
return parse_exp_in_context (stringptr, pc, block, comma, 0, NULL);
}
@ -1110,7 +1111,7 @@ parse_exp_1 (char **stringptr, CORE_ADDR pc, struct block *block, int comma)
is left untouched. */
static struct expression *
parse_exp_in_context (char **stringptr, CORE_ADDR pc, struct block *block,
parse_exp_in_context (char **stringptr, CORE_ADDR pc, const struct block *block,
int comma, int void_context_p, int *out_subexp)
{
volatile struct gdb_exception except;

View File

@ -41,7 +41,7 @@ extern int expout_ptr;
/* If this is nonzero, this block is used as the lexical context
for symbol names. */
extern struct block *expression_context_block;
extern const struct block *expression_context_block;
/* If expression_context_block is non-zero, then this is the PC within
the block that we want to evaluate expressions at. When debugging
@ -51,12 +51,12 @@ extern CORE_ADDR expression_context_pc;
/* The innermost context required by the stack and register variables
we've encountered so far. */
extern struct block *innermost_block;
extern const struct block *innermost_block;
/* The block in which the most recently discovered symbol was found.
FIXME: Should be declared along with lookup_symbol in symtab.h; is not
related specifically to parsing. */
extern struct block *block_found;
extern const struct block *block_found;
/* Number of arguments seen so far in innermost function call. */
extern int arglist_len;
@ -191,7 +191,7 @@ void write_exp_string_vector (int type, struct stoken_vector *vec);
extern void write_exp_bitstring (struct stoken);
extern void write_exp_elt_block (struct block *);
extern void write_exp_elt_block (const struct block *);
extern void write_exp_elt_objfile (struct objfile *objfile);

View File

@ -145,7 +145,7 @@ struct display
struct program_space *pspace;
/* Innermost block required by this expression when evaluated. */
struct block *block;
const struct block *block;
/* Status of this display (enabled or disabled). */
int enabled_p;

View File

@ -62,6 +62,7 @@
#include "macroscope.h"
#include "psymtab.h"
#include "parser-defs.h"
/* Prototypes for local functions */

View File

@ -980,11 +980,11 @@ extern struct symbol *lookup_block_symbol (const struct block *, const char *,
/* lookup a [struct, union, enum] by name, within a specified block. */
extern struct type *lookup_struct (const char *, struct block *);
extern struct type *lookup_struct (const char *, const struct block *);
extern struct type *lookup_union (const char *, struct block *);
extern struct type *lookup_union (const char *, const struct block *);
extern struct type *lookup_enum (const char *, struct block *);
extern struct type *lookup_enum (const char *, const struct block *);
/* from blockframe.c: */

View File

@ -1516,7 +1516,7 @@ value_of_variable (struct symbol *var, const struct block *b)
}
struct value *
address_of_variable (struct symbol *var, struct block *b)
address_of_variable (struct symbol *var, const struct block *b)
{
struct type *type = SYMBOL_TYPE (var);
struct value *val;

View File

@ -557,7 +557,8 @@ extern CORE_ADDR address_from_register (struct type *type, int regnum,
extern struct value *value_of_variable (struct symbol *var,
const struct block *b);
extern struct value *address_of_variable (struct symbol *var, struct block *b);
extern struct value *address_of_variable (struct symbol *var,
const struct block *b);
extern struct value *value_of_register (int regnum, struct frame_info *frame);

View File

@ -84,7 +84,7 @@ struct varobj_root
struct expression *exp;
/* Block for which this expression is valid. */
struct block *valid_block;
const struct block *valid_block;
/* The frame for this expression. This field is set iff valid_block is
not NULL. */