Skip to content

Commit c3eeaae

Browse files
keestorvalds
authored andcommitted
samples/vfs: avoid warning in statx override
Something changed recently to uncover this warning: samples/vfs/test-statx.c:24:15: warning: `struct foo' declared inside parameter list will not be visible outside of this definition or declaration 24 | #define statx foo | ^~~ Which is due the use of "struct statx" (here, "struct foo") in a function prototype argument list before it has been defined: int # 56 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h" foo # 56 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h" 3 4 (int __dirfd, const char *__restrict __path, int __flags, unsigned int __mask, struct # 57 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h" foo # 57 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h" 3 4 *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 5))); Add explicit struct before #include to avoid warning. Fixes: f1b5618 ("vfs: Add a sample program for the new mount API") Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Miklos Szeredi <[email protected]> Cc: Al Viro <[email protected]> Cc: David Howells <[email protected]> Link: http://lkml.kernel.org/r/202006282213.C516EA6@keescook Signed-off-by: Linus Torvalds <[email protected]>
1 parent 1139d33 commit c3eeaae

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

samples/vfs/test-statx.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include <linux/fcntl.h>
2424
#define statx foo
2525
#define statx_timestamp foo_timestamp
26+
struct statx;
27+
struct statx_timestamp;
2628
#include <sys/stat.h>
2729
#undef statx
2830
#undef statx_timestamp

0 commit comments

Comments
 (0)