Mercurial > hg > CbC > CbC_gcc
diff libstdc++-v3/libsupc++/new_opa.cc @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
line wrap: on
line diff
--- a/libstdc++-v3/libsupc++/new_opa.cc Thu Oct 25 07:37:49 2018 +0900 +++ b/libstdc++-v3/libsupc++/new_opa.cc Thu Feb 13 11:34:05 2020 +0900 @@ -1,6 +1,6 @@ // Support routines for the -*- C++ -*- dynamic memory management. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -43,6 +43,21 @@ using std::new_handler; using std::bad_alloc; +#if ! _GLIBCXX_HOSTED +extern "C" +{ +# if _GLIBCXX_HAVE_ALIGNED_ALLOC + void *aligned_alloc(size_t alignment, size_t size); +# elif _GLIBCXX_HAVE__ALIGNED_MALLOC + void *_aligned_malloc(size_t size, size_t alignment); +# elif _GLIBCXX_HAVE_POSIX_MEMALIGN + void *posix_memalign(void **, size_t alignment, size_t size); +# elif _GLIBCXX_HAVE_MEMALIGN + void *memalign(size_t alignment, size_t size); +# endif +} +#endif + namespace __gnu_cxx { #if _GLIBCXX_HAVE_ALIGNED_ALLOC using ::aligned_alloc; @@ -68,12 +83,6 @@ static inline void* aligned_alloc (std::size_t al, std::size_t sz) { -#ifdef __sun - // Solaris 10 memalign requires that alignment is greater than or equal to - // the size of a word. - if (al < sizeof(int)) - al = sizeof(int); -#endif return memalign (al, sz); } #else // !HAVE__ALIGNED_MALLOC && !HAVE_POSIX_MEMALIGN && !HAVE_MEMALIGN @@ -114,9 +123,10 @@ sz = 1; #if _GLIBCXX_HAVE_ALIGNED_ALLOC -# ifdef _AIX +# if defined _AIX || defined __APPLE__ /* AIX 7.2.0.0 aligned_alloc incorrectly has posix_memalign's requirement - * that alignment is a multiple of sizeof(void*). */ + * that alignment is a multiple of sizeof(void*). + * OS X 10.15 has the same requirement. */ if (align < sizeof(void*)) align = sizeof(void*); # endif