Skip to content

Commit

Permalink
[mlir] Fix building CRunnerUtils on OpenBSD with 15.x
Browse files Browse the repository at this point in the history
CRunnerUtils builds as C++11. 9c1d133 broke
the build on OpenBSD. aligned_alloc() was only introduced in C++17.
  • Loading branch information
brad0 authored and tru committed Sep 12, 2022
1 parent 1a5c5e0 commit c643956
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions mlir/lib/ExecutionEngine/CRunnerUtils.cpp
Expand Up @@ -127,14 +127,10 @@ extern "C" void *_mlir_alloc(uint64_t size) { return malloc(size); }
extern "C" void *_mlir_aligned_alloc(uint64_t alignment, uint64_t size) {
#ifdef _WIN32
return _aligned_malloc(size, alignment);
#elif defined(__APPLE__)
// aligned_alloc was added in MacOS 10.15. Fall back to posix_memalign to also
// support older versions.
#else
void *result = nullptr;
(void)::posix_memalign(&result, alignment, size);
return result;
#else
return aligned_alloc(alignment, size);
#endif
}

Expand Down

0 comments on commit c643956

Please sign in to comment.