Skip to content

Commit

Permalink
samples/bpf: replace meaningless counter with tracex4
Browse files Browse the repository at this point in the history
Currently, compiling samples/bpf with LLVM warns about the unused but
set variable with tracex4_user.

    ./samples/bpf/tracex4_user.c:54:14:
    warning: variable 'i' set but not used [-Wunused-but-set-variable]
        int map_fd, i, j = 0;
                    ^
                    1 warning generated.

This commit resolve this compiler warning by replacing the meaningless
counter.

Signed-off-by: Daniel T. Lee <[email protected]>
Acked-by: Yonghong Song <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Martin KaFai Lau <[email protected]>
  • Loading branch information
DanielTimLee authored and Martin KaFai Lau committed Dec 19, 2022
1 parent 13aa2a9 commit 71135b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions samples/bpf/tracex4_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int main(int ac, char **argv)
struct bpf_program *prog;
struct bpf_object *obj;
char filename[256];
int map_fd, i, j = 0;
int map_fd, j = 0;

snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
obj = bpf_object__open_file(filename, NULL);
Expand Down Expand Up @@ -82,7 +82,7 @@ int main(int ac, char **argv)
j++;
}

for (i = 0; ; i++) {
while (1) {
print_old_objects(map_fd);
sleep(1);
}
Expand Down

0 comments on commit 71135b7

Please sign in to comment.