public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Use const for dwarf2_property_baton
@ 2023-03-01 22:37 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-03-01 22:37 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5f27603700c0d89023f00b6521b36cc911c23f85

commit 5f27603700c0d89023f00b6521b36cc911c23f85
Author: Tom Tromey <tromey@adacore.com>
Date:   Wed Mar 1 08:03:49 2023 -0700

    Use const for dwarf2_property_baton
    
    Once a baton is stored in a struct type, it doesn't make sense to
    modify it.  This patch constifies the API.
    
    Approved-By: Simon Marchi <simon.marchi@efficios.com>

Diff:
---
 gdb/dwarf2/loc.c |  8 ++++----
 gdb/dwarf2/loc.h |  2 +-
 gdb/gdbtypes.h   | 10 +++++-----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index bf582bcfeff..914e016f085 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -347,7 +347,7 @@ decode_debug_loc_dwo_addresses (dwarf2_per_cu_data *per_cu,
    can be more than one in the list.  */
 
 const gdb_byte *
-dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
+dwarf2_find_location_expression (const dwarf2_loclist_baton *baton,
 				 size_t *locexpr_length, CORE_ADDR pc)
 {
   dwarf2_per_objfile *per_objfile = baton->per_objfile;
@@ -1691,7 +1691,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
 
     case PROP_LOCLIST:
       {
-	struct dwarf2_property_baton *baton = prop->baton ();
+	const dwarf2_property_baton *baton = prop->baton ();
 	CORE_ADDR pc;
 	const gdb_byte *data;
 	struct value *val;
@@ -1722,7 +1722,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
 
     case PROP_ADDR_OFFSET:
       {
-	struct dwarf2_property_baton *baton = prop->baton ();
+	const dwarf2_property_baton *baton = prop->baton ();
 	const struct property_addr_info *pinfo;
 	struct value *val;
 
@@ -1772,7 +1772,7 @@ dwarf2_compile_property_to_c (string_file *stream,
 			      CORE_ADDR pc,
 			      struct symbol *sym)
 {
-  struct dwarf2_property_baton *baton = prop->baton ();
+  const dwarf2_property_baton *baton = prop->baton ();
   const gdb_byte *data;
   size_t size;
   dwarf2_per_cu_data *per_cu;
diff --git a/gdb/dwarf2/loc.h b/gdb/dwarf2/loc.h
index 37925f48497..ad60177e93c 100644
--- a/gdb/dwarf2/loc.h
+++ b/gdb/dwarf2/loc.h
@@ -37,7 +37,7 @@ extern unsigned int entry_values_debug;
 
 /* Find a particular location expression from a location list.  */
 const gdb_byte *dwarf2_find_location_expression
-  (struct dwarf2_loclist_baton *baton,
+  (const dwarf2_loclist_baton *baton,
    size_t *locexpr_length,
    CORE_ADDR pc);
 
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 701a64d457a..c4889a4a05b 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -290,7 +290,7 @@ union dynamic_prop_data
 
   /* Storage for dynamic property.  */
 
-  dwarf2_property_baton *baton;
+  const dwarf2_property_baton *baton;
 
   /* Storage of variant parts for a type.  A type with variant parts
      has all its fields "linearized" -- stored in a single field
@@ -340,7 +340,7 @@ struct dynamic_prop
     m_data.const_val = const_val;
   }
 
-  dwarf2_property_baton *baton () const
+  const dwarf2_property_baton *baton () const
   {
     gdb_assert (m_kind == PROP_LOCEXPR
 		|| m_kind == PROP_LOCLIST
@@ -349,19 +349,19 @@ struct dynamic_prop
     return m_data.baton;
   }
 
-  void set_locexpr (dwarf2_property_baton *baton)
+  void set_locexpr (const dwarf2_property_baton *baton)
   {
     m_kind = PROP_LOCEXPR;
     m_data.baton = baton;
   }
 
-  void set_loclist (dwarf2_property_baton *baton)
+  void set_loclist (const dwarf2_property_baton *baton)
   {
     m_kind = PROP_LOCLIST;
     m_data.baton = baton;
   }
 
-  void set_addr_offset (dwarf2_property_baton *baton)
+  void set_addr_offset (const dwarf2_property_baton *baton)
   {
     m_kind = PROP_ADDR_OFFSET;
     m_data.baton = baton;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-01 22:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-01 22:37 [binutils-gdb] Use const for dwarf2_property_baton Tom Tromey

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).