Merge pull request #6575 from mjstapp/fix_avoid_clang_add_fetch

zebra: avoid an atomic builtin that clang doesn't like
This commit is contained in:
Russ White 2020-06-16 07:53:06 -04:00 committed by GitHub
commit 26a7e0ceda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2158,17 +2158,12 @@ static int dplane_update_enqueue(struct zebra_dplane_ctx *ctx)
} }
DPLANE_UNLOCK(); DPLANE_UNLOCK();
curr = atomic_add_fetch_explicit( curr = atomic_fetch_add_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
&(zdplane_info.dg_routes_queued), &(zdplane_info.dg_routes_queued),
#endif
1, memory_order_seq_cst); 1, memory_order_seq_cst);
curr++; /* We got the pre-incremented value */
/* Maybe update high-water counter also */ /* Maybe update high-water counter also */
high = atomic_load_explicit(&zdplane_info.dg_routes_queued_max, high = atomic_load_explicit(&zdplane_info.dg_routes_queued_max,
memory_order_seq_cst); memory_order_seq_cst);