[PATCH v2 0/3] use static_assertion for build errors
Ferruh Yigit
ferruh.yigit at amd.com
Mon Nov 13 19:13:30 CET 2023
On 11/13/2023 5:06 PM, Stephen Hemminger wrote:
> This series fixes a couple places where expressions that could not
> be evaluated as constant early in compiler passes were used. And then
> converts RTE_BUILD_BUG_ON() with static_assert.
>
> Stephen Hemminger (3):
> event/opdl: fix non-constant compile time assertion
> net/sfc: fix non-constant expression inr RTE_BUILD_BUG_ON()
> eal: replace out of bounds VLA with static_assert
>
Acked-by: Ferruh Yigit <ferruh.yigit at amd.com>
I am getting more build errors [1], [2].
[1] `meson --buildtype=debug build`
In file included from ../lib/eal/include/dev_driver.h:12,
from ../lib/ethdev/ethdev_driver.h:23,
from ../drivers/net/i40e/i40e_rxtx_vec_sse.c:6:
../drivers/net/i40e/i40e_rxtx_vec_sse.c: In function ‘descs_to_fdir_32b’:
../lib/eal/include/rte_common.h:499:51: error: expression in static
assertion is not constant
499 | #define RTE_BUILD_BUG_ON(condition) static_assert(!(condition),
#condition)
| ^~~~~~~~~~~~
../drivers/net/i40e/i40e_rxtx_vec_sse.c:147:9: note: in expansion of
macro ‘RTE_BUILD_BUG_ON’
147 | RTE_BUILD_BUG_ON(RTE_MBUF_F_RX_FDIR_ID != (1 <<
FDIR_ID_BIT_SHIFT));
| ^~~~~~~~~~~~~~~~
[2] `CC=clang meson --buildtype=debugoptimized build`
../lib/mempool/rte_mempool.c:749:2: error: static_assert expression is
not an integral constant expression
RTE_BUILD_BUG_ON(CALC_CACHE_FLUSHTHRESH(RTE_MEMPOOL_CACHE_MAX_SIZE) >
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/eal/include/rte_common.h:499:51: note: expanded from macro
'RTE_BUILD_BUG_ON'
#define RTE_BUILD_BUG_ON(condition) static_assert(!(condition), #condition)
^~~~~~~~~~~~
1 error generated.
More information about the dev
mailing list