On Mon, Aug 19, 2013 at 05:31:36AM -0400, Ed Maste wrote:
> Commit 1514b275 introduces the use of atomic_read_explicit for
> once-only initializers. When using C11 atomics this becomes
> atomic_load_explicit, and the first argument needs to be non-const --
> with FreeBSD HEAD's in-tree clang 3.3 the build fails for me with:
> 
> In file included from lib/bfd.c:34:
> ./lib/ovs-thread.h:482:5: error: first argument to atomic operation must be a
>       pointer to non-const _Atomic type ('const atomic_bool *' (aka
>       'const _Atomic(bool) *') invalid)
>     atomic_read_explicit(&once->done, &done, memory_order_relaxed);
>     ^                    ~~~~~~~~~~~
> 
> One workaround is to sprinkle CONST_CASTs around, in ovs-thread.h and
> lib/bfd. - e.g.:
> 
> --- a/lib/ovs-thread.h
> +++ b/lib/ovs-thread.h
> @@ -479,7 +479,8 @@ ovsthread_once_is_done__(const struct ovsthread_once 
> *once)
>  {
>      bool done;
> 
> -    atomic_read_explicit(&once->done, &done, memory_order_relaxed);
> +    atomic_read_explicit(CONST_CAST(atomic_bool *, &once->done), &done,
> +                         memory_order_relaxed);
>      return done;
>  }
> 
> Ben, what do you think?

Oops.  Thanks for the bug report.

I sent out a series that should fix the problem and make it more
difficult for it to recur:
        http://openvswitch.org/pipermail/dev/2013-August/030888.html
        http://openvswitch.org/pipermail/dev/2013-August/030889.html
        http://openvswitch.org/pipermail/dev/2013-August/030890.html

The last patch is really curious and makes me wonder if I really
misunderstand something:
        http://openvswitch.org/pipermail/dev/2013-August/030891.html
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to