Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion libcxx/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,6 @@ set(files
__mdspan/mdspan.h
__memory/addressof.h
__memory/align.h
__memory/aligned_alloc.h
__memory/allocate_at_least.h
__memory/allocation_guard.h
__memory/allocator.h
Expand Down
21 changes: 0 additions & 21 deletions libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -670,27 +670,6 @@ typedef __char32_t char32_t;
# define _LIBCPP_HAS_ALIGNED_ALLOCATION 1
# endif

// It is not yet possible to use aligned_alloc() on all Apple platforms since
// 10.15 was the first version to ship an implementation of aligned_alloc().
# if defined(__APPLE__)
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \
__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && \
__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000) || \
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000)
# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 0
# else
# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 1
# endif
# elif defined(__ANDROID__) && __ANDROID_API__ < 28
// Android only provides aligned_alloc when targeting API 28 or higher.
# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 0
# else
# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 1
# endif

# if defined(__APPLE__) || defined(__FreeBSD__)
# define _LIBCPP_WCTYPE_IS_MASK
# endif
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/module.modulemap.in
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,6 @@ module std [system] {
module memory {
module addressof { header "__memory/addressof.h" }
module align { header "__memory/align.h" }
module aligned_alloc { header "__memory/aligned_alloc.h" }
module allocate_at_least { header "__memory/allocate_at_least.h" }
module allocation_guard { header "__memory/allocation_guard.h" }
module allocator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP___MEMORY_ALIGNED_ALLOC_H
#define _LIBCPP___MEMORY_ALIGNED_ALLOC_H
#ifndef _LIBCPP_SRC_ALIGNED_ALLOC_H
#define _LIBCPP_SRC_ALIGNED_ALLOC_H

#include <__config>
#include <cstdlib>
Expand All @@ -29,7 +29,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) {
# if defined(_LIBCPP_MSVCRT_LIKE)
return ::_aligned_malloc(__size, __alignment);
# elif _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_C11_ALIGNED_ALLOC

// Android only provides aligned_alloc when targeting API 28 or higher.
# elif !defined(__ANDROID__) || __ANDROID_API__ >= 28
// aligned_alloc() requires that __size is a multiple of __alignment,
// but for C++ [new.delete.general], only states "if the value of an
// alignment argument passed to any of these functions is not a valid
Expand Down Expand Up @@ -60,4 +62,4 @@ inline _LIBCPP_HIDE_FROM_ABI void __libcpp_aligned_free(void* __ptr) {

_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP___MEMORY_ALIGNED_ALLOC_H
#endif // _LIBCPP_SRC_ALIGNED_ALLOC_H
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
// GCC doesn't support the aligned-allocation flags.
// XFAIL: gcc

// ADDITIONAL_COMPILE_FLAGS: -I %{libcxx-dir}/src -Wno-macro-redefined

// RUN: %{build} -faligned-allocation -fsized-deallocation
// RUN: %{run}
// RUN: %{build} -faligned-allocation -fno-sized-deallocation -DNO_SIZE
Expand All @@ -36,10 +38,7 @@

#include "test_macros.h"

TEST_DIAGNOSTIC_PUSH
TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header")
#include <__memory/aligned_alloc.h>
TEST_DIAGNOSTIC_POP
#include "include/aligned_alloc.h"

struct alloc_stats {
alloc_stats() { reset(); }
Expand Down
2 changes: 1 addition & 1 deletion libcxxabi/src/fallback_malloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#endif
#endif

#include <__memory/aligned_alloc.h>
#include "include/aligned_alloc.h" // from libc++
#include <__assert>
#include <stdlib.h> // for malloc, calloc, free
#include <string.h> // for memset
Expand Down
2 changes: 1 addition & 1 deletion libcxxabi/src/stdlib_new_delete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#include "__cxxabi_config.h"
#include "abort_message.h"
#include "include/aligned_alloc.h" // from libc++
#include "include/overridable_function.h" // from libc++
#include <__memory/aligned_alloc.h>
#include <cstddef>
#include <cstdlib>
#include <new>
Expand Down
Loading