[7/8] Turn target_can_lock_scheduler into a function-like macro

Message ID 20200721014914.29937-8-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 changes the object-like macro target_can_lock_scheduler into a
function-like macro.

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

	* infrun.c (set_schedlock_func): Update.
	* target.h (target_can_lock_scheduler): Now a function-like
	macro.
---
 gdb/ChangeLog | 6 ++++++
 gdb/infrun.c  | 2 +-
 gdb/target.h  | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

-- 
2.17.2

Comments

Simon Marchi July 21, 2020, 2:32 a.m. | #1
On 2020-07-20 9:49 p.m., Tom Tromey wrote:
> This changes the object-like macro target_can_lock_scheduler into a

> function-like macro.


Same question here and for patch 8, why a macro and not a function?

Simon
Tom Tromey July 21, 2020, 11:28 a.m. | #2
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:


Simon> On 2020-07-20 9:49 p.m., Tom Tromey wrote:
>> This changes the object-like macro target_can_lock_scheduler into a

>> function-like macro.


Simon> Same question here and for patch 8, why a macro and not a function?

Just that this way parallels other existing macros.

Tom
Tom Tromey Sept. 29, 2020, 1:37 a.m. | #3
>>> This changes the object-like macro target_can_lock_scheduler into a

>>> function-like macro.


Simon> Same question here and for patch 8, why a macro and not a function?

Tom> Just that this way parallels other existing macros.

I changed this to a function.

Tom

Patch

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 6f0154a0234..ff9b34f12fd 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2101,7 +2101,7 @@  show_scheduler_mode (struct ui_file *file, int from_tty,
 static void
 set_schedlock_func (const char *args, int from_tty, struct cmd_list_element *c)
 {
-  if (!target_can_lock_scheduler)
+  if (!target_can_lock_scheduler ())
     {
       scheduler_mode = schedlock_off;
       error (_("Target '%s' cannot support this command."), target_shortname);
diff --git a/gdb/target.h b/gdb/target.h
index 7811f499f70..14c0aa366b8 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1819,7 +1819,7 @@  extern bool target_has_execution (inferior *inf = nullptr);
 /* Can the target support the debugger control of thread execution?
    Can it lock the thread scheduler?  */
 
-#define target_can_lock_scheduler \
+#define target_can_lock_scheduler()					\
   (current_top_target ()->get_thread_control_capabilities () & tc_schedlock)
 
 /* Controls whether async mode is permitted.  */