Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ static void test_lpm_order(void)
static void test_lpm_map(int keysize)
{
LIBBPF_OPTS(bpf_map_create_opts, opts, .map_flags = BPF_F_NO_PREALLOC);
volatile size_t n_matches, n_matches_after_delete;
/* To avoid a -Wunused-but-set-variable warning. */
__maybe_unused volatile size_t n_matches, n_matches_after_delete;
size_t i, j, n_nodes, n_lookups;
struct tlpm_node *t, *list = NULL;
struct bpf_lpm_trie_key_u8 *key;
Expand Down
3 changes: 2 additions & 1 deletion tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ static void tp_subtest(struct test_bpf_cookie *skel)

static void burn_cpu(void)
{
volatile int j = 0;
/* To avoid a -Wunused-but-set-variable warning. */
__maybe_unused volatile int j = 0;
cpu_set_t cpu_set;
int i, err;

Expand Down
3 changes: 2 additions & 1 deletion tools/testing/selftests/bpf/prog_tests/find_vma.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ static bool find_vma_pe_condition(struct find_vma *skel)
static void test_find_vma_pe(struct find_vma *skel)
{
struct bpf_link *link = NULL;
volatile int j = 0;
/* To avoid a -Wunused-but-set-variable warning. */
__maybe_unused volatile int j = 0;
int pfd, i;
const int one_bn = 1000000000;

Expand Down
3 changes: 2 additions & 1 deletion tools/testing/selftests/bpf/prog_tests/perf_branches.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ static void test_perf_branches_common(int perf_fd,
int err, i, duration = 0;
bool detached = false;
struct bpf_link *link;
volatile int j = 0;
/* To avoid a -Wunused-but-set-variable warning. */
__maybe_unused volatile int j = 0;
cpu_set_t cpu_set;

skel = test_perf_branches__open_and_load();
Expand Down
3 changes: 2 additions & 1 deletion tools/testing/selftests/bpf/prog_tests/perf_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

static void burn_cpu(void)
{
volatile int j = 0;
/* To avoid a -Wunused-but-set-variable warning. */
__maybe_unused volatile int j = 0;
cpu_set_t cpu_set;
int i, err;

Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/bpf/test_maps.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <linux/compiler.h>

#define CHECK(condition, tag, format...) ({ \
int __ret = !!(condition); \
Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/bpf/test_progs.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/types.h>
typedef __u16 __sum16;
#include <arpa/inet.h>
#include <linux/compiler.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
#include <linux/ip.h>
Expand Down
Loading