re PR libstdc++/78110 (freestanding libstdc++ fails to compile)
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Wed, 26 Oct 2016 17:26:00 +0000 (17:26 +0000)
committerBernd Edlinger <edlinger@gcc.gnu.org>
Wed, 26 Oct 2016 17:26:00 +0000 (17:26 +0000)
2016-10-26  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR libstdc++/78110
        * libsupc++/new_opa.cc: Don't include <malloc.h> in a free standing
        environment.  Declare memalign directly in that case.

From-SVN: r241591

libstdc++-v3/ChangeLog
libstdc++-v3/libsupc++/new_opa.cc

index 1c878a2a6f3f80550b0c0383339bc7f391f7b6ea..de98de1236cfea9ff02ba20bed81e70ad177ef43 100644 (file)
@@ -1,3 +1,9 @@
+2016-10-26  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       PR libstdc++/78110
+       * libsupc++/new_opa.cc: Don't include <malloc.h> in a free standing
+       environment.  Declare memalign directly in that case.
+
 2016-10-26  Jonathan Wakely  <jwakely@redhat.com>
 
        * testsuite/experimental/filesystem/iterators/pop.cc: Remove
index 91e53a8b3608f63ed7467a23b3f82ac113b4766f..4ed1e249013937bdc5d4b47a6a1d7ae68c8ee85e 100644 (file)
@@ -48,7 +48,11 @@ aligned_alloc (std::size_t al, std::size_t sz)
   return nullptr;
 }
 #elif _GLIBCXX_HAVE_MEMALIGN
+#if _GLIBCXX_HOSTED
 #include <malloc.h>
+#else
+extern "C" void *memalign(std::size_t boundary, std::size_t size);
+#endif
 #define aligned_alloc memalign
 #else
 // The C library doesn't provide any aligned allocation functions, declare