This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gettimeofday not defined

Hi Stephen,

On Jun 19 19:30, Stephen Sheldon wrote:
> Sometime in the past several months MPlayer stopped compiling for Cygwin.  There
> was a complaint about gettimeofday not being defined.  The failing file did
> include sys/time.h, which contains a definition.  I found one similar report
> on the Cygwin mailing list.  I noticed that MPlayer was putting the macro
> "-D_ISOC99_SOURCE=1" on the gcc command line.  I replaced it with
> "-D_DEFAULT_SOURCE=1" and MPlayer compiled.  It also works without any
> ...SOURCE.
> Here is a small test case to show the problem:
> //#define _ISOC99_SOURCE 1
> #define _DEFAULT_SOURCE 1
> #include <sys/time.h>
> int main() {
>     struct timeval start;
>     gettimeofday(&start, NULL);
> }
> It compiles with _DEFAULT_SOURCE or without any ...SOURCE. I hope someone can
> examine the very complicated #if statements in sys/feature.h and sys/time.h
> and tell me that whether I should raise the issue  with the MPLayer folks or
> not.

As you might know, the feature test macros in newlib/Cygwin have
been heaviliy revamped to be more aligned with standards.

I examined sys/time.h and it turned out that gettimeofday was
accidentally guarded with __MISC_VISIBLE || __XSI_VISIBLE, while
it's not guarded at all in GLibc.  I fixed that in git so this
will be fixed in the (very soon) upcoming next Cygwin release.

Thanks for the report,

Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]