Note: this problem doesn't cause my any immediate problem, but it breaks the daily build on Mac. I don't think it is important to work on fixing this, but someone finds it interesting.
There appears to be a ttyname_r signature bug, see: http://autobuild.josefsson.org/gnulib/log-201004250717723515000.txt g++ -DHAVE_CONFIG_H -I. -DGNULIB_STRICT_CHECKING=1 -I. -I. -I.. -I./.. -I../gllib -I./../gllib -I/opt/local/include -MT test-fcntl-h-c++.o -MD -MP -MF $depbase.Tpo -c -o test-fcntl-h-c++.o test-fcntl-h-c++.cc &&\ mv -f $depbase.Tpo $depbase.Po ../gllib/unistd.h:1463: error: invalid conversion from 'char* (*)(int, char*, size_t)' to 'int (*)(int, char*, size_t)' make[4]: *** [test-fcntl-h-c++.o] Error 1 The relevant code and the 1463 line is: ,---- | #if 1 | /* Store at most BUFLEN characters of the pathname of the terminal FD is | open on in BUF. Return 0 on success, otherwise an error number. */ | # if !1 | _GL_FUNCDECL_SYS (ttyname_r, int, | (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); | # endif > _GL_CXXALIAS_SYS (ttyname_r, int, | (int fd, char *buf, size_t buflen)); | _GL_CXXALIASWARN (ttyname_r); | #elif defined GNULIB_POSIXCHECK | # undef ttyname_r | # if HAVE_RAW_DECL_TTYNAME_R | _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " | "use gnulib module ttyname_r for portability"); | # endif | #endif `---- /usr/include/unistd.h contains: #if __DARWIN_UNIX03 int ttyname_r(int, char *, size_t) __DARWIN_ALIAS(ttyname_r); #else /* !__DARWIN_UNIX03 */ char *ttyname_r(int, char *, size_t); #endif /* __DARWIN_UNIX03 */ So it seems ttyname_r on older Mac OS X versions returned char*. Should we define __DARWIN_UNIX03? I'm not sure how well supported that is. /usr/include/sys/cdefs.h contains: /* * The __DARWIN_ALIAS macros is used to do symbol renaming, * they allow old code to use the old symbol thus maintiang binary * compatability while new code can use a new improved version of the * same function. * * By default newly complied code will actually get the same symbols * that the old code did. Defining any of _APPLE_C_SOURCE, _XOPEN_SOURCE, * or _POSIX_C_SOURCE will give you the new symbols. Defining _XOPEN_SOURCE * or _POSIX_C_SOURCE also restricts the avilable symbols to a subset of * Apple's APIs. * * __DARWIN_ALIAS is used by itself if the function signature has not * changed, it is used along with a #ifdef check for __DARWIN_UNIX03 * if the signature has changed. Because the __LP64__ enviroment * only supports UNIX03 sementics it causes __DARWIN_UNIX03 to be * defined, but causes __DARWIN_ALIAS to do no symbol mangling. */ #if !defined(__DARWIN_UNIX03) #if defined(_APPLE_C_SOURCE) || defined(_XOPEN_SOURCE) || defined(_POSIX_C_SOURCE) || defined(__LP64_ _) #if defined(_NONSTD_SOURCE) #error "Can't define both _NONSTD_SOURCE and any of _APPLE_C_SOURCE, _XOPEN_SOURCE, _POSIX_C_SOURCE, or __LP64__" #endif /* _NONSTD_SOURCE */ #define __DARWIN_UNIX03 1 #elif defined(_NONSTD_SOURCE) #define __DARWIN_UNIX03 0 #else /* default */ #define __DARWIN_UNIX03 0 #endif /* _APPLE_C_SOURCE || _XOPEN_SOURCE || _POSIX_C_SOURCE || __LP64__ */ #endif /* !__DARWIN_UNIX03 */ #if __DARWIN_UNIX03 && !defined(__LP64__) #define __DARWIN_ALIAS(sym) __asm("_" __STRING(sym) "$UNIX2003") #else #define __DARWIN_ALIAS(sym) #endif Maybe we want to define _APPLE_C_SOURCE? I'm doing a gnulib build with that flag enabled now to see if it fixes anything. /Simon
