[PATCH v2 0/3] use static_assertion for build errors
Tyler Retzlaff
roretzla at linux.microsoft.com
Mon Nov 13 19:57:57 CET 2023
On Mon, Nov 13, 2023 at 06:13:30PM +0000, Ferruh Yigit wrote:
> 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));
this one is fixable by just making it a constant expression instead of a
const variable.
- i40e_rxtx_vec_sse.c: const uint32_t FDIR_ID_BIT_SHIFT = 13;
+ i40e_rxtx_vec_sse.c: #define FDIR_ID_BIT_SHIFT (13u)
... whatever ...
+ i40e_rxtx_vec_sse.c: #undef FDIR_ID_BIT_SHIFT
ty
More information about the dev
mailing list