bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/6] kern/lock.h: quiet GCC warnings about set but unused var


From: Samuel Thibault
Subject: Re: [PATCH 2/6] kern/lock.h: quiet GCC warnings about set but unused variables
Date: Sun, 15 Dec 2013 20:13:22 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Marin Ramesa, le Thu 12 Dec 2013 18:27:04 +0100, a écrit :
> --- a/kern/lock.h
> +++ b/kern/lock.h
> @@ -94,7 +94,10 @@ extern void                check_simple_locks(void);
>  /*
>   * Do not allocate storage for locks if not needed.
>   */
> -#define      decl_simple_lock_data(class,name)
> +struct l {};

Use a better name than just "l" :)

> diff --git a/kern/sched_prim.c b/kern/sched_prim.c
> index c06cd77..71f32c5 100644
> --- a/kern/sched_prim.c
> +++ b/kern/sched_prim.c
> @@ -228,6 +228,8 @@ void assert_wait(
>       thread_t                thread;
>  #if  MACH_SLOCKS
>       simple_lock_t           lock;
> +#else /* MACH_SLOCKS */
> +     decl_simple_lock_data( , lock);

This is not the same: simple_lock_t is a pointer. It'd be better to just
find a way to use decl_simple_lock_data for this.

        decl_simple_lock_data( , *lock);

would probably just work as expected.

> index 8fe3672..67067cf 100644
> --- a/kern/task.c
> +++ b/kern/task.c
> @@ -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);

Err, this is not the same at all, while task_lock is still using &task.
Either both need the fix, or none.

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]