From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH 1/2] Use bool in ada_add_all_symbols
Date: Fri, 24 Apr 2026 08:50:26 -0600 [thread overview]
Message-ID: <20260424-ada-bool-again-v1-1-cb63db324fff@adacore.com> (raw)
In-Reply-To: <20260424-ada-bool-again-v1-0-cb63db324fff@adacore.com>
This changes ada_add_all_symbols to use bool, then fixes up the
callers.
---
gdb/ada-lang.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 71a338ce17e..afdd59965fd 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -104,7 +104,7 @@ static void ada_add_block_symbols (std::vector<struct block_symbol> &,
static void ada_add_all_symbols (std::vector<struct block_symbol> &,
const struct block *,
const lookup_name_info &lookup_name,
- domain_search_flags, int, int *);
+ domain_search_flags, bool, bool *);
static bool is_nonfunction (const std::vector<struct block_symbol> &);
@@ -5528,7 +5528,7 @@ ada_add_block_renamings (std::vector<struct block_symbol> &result,
lookup_name_info decl_lookup_name (r_name,
lookup_name.match_type ());
ada_add_all_symbols (result, block, decl_lookup_name, domain,
- 1, NULL);
+ true, nullptr);
}
}
return result.size () != defns_mark;
@@ -5612,10 +5612,10 @@ add_nonlocal_symbols (std::vector<struct block_symbol> &result,
}
/* Find symbols in DOMAIN matching LOOKUP_NAME, in BLOCK and, if
- FULL_SEARCH is non-zero, enclosing scope and in global scopes,
+ FULL_SEARCH is true, enclosing scope and in global scopes,
returning the number of matches. Add these to RESULT.
- When FULL_SEARCH is non-zero, any non-function/non-enumeral
+ When FULL_SEARCH is false, any non-function/non-enumeral
symbol match within the nest of blocks whose innermost member is BLOCK,
is the one match returned (no other matches in that or
enclosing blocks is returned). If there are any matches in or
@@ -5633,13 +5633,13 @@ ada_add_all_symbols (std::vector<struct block_symbol> &result,
const struct block *block,
const lookup_name_info &lookup_name,
domain_search_flags domain,
- int full_search,
- int *made_global_lookup_p)
+ bool full_search,
+ bool *made_global_lookup_p)
{
struct symbol *sym;
- if (made_global_lookup_p)
- *made_global_lookup_p = 0;
+ if (made_global_lookup_p != nullptr)
+ *made_global_lookup_p = false;
/* Special case: If the user specifies a symbol name inside package
Standard, do a non-wild matching of the symbol name without
@@ -5679,8 +5679,8 @@ ada_add_all_symbols (std::vector<struct block_symbol> &result,
return;
}
- if (made_global_lookup_p)
- *made_global_lookup_p = 1;
+ if (made_global_lookup_p != nullptr)
+ *made_global_lookup_p = true;
/* Search symbols from all global blocks. */
@@ -5694,12 +5694,12 @@ ada_add_all_symbols (std::vector<struct block_symbol> &result,
}
/* Find symbols in DOMAIN matching LOOKUP_NAME, in BLOCK and, if FULL_SEARCH
- is non-zero, enclosing scope and in global scopes.
+ is true, enclosing scope and in global scopes.
Returns (SYM,BLOCK) tuples, indicating the symbols found and the
blocks and symbol tables (if any) in which they were found.
- When full_search is non-zero, any non-function/non-enumeral
+ When full_search is false, any non-function/non-enumeral
symbol match within the nest of blocks whose innermost member is BLOCK,
is the one match returned (no other matches in that or
enclosing blocks is returned). If there are any matches in or
@@ -5712,9 +5712,9 @@ static std::vector<struct block_symbol>
ada_lookup_symbol_list_worker (const lookup_name_info &lookup_name,
const struct block *block,
domain_search_flags domain,
- int full_search)
+ bool full_search)
{
- int syms_from_global_search;
+ bool syms_from_global_search;
std::vector<struct block_symbol> results;
ada_add_all_symbols (results, block, lookup_name,
@@ -5745,11 +5745,11 @@ ada_lookup_symbol_list (const char *name, const struct block *block,
symbol_name_match_type name_match_type = name_match_type_from_name (name);
lookup_name_info lookup_name (name, name_match_type);
- return ada_lookup_symbol_list_worker (lookup_name, block, domain, 1);
+ return ada_lookup_symbol_list_worker (lookup_name, block, domain, true);
}
/* The result is as for ada_lookup_symbol_list with FULL_SEARCH set
- to 1, but choosing the first symbol found if there are multiple
+ to true, but choosing the first symbol found if there are multiple
choices. */
block_symbol
@@ -11510,7 +11510,7 @@ get_var_value (const char *name, const char *err_msg)
std::vector<struct block_symbol> syms
= ada_lookup_symbol_list_worker (lookup_name,
get_selected_block (0),
- SEARCH_VFT, 1);
+ SEARCH_VFT, true);
if (syms.size () != 1)
{
@@ -13702,7 +13702,7 @@ class ada_language : public language_defn
for_each_symbol_callback_ftype callback) const override
{
std::vector<struct block_symbol> results
- = ada_lookup_symbol_list_worker (name, block, domain, 0);
+ = ada_lookup_symbol_list_worker (name, block, domain, false);
for (block_symbol &sym : results)
callback (&sym);
}
--
2.53.0
next prev parent reply other threads:[~2026-04-24 14:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 14:50 [PATCH 0/2] More bool in ada-lang.c Tom Tromey
2026-04-24 14:50 ` Tom Tromey [this message]
2026-05-08 12:50 ` [PATCH 1/2] Use bool in ada_add_all_symbols Andrew Burgess
2026-05-08 13:53 ` Tom Tromey
2026-04-24 14:50 ` [PATCH 2/2] Use bool in map_matching_symbols Tom Tromey
2026-05-08 13:10 ` Andrew Burgess
2026-05-08 13:43 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260424-ada-bool-again-v1-1-cb63db324fff@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox