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: octave configure on cygwin snapshot


Marco Atzeri <marco_atzeri <at> yahoo.it> writes:

> Right assumption. This test is performed by configure
> to verify is gettimeofday have one or 2 arguments.
> As in the snapshot the program fail to compile,
> configure wrongly assume that gettimeofday have only
> one argument.

I'm not sure of any platforms where it has only one parameter; more often,
the portability problem is whether the parameter is void* (as required by 
POSIX) or something else (as was the case in cygwin 1.5.24).

> On 1.5.24 the program compile fine an gettimeofday 
> is reported as function with two arguments.
> 
> > 
> > > Why not show us the snippet of conftest.c that is
> > triggering the error
> > > message?
> > 

OK, I see the problem now.  Run the preprocessor on conftest.c:

$ gcc -E conftest.c |grep -n -C2 timezone
440-};
441-
442:struct timezone {
443-  int tz_minuteswest;
444-  int tz_dsttime;
--
817-__tzinfo_type *__attribute__((__cdecl__)) __gettzinfo (void);
818-# 118 "/usr/include/time.h" 3 4
819:extern __attribute__((dllimport)) long _timezone;
820-extern __attribute__((dllimport)) int _daylight;
821-extern __attribute__((dllimport)) char *_tzname[2];
--
1168-# 73 "/usr/include/sys/time.h" 3 4
1169-int __attribute__((__cdecl__)) gettimeofday (struct timeval *__p, void 
*__tz);
1170:int __attribute__((__cdecl__)) settimeofday (const struct timeval *, const 
struct _timezone *);
1171-int __attribute__((__cdecl__)) utimes (const char *__path, const struct 
timeval *__tvp);
1172-int __attribute__((__cdecl__)) getitimer (int __which, struct itimerval 
*__value);
--
1178-{
1179-struct timeval time;
1180:  struct _timezone dummy;
1181-  gettimeofday (&time, &dummy);
1182-  ;

Oops - this line in cygwin/time.h is causing the problem:

#define timezone _timezone

As your testcase shows, the inclusion of <sys/time.h> manages to define struct 
timezone, but then subsequent includes trigger the macro that changes the 
spelling to _timezone, and your declarations all end up referring to the 
incomplete type struct _timezone, hence the compiler error.  So something in 
cygwin's headers needs to change in order to make sure struct timezone is not 
hidden by the macro in <cygwin/time.h>.

A workaround in the meantime might be configuring with
CFLAGS=-Dtimezone=_timezone.

-- 
Eric Blake



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


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