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 20:58:04 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-81-generic; KDE/5.18.0; x86_64; ; )

Hi Paul,

> As things stand, we're likely to run into other porting 
> glitches on non-w32 platforms, due to compilers that complain about dummy 
> declarations or whatever.

Such hassles have not occurred with the other files that I mentioned
  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
Therefore I think it's very improbable that we run into a problem with
"typedef int dummy;". Unused typedefs are very frequent in C.

> wouldn't it be better if we compiled stat-w32.c only on w32 platforms? 

This is certainly possible (patch below). What we then have is a platform
condition coded at the configure level (based on $host_os from
AC_CANONICAL_HOST) and a platform condition coded in C (based on preprocessor
defines). The experience has taught me that it is a maintainability problem
to keep them in sync.
  - At some point Mac OS would be recognized through
      case "$host_os" in macos*
    Later one had to write
      case "$host_os" in darwin*
  - At some point native Windows would be recognized through
      case "$host_os" in mingw* | pw32*
    Now it seems to be only
      case "$host_os" in mingw*
When they are not in sync, the typical outcome is a build failure (link error).
So, now, I prefer to do these platform conditions at one level OR the other -
not both.

> people auditing builds have to deal with these compilations that do nothing.

Who is doing that? Which rules are these people applying to decide whether
something is problematic? I would guess that empty object files are perfectly
OK.

Bruno


diff --git a/modules/fstat b/modules/fstat
index 7a62c6a..e498941 100644
--- a/modules/fstat
+++ b/modules/fstat
@@ -19,7 +19,11 @@ configure.ac:
 gl_FUNC_FSTAT
 if test $REPLACE_FSTAT = 1; then
   AC_LIBOBJ([fstat])
-  AC_LIBOBJ([stat-w32])
+  case "$host_os" in
+    mingw*)
+      AC_LIBOBJ([stat-w32])
+      ;;
+  esac
   gl_PREREQ_FSTAT
 fi
 gl_SYS_STAT_MODULE_INDICATOR([fstat])
diff --git a/modules/stat b/modules/stat
index de9e7cd..8d9dfd0 100644
--- a/modules/stat
+++ b/modules/stat
@@ -20,7 +20,11 @@ configure.ac:
 gl_FUNC_STAT
 if test $REPLACE_STAT = 1; then
   AC_LIBOBJ([stat])
-  AC_LIBOBJ([stat-w32])
+  case "$host_os" in
+    mingw*)
+      AC_LIBOBJ([stat-w32])
+      ;;
+  esac
   gl_PREREQ_STAT
 fi
 gl_SYS_STAT_MODULE_INDICATOR([stat])




reply via email to

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