Skip to content

Commit

Permalink
headers: Remove workarounds for undeffing _aligned_malloc
Browse files Browse the repository at this point in the history
These workarounds stem from an earlier attempt to work around clashes
between _mm_malloc and _mm_free with _aligned_malloc, see
228f1ad for where the earlier
"#define _aligned_malloc ..." workaround was removed.

Signed-off-by: Martin Storsjö <[email protected]>
  • Loading branch information
mstorsjo committed Dec 3, 2020
1 parent f5d7741 commit f70a833
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
17 changes: 1 addition & 16 deletions mingw-w64-headers/crt/malloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,14 @@ extern "C" {
extern unsigned int _amblksiz;

/* Make sure that X86intrin.h doesn't produce here collisions. */
#if (!defined (_XMMINTRIN_H_INCLUDED) && !defined (_MM_MALLOC_H_INCLUDED)) || defined(_aligned_malloc)
#if (!defined (_XMMINTRIN_H_INCLUDED) && !defined (_MM_MALLOC_H_INCLUDED))
#define __DO_ALIGN_DEFINES
#endif

#ifndef _MM_MALLOC_H_INCLUDED
#define _MM_MALLOC_H_INCLUDED
#endif

#ifdef __DO_ALIGN_DEFINES
#pragma push_macro("_aligned_free")
#pragma push_macro("_aligned_malloc")
#undef _aligned_free
#undef _aligned_malloc
#endif

#define _mm_free(a) _aligned_free(a)
#define _mm_malloc(a,b) _aligned_malloc(a,b)

Expand All @@ -91,14 +84,6 @@ extern "C" {
_CRTIMP void *__cdecl _aligned_offset_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment,size_t _Offset);
#endif

#ifdef __DO_ALIGN_DEFINES
#undef __DO_ALIGN_DEFINES

#pragma pop_macro("_aligned_malloc")
#pragma pop_macro("_aligned_free")

#endif

/* Users should really use MS provided versions */
void * __mingw_aligned_malloc (size_t _Size, size_t _Alignment);
void __mingw_aligned_free (void *_Memory);
Expand Down
8 changes: 1 addition & 7 deletions mingw-w64-headers/crt/stdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,15 +532,9 @@ float __cdecl __MINGW_NOTHROW strtof(const char * __restrict__ _Str,char ** __re
void *__cdecl realloc(void *_Memory,size_t _NewSize);
_CRTIMP void *__cdecl _recalloc(void *_Memory,size_t _Count,size_t _Size);
/* Make sure that X86intrin.h doesn't produce here collisions. */
#if (!defined (_XMMINTRIN_H_INCLUDED) && !defined (_MM_MALLOC_H_INCLUDED)) || defined(_aligned_malloc)
#pragma push_macro("_aligned_free")
#pragma push_macro("_aligned_malloc")
#undef _aligned_free
#undef _aligned_malloc
#if (!defined (_XMMINTRIN_H_INCLUDED) && !defined (_MM_MALLOC_H_INCLUDED))
_CRTIMP void __cdecl _aligned_free(void *_Memory);
_CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment);
#pragma pop_macro("_aligned_free")
#pragma pop_macro("_aligned_malloc")
#endif
_CRTIMP void *__cdecl _aligned_offset_malloc(size_t _Size,size_t _Alignment,size_t _Offset);
_CRTIMP void *__cdecl _aligned_realloc(void *_Memory,size_t _Size,size_t _Alignment);
Expand Down

0 comments on commit f70a833

Please sign in to comment.