From octave-maintainers-request at bevo dot che dot wisc dot edu Sat Dec 9 01:33:01 2000 Subject: strptime? compiling CVS sources problem... From: "John W. Eaton" To: John Smith Cc: octave-maintainers at bevo dot che dot wisc dot edu Date: Sat, 9 Dec 2000 01:32:49 -0600 On 9-Dec-2000, John Smith wrote: | Hello, | | Compiling a CVS octave collected today, I generate this error | message | | gcc -c -I. -I../../octave/liboctave -I.. -I../liboctave -I../src | -I../libcruft/misc -I../../octave -I../../octave/liboctave | -I../../octave/src -I../../octave/libcruft/misc -I../../octave/glob | -I../glob -DHAVE_CONFIG_H -mieee-fp -g -O2 -Wall | ../../octave/liboctave/strptime.c -o strptime.o | ../../octave/liboctave/strptime.c: In function `strptime_internal': | ../../octave/liboctave/strptime.c:576: warning: implicit declaration of | function `localtime_r' | ../../octave/liboctave/strptime.c:576: warning: comparison between pointer | and integer | ../../octave/liboctave/strptime.c: In function `strptime': | ../../octave/liboctave/strptime.c:863: argument `buf' doesn't match | prototype | /usr/include/time.h:92: prototype declaration | | | Warning at 576: | The function localtime_r in /usr/include/time.h is protected by | | #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT) | | extern char* asctime_r __P((__const struct tm *, char *)); | extern char* ctime_r __P((__const time_t *, char *)); | extern struct tm* gmtime_r __P((__const time_t *, struct tm *)); | extern struct tm* localtime_r __P((__const time_t *, struct tm *)); | | #endif | and doesn't get declared. But config.h does set HAVE_LOCALTIME_R to 1. | I don't suppose it really matters... | | Error at 863: | The strptime in /usr/include/time.h is declared | | extern char * strptime __P ((char * __s, __const char * __fmt, | struct tm * __tm)); | | whereas in liboctave/strptime.c it appears as | | char * | strptime (buf, format, tm) | const char *buf; | const char *format; | struct tm *tm; | | which is enough different to trigger the error at line 863. | | The config.h contains | /* Define if you have the strptime function. */ | #define HAVE_STRPTIME 1 | | Is this supposed to have any effect, in the sense of only declaring | strptime if it doesn't already exist? | | I have a fairly ancient Linux system. Perhaps I should simply be told | to upgrade it. Perhaps. Please try the following patch and let me know if it solves the problem. Thanks, jwe 2000-12-09 John W. Eaton * strptime.c: Surround everything after including config.h in #ifndef HAVE_STRPTIME ... #endif. Index: strptime.c =================================================================== RCS file: /usr/local/cvsroot/octave/liboctave/strptime.c,v retrieving revision 1.3 diff -u -r1.3 strptime.c --- strptime.c 2000/02/01 10:07:26 1.3 +++ strptime.c 2000/12/09 07:32:13 at @ -27,6 +27,8 @@ # include #endif +#ifndef HAVE_STRPTIME + #include #ifdef _LIBC # include at @ -869,3 +871,5 @@ #endif return strptime_internal (buf, format, tm, &decided); } + +#endif