summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2022-03-25 13:03:04 -0700
committerAlexei Starovoitov <ast@kernel.org>2022-03-28 20:00:11 -0700
commitccaff3d56acc47c257a99b2807b7c78a9467cf09 (patch)
treed1884831fa7aac73f5eceddc9d2b90fe894cddc3 /tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
parent9e928831113c64087fb173dd241fa97812e49490 (diff)
downloadlinux-ccaff3d56acc47c257a99b2807b7c78a9467cf09.tar.bz2
selftests/bpf: Fix clang compilation errors
llvm upstream patch ([1]) added to issue warning for code like void test() { int j = 0; for (int i = 0; i < 1000; i++) j++; return; } This triggered several errors in selftests/bpf build since compilation flag -Werror is used. ... test_lpm_map.c:212:15: error: variable 'n_matches' set but not used [-Werror,-Wunused-but-set-variable] size_t i, j, n_matches, n_matches_after_delete, n_nodes, n_lookups; ^ test_lpm_map.c:212:26: error: variable 'n_matches_after_delete' set but not used [-Werror,-Wunused-but-set-variable] size_t i, j, n_matches, n_matches_after_delete, n_nodes, n_lookups; ^ ... prog_tests/get_stack_raw_tp.c:32:15: error: variable 'cnt' set but not used [-Werror,-Wunused-but-set-variable] static __u64 cnt; ^ ... For test_lpm_map.c, 'n_matches'/'n_matches_after_delete' are changed to be volatile in order to silent the warning. I didn't remove these two declarations since they are referenced in a commented code which might be used by people in certain cases. For get_stack_raw_tp.c, the variable 'cnt' is removed. [1] https://reviews.llvm.org/D122271 Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20220325200304.2915588-1-yhs@fb.com
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c b/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
index e834a01de16a..16048978a1ef 100644
--- a/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
+++ b/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
@@ -29,11 +29,8 @@ static void get_stack_print_output(void *ctx, int cpu, void *data, __u32 size)
*/
struct get_stack_trace_t e;
int i, num_stack;
- static __u64 cnt;
struct ksym *ks;
- cnt++;
-
memset(&e, 0, sizeof(e));
memcpy(&e, data, size <= sizeof(e) ? size : sizeof(e));