On Tue, Sep 24, 2019 at 5:40 AM David Howells <dhowe...@redhat.com> wrote: > > Linus Torvalds <torva...@linux-foundation.org> wrote: > > > In honesty, I actually do have one warning in my tree: > > > > samples/vfs/test-statx.c:24:15: warning: ‘struct foo’ declared > > inside parameter list > > Were there any note lines from the compiler associated with this? The warning > message can't actually be taking place on this line.
That's the only thing that gcc says. I agree that it's not where the problem occurs, but the gcc warning system tries to avoid warning inside system header files, so it seems to have logic tracing it back to the user. But I have system header files that look like this: /* Fill *BUF with information about PATH in DIRFD. */ int statx (int __dirfd, const char *__restrict __path, int __flags, unsigned int __mask, struct statx *__restrict __buf) __THROW __nonnull ((2, 5)); and I think that's the one that triggers. You must have hit *something* similar too, since the only reason for that #define statx foo #define statx_timestamp foo_timestamp #include <sys/stat.h> #undef statx #undef statx_timestamp is that you're playing games with the kernel 'statx' clashing with user 'statx' use. And what I think happens is that you had the <sys/types.h> include *without* that #define, so the 'struct statx' got declared there, and then in <sys/stat.h> it gets used, but it gets used as 'struct foo', so now the compiler complains (properly) that you're using this undeclared 'struct foo' in the function declaration, and because of namespace rules it's not the same thing as then a later 'struct foo' would be. Linus Linus