From 00e36dabb4cdef51095aece46e451f2fab4c13c1 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 12 Feb 2025 02:09:44 +0100 Subject: Use MACRO_BEGIN/END This notably fixes at least a SAVE_HINT call. --- kern/lock.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'kern/lock.h') diff --git a/kern/lock.h b/kern/lock.h index 6c976eab..704118f0 100644 --- a/kern/lock.h +++ b/kern/lock.h @@ -267,18 +267,20 @@ extern unsigned long in_interrupt[NCPUS]; /* These are defined elsewhere with lock monitoring */ #if MACH_LOCK_MON == 0 -#define simple_lock(l) do { \ +#define simple_lock(l) \ +MACRO_BEGIN \ lock_check_no_interrupts(); \ simple_lock_nocheck(l); \ -} while (0) +MACRO_END #define simple_lock_try(l) ({ \ lock_check_no_interrupts(); \ simple_lock_try_nocheck(l); \ }) -#define simple_unlock(l) do { \ +#define simple_unlock(l) \ +MACRO_BEGIN \ lock_check_no_interrupts(); \ simple_unlock_nocheck(l); \ -} while (0) +MACRO_END #endif /* _irq variants */ @@ -302,10 +304,11 @@ class simple_lock_irq_data_t name; simple_lock_nocheck(&(l)->slock); \ __s; \ }) -#define simple_unlock_irq(s, l) do { \ +#define simple_unlock_irq(s, l) \ +MACRO_BEGIN \ simple_unlock_nocheck(&(l)->slock); \ splx(s); \ -} while (0) +MACRO_END #if MACH_KDB extern void db_show_all_slocks(void); -- cgit v1.2.3