ctime_r on OS X

Roman Leshchinskiy rl at cse.unsw.edu.au
Wed Sep 5 02:05:06 EDT 2007


Hi all,

validate still doesn't pass on OS X with SRC_CC_OPTS += -Werror. Now the 
error is:

RtsUtils.c: In function 'time_str':

RtsUtils.c:328:0:
      warning: implicit declaration of function 'ctime_r'

The problem is that in /usr/include/time.h, we have

#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE)
...
char *ctime_r(const time_t *, char *);
...
#endif

Is it ok to remove the PosixSource.h include from RtsUtils or do we want 
a better solution?

As an aside, it is IMO a bit problematic to use AC_CHECK_FUNCS if we are 
passing -Werror to gcc since it only checks if the function exists in a 
library but not whether it has a prototype. Perhaps checking for the 
existence of a (correct) prototype would be better?

Roman



More information about the Cvs-ghc mailing list