Skip to content

Commit ba02de1

Browse files
yonghong-songAlexei Starovoitov
authored andcommitted
selftests/bpf: fix a compilation error
I hit the following compilation error with gcc 4.8.5. prog_tests/flow_dissector.c: In function ‘test_flow_dissector’: prog_tests/flow_dissector.c:155:2: error: ‘for’ loop initial declarations are only allowed in C99 mode for (int i = 0; i < ARRAY_SIZE(tests); i++) { ^ prog_tests/flow_dissector.c:155:2: note: use option -std=c99 or -std=gnu99 to compile your code Let us fix the issue by avoiding this particular c99 feature. Fixes: a5cb334 ("selftests/bpf: make flow dissector tests more extensible") Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 193d000 commit ba02de1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎tools/testing/selftests/bpf/prog_tests/flow_dissector.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ struct test tests[] = {
143143
void test_flow_dissector(void)
144144
{
145145
struct bpf_object *obj;
146-
int err, prog_fd;
146+
int i, err, prog_fd;
147147

148148
err = bpf_flow_load(&obj, "./bpf_flow.o", "flow_dissector",
149149
"jmp_table", &prog_fd);
@@ -152,7 +152,7 @@ void test_flow_dissector(void)
152152
return;
153153
}
154154

155-
for (int i = 0; i < ARRAY_SIZE(tests); i++) {
155+
for (i = 0; i < ARRAY_SIZE(tests); i++) {
156156
struct bpf_flow_keys flow_keys;
157157
struct bpf_prog_test_run_attr tattr = {
158158
.prog_fd = prog_fd,

0 commit comments

Comments
 (0)