Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: simon.marchi@polymtl.ca
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH] gdb/dwarf: implement section_and_offset comparison using operator==
Date: Tue, 10 Mar 2026 13:44:57 -0400	[thread overview]
Message-ID: <20260310174458.747011-1-simon.marchi@polymtl.ca> (raw)

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


             reply	other threads:[~2026-03-10 17:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 17:44 simon.marchi [this message]
2026-03-10 18:18 ` Tom Tromey
2026-03-10 18:26   ` Simon Marchi

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=20260310174458.747011-1-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    /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