public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* gettimeofday not defined
@ 2016-06-19 21:51 Stephen Sheldon
  2016-06-20 12:58 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Sheldon @ 2016-06-19 21:51 UTC (permalink / raw)
  To: cygwin

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.



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: gettimeofday not defined
  2016-06-19 21:51 gettimeofday not defined Stephen Sheldon
@ 2016-06-20 12:58 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2016-06-20 12:58 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1593 bytes --]

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

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-20  8:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-19 21:51 gettimeofday not defined Stephen Sheldon
2016-06-20 12:58 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).