Pali Rohár <[email protected]> wrote:
> On Monday 22 June 2026 10:13:30 Kirill Makurin wrote:
>> Subject: [PATCH 1/4] crt: always use _wassert() to implement assert() macro
>> ...
>> Subject: [PATCH 2/4] crt: remove mingw-w64 wrapper for _assert()
>
> I still do not think that it is good idea to remove _assert usage and
> _assert fixes support in mingw-w64 wrapper.
The only difference mingw-w64 wrapper for _assert() makes is switching
translation mode on `stderr` to `_O_TEXT`, which allows it to properly display
the message if application enabled Unicode translation mode on `stderr`.
We did this change after I mentioned this issue, and I don't know if there is
anyone else who ever run into this issue. I expect only Windows-only code to
ever use Unicode translation modes as using them requires application to only
use wide stdio functions. IMO, always using _wassert() for assert()
implementation is the best solution.
We have only three problematic cases: crtdll.dll, msvcrt20.dll and
msvcrt40.dll. All of them can be redirected to OS msvcrt.dll, which may allow
them to enable Unicode translation mode. This is never going to happen in old
binaries which were built against real crtdll.dll and msvcrt{20,40}.dll because
there simply were no Unicode translation mode constants.
IMO, we can simply ignore this issue or provide pinpointed fixes for affected
CRTs. I find the latter pretty hard to do. And if we are to do pinpointed
fixes, I think they must go into _wassert() emulation; let's just leave
_assert() alone.
> The _assert function was begin used in mingw-w64 for a very long time
> and so I would like to see it still there.
I saw that _assert() is called directly in t_fseeki64.c. In that test, or if it
were any other test, it makes zero difference whether you use CRT _assert() or
mingw-w64 wrapper.
Keep in mind that the change only removes the mingw-w64 wrapper; we still
declare it in assert.h.
> I'm willing to spend more time on the _assert function to try to fix
> newly found issues, to let the _assert here.
- Kirill Makurin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public