+2020-01-17 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/92376
+ * include/bits/c++config: Only do PSTL config when the header is
+ present, to fix freestanding.
+ * libsupc++/new_opa.cc [!_GLIBCXX_HOSTED]: Declare allocation
+ functions if they were detected by configure.
+
2020-01-16 Kai-Uwe Eckhardt <kuehro@gmx.de>
Matthew Bauer <mjbauer95@gmail.com>
Jonathan Wakely <jwakely@redhat.com>
// PSTL configuration
#if __cplusplus >= 201703L
+// This header is not installed for freestanding:
+#if __has_include(<pstl/pstl_config.h>)
// Preserved here so we have some idea which version of upstream we've pulled in
// #define PSTL_VERSION 9000
# define _PSTL_ASSERT_MSG(_Condition, _Message) __glibcxx_assert(_Condition)
#include <pstl/pstl_config.h>
+#endif // __has_include
+#endif // C++17
-#endif
// End of prewritten config; the settings discovered at configure time follow.
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;