Patchwork Replace int with enum block_enum where appropriate.

login
register
mail settings
Submitter Doug Evans via gdb-patches
Date Aug. 5, 2019, 6:58 p.m.
Message ID <20190805185833.236434-1-cbiesinger@google.com>
Download mbox | patch
Permalink /patch/33968/
State New
Headers show

Comments

Doug Evans via gdb-patches - Aug. 5, 2019, 6:58 p.m.
For better readability and type safety.

gdb/ChangeLog:

2019-08-05  Christian Biesinger  <cbiesinger@google.com>

	* symtab.c (symbol_cache_lookup): Change int to enum block_enum.
	(error_in_psymtab_expansion): Likewise.
	(lookup_symbol_via_quick_fns): Likewise.
	(basic_lookup_transparent_type_quick): Likewise.
	(basic_lookup_transparent_type_1): Likewise.
---
 gdb/symtab.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
Tom Tromey - Aug. 6, 2019, 1:50 p.m.
>>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:

Christian> For better readability and type safety.
Christian> gdb/ChangeLog:

Christian> 2019-08-05  Christian Biesinger  <cbiesinger@google.com>

Christian> 	* symtab.c (symbol_cache_lookup): Change int to enum block_enum.
Christian> 	(error_in_psymtab_expansion): Likewise.
Christian> 	(lookup_symbol_via_quick_fns): Likewise.
Christian> 	(basic_lookup_transparent_type_quick): Likewise.
Christian> 	(basic_lookup_transparent_type_1): Likewise.

Thank you.  This is ok.

Tom
Doug Evans via gdb-patches - Aug. 6, 2019, 4:51 p.m.
On Tue, Aug 6, 2019 at 8:50 AM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:
>
> Christian> For better readability and type safety.
> Christian> gdb/ChangeLog:
>
> Christian> 2019-08-05  Christian Biesinger  <cbiesinger@google.com>
>
> Christian>      * symtab.c (symbol_cache_lookup): Change int to enum block_enum.
> Christian>      (error_in_psymtab_expansion): Likewise.
> Christian>      (lookup_symbol_via_quick_fns): Likewise.
> Christian>      (basic_lookup_transparent_type_quick): Likewise.
> Christian>      (basic_lookup_transparent_type_1): Likewise.
>
> Thank you.  This is ok.

Thanks, pushed.

Patch

diff --git a/gdb/symtab.c b/gdb/symtab.c
index 95008a5bd2..347e58ccf3 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1303,7 +1303,7 @@  set_symbol_cache_size_handler (const char *args, int from_tty,
 
 static struct block_symbol
 symbol_cache_lookup (struct symbol_cache *cache,
-		     struct objfile *objfile_context, int block,
+		     struct objfile *objfile_context, enum block_enum block,
 		     const char *name, domain_enum domain,
 		     struct block_symbol_cache **bsc_ptr,
 		     struct symbol_cache_slot **slot_ptr)
@@ -2338,7 +2338,7 @@  lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
    in a psymtab but not in a symtab.  */
 
 static void ATTRIBUTE_NORETURN
-error_in_psymtab_expansion (int block_index, const char *name,
+error_in_psymtab_expansion (enum block_enum block_index, const char *name,
 			    struct compunit_symtab *cust)
 {
   error (_("\
@@ -2355,8 +2355,9 @@  Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n\
    the "quick" symbol table functions.  */
 
 static struct block_symbol
-lookup_symbol_via_quick_fns (struct objfile *objfile, int block_index,
-			     const char *name, const domain_enum domain)
+lookup_symbol_via_quick_fns (struct objfile *objfile,
+			     enum block_enum block_index, const char *name,
+			     const domain_enum domain)
 {
   struct compunit_symtab *cust;
   const struct blockvector *bv;
@@ -2725,7 +2726,8 @@  lookup_transparent_type (const char *name)
    "quick" symbol table functions.  */
 
 static struct type *
-basic_lookup_transparent_type_quick (struct objfile *objfile, int block_index,
+basic_lookup_transparent_type_quick (struct objfile *objfile,
+				     enum block_enum block_index,
 				     const char *name)
 {
   struct compunit_symtab *cust;
@@ -2755,7 +2757,8 @@  basic_lookup_transparent_type_quick (struct objfile *objfile, int block_index,
    BLOCK_INDEX is either GLOBAL_BLOCK or STATIC_BLOCK.  */
 
 static struct type *
-basic_lookup_transparent_type_1 (struct objfile *objfile, int block_index,
+basic_lookup_transparent_type_1 (struct objfile *objfile,
+				 enum block_enum block_index,
 				 const char *name)
 {
   const struct blockvector *bv;