forked from macports/macports-ports
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0aca15
commit 480b6ee
Showing
2 changed files
with
42 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
math/vampire/files/0001-Allocator.cpp-fix-for-macOS-where-aligned_alloc-may-.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
From 94819be610e27eff71e2d692c618345d405dcd17 Mon Sep 17 00:00:00 2001 | ||
From: Sergey Fedorov <[email protected]> | ||
Date: Tue, 3 Sep 2024 18:38:34 +0800 | ||
Subject: [PATCH] Allocator.cpp: fix for macOS where aligned_alloc may not be | ||
supported | ||
|
||
--- Lib/Allocator.cpp | ||
+++ Lib/Allocator.cpp | ||
@@ -19,6 +19,10 @@ | ||
#include "Allocator.hpp" | ||
#include "Lib/Timer.hpp" | ||
|
||
+#ifdef __APPLE__ | ||
+#include <AvailabilityMacros.h> | ||
+#endif | ||
+ | ||
#ifndef INDIVIDUAL_ALLOCATIONS | ||
Lib::SmallObjectAllocator Lib::GLOBAL_SMALL_OBJECT_ALLOCATOR; | ||
#endif | ||
@@ -43,9 +47,10 @@ | ||
ALLOCATED += size; | ||
{ | ||
Lib::TimeoutProtector tp; | ||
+#if !defined(__APPLE__) || (defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) | ||
if(void *ptr = std::aligned_alloc(align, size)) | ||
return ptr; | ||
- | ||
+#endif | ||
// we might be here because `aligned_alloc` is finicky (Apple, looking at you) | ||
// so try again with `malloc` and hope for good alignment | ||
if(void *ptr = std::malloc(size)) |