]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: avoid an atomic builtin that clang doesn't like
authorMark Stapp <mjs@voltanet.io>
Fri, 12 Jun 2020 20:31:22 +0000 (16:31 -0400)
committerMark Stapp <mjs@voltanet.io>
Fri, 12 Jun 2020 20:31:22 +0000 (16:31 -0400)
We had special-cased use of atomic_add_fetch, because clang just
does not like that builtin. Just use atomic_fetch_add instead.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
zebra/zebra_dplane.c

index eb3d48d78427a7a65cb8c90bd6034b67084a5013..b9163cfaab9a0707d1c462bd880146282438dd87 100644 (file)
@@ -2158,17 +2158,12 @@ static int dplane_update_enqueue(struct zebra_dplane_ctx *ctx)
        }
        DPLANE_UNLOCK();
 
-       curr = atomic_add_fetch_explicit(
-#ifdef __clang__
-               /* TODO -- issue with the clang atomic/intrinsics currently;
-                * casting away the 'Atomic'-ness of the variable works.
-                */
-               (uint32_t *)&(zdplane_info.dg_routes_queued),
-#else
+       curr = atomic_fetch_add_explicit(
                &(zdplane_info.dg_routes_queued),
-#endif
                1, memory_order_seq_cst);
 
+       curr++; /* We got the pre-incremented value */
+
        /* Maybe update high-water counter also */
        high = atomic_load_explicit(&zdplane_info.dg_routes_queued_max,
                                    memory_order_seq_cst);