__counted_by is a GCC 14 / Clang 18 extension used in imported kernel uapi headers. Older compilers reject it with an error. Define it as an empty function-like macro when the compiler does not support it.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --- config/meson.build | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/meson.build b/config/meson.build index 344f68822be3..9777713ea434 100644 --- a/config/meson.build +++ b/config/meson.build @@ -474,6 +474,12 @@ dpdk_arch_headers += files('rte_config.h') # specify -D_GNU_SOURCE unconditionally add_project_arguments('-D_GNU_SOURCE', language: 'c') +# define __counted_by as empty on compilers that don't support it +if not cc.compiles('struct s { int n; int a[] __counted_by(n); };', + name : '__counted_by support') + add_project_arguments('-D__counted_by(a)=', language : 'c') +endif + # specify -D__BSD_VISIBLE for FreeBSD if is_freebsd add_project_arguments('-D__BSD_VISIBLE', language: 'c') -- 2.55.0

