Next MinGW build issue:

Sylvain Beucler <b...@beuc.net> writes:

> $ make
> [...]
> DLL_EXPORT -DPIC -o .libs/libguile_la-stime.o
> cc1: warnings being treated as errors
> stime.c:85: warning: ‘tzname’ redeclared without dllimport attribute: 
> previous dllimport ignored
>
> I found 2 references to this issue:
> - http://cygwin.com/ml/cygwin/2008-01/msg00491.html
> => removed tzname
> - http://www.nabble.com/getdate-on-mingw:-tzname-problems-td14855896.html
> => use HAVE_DECL_TZNAME instead
>
> I used the 2nd option:
> # if !HAVE_DECL_TZNAME /* For SGI.  */
> extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
> #endif
> #if defined (__MINGW32__)
> # define tzname _tzname
> #endif

I don't understand this.  The second half of this section implies that
the MinGW build isn't going to reference a function called `tzname'
anyway (because it's going to use `_tzname' instead).  So why should a
MinGW build want any declaration of `tzname' at all?

And as far as a declaration of `_tzname' is concerned, there are no
more #includes after this, so we must have already got a declaration
of `_tzname' from one of the preceding includes.

Hence, and taking care not to alter the !__MINGW32__ behaviour:

#if defined (__MINGW32__)
# define tzname _tzname
#else
#ifndef tzname /* For SGI.  */
extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
#endif
#endif

This looks pretty clear and safe to me, so I'll push a commit
straightaway and see if it works in the overnight MinGW build.

Regards,
        Neil


Reply via email to