public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Christian Biesinger <cbiesinger@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Use block_enum instead of int for better typesafety Date: Mon, 22 Jul 2019 03:26:00 -0000 [thread overview] Message-ID: <20190722032620.125893.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c32e6a04f42b8e4a1392ee4b87d040c06b917ef5 commit c32e6a04f42b8e4a1392ee4b87d040c06b917ef5 Author: Christian Biesinger <cbiesinger@google.com> Date: Thu Jul 11 13:35:13 2019 -0500 Use block_enum instead of int for better typesafety gdb/ChangeLog: 2019-07-21 Christian Biesinger <cbiesinger@google.com> * symtab.c (lookup_symbol_in_objfile_symtabs): Change int to block_enum. (lookup_symbol_in_objfile): Change int to block_enum and add a gdb_assert to make sure block_index is GLOBAL_BLOCK or STATIC_BLOCK. Diff: --- gdb/symtab.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gdb/symtab.c b/gdb/symtab.c index 719e5b2..ce1cdcf 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -92,7 +92,8 @@ struct block_symbol lookup_local_symbol (const char *name, enum language language); static struct block_symbol - lookup_symbol_in_objfile (struct objfile *objfile, int block_index, + lookup_symbol_in_objfile (struct objfile *objfile, + enum block_enum block_index, const char *name, const domain_enum domain); /* Type of the data stored on the program space. */ @@ -2244,8 +2245,9 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile, static symbols. */ static struct block_symbol -lookup_symbol_in_objfile_symtabs (struct objfile *objfile, int block_index, - const char *name, const domain_enum domain) +lookup_symbol_in_objfile_symtabs (struct objfile *objfile, + enum block_enum block_index, const char *name, + const domain_enum domain) { gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK); @@ -2516,11 +2518,13 @@ lookup_symbol_in_static_block (const char *name, BLOCK_INDEX is one of GLOBAL_BLOCK or STATIC_BLOCK. */ static struct block_symbol -lookup_symbol_in_objfile (struct objfile *objfile, int block_index, +lookup_symbol_in_objfile (struct objfile *objfile, enum block_enum block_index, const char *name, const domain_enum domain) { struct block_symbol result; + gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK); + if (symbol_lookup_debug) { fprintf_unfiltered (gdb_stdlog,
reply other threads:[~2019-07-22 3:26 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20190722032620.125893.qmail@sourceware.org \ --to=cbiesinger@sourceware.org \ --cc=gdb-cvs@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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).