This is the mail archive of the newlib@sourceware.cygnus.com mailing list for the newlib project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hallo! I have made some changes to newlib-1.8.1 in order to make some non-reentrant functions reentrant (asctime, localtime, strtok, rand, srand, w_gamma, w_lgamma, wf_gamma and wf_lgamma). Because these changes do affect the layout of the 'struct reent', I have guarded them by a preprocessor macro '_COMPATIBLE_STRUCT_REENT' (I believe this should be a configure-parameter, but I do not know how to introduce one). Another set of changes defines some initialised variables/structures as const in order to save space in multithreaded systems with shared text segments. I append the patch. Please let me know if you are willing to apply it to your sources and if some additional action is required by me. -jr -------------------------------------------------------------------------- Dr. Johannes Reisinger System Design FREQUENTIS A-1120 Wien, Spittelbreitengasse 34 http://www.frequentis.com Tel: +43/1/8100606-329, Fax -399 mailto:jreising@frequentis.com --------------------------------------------------------------------------
diff -r -c newlib.orig/ChangeLog newlib.patched/ChangeLog *** newlib.orig/ChangeLog Mon Jun 1 17:51:07 1998 --- newlib.patched/ChangeLog Thu Sep 24 15:38:12 1998 *************** *** 1,3 **** --- 1,45 ---- + Thu Sep 24 15:20:05 1998 Johannes Reisinger <jreising@frequentis.com> + + * libc/include/sys/reent.h: add variables _rand_next, _strtok_last, + _asctime_buf, _localtime_buf and _gamma_signgam to struct reent + to make rand/srand, strtok, asctime, localtime, w_gamma, + w_lgamma, wf_gamma, and wf_lgamma reentrant. Remove unneeded + elements _nextf and _nmalloc from the struct reent. + * libc/include/time.h: move definition of struct tm to sys/reent.h. + * libc/include/sys/config.h: #undef _COMPATIBLE_STRUCT_REENT. + This should possibly be a configure-parameter + (-enable-compatible-struct-reent?) + * libc/stdlib/rand.c: don't emit functions 'rand' and 'srand' if + '_REENT_ONLY' is set. Use variable '_rand_next' from struct reent + instead of static variable 'next' if '_COMPATIBLE_STRUCT_REENT' + is not defined. + * libc/stdlib/strtok.c: Use variable '_strtok_last' from struct reent + instead of static variable 'last' if '_COMPATIBLE_STRUCT_REENT' + is not defined. + * libc/stdlib/asctime.c: Use variable '_asctime_buf' from + struct reent instead of static variable 'buf' if + '_COMPATIBLE_STRUCT_REENT' is not defined. + * libc/stdlib/lcltime.c: Use variable '_localtime_buf' from + struct reent instead of static variable 'tim_s' if + '_COMPATIBLE_STRUCT_REENT' is not defined. + * libm/math/s_signgam.c: don't define variable 'signgam' unless + '_COMPATIBLE_STRUCT_REENT' is defined + * libm/math/w_gamma.c: Use variable '_gamma_signgam' from + struct reent instead of global variable 'signgam' if + '_COMPATIBLE_STRUCT_REENT' is not defined. + * libm/math/w_lgamma.c: Likewise. + * libm/math/wf_gamma.c: Likewise. + * libm/math/wf_lgamma.c: Likewise. + * libc/include/unctrl.h: define arrays __unctrl and __unctrllen + to be const. + * libc/include/unctrl.c: define arrays __unctrl and __unctrllen + to be const. + * libc/stdio/vfprintf.c: define arrays 'blanks' and 'zeroes' + to be const. + * libc/stdlib/mbtowc_r.c: define arraya 'JIS_state_table' and + 'JIS_action_table' to be const. + * libm/math/s_lib_ver.c: define variable _LIB_VERSION to be const. + Fri May 29 03:04:29 1998 Geoffrey Noer <noer@cygnus.com> * libc/include/sys/fcntl.h: add _close proto for Cygwin32 diff -r -c newlib.orig/libc/include/math.h newlib.patched/libc/include/math.h *** newlib.orig/libc/include/math.h Sat May 30 00:02:42 1998 --- newlib.patched/libc/include/math.h Wed Sep 23 14:08:22 1998 *************** *** 254,260 **** #define _LIB_VERSION_TYPE enum __fdlibm_version #define _LIB_VERSION __fdlib_version ! extern _LIB_VERSION_TYPE _LIB_VERSION; #define _IEEE_ __fdlibm_ieee #define _SVID_ __fdlibm_svid --- 254,260 ---- #define _LIB_VERSION_TYPE enum __fdlibm_version #define _LIB_VERSION __fdlib_version ! extern _CONST _LIB_VERSION_TYPE _LIB_VERSION; #define _IEEE_ __fdlibm_ieee #define _SVID_ __fdlibm_svid diff -r -c newlib.orig/libc/include/sys/config.h newlib.patched/libc/include/sys/config.h *** newlib.orig/libc/include/sys/config.h Mon Jun 1 17:49:15 1998 --- newlib.patched/libc/include/sys/config.h Thu Sep 24 15:17:22 1998 *************** *** 1,6 **** --- 1,8 ---- #ifndef __SYS_CONFIG_H__ #define __SYS_CONFIG_H__ + #undef _COMPATIBLE_STRUCT_REENT + /* exceptions first */ /* ??? Why is much of this stuff duplicated with machine/ieeefp.h? */ #if defined(__H8300__) || defined(__H8500__) || defined (__H8300H__) || defined(__W65__) || defined (__H8300S__) diff -r -c newlib.orig/libc/include/sys/reent.h newlib.patched/libc/include/sys/reent.h *** newlib.orig/libc/include/sys/reent.h Sat May 30 00:02:45 1998 --- newlib.patched/libc/include/sys/reent.h Thu Sep 24 13:50:16 1998 *************** *** 12,17 **** --- 12,30 ---- #include <_ansi.h> + struct tm + { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + }; + struct _glue { struct _glue *_next; *************** *** 157,168 **** --- 170,189 ---- int _cvtlen; /* should be size_t */ char *_cvtbuf; + #ifdef _COMPATIBLE_STRUCT_REENT /* Two next two fields were once used by malloc. They are no longer used. I'm leaving them here for now in case there really is a binary compatibility issue. */ #define _N_LISTS 30 unsigned char * _nextf[_N_LISTS]; unsigned int _nmalloc[_N_LISTS]; + #else /* _COMPATIBLE_STRUCT_REENT */ + unsigned int _rand_next; + char * _strtok_last; + char _asctime_buf[26]; + struct tm _localtime_buf; + int _gamma_signgam; + #endif /* _COMPATIBLE_STRUCT_REENT */ /* atexit stuff */ struct _atexit *_atexit; /* points to head of LIFO stack */ diff -r -c newlib.orig/libc/include/time.h newlib.patched/libc/include/time.h *** newlib.orig/libc/include/time.h Sat May 30 00:02:43 1998 --- newlib.patched/libc/include/time.h Thu Sep 24 13:48:24 1998 *************** *** 34,51 **** #define __time_t_defined #endif ! struct tm ! { ! int tm_sec; ! int tm_min; ! int tm_hour; ! int tm_mday; ! int tm_mon; ! int tm_year; ! int tm_wday; ! int tm_yday; ! int tm_isdst; ! }; clock_t _EXFUN(clock, (void)); double _EXFUN(difftime, (time_t _time2, time_t _time1)); --- 34,46 ---- #define __time_t_defined #endif ! /* ! * <sys/reent.h> defines struct tm ! * They must be defined there because struct _reent needs them (and we don't ! * want reent.h to include this file. ! */ ! ! #include <sys/reent.h> clock_t _EXFUN(clock, (void)); double _EXFUN(difftime, (time_t _time2, time_t _time1)); diff -r -c newlib.orig/libc/include/unctrl.h newlib.patched/libc/include/unctrl.h *** newlib.orig/libc/include/unctrl.h Sat May 30 00:02:43 1998 --- newlib.patched/libc/include/unctrl.h Thu Sep 24 13:51:16 1998 *************** *** 35,44 **** #ifndef _UNCTRL_H_ #define _UNCTRL_H_ #define unctrl(c) __unctrl[(c) & 0xff] #define unctrllen(ch) __unctrllen[(ch) & 0xff] ! extern char *__unctrl[256]; /* Control strings. */ ! extern char __unctrllen[256]; /* Control strings length. */ #endif /* _UNCTRL_H_ */ --- 35,46 ---- #ifndef _UNCTRL_H_ #define _UNCTRL_H_ + #include <_ansi.h> + #define unctrl(c) __unctrl[(c) & 0xff] #define unctrllen(ch) __unctrllen[(ch) & 0xff] ! extern _CONST char *__unctrl[256]; /* Control strings. */ ! extern _CONST char __unctrllen[256]; /* Control strings length. */ #endif /* _UNCTRL_H_ */ diff -r -c newlib.orig/libc/misc/unctrl.c newlib.patched/libc/misc/unctrl.c *** newlib.orig/libc/misc/unctrl.c Sat May 30 00:03:11 1998 --- newlib.patched/libc/misc/unctrl.c Wed Sep 23 14:19:27 1998 *************** *** 68,78 **** * SUCH DAMAGE. */ ! #ifndef lint static char sccsid[] = "@(#)unctrl.c 8.1 (Berkeley) 6/4/93"; ! #endif /* not lint */ ! char *__unctrl[256] = { "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", "^H", "^I", "^J", "^K", "^L", "^M", "^N", "^O", "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W", --- 68,79 ---- * SUCH DAMAGE. */ ! #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)unctrl.c 8.1 (Berkeley) 6/4/93"; ! #endif /* LIBC_SCCS and not lint */ ! #include <_ansi.h> ! _CONST char * _CONST __unctrl[256] = { "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", "^H", "^I", "^J", "^K", "^L", "^M", "^N", "^O", "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W", *************** *** 108,114 **** "0xf8", "0xf9", "0xfa", "0xfb", "0xfc", "0xfd", "0xfe", "0xff", }; ! char __unctrllen[256] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, --- 109,115 ---- "0xf8", "0xf9", "0xfa", "0xfb", "0xfc", "0xfd", "0xfe", "0xff", }; ! _CONST char __unctrllen[256] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, diff -r -c newlib.orig/libc/stdio/vfprintf.c newlib.patched/libc/stdio/vfprintf.c *** newlib.orig/libc/stdio/vfprintf.c Sat May 30 00:03:22 1998 --- newlib.patched/libc/stdio/vfprintf.c Wed Sep 23 13:20:06 1998 *************** *** 315,323 **** * below longer. */ #define PADSIZE 16 /* pad chunk size */ ! static char blanks[PADSIZE] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '}; ! static char zeroes[PADSIZE] = {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'}; /* --- 315,323 ---- * below longer. */ #define PADSIZE 16 /* pad chunk size */ ! static _CONST char blanks[PADSIZE] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '}; ! static _CONST char zeroes[PADSIZE] = {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'}; /* diff -r -c newlib.orig/libc/stdlib/mbtowc_r.c newlib.patched/libc/stdlib/mbtowc_r.c *** newlib.orig/libc/stdlib/mbtowc_r.c Sat May 30 00:03:31 1998 --- newlib.patched/libc/stdlib/mbtowc_r.c Wed Sep 23 13:18:29 1998 *************** *** 15,21 **** * is 2 (switch to JIS) + 2 (JIS characters) + 2 (switch back to ASCII) = 6. *************************************************************************************/ ! static JIS_STATE JIS_state_table[JIS_S_NUM][JIS_C_NUM] = { /* ESCAPE DOLLAR BRACKET AT B J NUL JIS_CHAR OTHER */ /* ASCII */ { A_ESC, DONE, DONE, DONE, DONE, DONE, DONE, DONE, DONE }, /* A_ESC */ { DONE, A_ESC_DL, DONE, DONE, DONE, DONE, DONE, DONE, DONE }, --- 15,21 ---- * is 2 (switch to JIS) + 2 (JIS characters) + 2 (switch back to ASCII) = 6. *************************************************************************************/ ! static _CONST JIS_STATE JIS_state_table[JIS_S_NUM][JIS_C_NUM] = { /* ESCAPE DOLLAR BRACKET AT B J NUL JIS_CHAR OTHER */ /* ASCII */ { A_ESC, DONE, DONE, DONE, DONE, DONE, DONE, DONE, DONE }, /* A_ESC */ { DONE, A_ESC_DL, DONE, DONE, DONE, DONE, DONE, DONE, DONE }, *************** *** 29,35 **** /* J2_ESC_BR*/{ INV, INV, INV, INV, DONE, DONE, INV, INV, INV }, }; ! static JIS_ACTION JIS_action_table[JIS_S_NUM][JIS_C_NUM] = { /* ESCAPE DOLLAR BRACKET AT B J NUL JIS_CHAR OTHER */ /* ASCII */ { NOOP, COPY_A, COPY_A, COPY_A, COPY_A, COPY_A, EMPTY, COPY_A, COPY_A}, /* A_ESC */ { COPY_A, NOOP, COPY_A, COPY_A, COPY_A, COPY_A, COPY_A, COPY_A, COPY_A}, --- 29,35 ---- /* J2_ESC_BR*/{ INV, INV, INV, INV, DONE, DONE, INV, INV, INV }, }; ! static _CONST JIS_ACTION JIS_action_table[JIS_S_NUM][JIS_C_NUM] = { /* ESCAPE DOLLAR BRACKET AT B J NUL JIS_CHAR OTHER */ /* ASCII */ { NOOP, COPY_A, COPY_A, COPY_A, COPY_A, COPY_A, EMPTY, COPY_A, COPY_A}, /* A_ESC */ { COPY_A, NOOP, COPY_A, COPY_A, COPY_A, COPY_A, COPY_A, COPY_A, COPY_A}, diff -r -c newlib.orig/libc/stdlib/rand.c newlib.patched/libc/stdlib/rand.c *** newlib.orig/libc/stdlib/rand.c Sat May 30 00:03:32 1998 --- newlib.patched/libc/stdlib/rand.c Wed Sep 23 09:59:24 1998 *************** *** 64,81 **** --- 64,97 ---- <<rand>> requires no supporting OS subroutines. */ + #ifndef _REENT_ONLY + #include <stdlib.h> + #include <reent.h> + #ifdef _COMPATIBLE_STRUCT_REENT static unsigned int next = 1; + #endif void _DEFUN (srand, (seed), unsigned int seed) { + #ifdef _COMPATIBLE_STRUCT_REENT next = seed; + #else + _REENT->_rand_next = seed; + #endif } int _DEFUN_VOID (rand) { + #ifdef _COMPATIBLE_STRUCT_REENT return ((next = next * 1103515245 + 12345) & RAND_MAX); + #else + return ((_REENT->_rand_next = _REENT->_rand_next * 1103515245 + 12345 ) + & RAND_MAX ); + #endif } + + #endif /* _REENT_ONLY */ diff -r -c newlib.orig/libc/string/strtok.c newlib.patched/libc/string/strtok.c *** newlib.orig/libc/string/strtok.c Sat May 30 00:03:37 1998 --- newlib.patched/libc/string/strtok.c Wed Sep 23 10:09:48 1998 *************** *** 62,67 **** --- 62,70 ---- #include <string.h> #include <_ansi.h> + #ifndef _COMPATIBLE_STRUCT_REENT + #include <reent.h> + #endif #ifndef _REENT_ONLY *************** *** 70,76 **** --- 73,83 ---- register char *s _AND register const char *delim) { + #ifdef _COMPATIBLE_STRUCT_REENT static char *last; return strtok_r (s, delim, &last); + #else + return strtok_r (s, delim, &(_REENT->_strtok_last)); + #endif } #endif diff -r -c newlib.orig/libc/time/asctime.c newlib.patched/libc/time/asctime.c *** newlib.orig/libc/time/asctime.c Sat May 30 00:04:48 1998 --- newlib.patched/libc/time/asctime.c Wed Sep 23 13:56:30 1998 *************** *** 48,53 **** --- 48,57 ---- */ #include <time.h> + #include <_ansi.h> + #ifndef _COMPATIBLE_STRUCT_REENT + #include <reent.h> + #endif #ifndef _REENT_ONLY *************** *** 55,61 **** --- 59,69 ---- _DEFUN (asctime, (tim_p), _CONST struct tm *tim_p) { + #ifdef _COMPATIBLE_STRUCT_REENT static char buf[26]; + #else + char *buf = _REENT->_asctime_buf; + #endif return asctime_r (tim_p, buf); } diff -r -c newlib.orig/libc/time/lcltime.c newlib.patched/libc/time/lcltime.c *** newlib.orig/libc/time/lcltime.c Sat May 30 00:04:48 1998 --- newlib.patched/libc/time/lcltime.c Wed Sep 23 13:59:30 1998 *************** *** 43,48 **** --- 43,51 ---- */ #include <time.h> + #ifndef _COMPATIBLE_STRUCT_REENT + #include <reent.h> + #endif #ifndef _REENT_ONLY *************** *** 50,57 **** --- 53,64 ---- _DEFUN (localtime, (tim_p), _CONST time_t * tim_p) { + #ifdef _COMPATIBLE_STRUCT_REENT static struct tm tim_s; return localtime_r (tim_p, &tim_s); + #else + return localtime_r (tim_p, &(_REENT -> _localtime_buf)); + #endif } #endif diff -r -c newlib.orig/libm/math/s_lib_ver.c newlib.patched/libm/math/s_lib_ver.c *** newlib.orig/libm/math/s_lib_ver.c Sat May 30 00:05:02 1998 --- newlib.patched/libm/math/s_lib_ver.c Wed Sep 23 13:39:43 1998 *************** *** 21,35 **** * define and initialize _LIB_VERSION */ #ifdef _POSIX_MODE ! _LIB_VERSION_TYPE _LIB_VERSION = _POSIX_; #else #ifdef _XOPEN_MODE ! _LIB_VERSION_TYPE _LIB_VERSION = _XOPEN_; #else #ifdef _SVID3_MODE ! _LIB_VERSION_TYPE _LIB_VERSION = _SVID_; #else /* default _IEEE_MODE */ ! _LIB_VERSION_TYPE _LIB_VERSION = _IEEE_; #endif #endif #endif --- 21,35 ---- * define and initialize _LIB_VERSION */ #ifdef _POSIX_MODE ! _CONST _LIB_VERSION_TYPE _LIB_VERSION = _POSIX_; #else #ifdef _XOPEN_MODE ! _CONST _LIB_VERSION_TYPE _LIB_VERSION = _XOPEN_; #else #ifdef _SVID3_MODE ! _CONST _LIB_VERSION_TYPE _LIB_VERSION = _SVID_; #else /* default _IEEE_MODE */ ! _CONST _LIB_VERSION_TYPE _LIB_VERSION = _IEEE_; #endif #endif #endif diff -r -c newlib.orig/libm/math/s_signgam.c newlib.patched/libm/math/s_signgam.c *** newlib.orig/libm/math/s_signgam.c Sat May 30 00:05:04 1998 --- newlib.patched/libm/math/s_signgam.c Wed Sep 23 13:46:44 1998 *************** *** 1 **** --- 1,5 ---- + #include <_ansi.h> + + #ifdef _COMPATIBLE_STRUCT_REENT int signgam = 0; + #endif diff -r -c newlib.orig/libm/math/w_gamma.c newlib.patched/libm/math/w_gamma.c *** newlib.orig/libm/math/w_gamma.c Sat May 30 00:05:11 1998 --- newlib.patched/libm/math/w_gamma.c Wed Sep 23 13:50:41 1998 *************** *** 132,137 **** --- 132,140 ---- */ #include "fdlibm.h" + #ifndef _COMPATIBLE_STRUCT_REENT + #include <reent.h> + #endif #include <errno.h> #ifndef _DOUBLE_IS_32BITS *************** *** 144,154 **** --- 147,165 ---- #endif { #ifdef _IEEE_LIBM + #ifdef _COMPATIBLE_STRUCT_REENT return __ieee754_gamma_r(x,&signgam); #else + return __ieee754_gamma_r(x,&(_REENT->_gamma_signgam)); + #endif + #else double y; struct exception exc; + #ifdef _COMPATIBLE_STRUCT_REENT y = __ieee754_gamma_r(x,&signgam); + #else + y = __ieee754_gamma_r(x,&(_REENT->_gamma_signgam)); + #endif if(_LIB_VERSION == _IEEE_) return y; if(!finite(y)&&finite(x)) { #ifndef HUGE_VAL diff -r -c newlib.orig/libm/math/w_lgamma.c newlib.patched/libm/math/w_lgamma.c *** newlib.orig/libm/math/w_lgamma.c Sat May 30 00:05:12 1998 --- newlib.patched/libm/math/w_lgamma.c Wed Sep 23 13:52:51 1998 *************** *** 19,24 **** --- 19,27 ---- */ #include "fdlibm.h" + #ifndef _COMPATIBLE_STRUCT_REENT + #include <reent.h> + #endif #include <errno.h> #ifndef _DOUBLE_IS_32BITS *************** *** 31,41 **** --- 34,52 ---- #endif { #ifdef _IEEE_LIBM + #ifdef _COMPATIBLE_STRUCT_REENT return __ieee754_lgamma_r(x,&signgam); #else + return __ieee754_lgamma_r(x,&(_REENT->_gamma_signgam)); + #endif + #else double y; struct exception exc; + #ifdef _COMPATIBLE_STRUCT_REENT y = __ieee754_lgamma_r(x,&signgam); + #else + y = __ieee754_lgamma_r(x,&(_REENT->_gamma_signgam)); + #endif if(_LIB_VERSION == _IEEE_) return y; if(!finite(y)&&finite(x)) { #ifndef HUGE_VAL diff -r -c newlib.orig/libm/math/wf_gamma.c newlib.patched/libm/math/wf_gamma.c *** newlib.orig/libm/math/wf_gamma.c Sat May 30 00:05:15 1998 --- newlib.patched/libm/math/wf_gamma.c Wed Sep 23 13:53:13 1998 *************** *** 15,20 **** --- 15,23 ---- */ #include "fdlibm.h" + #ifndef _COMPATIBLE_STRUCT_REENT + #include <reent.h> + #endif #include <errno.h> #ifdef __STDC__ *************** *** 25,35 **** --- 28,46 ---- #endif { #ifdef _IEEE_LIBM + #ifdef _COMPATIBLE_STRUCT_REENT return __ieee754_gammaf_r(x,&signgam); #else + return __ieee754_gammaf_r(x,&(_REENT->_gamma_signgam)); + #endif + #else float y; struct exception exc; + #ifdef _COMPATIBLE_STRUCT_REENT y = __ieee754_gammaf_r(x,&signgam); + #else + y = __ieee754_gammaf_r(x,&(_REENT->_gamma_signgam)); + #endif if(_LIB_VERSION == _IEEE_) return y; if(!finitef(y)&&finitef(x)) { #ifndef HUGE_VAL diff -r -c newlib.orig/libm/math/wf_lgamma.c newlib.patched/libm/math/wf_lgamma.c *** newlib.orig/libm/math/wf_lgamma.c Sat May 30 00:05:15 1998 --- newlib.patched/libm/math/wf_lgamma.c Wed Sep 23 13:53:29 1998 *************** *** 15,20 **** --- 15,23 ---- */ #include "fdlibm.h" + #ifndef _COMPATIBLE_STRUCT_REENT + #include <reent.h> + #endif #include <errno.h> #ifdef __STDC__ *************** *** 25,35 **** --- 28,46 ---- #endif { #ifdef _IEEE_LIBM + #ifdef _COMPATIBLE_STRUCT_REENT return __ieee754_lgammaf_r(x,&signgam); #else + return __ieee754_lgammaf_r(x,&(_REENT->_gamma_signgam)); + #endif + #else float y; struct exception exc; + #ifdef _COMPATIBLE_STRUCT_REENT y = __ieee754_lgammaf_r(x,&signgam); + #else + y = __ieee754_lgammaf_r(x,&(_REENT->_gamma_signgam)); + #endif if(_LIB_VERSION == _IEEE_) return y; if(!finitef(y)&&finitef(x)) { #ifndef HUGE_VAL