public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 2/6] Use array_view for symbol_impls
Date: Wed, 20 Apr 2022 08:50:09 -0600	[thread overview]
Message-ID: <20220420145013.3307418-3-tom@tromey.com> (raw)
In-Reply-To: <20220420145013.3307418-1-tom@tromey.com>

It seemed to me that using array_view for symbol_impls would give a
bit more error checking, at least when gdb is built in libstdc++ debug
mode.
---
 gdb/symtab.c | 2 +-
 gdb/symtab.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/symtab.c b/gdb/symtab.c
index a75492603b8..43a64edab34 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -6502,7 +6502,7 @@ static struct symbol_impl symbol_impl[MAX_SYMBOL_IMPLS];
 /* The globally visible pointer.  This is separate from 'symbol_impl'
    so that it can be const.  */
 
-const struct symbol_impl *symbol_impls = &symbol_impl[0];
+gdb::array_view<const struct symbol_impl> symbol_impls (symbol_impl);
 
 /* Make sure we saved enough room in struct symbol.  */
 
diff --git a/gdb/symtab.h b/gdb/symtab.h
index ce09bc19bfe..9b677ffe451 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1188,7 +1188,7 @@ enum symbol_subclass_kind
   SYMBOL_RUST_VTABLE
 };
 
-extern const struct symbol_impl *symbol_impls;
+extern gdb::array_view<const struct symbol_impl> symbol_impls;
 
 /* This structure is space critical.  See space comments at the top.  */
 
-- 
2.34.1


  parent reply	other threads:[~2022-04-20 14:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20 14:50 [PATCH 0/6] More symbol methods Tom Tromey
2022-04-20 14:50 ` [PATCH 1/6] Add accessors for symbol's artificial field Tom Tromey
2022-04-20 15:15   ` Simon Marchi
2022-04-20 15:20     ` Tom Tromey
2022-04-20 14:50 ` Tom Tromey [this message]
2022-04-20 14:50 ` [PATCH 3/6] Remove symbol::aclass_index Tom Tromey
2022-04-20 14:50 ` [PATCH 4/6] Replace symbol_objfile with symbol::objfile Tom Tromey
2022-04-20 14:50 ` [PATCH 5/6] Replace symbol_arch with symbol::arch Tom Tromey
2022-04-20 14:50 ` [PATCH 6/6] Replace symbol_symtab with symbol::symtab Tom Tromey
2022-04-20 15:20   ` Simon Marchi
2022-04-20 15:29     ` 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=20220420145013.3307418-3-tom@tromey.com \
    --to=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).