[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cygwin bugs in unistd
From: |
Eric Blake |
Subject: |
Re: cygwin bugs in unistd |
Date: |
Thu, 24 Dec 2009 06:42:54 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Eric Blake on 12/23/2009 9:17 PM:
> Hmm, looking at it further, it looks like we need to make all of our
> conditional #includes in the *.in.h files also be activated if
> GNULIB_POSIXCHECK is defined. I'll work on a followup patch for that.
These were the only includes that I found that were conditional on a
particular module being in use. In particular, I've tested that it lets
me run CFLAGS=-DGNULIB_POSIXCHECK on m4 under cygwin again (it was failing
because unlinkat was being overridden by the replacement unistd.h prior to
the inclusion of the (improper) declaration in the system stdio.h).
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkszb94ACgkQ84KuGfSFAYD4OQCfUKvi7lVZxvbNF/eKVohaCJIw
SpUAoIocfj2a6Xlct0diak9RgYQ/8Xxt
=dcdo
-----END PGP SIGNATURE-----
From 3435c222f524bcd5d7701cc46a7c01a3aa04dbbe Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Thu, 24 Dec 2009 06:01:43 -0700
Subject: [PATCH] build: pull in conditional headers during GNULIB_POSIXCHECK
Any time we conditionally include a header in order to satisfy
prerequisites of one module, we must also include that header
under GNULIB_POSIXCHECK to avoid compilation errors if that
module is not in use. If this is not done, then our link warning
override can occur before the system's declaration, which
causes a syntax error when the system header is finally included.
* lib/stdio.in.h (includes): Using GNULIB_POSIXCHECK also requires
definitions from any conditionally-included headers.
* lib/stdlib.in.h (includes): Likewise.
* lib/unistd.in.h (includes): Likewise.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 8 ++++++++
lib/stdio.in.h | 9 +++++----
lib/stdlib.in.h | 5 +++--
lib/unistd.in.h | 10 ++++++----
4 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8c4fe25..c8a7514 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-12-24 Eric Blake <address@hidden>
+
+ build: pull in conditional headers during GNULIB_POSIXCHECK
+ * lib/stdio.in.h (includes): Using GNULIB_POSIXCHECK also requires
+ definitions from any conditionally-included headers.
+ * lib/stdlib.in.h (includes): Likewise.
+ * lib/unistd.in.h (includes): Likewise.
+
2009-12-23 Eric Blake <address@hidden>
unistd: work around cygwin bug
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index a52f65f..55c36dd 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -39,10 +39,11 @@
#include <stdarg.h>
#include <stddef.h>
-#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
- || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
- || (@GNULIB_GETDELIM@ && address@hidden@) \
- || (@GNULIB_GETLINE@ && (address@hidden@ || @REPLACE_GETLINE@))
+#if ((@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
+ || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
+ || (@GNULIB_GETDELIM@ && address@hidden@) \
+ || (@GNULIB_GETLINE@ && (address@hidden@ || @REPLACE_GETLINE@)) \
+ || defined GNULIB_POSIXCHECK)
/* Get off_t and ssize_t. */
# include <sys/types.h>
#endif
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index d46f5c9..39dbc68 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -39,7 +39,7 @@
#include <stddef.h>
/* Solaris declares getloadavg() in <sys/loadavg.h>. */
-#if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@
+#if (@GNULIB_GETLOADAVG@ || defined GNULIB_GETLOADAVG) && @HAVE_SYS_LOADAVG_H@
# include <sys/loadavg.h>
#endif
@@ -49,7 +49,8 @@
# include <random.h>
#endif
-#if @GNULIB_RANDOM_R@ || address@hidden@
+#if (@GNULIB_RANDOM_R@ || address@hidden@ \
+ || defined GNULIB_POSIXCHECK)
# include <stdint.h>
#endif
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index d0188f5..1a11d1a 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -35,12 +35,12 @@
/* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
- || @GNULIB_SYMLINKAT@)
+ || @GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK)
# include <stdio.h>
#endif
/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
-#if @GNULIB_UNLINKAT@
+#if @GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK
# include <fcntl.h>
#endif
@@ -50,13 +50,15 @@
#include <stdlib.h>
/* mingw declares getcwd in <io.h>, not in <unistd.h>. */
-#if @GNULIB_GETCWD@ && ((defined _WIN32 || defined __WIN32__) && ! defined
__CYGWIN__)
+#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
+ && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
# include <io.h>
#endif
#if ((@GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@) \
|| (@GNULIB_READLINK@ && (address@hidden@ || @REPLACE_READLINK@)) \
- || (@GNULIB_READLINKAT@ && address@hidden@))
+ || (@GNULIB_READLINKAT@ && address@hidden@) \
+ || defined GNULIB_POSIXCHECK)
/* Get ssize_t. */
# include <sys/types.h>
#endif
--
1.6.4.2