Skip to content

Commit 1cc8fb4

Browse files
yonghong-songkernel-patches-bot
authored andcommitted
samples/bpf: fix a compilation error with fallthrough marking
Compiling samples/bpf hits an error related to fallthrough marking. ... CC samples/bpf/hbm.o samples/bpf/hbm.c: In function ‘main’: samples/bpf/hbm.c:486:4: error: ‘fallthrough’ undeclared (first use in this function) fallthrough; ^~~~~~~~~~~ The "fallthrough" is not defined under tools/include directory. Rather, it is "__fallthrough" is defined in linux/compiler.h. Including "linux/compiler.h" and using "__fallthrough" fixed the issue. Signed-off-by: Yonghong Song <[email protected]>
1 parent d4b57a7 commit 1cc8fb4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

samples/bpf/hbm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <errno.h>
4141
#include <fcntl.h>
4242
#include <linux/unistd.h>
43+
#include <linux/compiler.h>
4344

4445
#include <linux/bpf.h>
4546
#include <bpf/bpf.h>
@@ -483,7 +484,7 @@ int main(int argc, char **argv)
483484
"Option -%c requires an argument.\n\n",
484485
optopt);
485486
case 'h':
486-
fallthrough;
487+
__fallthrough;
487488
default:
488489
Usage();
489490
return 0;

0 commit comments

Comments
 (0)