crt: Simplify C99 _Exit symbol C99 _Exit symbol is available only in the UCRT DLL libraries. It is not available in any crtdll/msvcr* DLL library. Currently the _Exit symbol is provided by the libmingwex.a static library and also by the UCRT import library. At the same time, mingw-w64 header files provides inline function _Exit function. Simplify the whole implementation. Remove inline function _Exit and also remove mingwex _Exit implementation. For non-UCRT builds define just _Exit symbol as alias to _exit symbol. Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 8960f7a..1d7eb87 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am
@@ -1315,7 +1315,6 @@ ssp/stpcpy_chk.c ssp/strcpy_chk.c ssp/strncat_chk.c ssp/strncpy_chk.c \ \ stdio/strtok_r.c \ - stdio/_Exit.c \ stdio/asprintf.c \ stdio/mingw_ftruncate64.c stdio/lltoa.c stdio/lltow.c \ stdio/__mingw_fix_stat.h stdio/__mingw_fix_stat_finish.c stdio/__mingw_fix_fstat_finish.c \
diff --git a/mingw-w64-crt/def-include/crt-aliases.def.in b/mingw-w64-crt/def-include/crt-aliases.def.in index 1dd30d0..64e53d5 100644 --- a/mingw-w64-crt/def-include/crt-aliases.def.in +++ b/mingw-w64-crt/def-include/crt-aliases.def.in
@@ -243,6 +243,9 @@ #endif ; This is list of symbol aliases for C99 functions +#ifndef UCRTBASE +_Exit == _exit +#endif ; ADD_UNDERSCORE(logb) #ifdef WITH_NEXTAFTER_ALIAS ADD_UNDERSCORE(nextafter)
diff --git a/mingw-w64-crt/stdio/_Exit.c b/mingw-w64-crt/stdio/_Exit.c deleted file mode 100644 index 5b049f5..0000000 --- a/mingw-w64-crt/stdio/_Exit.c +++ /dev/null
@@ -1,10 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#define __CRT__NO_INLINE -#include <stdlib.h> - -void _Exit(int status) - { _exit(status); }
diff --git a/mingw-w64-headers/crt/process.h b/mingw-w64-headers/crt/process.h index f5595df..7907172 100644 --- a/mingw-w64-headers/crt/process.h +++ b/mingw-w64-headers/crt/process.h
@@ -45,14 +45,8 @@ void __cdecl __MINGW_NOTHROW quick_exit(int _Code) __MINGW_ATTRIB_NORETURN; #endif -#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ /* C99 function name */ void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN; -#ifndef __CRT__NO_INLINE - __CRT_INLINE __MINGW_ATTRIB_NORETURN void __cdecl _Exit(int status) - { _exit(status); } -#endif /* !__CRT__NO_INLINE */ -#endif /* Not __NO_ISOCEXT */ #pragma push_macro("abort") #undef abort
diff --git a/mingw-w64-headers/crt/stdlib.h b/mingw-w64-headers/crt/stdlib.h index f280b44..2c72b0b 100644 --- a/mingw-w64-headers/crt/stdlib.h +++ b/mingw-w64-headers/crt/stdlib.h
@@ -256,14 +256,8 @@ void __cdecl __MINGW_NOTHROW quick_exit(int _Code) __MINGW_ATTRIB_NORETURN; #endif -#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ /* C99 function name */ void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN; -#ifndef __CRT__NO_INLINE - __CRT_INLINE __MINGW_ATTRIB_NORETURN void __cdecl _Exit(int status) - { _exit(status); } -#endif /* !__CRT__NO_INLINE */ -#endif /* Not __NO_ISOCEXT */ #pragma push_macro("abort") #undef abort