bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] stat: port to xlc 12.01


From: Bruno Haible
Subject: Re: [PATCH] stat: port to xlc 12.01
Date: Sun, 25 Jun 2017 11:14:14 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-81-generic; KDE/5.18.0; x86_64; ; )

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  <address@hidden>

        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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]