bug-gnulib
[Top][All Lists]
Advanced

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

getdate on mingw: tzname problems


From: Simon Josefsson
Subject: getdate on mingw: tzname problems
Date: Wed, 16 Jan 2008 00:00:40 +0100
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

Compiling getdate on mingw32:

getdate.y: In function 'get_date':
getdate.y:1325: warning: 'tzname' redeclared without dllimport attribute: 
previous dllimport ignored

Linking fails:

Info: resolving _tzname by linking to __imp__tzname (auto-import)
Creating library file: .libs/libshishi.dll.a
fu000001.o:(.idata$2+0xc): undefined reference to `_libmoldname_a_iname'
fu000002.o:(.idata$2+0xc): undefined reference to `_libmoldname_a_iname'
nmth000000.o:(.idata$4+0x0): undefined reference to `__nm__tzname'
collect2: ld returned 1 exit status
make[3]: *** [libshishi.la] Error 1

getdate.y:1325 reads:

# ifndef tzname
    extern char *tzname[];
# endif

tzname is declared in in time.h, although exactly which prototype is
used I'm not sure, but this could be it:

/* CRTDLL is royally messed up when it comes to these macros.
   TODO: import and alias these via oldnames import library instead 
   of macros.  */
#define daylight        _daylight
/* NOTE: timezone not defined as macro because it would conflict with
   struct timezone in sys/time.h.
   Also, tzname used to a be macro, but now it's in moldname. */
__MINGW_IMPORT char     *tzname[2];

Anyway, as far as I can tell, nothing says that tzname has to be a
#define.  OpenGroup spec says it should be 'extern char *tzname[2];':

http://www.opengroup.org/onlinepubs/009695399/functions/tzname.html

Is there any platform where tzname isn't defined in time.h?  If not, I
would suggest this patch:

diff --git a/gl/getdate.y b/gl/getdate.y
index 1ed914f..8de85d0 100644
--- a/gl/getdate.y
+++ b/gl/getdate.y
@@ -1321,9 +1321,6 @@ get_date (struct timespec *result, char const *p, struct 
timespec const *now)
 #else
 #if HAVE_TZNAME
   {
-# ifndef tzname
-    extern char *tzname[];
-# endif
     int i;
     for (i = 0; i < 2; i++)
       {

If there are platforms that doesn't declare tzname properly, I suppose
we should detect that using AC_CHECK_DECLS and work around it in the
time-h module.

Thoughts?

Maybe we could apply the patch, and wait for bug reports.  Then we will
find out which platform lacks a proper tztime prototype.

/Simon




reply via email to

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