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 defines just
_Exit symbol as alias to _exit symbol.
---
 mingw-w64-crt/Makefile.am                    |  1 -
 mingw-w64-crt/def-include/crt-aliases.def.in |  3 +++
 mingw-w64-crt/stdio/_Exit.c                  | 10 ----------
 mingw-w64-headers/crt/process.h              |  6 ------
 mingw-w64-headers/crt/stdlib.h               |  6 ------
 5 files changed, 3 insertions(+), 23 deletions(-)
 delete mode 100644 mingw-w64-crt/stdio/_Exit.c

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 6eb097bb6499..33a5290409b4 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -1316,7 +1316,6 @@ src_libmingwex=\
   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 1dd30d0a2d00..64e53d555b96 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 @@ putwchar == _fputwchar
 #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 5b049f566b1a..000000000000
--- 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 b2ab10a2ca0c..27b671d906ca 100644
--- a/mingw-w64-headers/crt/process.h
+++ b/mingw-w64-headers/crt/process.h
@@ -45,14 +45,8 @@ _CRT_BEGIN_C_HEADER
   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 f280b4415254..2c72b0b41a77 100644
--- a/mingw-w64-headers/crt/stdlib.h
+++ b/mingw-w64-headers/crt/stdlib.h
@@ -256,14 +256,8 @@ _CRTIMP int __cdecl ___mb_cur_max_func(void);
   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
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to