crt: remove mingw-w64 wrapper for _assert() The purpose of `_assert` wrapper was to make `assert` usable when an Unicode translation mode was enabled on stderr. At the time when this wrapper was added, it was asumed that `_assert` does not return, when in fact it can. It is important to keep in mind that after displaying the message, `_assert` terminates the process by calling `abort`; it is possible to escape from `abort` by setting signal handler for SIGABRT which calls `longjmp`. If an application were to perform such escape, previous translation mode used on stderr will not be restored and it will be left in `_O_TEXT` translation mode. `_assert` is also called from mingw-w64 wrapper for `_wassert`, which allocates memory using `malloc`; such escape from `_assert` would result in a memory leak. To avoid issues descrived above, remove wrapper for `_assert`. Any application that calls `_assert` directly must take its limitations into account. This change effectively reverts b2c3c92b542df57ed8bfcd798928692e94a35308. Signed-off-by: Kirill Makurin <maiddaisuki@outlook.com> Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 85ba329..61c2b3d 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am
@@ -1273,7 +1273,6 @@ math/powi.def.h math/sqrt.def.h \ math/cephes_mconf.h math/fp_consts.h math/pi_const.h \ \ - misc/_assert.c \ misc/mingw_longjmp.S \ misc/mingw_getsp.S \ misc/alarm.c \
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-runtime-l1-1-0.def.in b/mingw-w64-crt/lib-common/api-ms-win-crt-runtime-l1-1-0.def.in index ef0aa03..79a7ac1 100644 --- a/mingw-w64-crt/lib-common/api-ms-win-crt-runtime-l1-1-0.def.in +++ b/mingw-w64-crt/lib-common/api-ms-win-crt-runtime-l1-1-0.def.in
@@ -24,7 +24,7 @@ __wcserror __wcserror_s ; DATA set manually -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _beginthread _beginthreadex _c_exit
diff --git a/mingw-w64-crt/lib-common/msvcr120_app.def.in b/mingw-w64-crt/lib-common/msvcr120_app.def.in index 0963eea..06260ee 100644 --- a/mingw-w64-crt/lib-common/msvcr120_app.def.in +++ b/mingw-w64-crt/lib-common/msvcr120_app.def.in
@@ -1179,7 +1179,7 @@ _aligned_realloc _aligned_recalloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 7909159..39ece04 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in
@@ -531,7 +531,7 @@ F_I386(_adjust_fdiv DATA) _aexit_rtn DATA _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atoi64 _atoldbl
diff --git a/mingw-w64-crt/lib-common/ucrtbase-common.def.in b/mingw-w64-crt/lib-common/ucrtbase-common.def.in index a87d4da..507e0af 100644 --- a/mingw-w64-crt/lib-common/ucrtbase-common.def.in +++ b/mingw-w64-crt/lib-common/ucrtbase-common.def.in
@@ -246,7 +246,7 @@ F_DEBUG(_aligned_realloc_dbg) _aligned_recalloc F_DEBUG(_aligned_recalloc_dbg) -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib32/crtdll.def.in b/mingw-w64-crt/lib32/crtdll.def.in index 99ededa..154d7ad 100644 --- a/mingw-w64-crt/lib32/crtdll.def.in +++ b/mingw-w64-crt/lib32/crtdll.def.in
@@ -110,7 +110,7 @@ _aexit_rtn_dll DATA _aexit_rtn DATA == _aexit_rtn_dll _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _basemajor_dll DATA _baseminor_dll DATA _baseversion_dll DATA
diff --git a/mingw-w64-crt/lib32/msvcr100.def.in b/mingw-w64-crt/lib32/msvcr100.def.in index 50d3169..1db3e07 100644 --- a/mingw-w64-crt/lib32/msvcr100.def.in +++ b/mingw-w64-crt/lib32/msvcr100.def.in
@@ -730,7 +730,7 @@ _aligned_realloc _aligned_recalloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib32/msvcr100d.def.in b/mingw-w64-crt/lib32/msvcr100d.def.in index ee5717d..9899fe0 100644 --- a/mingw-w64-crt/lib32/msvcr100d.def.in +++ b/mingw-w64-crt/lib32/msvcr100d.def.in
@@ -777,7 +777,7 @@ _aligned_recalloc _aligned_recalloc_dbg _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib32/msvcr110.def.in b/mingw-w64-crt/lib32/msvcr110.def.in index 09a7e68..1a4db81 100644 --- a/mingw-w64-crt/lib32/msvcr110.def.in +++ b/mingw-w64-crt/lib32/msvcr110.def.in
@@ -854,7 +854,7 @@ _aligned_realloc _aligned_recalloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib32/msvcr110d.def.in b/mingw-w64-crt/lib32/msvcr110d.def.in index 3448d40..0b52690 100644 --- a/mingw-w64-crt/lib32/msvcr110d.def.in +++ b/mingw-w64-crt/lib32/msvcr110d.def.in
@@ -901,7 +901,7 @@ _aligned_recalloc _aligned_recalloc_dbg _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib32/msvcr120.def.in b/mingw-w64-crt/lib32/msvcr120.def.in index 25933f1..af88bbb 100644 --- a/mingw-w64-crt/lib32/msvcr120.def.in +++ b/mingw-w64-crt/lib32/msvcr120.def.in
@@ -865,7 +865,7 @@ _aligned_realloc _aligned_recalloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib32/msvcr120d.def.in b/mingw-w64-crt/lib32/msvcr120d.def.in index e362dcd..b8d4c9b 100644 --- a/mingw-w64-crt/lib32/msvcr120d.def.in +++ b/mingw-w64-crt/lib32/msvcr120d.def.in
@@ -912,7 +912,7 @@ _aligned_recalloc _aligned_recalloc_dbg _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib32/msvcr40d.def.in b/mingw-w64-crt/lib32/msvcr40d.def.in index 5f5f754..aced5b3 100644 --- a/mingw-w64-crt/lib32/msvcr40d.def.in +++ b/mingw-w64-crt/lib32/msvcr40d.def.in
@@ -1081,7 +1081,7 @@ _adj_fptan _adjust_fdiv DATA _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atoldbl _beep
diff --git a/mingw-w64-crt/lib32/msvcr70.def.in b/mingw-w64-crt/lib32/msvcr70.def.in index 29a8aa9..53e2bfe 100644 --- a/mingw-w64-crt/lib32/msvcr70.def.in +++ b/mingw-w64-crt/lib32/msvcr70.def.in
@@ -258,7 +258,7 @@ _aligned_offset_realloc _aligned_realloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atoi64 _atoldbl
diff --git a/mingw-w64-crt/lib32/msvcr70d.def.in b/mingw-w64-crt/lib32/msvcr70d.def.in index 3bbf5c5..7784d76 100644 --- a/mingw-w64-crt/lib32/msvcr70d.def.in +++ b/mingw-w64-crt/lib32/msvcr70d.def.in
@@ -292,7 +292,7 @@ _aligned_realloc _aligned_realloc_dbg _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atoi64 _atoldbl
diff --git a/mingw-w64-crt/lib32/msvcr71.def.in b/mingw-w64-crt/lib32/msvcr71.def.in index 6248aa6..aa33cd3 100644 --- a/mingw-w64-crt/lib32/msvcr71.def.in +++ b/mingw-w64-crt/lib32/msvcr71.def.in
@@ -251,7 +251,7 @@ _aligned_offset_realloc _aligned_realloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atoi64 _atoldbl
diff --git a/mingw-w64-crt/lib32/msvcr71d.def.in b/mingw-w64-crt/lib32/msvcr71d.def.in index 71fee41..a317d1e 100644 --- a/mingw-w64-crt/lib32/msvcr71d.def.in +++ b/mingw-w64-crt/lib32/msvcr71d.def.in
@@ -285,7 +285,7 @@ _aligned_realloc _aligned_realloc_dbg _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atoi64 _atoldbl
diff --git a/mingw-w64-crt/lib32/msvcr80.def.in b/mingw-w64-crt/lib32/msvcr80.def.in index d84908c..7d57998 100644 --- a/mingw-w64-crt/lib32/msvcr80.def.in +++ b/mingw-w64-crt/lib32/msvcr80.def.in
@@ -355,7 +355,7 @@ _aligned_offset_realloc _aligned_realloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib32/msvcr80d.def.in b/mingw-w64-crt/lib32/msvcr80d.def.in index 30302a1..d4deb17 100644 --- a/mingw-w64-crt/lib32/msvcr80d.def.in +++ b/mingw-w64-crt/lib32/msvcr80d.def.in
@@ -416,7 +416,7 @@ _aligned_recalloc _aligned_recalloc_dbg _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib32/msvcr90.def.in b/mingw-w64-crt/lib32/msvcr90.def.in index 5c3d6a4..a6f5752 100644 --- a/mingw-w64-crt/lib32/msvcr90.def.in +++ b/mingw-w64-crt/lib32/msvcr90.def.in
@@ -355,7 +355,7 @@ _aligned_realloc _aligned_recalloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib32/msvcr90d.def.in b/mingw-w64-crt/lib32/msvcr90d.def.in index 294cb57..eb4f68e 100644 --- a/mingw-w64-crt/lib32/msvcr90d.def.in +++ b/mingw-w64-crt/lib32/msvcr90d.def.in
@@ -406,7 +406,7 @@ _aligned_recalloc _aligned_recalloc_dbg _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib32/msvcrt10.def.in b/mingw-w64-crt/lib32/msvcrt10.def.in index ab67734..8a7d408 100644 --- a/mingw-w64-crt/lib32/msvcrt10.def.in +++ b/mingw-w64-crt/lib32/msvcrt10.def.in
@@ -902,7 +902,7 @@ _acmdln DATA _aexit_rtn DATA _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert __msvcrt_beginthread == _beginthread ; rename _beginthread as it does not handle SSE floating point exceptions, real _beginthread provided by emu _c_exit _cabs
diff --git a/mingw-w64-crt/lib32/msvcrt20.def.in b/mingw-w64-crt/lib32/msvcrt20.def.in index 0b13fc4..8a87561 100644 --- a/mingw-w64-crt/lib32/msvcrt20.def.in +++ b/mingw-w64-crt/lib32/msvcrt20.def.in
@@ -937,7 +937,7 @@ _abnormal_termination _access _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atoldbl _beep
diff --git a/mingw-w64-crt/lib32/msvcrt40.def.in b/mingw-w64-crt/lib32/msvcrt40.def.in index 95654f5..4c698c1 100644 --- a/mingw-w64-crt/lib32/msvcrt40.def.in +++ b/mingw-w64-crt/lib32/msvcrt40.def.in
@@ -1055,7 +1055,7 @@ _adj_fptan _adjust_fdiv DATA _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atoldbl _beep
diff --git a/mingw-w64-crt/lib32/msvcrtd.def.in b/mingw-w64-crt/lib32/msvcrtd.def.in index f7d5dce..ea0c17c 100644 --- a/mingw-w64-crt/lib32/msvcrtd.def.in +++ b/mingw-w64-crt/lib32/msvcrtd.def.in
@@ -237,7 +237,7 @@ _adjust_fdiv DATA _aexit_rtn DATA _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atoi64 _atoldbl
diff --git a/mingw-w64-crt/lib64/msvcr100.def.in b/mingw-w64-crt/lib64/msvcr100.def.in index 7e70caa..2e7991c 100644 --- a/mingw-w64-crt/lib64/msvcr100.def.in +++ b/mingw-w64-crt/lib64/msvcr100.def.in
@@ -687,7 +687,7 @@ _aligned_realloc _aligned_recalloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib64/msvcr100d.def.in b/mingw-w64-crt/lib64/msvcr100d.def.in index 65ed8c2..26c568d 100644 --- a/mingw-w64-crt/lib64/msvcr100d.def.in +++ b/mingw-w64-crt/lib64/msvcr100d.def.in
@@ -732,7 +732,7 @@ _aligned_recalloc _aligned_recalloc_dbg _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib64/msvcr110.def.in b/mingw-w64-crt/lib64/msvcr110.def.in index aea6fab..83362bc 100644 --- a/mingw-w64-crt/lib64/msvcr110.def.in +++ b/mingw-w64-crt/lib64/msvcr110.def.in
@@ -813,7 +813,7 @@ _aligned_realloc _aligned_recalloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib64/msvcr110d.def.in b/mingw-w64-crt/lib64/msvcr110d.def.in index ee51330..6217687 100644 --- a/mingw-w64-crt/lib64/msvcr110d.def.in +++ b/mingw-w64-crt/lib64/msvcr110d.def.in
@@ -858,7 +858,7 @@ _aligned_recalloc _aligned_recalloc_dbg _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib64/msvcr120.def.in b/mingw-w64-crt/lib64/msvcr120.def.in index 6442bb7..9095011 100644 --- a/mingw-w64-crt/lib64/msvcr120.def.in +++ b/mingw-w64-crt/lib64/msvcr120.def.in
@@ -825,7 +825,7 @@ _aligned_realloc _aligned_recalloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib64/msvcr120d.def.in b/mingw-w64-crt/lib64/msvcr120d.def.in index 51156e5..31c3258 100644 --- a/mingw-w64-crt/lib64/msvcr120d.def.in +++ b/mingw-w64-crt/lib64/msvcr120d.def.in
@@ -870,7 +870,7 @@ _aligned_recalloc _aligned_recalloc_dbg _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib64/msvcr80.def.in b/mingw-w64-crt/lib64/msvcr80.def.in index db1710d..f81f10e 100644 --- a/mingw-w64-crt/lib64/msvcr80.def.in +++ b/mingw-w64-crt/lib64/msvcr80.def.in
@@ -298,7 +298,7 @@ _aligned_offset_realloc _aligned_realloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib64/msvcr80d.def.in b/mingw-w64-crt/lib64/msvcr80d.def.in index a28217c..3fbac94 100644 --- a/mingw-w64-crt/lib64/msvcr80d.def.in +++ b/mingw-w64-crt/lib64/msvcr80d.def.in
@@ -353,7 +353,7 @@ _aligned_recalloc _aligned_recalloc_dbg _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib64/msvcr90.def.in b/mingw-w64-crt/lib64/msvcr90.def.in index 1bc3045..3efea26 100644 --- a/mingw-w64-crt/lib64/msvcr90.def.in +++ b/mingw-w64-crt/lib64/msvcr90.def.in
@@ -302,7 +302,7 @@ _aligned_realloc _aligned_recalloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/lib64/msvcr90d.def.in b/mingw-w64-crt/lib64/msvcr90d.def.in index 864e0e1..c95a741 100644 --- a/mingw-w64-crt/lib64/msvcr90d.def.in +++ b/mingw-w64-crt/lib64/msvcr90d.def.in
@@ -347,7 +347,7 @@ _aligned_recalloc _aligned_recalloc_dbg _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/libarm32/msvcr110.def.in b/mingw-w64-crt/libarm32/msvcr110.def.in index d708540..3c067e0 100644 --- a/mingw-w64-crt/libarm32/msvcr110.def.in +++ b/mingw-w64-crt/libarm32/msvcr110.def.in
@@ -807,7 +807,7 @@ _aligned_realloc _aligned_recalloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/libarm32/msvcr110d.def.in b/mingw-w64-crt/libarm32/msvcr110d.def.in index 80a3e30..7164dbb 100644 --- a/mingw-w64-crt/libarm32/msvcr110d.def.in +++ b/mingw-w64-crt/libarm32/msvcr110d.def.in
@@ -852,7 +852,7 @@ _aligned_recalloc _aligned_recalloc_dbg _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/libarm32/msvcr120.def.in b/mingw-w64-crt/libarm32/msvcr120.def.in index 3a2f926..8e3b65f 100644 --- a/mingw-w64-crt/libarm32/msvcr120.def.in +++ b/mingw-w64-crt/libarm32/msvcr120.def.in
@@ -799,7 +799,7 @@ _aligned_realloc _aligned_recalloc _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/libarm32/msvcr120d.def.in b/mingw-w64-crt/libarm32/msvcr120d.def.in index 4380106..ef27891 100644 --- a/mingw-w64-crt/libarm32/msvcr120d.def.in +++ b/mingw-w64-crt/libarm32/msvcr120d.def.in
@@ -844,7 +844,7 @@ _aligned_recalloc _aligned_recalloc_dbg _amsg_exit -__msvcrt_assert DATA == _assert ; mingw-w64 provides _assert() function as wrapper around renamed __msvcrt_assert symbol +_assert _atodbl _atodbl_l _atof_l
diff --git a/mingw-w64-crt/misc/_assert.c b/mingw-w64-crt/misc/_assert.c deleted file mode 100644 index c8c8548..0000000 --- a/mingw-w64-crt/misc/_assert.c +++ /dev/null
@@ -1,46 +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. - */ - -#include <assert.h> -#include <fcntl.h> -#include <io.h> -#include <stdio.h> -#include <stdlib.h> - -/* This is import symbol name for "_assert" from CRT DLL library */ -extern void (__cdecl *__MINGW_IMP_SYMBOL(__msvcrt_assert))(const char *message, const char *file, unsigned line); - -/* Turn off _O_WTEXT, _O_U16TEXT or _O_U8TEXT mode on stderr stream - * by changing mode to _O_TEXT, because fprintf (called by __msvcrt_assert) - * does not work (and does nothing) on FILE* stream in some of those modes. - * Only fwprintf works with those modes, but _assert uses fprintf. - * Before changing the FILE* stream mode, it is required to flush buffers. */ -void __cdecl _assert(const char *message, const char *file, unsigned line) -{ - /* stderr expands to function call */ - FILE *stream = stderr; - /* Cache fd used by `stderr` */ - int fd = _fileno (stream); - /* We need to restore previous mode in case `_assert` returns; it can happen - * if program has called _set_error_mode(_OUT_TO_MSGBOX) and user pressed - * "Ignore" button in popped up message box. */ - int oldmode; - - /* Change `stderr` mode to `_O_TEXT` */ - fflush(stream); - oldmode = _setmode(fd, _O_TEXT); - - /* Call CRT `_assert` */ - __MINGW_IMP_SYMBOL(__msvcrt_assert)(message, file, line); - - /* Restore `stderr` mode to `oldmode` */ - fflush (stream); - if (_setmode (fd, oldmode) != _O_TEXT) { - abort (); - } -} - -void (__cdecl *__MINGW_IMP_SYMBOL(_assert))(const char *message, const char *file, unsigned line) = _assert;
diff --git a/mingw-w64-headers/crt/assert.h b/mingw-w64-headers/crt/assert.h index 5dd20e2..49be078 100644 --- a/mingw-w64-headers/crt/assert.h +++ b/mingw-w64-headers/crt/assert.h
@@ -19,8 +19,8 @@ _CRT_BEGIN_C_HEADER +_CRTIMP void __cdecl _assert (const char *_Message, const char *_File, unsigned _Line); _CRTIMP void __cdecl _wassert(const wchar_t *_Message,const wchar_t *_File,unsigned _Line); -void __cdecl _assert (const char *_Message, const char *_File, unsigned _Line); _CRT_END_C_HEADER