This patch series provides all _aligned_* functions for all CRT import libs.

PATCH v3 fixes __mingw_aligned_msize() for alignment < sizeof(void*) and
changes mingw-aligned-malloc.c to be compatible with MS CRT functions.
New tests are in t_aligned_alloc.c too.

Now the t_aligned_alloc.c test is passing with different CRT libraries:
crtdll, msvcr40d, msvcrt, msvcr70, UCRT...

crtdll and msvcr40d are using only mingw-w64 emulated functions
msvcrt and msvcr70 are using CRT functions for allocation and mingw-w64
emulation for aligned msize
UCRT is using CRT functions only, none mingw-w64 emulation

It does not pass with msvcrt10 and msvcrt20 because these libraries have
broken _msize() function. The first malloc/_msize test in the file
t_aligned_alloc.c is failing.

Pali Rohár (7):
  headers: Add missing declaration for __mingw_aligned_offset_malloc()
  crt: Provide _aligned_* functions
  crt: Implement __mingw_aligned_msize() function
  crt: Change mingw-aligned-malloc.c to be compatible with MS CRT
    functions
  crt: Provide _aligned_msize function for all CRT import libraries
  crt: Provide *_recalloc functions
  crt: Add test case for _aligned_* and *_recalloc functions

 mingw-w64-crt/Makefile.am                     |  19 +++
 mingw-w64-crt/lib-common/msvcrt.def.in        |  10 +-
 mingw-w64-crt/misc/_aligned_free.c            |  18 ++
 mingw-w64-crt/misc/_aligned_malloc.c          |  18 ++
 mingw-w64-crt/misc/_aligned_msize.c           |  13 ++
 mingw-w64-crt/misc/_aligned_offset_malloc.c   |  18 ++
 mingw-w64-crt/misc/_aligned_offset_realloc.c  |  18 ++
 mingw-w64-crt/misc/_aligned_offset_recalloc.c |  25 +++
 mingw-w64-crt/misc/_aligned_realloc.c         |  18 ++
 mingw-w64-crt/misc/_aligned_recalloc.c        |  25 +++
 mingw-w64-crt/misc/_recalloc.c                |  25 +++
 mingw-w64-crt/misc/mingw-aligned-malloc.c     |  40 ++++-
 mingw-w64-crt/testcases/t_aligned_alloc.c     | 156 ++++++++++++++++++
 mingw-w64-headers/crt/crtdbg.h                |   2 -
 mingw-w64-headers/crt/malloc.h                |   4 +-
 mingw-w64-headers/crt/stdlib.h                |   2 -
 16 files changed, 393 insertions(+), 18 deletions(-)
 create mode 100644 mingw-w64-crt/misc/_aligned_free.c
 create mode 100644 mingw-w64-crt/misc/_aligned_malloc.c
 create mode 100644 mingw-w64-crt/misc/_aligned_msize.c
 create mode 100644 mingw-w64-crt/misc/_aligned_offset_malloc.c
 create mode 100644 mingw-w64-crt/misc/_aligned_offset_realloc.c
 create mode 100644 mingw-w64-crt/misc/_aligned_offset_recalloc.c
 create mode 100644 mingw-w64-crt/misc/_aligned_realloc.c
 create mode 100644 mingw-w64-crt/misc/_aligned_recalloc.c
 create mode 100644 mingw-w64-crt/misc/_recalloc.c
 create mode 100644 mingw-w64-crt/testcases/t_aligned_alloc.c

-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to