[PATCH v5 6/6] eal: replace out of bounds VLA with static_assert

Morten Brørup mb at smartsharesystems.com
Thu Jan 18 19:42:14 CET 2024


> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Thursday, 18 January 2024 17.51
> 
> Both Gcc, clang and MSVC have better way to do compile time
> assertions rather than using out of bounds array access.
> The old method would fail if -Wvla is enabled because compiler
> can't determine size in that code.  Also, the use of new
> _Static_assert will catch broken code that is passing non-constant
> expression to RTE_BUILD_BUG_ON().
> 
> Add workaround for clang static_assert in switch,
> and missing static_assert in older FreeBSD.
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> Acked-by: Morten Brørup <mb at smartsharesystems.com>
> Acked-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
> ---

Reviewed-by: Morten Brørup <mb at smartsharesystems.com>



More information about the dev mailing list