More type safety for symbol_search

Message ID 20230918000013.1821776-1-tom@tromey.com
State New
Headers
Series More type safety for symbol_search |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Tom Tromey Sept. 18, 2023, midnight UTC
  This patch changes class symbol_search to store a block_enum rather
than an int.

Regression tested on x86-64 Fedora 38.
---
 gdb/symtab.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
  

Comments

Simon Marchi Sept. 18, 2023, 12:47 a.m. UTC | #1
On 2023-09-17 20:00, Tom Tromey wrote:
> This patch changes class symbol_search to store a block_enum rather
> than an int.
> 
> Regression tested on x86-64 Fedora 38.

Thanks, seems obviously good.

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon
  

Patch

diff --git a/gdb/symtab.h b/gdb/symtab.h
index 8f587807ff9..365743384e1 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2479,7 +2479,7 @@  extern symbol *find_function_alias_target (bound_minimal_symbol msymbol);
    the following structs is returned.  */
 struct symbol_search
 {
-  symbol_search (int block_, struct symbol *symbol_)
+  symbol_search (block_enum block_, struct symbol *symbol_)
     : block (block_),
       symbol (symbol_)
   {
@@ -2487,7 +2487,7 @@  struct symbol_search
     msymbol.objfile = nullptr;
   }
 
-  symbol_search (int block_, struct minimal_symbol *minsym,
+  symbol_search (block_enum block_, struct minimal_symbol *minsym,
 		 struct objfile *objfile)
     : block (block_),
       symbol (nullptr)
@@ -2506,9 +2506,9 @@  struct symbol_search
     return compare_search_syms (*this, other) == 0;
   }
 
-  /* The block in which the match was found.  Could be, for example,
-     STATIC_BLOCK or GLOBAL_BLOCK.  */
-  int block;
+  /* The block in which the match was found.  Either STATIC_BLOCK or
+     GLOBAL_BLOCK.  */
+  block_enum block;
 
   /* Information describing what was found.