diff options
author | Earnie Boyd <earnie@users.sf.net> | 2001-12-05 15:01:06 +0000 |
---|---|---|
committer | Earnie Boyd <earnie@users.sf.net> | 2001-12-05 15:01:06 +0000 |
commit | 98a05abd051b2ad32ba227e7b2fa4dfbc733b728 (patch) | |
tree | 6916a53c587cf1a579803782ce6ef18eef789a0b | |
parent | ff1924262ad41c8e69916eebd19c1969c7b23fdb (diff) | |
download | newlib-98a05abd051b2ad32ba227e7b2fa4dfbc733b728.zip newlib-98a05abd051b2ad32ba227e7b2fa4dfbc733b728.tar.gz newlib-98a05abd051b2ad32ba227e7b2fa4dfbc733b728.tar.bz2 |
Merge MinGW CVS differences
41 files changed, 357 insertions, 147 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 614c77a..950fc16 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -2,14 +2,73 @@ * include/strings.h: New File. +2001-12-02 Danny Smith <dannysmith@users.sourceforge.net> + + Apply patches from: + 2001-06-21 Mumit Khan <khan@nanotech.wisc.edu> + + * include/math.h (_FPCLASS* ): Add defines from float.h. + (IEEE recommended functions): Add declarations from float.h. + * include/float.h (_FPCLASS* ): Protect against redefinition. + +2001-11-29 Wu Yongwei <adah@netstd.com> + + * include/_mingw.h,assert.h,conio.h,ctype.h,dir.h,direct.h + dirent.h,dos.h,errno.h,excpt.h,fcntl.h,float.h,io.h, + limits.h,locale.h,malloc.h,math.h,process.h,setjmp.h, + share.h,signal.h,stdarg.h,stddef.h,stdint.h,stdio.h, + stdlib.h,string.h,tchar.h,time.h,varargs.h,wchar.h, + wctype.h,sys/stat.h,sys/timeb.h,sys/types.h,sys/utime.h: + Correct spelling of "disclaimed" in comments. + * include/excpt.h: Another spelling correction. + 2001-11-08 Robert Collins <rbtcollins@hotmail.com> * include/errno.h: Fix "errno is not a prototype" warning. +2001-11-07 Danny Smith <dannysmith@users.sourceforge.net> + + * include/ctype.h (tolower, toupper,_tolower,_toupper): Comment + differences between ANSI and non-ANSI versions. + (_ctype[],_pctype): Declare vars. + (__ISCTYPE): New helper macro using _pctype. + (is* ctype functions): Use __ISCTYPE to define inline versions. + (_toupper, _tolower, __isascii, __toascii, __iscsym, __iscsymf): + Inline definitions. + (isw* ctype functions): Inline definitions. + * include/wctype.h (_ctype[],_pctype): Declare vars. + (isw* ctype functions): Inline definitions. + + +2001-11-06 Danny Smith <dannysmith@users.sourceforge.net> + + * include/float.h (_clearfp, _statusfp, _fpreset, fpreset, + __fpecode): Use __STDC__ prototypes. + + +2001-11-06 Thomas Pfaff <tpfaff@gmx.net> + + * mthr_stub.c (__mingwthr_remove_key_dtor) New. + * mthr_init.c (DllMain) Run dtors if a process terminates. + * mthr.c (__mingwthr_add_key_dtor) Removed. + (___mingwthr_add_key_dtor) New. + (___mingwthr_remove_key_dtor) New. + (__mingwthr_run_key_dtors) Complete rewrite. + (__mingwthr_remove_key_dtor) New. + 2001-11-05 Egor Duda <deo@logos-m.ru> * Makefile.in: Delete unused executable after creating base-files. +2001-11-06 Danny Smith <dannysmith@users.sourceforge.net> + + * include/errno.h (_errno): Use __STDC__ prototype. + Thanks to: Jim Barton. + +2001-11-04 "stefan" <stefan@lkcc.org> + + * include/sys/locking.h (_LK_UNLCK, LK_UNLCK): Correct names. + 2001-10-30 Danny Smith <dannysmith@users.sourceforge.net> * include/io.h (_commit): Add declaration. diff --git a/winsup/mingw/include/_mingw.h b/winsup/mingw/include/_mingw.h index b3ad039..e6fa7dd 100644 --- a/winsup/mingw/include/_mingw.h +++ b/winsup/mingw/include/_mingw.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * */ diff --git a/winsup/mingw/include/assert.h b/winsup/mingw/include/assert.h index 3c3ceaa..07a7d1f 100644 --- a/winsup/mingw/include/assert.h +++ b/winsup/mingw/include/assert.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/conio.h b/winsup/mingw/include/conio.h index f4fa731..4e8d55a 100644 --- a/winsup/mingw/include/conio.h +++ b/winsup/mingw/include/conio.h @@ -16,7 +16,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/ctype.h b/winsup/mingw/include/ctype.h index e58b153..bc7c60d 100644 --- a/winsup/mingw/include/ctype.h +++ b/winsup/mingw/include/ctype.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ @@ -44,10 +44,10 @@ #define _UPPER 0x0001 #define _LOWER 0x0002 #define _DIGIT 0x0004 -#define _SPACE 0x0008 +#define _SPACE 0x0008 /* HT LF VT FF CR SP */ #define _PUNCT 0x0010 #define _CONTROL 0x0020 -#define _BLANK 0x0040 +#define _BLANK 0x0040 /* this is SP only, not SP and HT as in C99 */ #define _HEX 0x0080 #define _LEADBYTE 0x8000 @@ -71,26 +71,28 @@ int isspace(int); int isupper(int); int isxdigit(int); -#ifndef __STRICT_ANSI__ +#ifndef __STRICT_ANSI__ int _isctype (int, int); #endif +/* These are the ANSI versions, with correct checking of argument */ int tolower(int); int toupper(int); /* * NOTE: The above are not old name type wrappers, but functions exported - * explicitly by CRTDLL. However, underscored versions are also exported. + * explicitly by MSVCRT/CRTDLL. However, underscored versions are also + * exported. */ #ifndef __STRICT_ANSI__ +/* + * These are the cheap non-std versions: The return values are undefined + * if the argument is not ASCII char or is not of appropriate case + */ int _tolower(int); int _toupper(int); #endif -#ifndef WEOF -#define WEOF (wchar_t)(0xFFFF) -#endif - /* Also defined in stdlib.h */ #ifndef MB_CUR_MAX # ifdef __MSVCRT__ @@ -102,12 +104,64 @@ int _toupper(int); # endif /* not __MSVCRT */ #endif /* MB_CUR_MAX */ +__MINGW_IMPORT unsigned short _ctype[]; +#ifdef __MSVCRT__ +__MINGW_IMPORT unsigned short* _pctype; +#else /* CRTDLL */ +__MINGW_IMPORT unsigned short* _pctype_dll; +#define _pctype _pctype_dll +#endif + +/* + * Use inlines here rather than macros, because macros will upset + * C++ usage (eg, ::isalnum), and so usually get undefined + * + * According to standard for SB chars, these function are defined only + * for input values representable by unsigned char or EOF. + * Thus, there is no range test. + * This reproduces behaviour of MSVCRT.dll lib implemention for SB chars. + * + * If no MB char support is needed, these can be simplified even + * more by command line define -DMB_CUR_MAX=1. The compiler will then + * optimise away the constant condition. + */ + + +#if ! (defined (__NO_CTYPE_INLINES) || defined (__STRICT_ANSI__ )) +/* use simple lookup if SB locale, else _isctype() */ +#define __ISCTYPE(c, mask) (MB_CUR_MAX == 1 ? (_pctype[c] & mask) : _isctype(c, mask)) +extern __inline__ int isalnum(int c) {return __ISCTYPE(c, (_ALPHA|_DIGIT));} +extern __inline__ int isalpha(int c) {return __ISCTYPE(c, _ALPHA);} +extern __inline__ int iscntrl(int c) {return __ISCTYPE(c, _CONTROL);} +extern __inline__ int isdigit(int c) {return __ISCTYPE(c, _DIGIT);} +extern __inline__ int isgraph(int c) {return __ISCTYPE(c, (_PUNCT|_ALPHA|_DIGIT));} +extern __inline__ int islower(int c) {return __ISCTYPE(c, _LOWER);} +extern __inline__ int isprint(int c) {return __ISCTYPE(c, (_BLANK|_PUNCT|_ALPHA|_DIGIT));} +extern __inline__ int ispunct(int c) {return __ISCTYPE(c, _PUNCT);} +extern __inline__ int isspace(int c) {return __ISCTYPE(c, _SPACE);} +extern __inline__ int isupper(int c) {return __ISCTYPE(c, _UPPER);} +extern __inline__ int isxdigit(int c) {return __ISCTYPE(c, _HEX);} + +/* these reproduce behaviour of lib underscored versions */ +extern __inline__ int _tolower(int c) {return ( c -'A'+'a');} +extern __inline__ int _toupper(int c) {return ( c -'a'+'A');} + +/* TODO? Is it worth inlining ANSI tolower, toupper? Probably only + if we only want C-locale. */ + +#endif /* _NO_CTYPE_INLINES */ + +/* Wide character equivalents */ + +#ifndef WEOF +#define WEOF (wchar_t)(0xFFFF) +#endif + #ifndef _WCTYPE_T_DEFINED typedef wchar_t wctype_t; #define _WCTYPE_T_DEFINED #endif -/* Wide character equivalents */ int iswalnum(wint_t); int iswalpha(wint_t); int iswascii(wint_t); @@ -128,12 +182,37 @@ wchar_t towupper(wchar_t); int isleadbyte (int); +/* Also in wctype.h */ +#if ! (defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) +#define __WCTYPE_INLINES_DEFINED +extern __inline__ int iswalnum(wint_t wc) {return (iswctype(wc,_ALPHA|_DIGIT));} +extern __inline__ int iswalpha(wint_t wc) {return (iswctype(wc,_ALPHA));} +extern __inline__ int iswascii(wint_t wc) {return (((unsigned)wc & 0x7F) ==0);} +extern __inline__ int iswcntrl(wint_t wc) {return (iswctype(wc,_CONTROL));} +extern __inline__ int iswdigit(wint_t wc) {return (iswctype(wc,_DIGIT));} +extern __inline__ int iswgraph(wint_t wc) {return (iswctype(wc,_PUNCT|_ALPHA|_DIGIT));} +extern __inline__ int iswlower(wint_t wc) {return (iswctype(wc,_LOWER));} +extern __inline__ int iswprint(wint_t wc) {return (iswctype(wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));} +extern __inline__ int iswpunct(wint_t wc) {return (iswctype(wc,_PUNCT));} +extern __inline__ int iswspace(wint_t wc) {return (iswctype(wc,_SPACE));} +extern __inline__ int iswupper(wint_t wc) {return (iswctype(wc,_UPPER));} +extern __inline__ int iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));} +extern __inline__ int isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);} +#endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */ + #ifndef __STRICT_ANSI__ int __isascii (int); int __toascii (int); int __iscsymf (int); /* Valid first character in C symbol */ int __iscsym (int); /* Valid character in C symbol (after first) */ +#ifndef __NO_CTYPE_INLINES +extern __inline__ int __isascii(int c) {return (((unsigned)c & ~0x7F) == 0);} +extern __inline__ int __toascii(int c) {return (c & 0x7F);} +extern __inline__ int __iscsymf(int c) {return (isalpha(c) || (c == '_'));} +extern __inline__ int __iscsym(int c) {return (isalnum(c) || (c == '_'));} +#endif /* __NO_CTYPE_INLINES */ + #ifndef _NO_OLDNAMES int isascii (int); int toascii (int); diff --git a/winsup/mingw/include/dir.h b/winsup/mingw/include/dir.h index 8f089f8..d759a0a 100644 --- a/winsup/mingw/include/dir.h +++ b/winsup/mingw/include/dir.h @@ -17,7 +17,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * */ diff --git a/winsup/mingw/include/direct.h b/winsup/mingw/include/direct.h index c5b07aa..cbd8e9f 100644 --- a/winsup/mingw/include/direct.h +++ b/winsup/mingw/include/direct.h @@ -16,7 +16,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/dirent.h b/winsup/mingw/include/dirent.h index 3d484ee..92ec6b5 100644 --- a/winsup/mingw/include/dirent.h +++ b/winsup/mingw/include/dirent.h @@ -12,7 +12,7 @@ * * This code is distributed in the hope that is will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includeds but is not limited to warranties of + * DISCLAIMED. This includeds but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/dos.h b/winsup/mingw/include/dos.h index 57a89b5..d0d7892 100644 --- a/winsup/mingw/include/dos.h +++ b/winsup/mingw/include/dos.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/errno.h b/winsup/mingw/include/errno.h index dedf340..fdeb8e3 100644 --- a/winsup/mingw/include/errno.h +++ b/winsup/mingw/include/errno.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/excpt.h b/winsup/mingw/include/excpt.h index 7bc0329..0947b22 100644 --- a/winsup/mingw/include/excpt.h +++ b/winsup/mingw/include/excpt.h @@ -19,7 +19,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ @@ -98,7 +98,7 @@ typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD; __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler)); /* - * A macro which (dispite its name) *removes* an installed + * A macro which (despite its name) *removes* an installed * exception handler. Should be used only in conjunction with the above * install routine __try1. * Move the pointer to the old reg. struct (at the current stack diff --git a/winsup/mingw/include/fcntl.h b/winsup/mingw/include/fcntl.h index 44b0009..61ed946 100644 --- a/winsup/mingw/include/fcntl.h +++ b/winsup/mingw/include/fcntl.h @@ -16,7 +16,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/float.h b/winsup/mingw/include/float.h index af7c086..709f369 100644 --- a/winsup/mingw/include/float.h +++ b/winsup/mingw/include/float.h @@ -24,7 +24,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ @@ -137,7 +137,11 @@ #define _PC_53 0x00010000 #define _PC_64 0x00000000 +/* These are also defined in Mingw math.h, needed to work around + GCC build issues. */ /* Return values for fpclass. */ +#ifndef __MINGW_FPCLASS_DEFINED +#define __MINGW_FPCLASS_DEFINED 1 #define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */ #define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */ #define _FPCLASS_NINF 0x0004 /* Negative Infinity */ @@ -148,6 +152,7 @@ #define _FPCLASS_PD 0x0080 /* Positive Denormal */ #define _FPCLASS_PN 0x0100 /* Positive Normal */ #define _FPCLASS_PINF 0x0200 /* Positive Infinity */ +#endif /* __MINGW_FPCLASS_DEFINED */ /* invalid subconditions (_SW_INVALID also set) */ #define _SW_UNEMULATED 0x0040 /* unemulated instruction */ @@ -181,16 +186,16 @@ unsigned int _controlfp (unsigned int unNew, unsigned int unMask); unsigned int _control87 (unsigned int unNew, unsigned int unMask); -unsigned int _clearfp (); /* Clear the FPU status word */ -unsigned int _statusfp (); /* Report the FPU status word */ +unsigned int _clearfp (void); /* Clear the FPU status word */ +unsigned int _statusfp (void); /* Report the FPU status word */ #define _clear87 _clearfp #define _status87 _statusfp -void _fpreset (); /* Reset the FPU */ -void fpreset (); +void _fpreset (void); /* Reset the FPU */ +void fpreset (void); /* Global 'variable' for the current floating point error code. */ -int * __fpecode(); +int * __fpecode(void); #define _fpecode (*(__fpecode())) /* diff --git a/winsup/mingw/include/io.h b/winsup/mingw/include/io.h index 8896686..ea86ffa 100644 --- a/winsup/mingw/include/io.h +++ b/winsup/mingw/include/io.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/limits.h b/winsup/mingw/include/limits.h index 725d56e..a1901fc 100644 --- a/winsup/mingw/include/limits.h +++ b/winsup/mingw/include/limits.h @@ -18,7 +18,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/locale.h b/winsup/mingw/include/locale.h index 3527bfb..06db31a 100644 --- a/winsup/mingw/include/locale.h +++ b/winsup/mingw/include/locale.h @@ -16,7 +16,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/malloc.h b/winsup/mingw/include/malloc.h index 9711cc5..85ad4e8 100644 --- a/winsup/mingw/include/malloc.h +++ b/winsup/mingw/include/malloc.h @@ -18,7 +18,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/math.h b/winsup/mingw/include/math.h index 8f2ba10..3fcaa1e 100644 --- a/winsup/mingw/include/math.h +++ b/winsup/mingw/include/math.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ @@ -46,6 +46,23 @@ */ #ifndef __STRICT_ANSI__ + +/* These are also defined in Mingw float.h; needed here as well to work + around GCC build issues. */ +#ifndef __MINGW_FPCLASS_DEFINED +#define __MINGW_FPCLASS_DEFINED 1 +#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */ +#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */ +#define _FPCLASS_NINF 0x0004 /* Negative Infinity */ +#define _FPCLASS_NN 0x0008 /* Negative Normal */ +#define _FPCLASS_ND 0x0010 /* Negative Denormal */ +#define _FPCLASS_NZ 0x0020 /* Negative Zero */ +#define _FPCLASS_PZ 0x0040 /* Positive Zero */ +#define _FPCLASS_PD 0x0080 /* Positive Denormal */ +#define _FPCLASS_PN 0x0100 /* Positive Normal */ +#define _FPCLASS_PINF 0x0200 /* Positive Infinity */ +#endif /* __MINGW_FPCLASS_DEFINED */ + #ifndef _NO_OLDNAMES #define DOMAIN _DOMAIN @@ -153,6 +170,25 @@ double _y1 (double); double _yn (int, double); int _matherr (struct _exception *); +/* These are also declared in Mingw float.h; needed here as well to work + around GCC build issues. */ +/* BEGIN FLOAT.H COPY */ +/* + * IEEE recommended functions + */ + +double _chgsign (double); +double _copysign (double, double); +double _logb (double); +double _nextafter (double, double); +double _scalb (double, long); + +int _finite (double); +int _fpclass (double); +int _isnan (double); + +/* END FLOAT.H COPY */ + #ifndef _NO_OLDNAMES /* diff --git a/winsup/mingw/include/process.h b/winsup/mingw/include/process.h index dc138c3..adf19e8 100644 --- a/winsup/mingw/include/process.h +++ b/winsup/mingw/include/process.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/setjmp.h b/winsup/mingw/include/setjmp.h index 9164178..89f045f 100644 --- a/winsup/mingw/include/setjmp.h +++ b/winsup/mingw/include/setjmp.h @@ -16,7 +16,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/share.h b/winsup/mingw/include/share.h index 8abf787..7c4b1c6 100644 --- a/winsup/mingw/include/share.h +++ b/winsup/mingw/include/share.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/signal.h b/winsup/mingw/include/signal.h index f4eb33a..4298acc 100644 --- a/winsup/mingw/include/signal.h +++ b/winsup/mingw/include/signal.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/stdarg.h b/winsup/mingw/include/stdarg.h index 9d08ee8..20169a1 100644 --- a/winsup/mingw/include/stdarg.h +++ b/winsup/mingw/include/stdarg.h @@ -23,7 +23,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/stddef.h b/winsup/mingw/include/stddef.h index e953fca..7bdc2cf 100644 --- a/winsup/mingw/include/stddef.h +++ b/winsup/mingw/include/stddef.h @@ -21,7 +21,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * */ diff --git a/winsup/mingw/include/stdint.h b/winsup/mingw/include/stdint.h index 17fe37b..c3a79c5 100644 --- a/winsup/mingw/include/stdint.h +++ b/winsup/mingw/include/stdint.h @@ -10,7 +10,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * Date: 2000-12-02 diff --git a/winsup/mingw/include/stdio.h b/winsup/mingw/include/stdio.h index a5a3e7c9..4a7d09f 100644 --- a/winsup/mingw/include/stdio.h +++ b/winsup/mingw/include/stdio.h @@ -19,7 +19,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/stdlib.h b/winsup/mingw/include/stdlib.h index 18a80a7..5be239b 100644 --- a/winsup/mingw/include/stdlib.h +++ b/winsup/mingw/include/stdlib.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/string.h b/winsup/mingw/include/string.h index 55aa0bf..038487b 100644 --- a/winsup/mingw/include/string.h +++ b/winsup/mingw/include/string.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/sys/locking.h b/winsup/mingw/include/sys/locking.h index cf33b5f..48e08e2 100644 --- a/winsup/mingw/include/sys/locking.h +++ b/winsup/mingw/include/sys/locking.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ @@ -32,14 +32,14 @@ /* All the headers include this file. */ #include <_mingw.h> -#define _LK_UNLOCK 0 /* Unlock */ +#define _LK_UNLCK 0 /* Unlock */ #define _LK_LOCK 1 /* Lock */ #define _LK_NBLCK 2 /* Non-blocking lock */ #define _LK_RLCK 3 /* Lock for read only */ #define _LK_NBRLCK 4 /* Non-blocking lock for read only */ #ifndef NO_OLDNAMES -#define LK_UNLOCK _LK_UNLOCK +#define LK_UNLCK _LK_UNLCK #define LK_LOCK _LK_LOCK #define LK_NBLCK _LK_NBLCK #define LK_RLCK _LK_RLCK diff --git a/winsup/mingw/include/sys/stat.h b/winsup/mingw/include/sys/stat.h index 4786210..1620b06 100644 --- a/winsup/mingw/include/sys/stat.h +++ b/winsup/mingw/include/sys/stat.h @@ -16,7 +16,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/sys/timeb.h b/winsup/mingw/include/sys/timeb.h index 696a334..2011162 100644 --- a/winsup/mingw/include/sys/timeb.h +++ b/winsup/mingw/include/sys/timeb.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/sys/types.h b/winsup/mingw/include/sys/types.h index dce11f5..76c3d8d 100644 --- a/winsup/mingw/include/sys/types.h +++ b/winsup/mingw/include/sys/types.h @@ -16,7 +16,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warrenties of + * DISCLAIMED. This includes but is not limited to warrenties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/sys/utime.h b/winsup/mingw/include/sys/utime.h index 59d00fe..7c907f3 100644 --- a/winsup/mingw/include/sys/utime.h +++ b/winsup/mingw/include/sys/utime.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/tchar.h b/winsup/mingw/include/tchar.h index de17a61..6d67915 100644 --- a/winsup/mingw/include/tchar.h +++ b/winsup/mingw/include/tchar.h @@ -26,7 +26,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/time.h b/winsup/mingw/include/time.h index 34b2562..6e9d1e4 100644 --- a/winsup/mingw/include/time.h +++ b/winsup/mingw/include/time.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/varargs.h b/winsup/mingw/include/varargs.h index 5370344..f81c864 100644 --- a/winsup/mingw/include/varargs.h +++ b/winsup/mingw/include/varargs.h @@ -26,7 +26,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/wchar.h b/winsup/mingw/include/wchar.h index 008d5f0..eaeb4d0 100644 --- a/winsup/mingw/include/wchar.h +++ b/winsup/mingw/include/wchar.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision$ diff --git a/winsup/mingw/include/wctype.h b/winsup/mingw/include/wctype.h index 3dc5ae2..1fb00fb 100644 --- a/winsup/mingw/include/wctype.h +++ b/winsup/mingw/include/wctype.h @@ -15,7 +15,7 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * */ @@ -63,7 +63,7 @@ typedef wchar_t wctype_t; #define _WCTYPE_T_DEFINED #endif -/* Wide character equivalents */ +/* Wide character equivalents - also in ctype.h */ int iswalnum(wint_t); int iswalpha(wint_t); int iswascii(wint_t); @@ -84,6 +84,34 @@ wchar_t towupper(wchar_t); int isleadbyte (int); +/* Also in ctype.h */ + +__MINGW_IMPORT unsigned short _ctype[]; +#ifdef __MSVCRT__ +__MINGW_IMPORT unsigned short* _pctype; +#else +__MINGW_IMPORT unsigned short* _pctype_dll; +#define _pctype _pctype_dll +#endif + +#if !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) +#define __WCTYPE_INLINES_DEFINED +extern inline int iswalnum(wint_t wc) {return (iswctype(wc,_ALPHA|_DIGIT));} +extern inline int iswalpha(wint_t wc) {return (iswctype(wc,_ALPHA));} +extern inline int iswascii(wint_t wc) {return (((unsigned)wc & 0x7F) ==0);} +extern inline int iswcntrl(wint_t wc) {return (iswctype(wc,_CONTROL));} +extern inline int iswdigit(wint_t wc) {return (iswctype(wc,_DIGIT));} +extern inline int iswgraph(wint_t wc) {return (iswctype(wc,_PUNCT|_ALPHA|_DIGIT));} +extern inline int iswlower(wint_t wc) {return (iswctype(wc,_LOWER));} +extern inline int iswprint(wint_t wc) {return (iswctype(wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));} +extern inline int iswpunct(wint_t wc) {return (iswctype(wc,_PUNCT));} +extern inline int iswspace(wint_t wc) {return (iswctype(wc,_SPACE));} +extern inline int iswupper(wint_t wc) {return (iswctype(wc,_UPPER));} +extern inline int iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));} +extern inline int isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);} +#endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */ + + typedef wchar_t wctrans_t; wint_t towctrans(wint_t, wctrans_t); wctrans_t wctrans(const char*); diff --git a/winsup/mingw/mthr.c b/winsup/mingw/mthr.c index 2485547..f282364 100644 --- a/winsup/mingw/mthr.c +++ b/winsup/mingw/mthr.c @@ -26,7 +26,6 @@ /* To protect the thread/key association data structure modifications. */ CRITICAL_SECTION __mingwthr_cs; -typedef struct __mingwthr_thread __mingwthr_thread_t; typedef struct __mingwthr_key __mingwthr_key_t; /* The list of threads active with key/dtor pairs. */ @@ -36,14 +35,8 @@ struct __mingwthr_key { __mingwthr_key_t *next; }; -/* The list of key/dtor pairs for a particular thread. */ -struct __mingwthr_thread { - DWORD thread_id; - __mingwthr_key_t *keys; - __mingwthr_thread_t *next; -}; -static __mingwthr_thread_t *__mingwthr_thread_list; +static __mingwthr_key_t *key_dtor_list; /* * __mingwthr_key_add: @@ -55,9 +48,8 @@ static __mingwthr_thread_t *__mingwthr_thread_list; */ static int -__mingwthr_add_key_dtor (DWORD thread_id, DWORD key, void (*dtor) (void *)) +___mingwthr_add_key_dtor ( DWORD key, void (*dtor) (void *)) { - __mingwthr_thread_t *threadp; __mingwthr_key_t *new_key; new_key = (__mingwthr_key_t *) calloc (1, sizeof (__mingwthr_key_t)); @@ -67,45 +59,66 @@ __mingwthr_add_key_dtor (DWORD thread_id, DWORD key, void (*dtor) (void *)) new_key->key = key; new_key->dtor = dtor; - /* This may be called by multiple threads, and so we need to protect - the whole process of adding the key/dtor pair. */ EnterCriticalSection (&__mingwthr_cs); - for (threadp = __mingwthr_thread_list; - threadp && (threadp->thread_id != thread_id); - threadp = threadp->next) - ; - - if (threadp == NULL) - { - threadp = (__mingwthr_thread_t *) - calloc (1, sizeof (__mingwthr_thread_t)); - if (threadp == NULL) - { - free (new_key); - LeaveCriticalSection (&__mingwthr_cs); - return -1; - } - threadp->thread_id = thread_id; - threadp->next = __mingwthr_thread_list; - __mingwthr_thread_list = threadp; - } - - new_key->next = threadp->keys; - threadp->keys = new_key; + new_key->next = key_dtor_list; + key_dtor_list = new_key; LeaveCriticalSection (&__mingwthr_cs); #ifdef DEBUG - printf ("%s: allocating: (%ld, %ld, %x)\n", - __FUNCTION__, thread_id, key, dtor); + printf ("%s: allocating: (%ld, %x)\n", + __FUNCTION__, key, dtor); #endif return 0; } +static int +___mingwthr_remove_key_dtor ( DWORD key ) +{ + __mingwthr_key_t *prev_key; + __mingwthr_key_t *cur_key; + + EnterCriticalSection (&__mingwthr_cs); + + prev_key = NULL; + cur_key = key_dtor_list; + + while( cur_key != NULL ) + { + if( cur_key->key == key ) + { +// take key/dtor out of list + if( prev_key == NULL ) + { + key_dtor_list = cur_key->next; + } + else + { + prev_key->next = cur_key->next; + } + +#ifdef DEBUG + printf ("%s: removing: (%ld)\n", + __FUNCTION__, key ); +#endif + + free( cur_key ); + break; + } + + prev_key = cur_key; + cur_key = cur_key->next; + } + + LeaveCriticalSection (&__mingwthr_cs); + + return 0; +} + /* - * __mingwthr_run_key_dtors (DWORD thread_id): + * __mingwthr_run_key_dtors (void): * * Callback from DllMain when thread detaches to clean up the key * storage. @@ -118,68 +131,41 @@ __mingwthr_add_key_dtor (DWORD thread_id, DWORD key, void (*dtor) (void *)) */ void -__mingwthr_run_key_dtors (DWORD thread_id) +__mingwthr_run_key_dtors (void) { - __mingwthr_thread_t *prev_threadp, *threadp; __mingwthr_key_t *keyp; #ifdef DEBUG - printf ("%s: Entering Thread id %ld\n", __FUNCTION__, thread_id); + printf ("%s: Entering Thread id %ld\n", __FUNCTION__, GetCurrentThreadId() ); #endif - /* Since this is called just once per thread, we only need to protect - the part where we take out this thread's entry and reconfigure the - list instead of wrapping the whole process in a critical section. */ EnterCriticalSection (&__mingwthr_cs); - prev_threadp = NULL; - for (threadp = __mingwthr_thread_list; - threadp && (threadp->thread_id != thread_id); - prev_threadp = threadp, threadp = threadp->next) - ; - - if (threadp == NULL) - { - LeaveCriticalSection (&__mingwthr_cs); - return; - } - - /* take the damned thread out of the chain. */ - if (prev_threadp == NULL) /* first entry hit. */ - __mingwthr_thread_list = threadp->next; - else - prev_threadp->next = threadp->next; - - LeaveCriticalSection (&__mingwthr_cs); - - for (keyp = threadp->keys; keyp; ) - { - __mingwthr_key_t *prev_keyp; - LPVOID value = TlsGetValue (keyp->key); - if (GetLastError () == ERROR_SUCCESS) - { + for (keyp = key_dtor_list; keyp; ) + { + LPVOID value = TlsGetValue (keyp->key); + if (GetLastError () == ERROR_SUCCESS) + { #ifdef DEBUG - printf (" (%ld, %x)\n", keyp->key, keyp->dtor); + printf (" (%ld, %x)\n", keyp->key, keyp->dtor); #endif - if (value) - (*keyp->dtor) (value); - } + if (value) + (*keyp->dtor) (value); + } #ifdef DEBUG - else - { - printf (" TlsGetValue FAILED (%ld, %x)\n", - keyp->key, keyp->dtor); - } + else + { + printf (" TlsGetValue FAILED (%ld, %x)\n", + keyp->key, keyp->dtor); + } #endif - prev_keyp = keyp; - keyp = keyp->next; - free (prev_keyp); - } + keyp = keyp->next; + } - free (threadp); + LeaveCriticalSection (&__mingwthr_cs); #ifdef DEBUG - printf ("%s: Exiting Thread id %ld\n", __FUNCTION__, thread_id); + printf ("%s: Exiting Thread id %ld\n", __FUNCTION__, GetCurrentThreadId() ); #endif } @@ -197,10 +183,15 @@ __mingwthr_key_dtor (DWORD key, void (*dtor) (void *)) { if (dtor) { - DWORD thread_id = GetCurrentThreadId (); - return __mingwthr_add_key_dtor (thread_id, key, dtor); + return ___mingwthr_add_key_dtor (key, dtor); } return 0; } +__declspec(dllexport) +int +__mingwthr_remove_key_dtor (DWORD key ) +{ + return ___mingwthr_remove_key_dtor ( key ); +} diff --git a/winsup/mingw/mthr_init.c b/winsup/mingw/mthr_init.c index 23f7966..5c8c8bb 100644 --- a/winsup/mingw/mthr_init.c +++ b/winsup/mingw/mthr_init.c @@ -52,25 +52,29 @@ DllMain (HANDLE hDllHandle /* Library instance handle. */, { extern CRITICAL_SECTION __mingwthr_cs; - extern void __mingwthr_run_key_dtors (DWORD); + extern void __mingwthr_run_key_dtors( void ); + +#ifdef DEBUG + printf ("%s: reason %d\n", __FUNCTION__, reason ); +#endif switch (reason) { case DLL_PROCESS_ATTACH: - InitializeCriticalSection (&__mingwthr_cs); - break; + InitializeCriticalSection (&__mingwthr_cs); + break; case DLL_PROCESS_DETACH: - DeleteCriticalSection (&__mingwthr_cs); + __mingwthr_run_key_dtors(); + DeleteCriticalSection (&__mingwthr_cs); break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: - __mingwthr_run_key_dtors (GetCurrentThreadId ()); + __mingwthr_run_key_dtors(); break; } return TRUE; } - diff --git a/winsup/mingw/mthr_stub.c b/winsup/mingw/mthr_stub.c index b2d219c..cb926c1 100644 --- a/winsup/mingw/mthr_stub.c +++ b/winsup/mingw/mthr_stub.c @@ -35,3 +35,11 @@ __mingwthr_key_dtor (DWORD key, void (*dtor) (void *)) return 0; } + +int +__mingwthr_remove_key_dtor (DWORD key ) +{ + assert (0); + /* NOTREACHED */ + return 0; +} |