On Mon, 2024-07-22 at 22:54 -0700, Tony Ambardar wrote:
> Add a "bpf_util.h" include to avoid the following error seen
> compiling for
> mips64el with musl libc:
>
> bench.c: In function 'find_benchmark':
> bench.c:590:25: error: implicit declaration of function
> 'ARRAY_SIZE' [-Werror=implicit-function-declaration]
> 590 | for (i = 0; i < ARRAY_SIZE(benchs); i++) {
> | ^~~~~~~~~~
> cc1: all warnings being treated as errors
I'm curious why this error doesn't occur on other platforms. ARRAY_SIZE
is actually defined in linux/kernel.h (tools/include/linux/kernel.h). I
think you should find out why this file is not included on your
platform.
>
> Fixes: 8e7c2a023ac0 ("selftests/bpf: Add benchmark runner
> infrastructure")
> Signed-off-by: Tony Ambardar <[email protected]>
> ---
> tools/testing/selftests/bpf/bench.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/bpf/bench.c
> b/tools/testing/selftests/bpf/bench.c
> index 627b74ae041b..90dc3aca32bd 100644
> --- a/tools/testing/selftests/bpf/bench.c
> +++ b/tools/testing/selftests/bpf/bench.c
> @@ -10,6 +10,7 @@
> #include <sys/sysinfo.h>
> #include <signal.h>
> #include "bench.h"
> +#include "bpf_util.h"
> #include "testing_helpers.h"
>
> struct env env = {