aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2021-01-22 08:53:44 -0800
committerChris Robinson <[email protected]>2021-01-22 08:53:44 -0800
commitf576a353638236775ecb4f4e8ba93cb1716fbe2d (patch)
treea9c4be63a500465264136580d15e62af14ebab60
parent1dcc6361fe5c06dfd3ec30cfb9bce04e0c522805 (diff)
Don't bother checking for std::aligned_alloc
-rw-r--r--CMakeLists.txt17
-rw-r--r--common/almalloc.cpp7
-rw-r--r--config.h.in3
3 files changed, 2 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 651f84e8..1f355508 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -153,19 +153,9 @@ set(EXPORT_DECL "")
# Require C++14
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
-if(CMAKE_CXX14_EXTENSION_COMPILE_OPTION)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX14_EXTENSION_COMPILE_OPTION}")
-elseif(CMAKE_CXX14_STANDARD_COMPILE_OPTION)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX14_STANDARD_COMPILE_OPTION}")
-endif()
# Prefer C11, but support C99 and C90 too.
set(CMAKE_C_STANDARD 11)
-if(CMAKE_C11_EXTENSION_COMPILE_OPTION)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C11_EXTENSION_COMPILE_OPTION}")
-elseif(CMAKE_C11_STANDARD_COMPILE_OPTION)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C11_STANDARD_COMPILE_OPTION}")
-endif()
if(NOT WIN32)
# Check if _POSIX_C_SOURCE and _XOPEN_SOURCE needs to be set for POSIX functions
@@ -534,13 +524,6 @@ if(HAVE_INTRIN_H)
}" HAVE_CPUID_INTRINSIC)
endif()
-check_cxx_source_compiles("#include <cstdlib>
-int main()
-{
- void *ptr{std::aligned_alloc(alignof(int), sizeof(int))};
- std::free(ptr);
- return 0;
-}" HAVE_STD_ALIGNED_ALLOC)
check_symbol_exists(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
check_symbol_exists(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC)
check_symbol_exists(proc_pidpath libproc.h HAVE_PROC_PIDPATH)
diff --git a/common/almalloc.cpp b/common/almalloc.cpp
index 4d7ff62c..ad1dc6be 100644
--- a/common/almalloc.cpp
+++ b/common/almalloc.cpp
@@ -18,10 +18,7 @@ void *al_malloc(size_t alignment, size_t size)
assert((alignment & (alignment-1)) == 0);
alignment = std::max(alignment, alignof(std::max_align_t));
-#if defined(HAVE_STD_ALIGNED_ALLOC)
- size = (size+(alignment-1))&~(alignment-1);
- return std::aligned_alloc(alignment, size);
-#elif defined(HAVE_POSIX_MEMALIGN)
+#if defined(HAVE_POSIX_MEMALIGN)
void *ret{};
if(posix_memalign(&ret, alignment, size) == 0)
return ret;
@@ -53,7 +50,7 @@ void *al_calloc(size_t alignment, size_t size)
void al_free(void *ptr) noexcept
{
-#if defined(HAVE_STD_ALIGNED_ALLOC) || defined(HAVE_POSIX_MEMALIGN)
+#if defined(HAVE_POSIX_MEMALIGN)
std::free(ptr);
#elif defined(HAVE__ALIGNED_MALLOC)
_aligned_free(ptr);
diff --git a/config.h.in b/config.h.in
index f7e1542e..a28204ef 100644
--- a/config.h.in
+++ b/config.h.in
@@ -5,9 +5,6 @@
/* Define if HRTF data is embedded in the library */
#cmakedefine ALSOFT_EMBED_HRTF_DATA
-/* Define if we have the std::aligned_alloc function */
-#cmakedefine HAVE_STD_ALIGNED_ALLOC
-
/* Define if we have the posix_memalign function */
#cmakedefine HAVE_POSIX_MEMALIGN