Clang does not handle casts in static_assert() expressions. It doesn't like use of floating point to calculate threshold. Use a different expression with same effect.
Modify comment in mlx5 so that developers don't go searching for old value. Signed-off-by: Stephen Hemminger <step...@networkplumber.org> --- drivers/net/mlx5/mlx5_rxq.c | 2 +- lib/mempool/rte_mempool.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 1bb036afebb3..7d972b6d927c 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1444,7 +1444,7 @@ mlx5_mprq_alloc_mp(struct rte_eth_dev *dev) /* * rte_mempool_create_empty() has sanity check to refuse large cache * size compared to the number of elements. - * CACHE_FLUSHTHRESH_MULTIPLIER is defined in a C file, so using a + * CALC_CACHE_FLUSHTHRESH() is defined in a C file, so using a * constant number 2 instead. */ obj_num = RTE_MAX(obj_num, MLX5_MPRQ_MP_CACHE_SZ * 2); diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c index b7a19bea7185..12390a2c8155 100644 --- a/lib/mempool/rte_mempool.c +++ b/lib/mempool/rte_mempool.c @@ -50,9 +50,10 @@ static void mempool_event_callback_invoke(enum rte_mempool_event event, struct rte_mempool *mp); -#define CACHE_FLUSHTHRESH_MULTIPLIER 1.5 -#define CALC_CACHE_FLUSHTHRESH(c) \ - ((typeof(c))((c) * CACHE_FLUSHTHRESH_MULTIPLIER)) +/* Note: avoid using floating point since that compiler + * may not think that is constant. + */ +#define CALC_CACHE_FLUSHTHRESH(c) (((c) * 3) / 2) #if defined(RTE_ARCH_X86) /* -- 2.43.0