bug-gnulib
[Top][All Lists]
Advanced

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

gettimeofday module on cygwin


From: Eric Blake
Subject: gettimeofday module on cygwin
Date: Thu, 05 Jul 2007 07:02:40 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.12) Gecko/20070509 Thunderbird/1.5.0.12 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

When configuring with -Werror, the gettimeofday module decides that
cygwin's gettimeofday is non-compliant because a warning is made fatal:

configure:13103: checking for gettimeofday with POSIX signature
configure:13135: gcc -std=gnu99 -c -gdwarf-2 -Wall -Werror  conftest.c >&5
conftest.c: In function `main':
conftest.c:109: warning: initialization from incompatible pointer type

where cygwin provides:
int gettimeofday (struct timeval *__p, struct timezone *__z);

This later leads to problems, since cygwin's <sys/time.h> declares struct
timeval, then includes <sys/select.h>, which in turn includes <sys/time.h>
to guarantee struct timeval is declared no matter which header was
included first.  But once gnulib has decided that cygwin needs the
replacement, it turns into the following:

include ./sys/time.h
 first time, so...
 include_next /usr/include/sys/time.h
  declare struct timeval
  include /usr/include/sys/select.h
   include ./sys/time.h
   second time, so...
   define gettimeofday rpl_gettimeofday
   declare gettimeofday (struct timeval*, void*);
  declare gettimeofday (struct timeval*, struct timezone*)

leading to this error:

In file included from ./sys/time.h:26,
                 from gettimeofday.c:25:
/usr/include/sys/time.h:73: error: conflicting types for 'rpl_gettimeofday'
./sys/time.h:45: error: previous declaration of 'rpl_gettimeofday' was here
/usr/include/sys/time.h:73: error: conflicting types for 'rpl_gettimeofday'
./sys/time.h:45: error: previous declaration of 'rpl_gettimeofday' was here

(why gcc 3.4.4 prints the error twice is an independent issue; hopefully
it has been resolved in newer gcc)

At any rate, is it necessary that gettimeofday.m4 insist that gettimeofday
have void* as the type of the second parameter?  If so, we need to come up
with a way to work around the inclusion cycle on cygwin, such that when
<sys/select.h> pulls in <sys/time.h>, the cygwin header still declares
gettimeofday rather than a conflicting rpl_gettimeofday.  Without -Werror,
gnulib does not create ./sys/time.h, so this problem does not surface.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGjOvv84KuGfSFAYARAnKfAKDIkT9oWxIpa6eTnWxU2CXiMn/9FQCdEY3j
QTx6Zb+JojtULTUc5ncmK6E=
=/E5A
-----END PGP SIGNATURE-----




reply via email to

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