public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFC] undef reg in gdb_curses.h
@ 2013-10-17 15:46 Tom Tromey
  2013-10-17 16:58 ` Pedro Alves
  2013-10-29 16:41 ` Tom Tromey
  0 siblings, 2 replies; 3+ messages in thread
From: Tom Tromey @ 2013-10-17 15:46 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I tried to build gdb on the AIX machine in the GCC compile farm
(gcc111), but it failed in a couple of spots because gdb uses "reg" as
a variable name and the AIX <curses.h> defines "reg" to "register".

I saw that we already had a workaround for this lurking in utils.c, so
I just moved that to gdb_curses.h.

This fixed the problem on AIX and still builds on x86-64 Fedora 18.

Let me know what you think.  I suppose in the absence of comments I
will put this in.

	* utils.c (reg): Move undefinition...
	* gdb_curses.h: ... here.  Update comment to mention AIX.
---
 gdb/gdb_curses.h | 8 ++++++++
 gdb/utils.c      | 5 -----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/gdb/gdb_curses.h b/gdb/gdb_curses.h
index 37b2d5b..92c6db1 100644
--- a/gdb/gdb_curses.h
+++ b/gdb/gdb_curses.h
@@ -54,4 +54,12 @@
 extern int tgetnum (const char *);
 #endif
 
+/* SunOS's curses.h has a '#define reg register' in it.  Thank you Sun.  */
+/* Ditto for:
+   -bash-4.2$ uname -a
+   AIX power-aix 1 7 00F84C0C4C00  */
+#ifdef reg
+#undef reg
+#endif
+
 #endif /* gdb_curses.h */
diff --git a/gdb/utils.c b/gdb/utils.c
index 47f9dfe..1986758 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -40,11 +40,6 @@
 #include <pc.h>
 #endif
 
-/* SunOS's curses.h has a '#define reg register' in it.  Thank you Sun.  */
-#ifdef reg
-#undef reg
-#endif
-
 #include <signal.h>
 #include "timeval-utils.h"
 #include "gdbcmd.h"
-- 
1.8.1.4

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

* Re: [RFC] undef reg in gdb_curses.h
  2013-10-17 15:46 [RFC] undef reg in gdb_curses.h Tom Tromey
@ 2013-10-17 16:58 ` Pedro Alves
  2013-10-29 16:41 ` Tom Tromey
  1 sibling, 0 replies; 3+ messages in thread
From: Pedro Alves @ 2013-10-17 16:58 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 10/17/2013 04:46 PM, Tom Tromey wrote:

> Let me know what you think.

I think, this is the right thing to do.

That define looks like an old BSD thing.  Just googling
around for "#define reg register" finds:

 http://marc.info/?l=netbsd-bugs&m=91480640622229&w=2
 http://www.retro11.de/ouxr/211bsd/usr/include/curses.h.html

Which ended on Mac OS too:

 https://www.opensource.apple.com/source/Libcurses/Libcurses-24/curses.h

Curious how nobody reported this before -- maybe people have been
using GNU ncurses on Macs.

-- 
Pedro Alves

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

* Re: [RFC] undef reg in gdb_curses.h
  2013-10-17 15:46 [RFC] undef reg in gdb_curses.h Tom Tromey
  2013-10-17 16:58 ` Pedro Alves
@ 2013-10-29 16:41 ` Tom Tromey
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2013-10-29 16:41 UTC (permalink / raw)
  To: gdb-patches

>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Tom> I tried to build gdb on the AIX machine in the GCC compile farm
Tom> (gcc111), but it failed in a couple of spots because gdb uses "reg" as
Tom> a variable name and the AIX <curses.h> defines "reg" to "register".

Tom> I saw that we already had a workaround for this lurking in utils.c, so
Tom> I just moved that to gdb_curses.h.

Tom> This fixed the problem on AIX and still builds on x86-64 Fedora 18.

Tom> Let me know what you think.  I suppose in the absence of comments I
Tom> will put this in.

I'm checking this in now.

Tom

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

end of thread, other threads:[~2013-10-29 16:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-17 15:46 [RFC] undef reg in gdb_curses.h Tom Tromey
2013-10-17 16:58 ` Pedro Alves
2013-10-29 16:41 ` 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).