[ovs-dev] [PATCH v2] sparse: Avoid sparse warnings for additional pthread initializers.

Andy Zhou azhou at nicira.com
Mon Jul 22 20:55:34 UTC 2013


Looks good. It works now in my local build. Thanks.


On Mon, Jul 22, 2013 at 1:31 PM, Ben Pfaff <blp at nicira.com> wrote:

> Reported-by: Andy Zhou <azhou at nicira.com>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
> v1->v2: Avoid conflict with ovs-thread.h definitions.
>
>  include/sparse/pthread.h |   11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/include/sparse/pthread.h b/include/sparse/pthread.h
> index 723c351..6cdf5c8 100644
> --- a/include/sparse/pthread.h
> +++ b/include/sparse/pthread.h
> @@ -33,12 +33,21 @@ int pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
> OVS_RELEASES(rwlock);
>  int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *mutex)
>      OVS_MUST_HOLD(mutex);
>
> -/* Sparse complains about the proper PTHREAD_MUTEX_INITIALIZER definition.
> +/* Sparse complains about the proper PTHREAD_*_INITIALIZER definitions.
>   * Luckily, it's not a real compiler so we can overwrite it with something
>   * simple. */
>  #undef PTHREAD_MUTEX_INITIALIZER
>  #define PTHREAD_MUTEX_INITIALIZER {}
>
> +#undef PTHREAD_RWLOCK_INITIALIZER
> +#define PTHREAD_RWLOCK_INITIALIZER {}
> +
> +#undef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
> +#define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP {}
> +
> +#undef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
> +#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP {}
> +
>  #define pthread_mutex_trylock(MUTEX)                    \
>      ({                                                  \
>          int retval = pthread_mutex_trylock(mutex);      \
> --
> 1.7.2.5
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20130722/f310fd4c/attachment-0003.html>


More information about the dev mailing list