public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Namespace the reg class to avoid clashes with OS headers
@ 2020-03-17 13:56 Kamil Rytarowski
  2020-03-18  1:19 ` Simon Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Kamil Rytarowski @ 2020-03-17 13:56 UTC (permalink / raw)
  To: gdb-patches

Fix build issues on NetBSD where the reg symbol exists in public headers.
---
 gdb/regformats/regdef.h | 4 ++++
 gdbserver/regcache.cc   | 2 +-
 gdbserver/tdesc.cc      | 2 +-
 gdbserver/tdesc.h       | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gdb/regformats/regdef.h b/gdb/regformats/regdef.h
index 340281e2425..ed9aeb7af4b 100644
--- a/gdb/regformats/regdef.h
+++ b/gdb/regformats/regdef.h
@@ -19,6 +19,8 @@
 #ifndef REGFORMATS_REGDEF_H
 #define REGFORMATS_REGDEF_H

+namespace gdb {
+
 struct reg
 {
   reg (int _offset)
@@ -60,4 +62,6 @@ struct reg
   }
 };

+} /* namespace gdb */
+
 #endif /* REGFORMATS_REGDEF_H */
diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc
index 33d38879dc6..6c0af95b34e 100644
--- a/gdbserver/regcache.cc
+++ b/gdbserver/regcache.cc
@@ -198,7 +198,7 @@ regcache_cpy (struct regcache *dst, struct regcache *src)

 /* Return a reference to the description of register N.  */

-static const struct reg &
+static const struct gdb::reg &
 find_register_by_number (const struct target_desc *tdesc, int n)
 {
   return tdesc->reg_defs[n];
diff --git a/gdbserver/tdesc.cc b/gdbserver/tdesc.cc
index de25e7cfb46..8d97defb9b5 100644
--- a/gdbserver/tdesc.cc
+++ b/gdbserver/tdesc.cc
@@ -75,7 +75,7 @@ init_target_desc (struct target_desc *tdesc,
 	gdb_assert (regnum == 0 || regnum >= tdesc->reg_defs.size ());

 	if (regnum != 0)
-	  tdesc->reg_defs.resize (regnum, reg (offset));
+	  tdesc->reg_defs.resize (regnum, gdb::reg (offset));

 	tdesc->reg_defs.emplace_back (treg->name.c_str (), offset,
 				      treg->bitsize);
diff --git a/gdbserver/tdesc.h b/gdbserver/tdesc.h
index 5e0df85cea8..f9ca478ff6d 100644
--- a/gdbserver/tdesc.h
+++ b/gdbserver/tdesc.h
@@ -31,7 +31,7 @@ struct target_desc : tdesc_element
 {
   /* A vector of elements of register definitions that
      describe the inferior's register set.  */
-  std::vector<struct reg> reg_defs;
+  std::vector<struct gdb::reg> reg_defs;

   /* The register cache size, in bytes.  */
   int registers_size;
--
2.25.0


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

* Re: [PATCH] Namespace the reg class to avoid clashes with OS headers
  2020-03-17 13:56 [PATCH] Namespace the reg class to avoid clashes with OS headers Kamil Rytarowski
@ 2020-03-18  1:19 ` Simon Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2020-03-18  1:19 UTC (permalink / raw)
  To: Kamil Rytarowski, gdb-patches

On 2020-03-17 9:56 a.m., Kamil Rytarowski wrote:
> Fix build issues on NetBSD where the reg symbol exists in public headers.

When fixing build issues, please quote the compilation error in the
commit message.  Also, please don't forget the ChangeLog entry.

The patch is ok with those two addressed.

Simon

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

end of thread, other threads:[~2020-03-18  1:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17 13:56 [PATCH] Namespace the reg class to avoid clashes with OS headers Kamil Rytarowski
2020-03-18  1:19 ` Simon Marchi

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