// Support routines for the -*- C++ -*- dynamic memory management.
-// Copyright (C) 1997-2021 Free Software Foundation, Inc.
+// Copyright (C) 1997-2024 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
void *posix_memalign(void **, size_t alignment, size_t size);
# elif _GLIBCXX_HAVE_MEMALIGN
void *memalign(size_t alignment, size_t size);
+# else
+ // A freestanding C runtime may not provide "malloc" -- but there is no
+ // other reasonable way to implement "operator new".
+ void *malloc(size_t);
# endif
}
#endif
static inline void*
aligned_alloc (std::size_t al, std::size_t sz)
{
+ // Solaris requires al >= sizeof a word and QNX requires >= sizeof(void*)
+ // but they both provide posix_memalign, so will use the definition above.
return memalign (al, sz);
}
#else // !HAVE__ALIGNED_MALLOC && !HAVE_POSIX_MEMALIGN && !HAVE_MEMALIGN