[2/8] Remove target_has_memory macro

Message ID 20200721014914.29937-3-tom@tromey.com
State New
Headers show
Series
  • Remove object-like target macros
Related show

Commit Message

Tom Tromey July 21, 2020, 1:49 a.m.
This removes the target_has_memory object-like macro, replacing it
with the underlying function.

gdb/ChangeLog
2020-07-20  Tom Tromey  <tom@tromey.com>

	* target.c (target_has_memory): Rename from target_has_memory_1.
	* tui/tui-regs.c (tui_data_window::show_registers): Update.
	* thread.c (scoped_restore_current_thread::restore)
	(scoped_restore_current_thread::scoped_restore_current_thread):
	Update.
	* frame.c (get_current_frame, has_stack_frames): Update.
	* target.h (target_has_memory): Remove macro.
	(target_has_memory): Rename from target_has_memory_1.
---
 gdb/ChangeLog      | 11 +++++++++++
 gdb/frame.c        |  4 ++--
 gdb/target.c       |  2 +-
 gdb/target.h       |  3 +--
 gdb/thread.c       |  4 ++--
 gdb/tui/tui-regs.c |  2 +-
 6 files changed, 18 insertions(+), 8 deletions(-)

-- 
2.17.2

Patch

diff --git a/gdb/frame.c b/gdb/frame.c
index ac1016b083f..44989a35193 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1605,7 +1605,7 @@  get_current_frame (void)
     error (_("No registers."));
   if (!target_has_stack)
     error (_("No stack."));
-  if (!target_has_memory)
+  if (!target_has_memory ())
     error (_("No memory."));
   /* Traceframes are effectively a substitute for the live inferior.  */
   if (get_traceframe_number () < 0)
@@ -1640,7 +1640,7 @@  static struct frame_info *selected_frame;
 int
 has_stack_frames (void)
 {
-  if (!target_has_registers || !target_has_stack || !target_has_memory)
+  if (!target_has_registers || !target_has_stack || !target_has_memory ())
     return 0;
 
   /* Traceframes are effectively a substitute for the live inferior.  */
diff --git a/gdb/target.c b/gdb/target.c
index afd1d5b327d..352d5aa61c6 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -170,7 +170,7 @@  show_targetdebug (struct ui_file *file, int from_tty,
 }
 
 int
-target_has_memory_1 (void)
+target_has_memory ()
 {
   for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
     if (t->has_memory ())
diff --git a/gdb/target.h b/gdb/target.h
index 208866a9c05..122c8631b5d 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1794,8 +1794,7 @@  extern void default_target_pass_ctrlc (struct target_ops *ops);
 
 /* Does the target include memory?  (Dummy targets don't.)  */
 
-extern int target_has_memory_1 (void);
-#define target_has_memory target_has_memory_1 ()
+extern int target_has_memory ();
 
 /* Does the target have a stack?  (Exec files don't, VxWorks doesn't, until
    we start a process.)  */
diff --git a/gdb/thread.c b/gdb/thread.c
index 4dce1ef82aa..958888e1d82 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1407,7 +1407,7 @@  scoped_restore_current_thread::restore ()
       && m_thread->state == THREAD_STOPPED
       && target_has_registers
       && target_has_stack
-      && target_has_memory)
+      && target_has_memory ())
     restore_selected_frame (m_selected_frame_id, m_selected_frame_level);
 }
 
@@ -1441,7 +1441,7 @@  scoped_restore_current_thread::scoped_restore_current_thread ()
       if (m_was_stopped
 	  && target_has_registers
 	  && target_has_stack
-	  && target_has_memory)
+	  && target_has_memory ())
 	{
 	  /* When processing internal events, there might not be a
 	     selected frame.  If we naively call get_selected_frame
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 04d7469de5a..d7d13045d09 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -182,7 +182,7 @@  tui_data_window::show_registers (struct reggroup *group)
   if (group == 0)
     group = general_reggroup;
 
-  if (target_has_registers && target_has_stack && target_has_memory)
+  if (target_has_registers && target_has_stack && target_has_memory ())
     {
       show_register_group (group, get_selected_frame (NULL),
 			   group == m_current_group);