[tz] [PATCH] Allow use of <direct.h> from Microsoft Windows to fix mkdir() parameters

Ian Abbott abbotti at mev.co.uk
Fri Feb 26 18:38:00 UTC 2016



On 26/02/2016 17:06, Paul Eggert wrote:
> On 02/26/2016 06:11 AM, Ian Abbott wrote:
>> It builds in a MinGW-w64 Win32 or Win64 environment with the following
>> command line:
>>
>> make CFLAGS="-DHAVE_SYS_WAIT_H=0 -DHAVE_DIRECT_H=1 -DHAVE_SYMLINK=0
>> -DHAVE_LINK=0 -DHAVE_LOCALTIME_R=0 -DHAVE_POSIX_DECLS=0"
>>
>
> Thanks, but why is the -DHAVE_POSIX_DECLS=0 argument needed? I was
> hoping that HAVE_POSIX_DECLS could have the default value under MS-Windows.

With -DHAVE_POSIX_DECLS=1, there were more warnings when compiling 
"localtime.c":


cc -DTZDIR=\"/usr/local/etc/zoneinfo\" -DHAVE_SYS_WAIT_H=0 
-DHAVE_SYMLINK=0 -DHAVE_LINK=0 -DHAVE_DIRECT_H=1 -DHAVE_LOCALTIME_R=0 
-DHAVE_POSIX_DECLS=1   -c -o localtime.o localtime.c
localtime.c:181:10: warning: 'tzname' redeclared without dllimport 
attribute: previous dllimport ignored [-Wattributes]
  char *   tzname[2] = {
           ^
localtime.c: In function 'ctime_r':
localtime.c:1703:16: warning: implicit declaration of function 
'asctime_r' [-Wimplicit-function-declaration]
    return tmp ? asctime_r(tmp, buf) : NULL;
                 ^
localtime.c:1703:36: warning: pointer/integer type mismatch in 
conditional expression
    return tmp ? asctime_r(tmp, buf) : NULL;
                                     ^


And the make failed when linking 'zdump':


cc -DTZDIR=\"/usr/local/etc/zoneinfo\" -o zdump -DHAVE_SYS_WAIT_H=0 
-DHAVE_SYMLINK=0 -DHAVE_LINK=0 -DHAVE_DIRECT_H=1 -DHAVE_LOCALTIME_R=0 
-DHAVE_POSIX_DECLS=1  zdump.o localtime.o asctime.o
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/lib/../lib/libmsvcrt.a(dsvfs00854.o):(.text+0x0): 
multiple definition of `tzname'
localtime.o:localtime.c:(.data+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
Makefile:416: recipe for target 'zdump' failed
make: *** [zdump] Error 1


>> I still get the warnings about the dllimport attribute on 'tzname'.
>
> Sorry, I forgot to avoid redefinition of tzname. Fixed in the attached
> patch, which I've installed on GitHub. This still assumes you're
> compiling without setting HAVE_POSIX_DECLS, though, so possibly we need
> further changes.

That's better.  It builds with -DHAVE_POSIX_DECLS=1 now, but there are 
still warnings due to the implicit declaration of 'asctime_r' when 
compiling "localtime.c" (see above for the actual warnings).  Those 
warnings go away if I add '-DHAVE_INCOMPATIBLE_CTIME_R=1' to CFLAGS.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-


More information about the tz mailing list