Use newly introduced __rte_constant(e) macro instead of directly using __builtin_constant_p() allowing mempool to be built by MSVC.
Signed-off-by: Tyler Retzlaff <roret...@linux.microsoft.com> --- lib/mempool/rte_mempool.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h index 23fd5c8..a3564fb 100644 --- a/lib/mempool/rte_mempool.h +++ b/lib/mempool/rte_mempool.h @@ -1521,7 +1521,7 @@ struct rte_mempool_cache * /* The cache is a stack, so copy will be in reverse order. */ cache_objs = &cache->objs[cache->len]; - if (__extension__(__builtin_constant_p(n)) && n <= cache->len) { + if (__rte_constant(n) && n <= cache->len) { /* * The request size is known at build time, and * the entire request can be satisfied from the cache, @@ -1542,8 +1542,7 @@ struct rte_mempool_cache * * If the request size 'n' is known at build time, the above comparison * ensures that n > cache->len here, so omit RTE_MIN(). */ - len = __extension__(__builtin_constant_p(n)) ? cache->len : - RTE_MIN(n, cache->len); + len = __rte_constant(n) ? cache->len : RTE_MIN(n, cache->len); cache->len -= len; remaining = n - len; for (index = 0; index < len; index++) @@ -1554,7 +1553,7 @@ struct rte_mempool_cache * * where the entire request can be satisfied from the cache * has already been handled above, so omit handling it here. */ - if (!__extension__(__builtin_constant_p(n)) && remaining == 0) { + if (!__rte_constant(n) && remaining == 0) { /* The entire request is satisfied from the cache. */ RTE_MEMPOOL_CACHE_STAT_ADD(cache, get_success_bulk, 1); -- 1.8.3.1