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?
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to