diff options
author | Marin Ramesa <mpr@hi.t-com.hr> | 2013-12-16 00:18:41 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-12-16 07:43:56 +0100 |
commit | f3593b77a6ab8550c119e0617e3dee4abf144533 (patch) | |
tree | 16b69043695f7e84b152c47f9f36df6e7bd78532 /kern | |
parent | 4e639015436ec69fc161da2eb061073701483680 (diff) |
kern: quiet GCC warnings about set but unused variables
* kern/lock.h (simple_lock_data_empty): Define.
(decl_simple_lock_data, simple_unlock): Likewise.
* kern/sched_prim.c (lock): Declare.
[MACH_SLOCKS]: Remove #ifs.
* kern/task.c (task_lock, task_unlock): Remove address operator.
Diffstat (limited to 'kern')
-rw-r--r-- | kern/lock.h | 6 | ||||
-rw-r--r-- | kern/sched_prim.c | 18 | ||||
-rw-r--r-- | kern/task.c | 4 |
3 files changed, 9 insertions, 19 deletions
diff --git a/kern/lock.h b/kern/lock.h index 4f38ea3..a6d286a 100644 --- a/kern/lock.h +++ b/kern/lock.h @@ -94,7 +94,9 @@ extern void check_simple_locks(void); /* * Do not allocate storage for locks if not needed. */ -#define decl_simple_lock_data(class,name) +struct simple_lock_data_empty {}; +#define decl_simple_lock_data(class,name) \ +class struct simple_lock_data_empty name; #define simple_lock_addr(lock) ((simple_lock_t)0) /* @@ -102,7 +104,7 @@ extern void check_simple_locks(void); */ #define simple_lock_init(l) #define simple_lock(l) -#define simple_unlock(l) +#define simple_unlock(l) ((void)(l)) #define simple_lock_try(l) (TRUE) /* always succeeds */ #define simple_lock_taken(l) (1) /* always succeeds */ #define check_simple_locks() diff --git a/kern/sched_prim.c b/kern/sched_prim.c index ec041fc..8aad146 100644 --- a/kern/sched_prim.c +++ b/kern/sched_prim.c @@ -226,9 +226,7 @@ void assert_wait( queue_t q; int index; thread_t thread; -#if MACH_SLOCKS - simple_lock_t lock; -#endif /* MACH_SLOCKS */ + decl_simple_lock_data( , *lock); spl_t s; thread = current_thread(); @@ -240,9 +238,7 @@ void assert_wait( if (event != 0) { index = wait_hash(event); q = &wait_queue[index]; -#if MACH_SLOCKS lock = &wait_lock[index]; -#endif /* MACH_SLOCKS */ simple_lock(lock); thread_lock(thread); enqueue_tail(q, &(thread->links)); @@ -284,9 +280,7 @@ void clear_wait( { int index; queue_t q; -#if MACH_SLOCKS - simple_lock_t lock; -#endif /* MACH_SLOCKS */ + decl_simple_lock_data( , *lock); event_t event; spl_t s; @@ -306,9 +300,7 @@ void clear_wait( thread_unlock(thread); index = wait_hash(event); q = &wait_queue[index]; -#if MACH_SLOCKS lock = &wait_lock[index]; -#endif /* MACH_SLOCKS */ simple_lock(lock); /* * If the thread is still waiting on that event, @@ -387,18 +379,14 @@ void thread_wakeup_prim( queue_t q; int index; thread_t thread, next_th; -#if MACH_SLOCKS - simple_lock_t lock; -#endif /* MACH_SLOCKS */ + decl_simple_lock_data( , *lock); spl_t s; int state; index = wait_hash(event); q = &wait_queue[index]; s = splsched(); -#if MACH_SLOCKS lock = &wait_lock[index]; -#endif /* MACH_SLOCKS */ simple_lock(lock); thread = (thread_t) queue_first(q); while (!queue_end(q, (queue_entry_t)thread)) { diff --git a/kern/task.c b/kern/task.c index 8fe3672..13b3c76 100644 --- a/kern/task.c +++ b/kern/task.c @@ -761,7 +761,7 @@ kern_return_t task_info( event_info = (task_events_info_t) task_info_out; - task_lock(&task); + task_lock(task); event_info->faults = task->faults; event_info->zero_fills = task->zero_fills; event_info->reactivations = task->reactivations; @@ -769,7 +769,7 @@ kern_return_t task_info( event_info->cow_faults = task->cow_faults; event_info->messages_sent = task->messages_sent; event_info->messages_received = task->messages_received; - task_unlock(&task); + task_unlock(task); *task_info_count = TASK_EVENTS_INFO_COUNT; break; |