[libcxx-commits] [PATCH] D91379: [libc++] Factor out common logic for calling aligned allocation

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 2 13:20:04 PST 2020


ldionne added a comment.

In D91379#2429302 <https://reviews.llvm.org/D91379#2429302>, @mstorsjo wrote:

> In D91379#2428659 <https://reviews.llvm.org/D91379#2428659>, @dmajor wrote:
>
>> In D91379#2427960 <https://reviews.llvm.org/D91379#2427960>, @mstorsjo wrote:
>>
>>> I haven't run into this issue - how do you end up getting intrin.h included before the other includes here?
>>
>> Any case with intrin.h coming first should do it:
>>
>>   $ cat test.cpp
>>   #include <intrin.h>
>>   #include <new>
>>   
>>   $ ./clang/bin/x86_64-w64-mingw32-clang++ -c test.cpp 
>>   In file included from test.cpp:2:
>>   /home/vm/Desktop/mingwtest/clang/bin/../x86_64-w64-mingw32/include/c++/v1/new:314:12: error: no member named '_aligned_malloc' in the global namespace
>>     return ::_aligned_malloc(__size, __alignment);
>>            ~~^
>>   /home/vm/Desktop/mingwtest/clang/bin/../x86_64-w64-mingw32/include/c++/v1/new:326:5: error: no type named '_aligned_free' in the global namespace
>>     ::_aligned_free(__ptr);
>>     ~~^
>>   2 errors generated.
>
> Ah, doh. Indeed, I can reproduce that. Apparently the code I build regularly doesn't happen to use that setup.
>
> I'll look into fixing the mingw-w64 header bug.

Actually, is there any chance that mingw could implement `aligned_alloc` from C11? This would increase their level of conformance, and solve this issue at the same time by providing a canonical, standardized name to do aligned allocation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91379/new/

https://reviews.llvm.org/D91379



More information about the libcxx-commits mailing list