« Return to Thread: "dir" crashing oactve 3.2.0/mingw32

Re: "dir" crashing oactve 3.2.0/mingw32

by Benjamin Lindner :: Rate this Message:

Reply to Author | View in Thread

>
> just back from holiday and catching up on unread emails.
> thanks for the fix, it's of course the right thing to do.
>
> benjamin
>

Hmm, the patch introduces a regression when building both 3.2.x and
current development tip.
At linking stage of liboctave ld.exe fails with missing symbols related
to tzname.

I found that liboctave/strftime.c declares

#if HAVE_TZNAME
extern OCTAVE_IMPORT char *tzname[];
#endif

However, on mingw32, tzname[] is declared in <time.h> which is included
by liboctave/strftime.c. The specific declaration in <time.h> does not
match the one in strftime.c and I suppose the declaration in <time.h> is
hidden by the declaration in strftime.c.

There is a config.h preprocessor macro HAVE_DECL_TZNAME, which according
to config.h is defined if a tzname declaration is present. So the
double-declaration is redundant and in the case of mingw32 breaks linking.

My suggestion is to change strftime.c to

#if HAVE_TZNAME && !HAVE_DECL_TZNAME
extern OCTAVE_IMPORT char *tzname[];
#endif

as the attached changeset does.

benjamin


# HG changeset patch
# User Benjamin Lindner <lindnerb@...>
# Date 1250187632 -7200
# Node ID fba4a85c73af16413b28ae284c4d897f3f23d961
# Parent  8cf7b375ad6f0428fc99a8ed1b99f82db99b03a5
skip double declaration of tztime

diff -r 8cf7b375ad6f -r fba4a85c73af liboctave/strftime.c
--- a/liboctave/strftime.c Thu Aug 13 19:24:34 2009 +0200
+++ b/liboctave/strftime.c Thu Aug 13 20:20:32 2009 +0200
@@ -49,7 +49,7 @@
 # endif
 #endif
 
-#if HAVE_TZNAME
+#if HAVE_TZNAME && !HAVE_DECL_TZNAME
 extern OCTAVE_IMPORT char *tzname[];
 #endif
 

 « Return to Thread: "dir" crashing oactve 3.2.0/mingw32