bug-gnulib
[Top][All Lists]
Advanced

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

Re: ::gettimeofday' has not been declared - on cygwin


From: Paul Eggert
Subject: Re: ::gettimeofday' has not been declared - on cygwin
Date: Thu, 21 Mar 2013 16:30:16 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4

On 03/21/2013 01:42 PM, marco atzeri wrote:

> Sorry, it fails again.

Yes.  We're still making progress, though.
Can you please try the following patch instead?

(Tom, it's low priority to test this on Solaris,
as it affects only sys/time.h and the change
shouldn't matter on Solaris.)

Thanks.

>From 6e932aa0d8eb6eb600f36edb8700ca2edc41f490 Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Tue, 19 Mar 2013 09:08:47 -0700
Subject: [PATCH] sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to
 Cygwin

Problem reported by Marco Atzeri in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00000.html>.
* lib/sys_select.in.h [HAVE_SYS_SELECT_H && _CYGWIN_SYS_TIME_H]:
Simply delegate to the system <sys/select.h> in this case too.
Also, pay attention to _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H only
if OSF/1, since otherwise Cygwin breaks, and it doesn't seem to
be needed on Solaris either.
* lib/sys_time.in.h [_CYGWIN_SYS_TIME_H]:
Simply delgate to the system <sys/time.h> in this case.
---
 ChangeLog           | 13 +++++++++++++
 lib/sys_select.in.h | 16 ++++++++++------
 lib/sys_time.in.h   |  9 +++++++++
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 60dbe19..3843c33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2013-03-21  Paul Eggert  <address@hidden>
+
+       sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
+       Problem reported by Marco Atzeri in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00000.html>.
+       * lib/sys_select.in.h [HAVE_SYS_SELECT_H && _CYGWIN_SYS_TIME_H]:
+       Simply delegate to the system <sys/select.h> in this case too.
+       Also, pay attention to _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H only
+       if OSF/1, since otherwise Cygwin breaks, and it doesn't seem to
+       be needed on Solaris either.
+       * lib/sys_time.in.h [_CYGWIN_SYS_TIME_H]:
+       Simply delgate to the system <sys/time.h> in this case.
+
 2013-03-19  Karl Berry  <address@hidden>
 
        * build-aux/gnupload: check for erroneous (with gnupload) use of
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index 5a88d51..28a3dac 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -21,23 +21,27 @@
 
 /* On OSF/1 and Solaris 2.6, <sys/types.h> and <sys/time.h>
    both include <sys/select.h>.
+   On Cygwin, <sys/time.h> includes <sys/select.h>.
    Simply delegate to the system's header in this case.  */
 #if (@HAVE_SYS_SELECT_H@                                                \
-     && ((defined __osf__ && defined _SYS_TYPES_H_ && defined _OSF_SOURCE) \
+     && ((defined __osf__ && defined _SYS_TYPES_H_                      \
+          && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H         \
+          && defined _OSF_SOURCE)                                       \
          || (defined __sun && defined _SYS_TYPES_H                      \
              && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE)   \
-                 || defined __EXTENSIONS__)))                           \
-     && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H)
+                 || defined __EXTENSIONS__))))
 
 # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H
 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
 
 #elif (@HAVE_SYS_SELECT_H@                                              \
-       && ((defined __osf__ && defined _SYS_TIME_H_ && defined _OSF_SOURCE) \
+       && (defined _CYGWIN_SYS_TIME_H                                   \
+           || (defined __osf__ && defined _SYS_TIME_H_                  \
+               && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H    \
+               && defined _OSF_SOURCE)                                  \
            || (defined __sun && defined _SYS_TIME_H                     \
                && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
-                   || defined __EXTENSIONS__)))                         \
-       && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H)
+                   || defined __EXTENSIONS__))))
 
 # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
index 1e6392d..09c9601 100644
--- a/lib/sys_time.in.h
+++ b/lib/sys_time.in.h
@@ -24,6 +24,14 @@
 #endif
 @PRAGMA_COLUMNS@
 
+/* On Cygwin, <sys/time.h> includes itself recursively via <sys/select.h>.
+   Simply delegate to the system's header in this case; it is a no-op.
+   Without this extra ifdef, the C++ gettimeofday declaration below
+   would be a forward declaration in gnulib's nested <sys/time.h>.  */
+#ifdef _CYGWIN_SYS_TIME_H
+# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+#else
+
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_SYS_TIME_H@
 # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
@@ -200,4 +208,5 @@ _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable 
- "
 #endif
 
 #endif /* address@hidden@_SYS_TIME_H */
+#endif /* _CYGWIN_SYS_TIME_H */
 #endif /* address@hidden@_SYS_TIME_H */
-- 
1.7.11.7





reply via email to

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