This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit/Ada] struct block parameter constification in ada-lang.c


Hello,

This patch series constifies a number of struct block * parameters
inside ada-lang.c...

gdb/ChangeLog:

        * ada-lang.c (ada_add_block_symbols, add_defn_to_vec)
        (lookup_cached_symbol, ada_add_local_symbols): Add "const" to
        struct block * parameter.
        (ada_lookup_symbol_list_worker): Constify local variable "block".
        Remove cast which is no longer necessary.

Tested on x86_64-linux. Pushed.

Thank you,
-- 
Joel

---
 gdb/ChangeLog  |  8 ++++++++
 gdb/ada-lang.c | 18 ++++++++----------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 99eb2fb..940c6a2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2014-02-10  Joel Brobecker  <brobecker@adacore.com>
+
+	* ada-lang.c (ada_add_block_symbols, add_defn_to_vec)
+	(lookup_cached_symbol, ada_add_local_symbols): Add "const" to
+	struct block * parameter.
+	(ada_lookup_symbol_list_worker): Constify local variable "block".
+	Remove cast which is no longer necessary.
+
 2014-02-10  Doug Evans  <xdje42@gmail.com>
 
 	Add Guile as an extension language.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index cad480f..269112c 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -109,13 +109,13 @@ static int full_match (const char *, const char *);
 static struct value *make_array_descriptor (struct type *, struct value *);
 
 static void ada_add_block_symbols (struct obstack *,
-                                   struct block *, const char *,
+                                   const struct block *, const char *,
                                    domain_enum, struct objfile *, int);
 
 static int is_nonfunction (struct ada_symbol_info *, int);
 
 static void add_defn_to_vec (struct obstack *, struct symbol *,
-                             struct block *);
+                             const struct block *);
 
 static int num_defns_collected (struct obstack *);
 
@@ -4250,7 +4250,7 @@ make_array_descriptor (struct type *type, struct value *arr)
 
 static int
 lookup_cached_symbol (const char *name, domain_enum namespace,
-                      struct symbol **sym, struct block **block)
+                      struct symbol **sym, const struct block **block)
 {
   return 0;
 }
@@ -4374,7 +4374,7 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1)
 static void
 add_defn_to_vec (struct obstack *obstackp,
                  struct symbol *sym,
-                 struct block *block)
+                 const struct block *block)
 {
   int i;
   struct ada_symbol_info *prevDefns = defns_collected (obstackp, 0);
@@ -4932,7 +4932,7 @@ remove_irrelevant_renamings (struct ada_symbol_info *syms,
 
 static void
 ada_add_local_symbols (struct obstack *obstackp, const char *name,
-                       struct block *block, domain_enum domain,
+                       const struct block *block, domain_enum domain,
                        int wild_match_p)
 {
   int block_depth = 0;
@@ -5163,7 +5163,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
 			       int full_search)
 {
   struct symbol *sym;
-  struct block *block;
+  const struct block *block;
   const char *name;
   const int wild_match_p = should_use_wild_match (name0);
   int cacheIfUnique;
@@ -5177,9 +5177,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
   /* Search specified block and its superiors.  */
 
   name = name0;
-  block = (struct block *) block0;      /* FIXME: No cast ought to be
-                                           needed, but adding const will
-                                           have a cascade effect.  */
+  block = block0;
 
   /* Special case: If the user specifies a symbol name inside package
      Standard, do a non-wild matching of the symbol name without
@@ -5626,7 +5624,7 @@ full_match (const char *sym_name, const char *search_name)
 
 static void
 ada_add_block_symbols (struct obstack *obstackp,
-                       struct block *block, const char *name,
+                       const struct block *block, const char *name,
                        domain_enum domain, struct objfile *objfile,
                        int wild)
 {
-- 
1.8.3.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]