Hi Paul, > diff --git a/lib/stat-w32.c b/lib/stat-w32.c > index b4c762c..022d01c 100644 > --- a/lib/stat-w32.c > +++ b/lib/stat-w32.c > @@ -18,13 +18,15 @@ > > #include <config.h> > > +/* Include this on all platforms, so that the compilation unit is nonempty. > */ > +#include <sys/types.h> > + > #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ > > /* Ensure that <windows.h> defines FILE_ID_INFO. */ > #undef _WIN32_WINNT > #define _WIN32_WINNT _WIN32_WINNT_WIN8 > > -#include <sys/types.h> > #include <sys/stat.h> > #include <errno.h> > #include <limits.h>
I prefer the generic idiom 'typedef int dummy;' instead, because: 1) It's generic (i.e. looks the same in all files that need it), and we're already using it in lib/argp-pin.c lib/canonicalize-lgpl.c lib/dummy.c lib/float.c lib/getcwd-lgpl.c lib/glthread/threadlib.c lib/lstat.c lib/math.c lib/pthread.c lib/sys_socket.c lib/u64.c lib/unistd.c 2) The <sys/types.h> include here really belongs together with <sys/stat.h>. 2017-06-25 Bruno Haible <br...@clisp.org> stat: Improve last change. * lib/stat-w32.c: Revert last change. Use generic idiom instead. diff --git a/lib/stat-w32.c b/lib/stat-w32.c index 022d01c..237e2aa 100644 --- a/lib/stat-w32.c +++ b/lib/stat-w32.c @@ -18,15 +18,13 @@ #include <config.h> -/* Include this on all platforms, so that the compilation unit is nonempty. */ -#include <sys/types.h> - #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* Ensure that <windows.h> defines FILE_ID_INFO. */ #undef _WIN32_WINNT #define _WIN32_WINNT _WIN32_WINNT_WIN8 +#include <sys/types.h> #include <sys/stat.h> #include <errno.h> #include <limits.h> @@ -414,4 +412,10 @@ _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf) } } +#else + +/* This declaration is solely to ensure that after preprocessing + this file is never empty. */ +typedef int dummy; + #endif