The following error occurred when building the tests for kselftest.
$ make headers
$ make -C tools/testing/selftests
...
gcc -O2 -W -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wstrict-prototypes -Wswitch-default -Wundef -Wwrite-strings -Wformat -Wno-type-limits -Wstrict-aliasing=3 -Wshadow -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ -I/disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/ -I/disk/workspaces/rvck/tools/testing/selftests/hid/tools/include -I/disk/workspaces/rvck/kernel/bpf/ -I/disk/workspaces/rvck/tools/include -I/disk/workspaces/rvck/tools/include/uapi -g -O0 -DUSE_LIBCAP /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/btf.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/btf_dumper.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/cfg.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/cgroup.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/common.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/feature.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/gen.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/iter.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/json_writer.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/link.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/main.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/map.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/map_perf_ring.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/net.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/netlink_dumper.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/perf.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/pids.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/prog.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/struct_ops.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/tracelog.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/xlated_dumper.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/disasm.o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/libbpf/libbpf.a -lelf -lz -lcap -o /disk/workspaces/rvck/tools/testing/selftests/hid/tools/build/bpftool/bpftool
GEN vmlinux.h
CLNG-BPF hid.bpf.o
In file included from progs/hid.c:6:
progs/hid_bpf_helpers.h:9:38: error: declaration of 'struct hid_bpf_ctx' will not be visible outside of this function [-Werror,-Wvisibility]
9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx,
| ^
progs/hid.c:23:35: error: incompatible pointer types passing 'struct hid_bpf_ctx *' to parameter of type 'struct hid_bpf_ctx *' [-Werror,-Wincompatible-pointer-types]
23 | __u8 *rw_data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 3 /* size */);
| ^~~~~~~
progs/hid_bpf_helpers.h:9:51: note: passing argument to parameter 'ctx' here
9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx,
| ^
progs/hid.c:32:16: error: incomplete definition of type 'struct hid_bpf_ctx'
32 | return hid_ctx->size;
| ~~~~~~~^
progs/hid_bpf_helpers.h:13:15: note: forward declaration of 'struct hid_bpf_ctx'
13 | extern struct hid_bpf_ctx *hid_bpf_allocate_context(unsigned int hid_id) __ksym;
| ^
progs/hid.c:38:35: error: incompatible pointer types passing 'struct hid_bpf_ctx *' to parameter of type 'struct hid_bpf_ctx *' [-Werror,-Wincompatible-pointer-types]
38 | __u8 *rw_data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4 /* size */);
| ^~~~~~~
progs/hid_bpf_helpers.h:9:51: note: passing argument to parameter 'ctx' here
9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx,
| ^
progs/hid.c:45:16: error: incomplete definition of type 'struct hid_bpf_ctx'
45 | return hid_ctx->size;
| ~~~~~~~^
progs/hid_bpf_helpers.h:13:15: note: forward declaration of 'struct hid_bpf_ctx'
13 | extern struct hid_bpf_ctx *hid_bpf_allocate_context(unsigned int hid_id) __ksym;
| ^
progs/hid.c:51:35: error: incompatible pointer types passing 'struct hid_bpf_ctx *' to parameter of type 'struct hid_bpf_ctx *' [-Werror,-Wincompatible-pointer-types]
51 | __u8 *rw_data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 3 /* size */);
| ^~~~~~~
progs/hid_bpf_helpers.h:9:51: note: passing argument to parameter 'ctx' here
9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx,
| ^
progs/hid.c:66:27: error: use of undeclared identifier 'HID_BPF_FLAG_INSERT_HEAD'
66 | ctx->insert_head ? HID_BPF_FLAG_INSERT_HEAD :
| ^
progs/hid.c:67:13: error: use of undeclared identifier 'HID_BPF_FLAG_NONE'
67 | HID_BPF_FLAG_NONE);
| ^
progs/hid.c:144:32: error: incompatible pointer types passing 'struct hid_bpf_ctx *' to parameter of type 'struct hid_bpf_ctx *' [-Werror,-Wincompatible-pointer-types]
144 | __u8 *data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4096 /* size */);
| ^~~~~~~
progs/hid_bpf_helpers.h:9:51: note: passing argument to parameter 'ctx' here
9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx,
| ^
progs/hid.c:163:32: error: incompatible pointer types passing 'struct hid_bpf_ctx *' to parameter of type 'struct hid_bpf_ctx *' [-Werror,-Wincompatible-pointer-types]
163 | __u8 *data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4 /* size */);
| ^~~~~~~
progs/hid_bpf_helpers.h:9:51: note: passing argument to parameter 'ctx' here
9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx,
| ^
progs/hid.c:180:32: error: incompatible pointer types passing 'struct hid_bpf_ctx *' to parameter of type 'struct hid_bpf_ctx *' [-Werror,-Wincompatible-pointer-types]
180 | __u8 *data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4 /* size */);
| ^~~~~~~
progs/hid_bpf_helpers.h:9:51: note: passing argument to parameter 'ctx' here
9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx,
| ^
progs/hid.c:197:32: error: incompatible pointer types passing 'struct hid_bpf_ctx *' to parameter of type 'struct hid_bpf_ctx *' [-Werror,-Wincompatible-pointer-types]
197 | __u8 *data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4 /* size */);
| ^~~~~~~
progs/hid_bpf_helpers.h:9:51: note: passing argument to parameter 'ctx' here
9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx,
| ^
12 errors generated.
make[1]: *** [Makefile:230: /disk/workspaces/rvck/tools/testing/selftests/hid/hid.bpf.o] Error 1
make[1]: Leaving directory '/disk/workspaces/rvck/tools/testing/selftests/hid'
...
The following error occurred when building the tests for kselftest.