Commit 544d6adf authored by Yonghong Song's avatar Yonghong Song Committed by Alexei Starovoitov

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: default avatarYonghong Song <yhs@fb.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201006043427.1891805-1-yhs@fb.com
parent 9618bde4
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <linux/unistd.h> #include <linux/unistd.h>
#include <linux/compiler.h>
#include <linux/bpf.h> #include <linux/bpf.h>
#include <bpf/bpf.h> #include <bpf/bpf.h>
...@@ -483,7 +484,7 @@ int main(int argc, char **argv) ...@@ -483,7 +484,7 @@ int main(int argc, char **argv)
"Option -%c requires an argument.\n\n", "Option -%c requires an argument.\n\n",
optopt); optopt);
case 'h': case 'h':
fallthrough; __fallthrough;
default: default:
Usage(); Usage();
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment