Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb/dwarf: implement section_and_offset comparison using operator==
@ 2026-03-10 17:44 simon.marchi
  2026-03-10 18:18 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: simon.marchi @ 2026-03-10 17:44 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@efficios.com>

This was suggested during review.

Change-Id: Iabe893f5b7ee1c4dce9655cbc323e3640e061aa3
---
 gdb/dwarf2/section.h | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/gdb/dwarf2/section.h b/gdb/dwarf2/section.h
index 34a1810a387f..4711e53d1ad6 100644
--- a/gdb/dwarf2/section.h
+++ b/gdb/dwarf2/section.h
@@ -124,6 +124,10 @@ struct section_and_offset
 {
   const dwarf2_section_info *section;
   sect_offset offset;
+
+  friend bool operator== (const section_and_offset &lhs,
+			  const section_and_offset &rhs) noexcept
+  { return lhs.section == rhs.section && lhs.offset == rhs.offset; }
 };
 
 /* Hash function for section_and_offset.  */
@@ -141,18 +145,9 @@ struct section_and_offset_hash
   }
 };
 
-/* Equality function for section_and_offset.  */
-
-struct section_and_offset_eq
-{
-  bool operator() (const section_and_offset &a,
-		   const section_and_offset &b) const noexcept
-  { return a.section == b.section && a.offset == b.offset; }
-};
-
 template<typename Value>
 using unordered_section_and_offset_map
   = gdb::unordered_map<section_and_offset, Value,
-		       section_and_offset_hash, section_and_offset_eq>;
+		       section_and_offset_hash>;
 
 #endif /* GDB_DWARF2_SECTION_H */

base-commit: 34909f3a1dea81b0b83654c0de9375be20ac3d3b
-- 
2.53.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gdb/dwarf: implement section_and_offset comparison using operator==
  2026-03-10 17:44 [PATCH] gdb/dwarf: implement section_and_offset comparison using operator== simon.marchi
@ 2026-03-10 18:18 ` Tom Tromey
  2026-03-10 18:26   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2026-03-10 18:18 UTC (permalink / raw)
  To: simon.marchi; +Cc: gdb-patches, Simon Marchi

>>>>> "Simon" == simon marchi <simon.marchi@polymtl.ca> writes:

Simon> From: Simon Marchi <simon.marchi@efficios.com>
Simon> This was suggested during review.

Thanks.

I thought there was some other code instantiating & using
section_and_offset_eq?

Anyway this is good.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gdb/dwarf: implement section_and_offset comparison using operator==
  2026-03-10 18:18 ` Tom Tromey
@ 2026-03-10 18:26   ` Simon Marchi
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2026-03-10 18:26 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches, Simon Marchi



On 2026-03-10 14:18, Tom Tromey wrote:
>>>>>> "Simon" == simon marchi <simon.marchi@polymtl.ca> writes:
> 
> Simon> From: Simon Marchi <simon.marchi@efficios.com>
> Simon> This was suggested during review.
> 
> Thanks.
> 
> I thought there was some other code instantiating & using
> section_and_offset_eq?
> 
> Anyway this is good.
> Approved-By: Tom Tromey <tom@tromey.com>
> 
> Tom

I think it was only used in an htab_t comparator that disappeared in the
latest patch of the series, which moved to gdb::unordered_map.

Pushed, thanks.

Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-10 18:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-10 17:44 [PATCH] gdb/dwarf: implement section_and_offset comparison using operator== simon.marchi
2026-03-10 18:18 ` Tom Tromey
2026-03-10 18:26   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox