On dropping -D_REENTRANT -D_THREAD_SAFE

Simon Josefsson simon at josefsson.org
Sun Jan 6 15:17:05 CET 2008


Nikos Mavrogiannopoulos <nmav at gnutls.org> writes:

> On Friday 04 January 2008, Simon Josefsson wrote:
>> For a long time configure.in has contained:
>>
>> dnl In order to use the reentrant libc functions.
>> dnl I hope it is portable enough.
>> CFLAGS="${CFLAGS} -D_REENTRANT -D_THREAD_SAFE"
>
> I believe these flags are used in solaris. Probably older systems
> require them too.

But does it have any effect for any functions we actually use?
libgnutls* uses very few POSIX/C89 functions that have thread-issues,
the only one I could find was that we use gmtime_r.

I checked on a solaris 5.10 machine, and the _REENTRANT symbol enables
prototypes for some functions like getlogin_r, ttyname_r, rand_r, and
actually also gmtime_r.  However, the gmtime_r prototype, and most other
prototypes, are also always declared if !_STRICT_STDC:

#if defined(__EXTENSIONS__) || \
        (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
        (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
extern struct tm *gmtime_r(const time_t *_RESTRICT_KYWD,
                        struct tm *_RESTRICT_KYWD);

So I think we are safe.  To make sure, I'll build the latest daily
snapshot and build it on this machine now..

/Simon





More information about the Gnutls-devel mailing list