https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93469

--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I wonder if this would suffice:

--- a/libstdc++-v3/config/os/bsd/darwin/os_defines.h
+++ b/libstdc++-v3/config/os/bsd/darwin/os_defines.h
@@ -57,4 +57,29 @@
 // read(2) can return EINVAL for n >= INT_MAX.
 #define _GLIBCXX_MAX_READ_SIZE (__INT_MAX__ - 1)

+#if (defined _POSIX_C_SOURCE && _POSIX_C_SOURCE < 202405L) \
+  || (defined _XOPEN_SOURCE && _XOPEN_SOURCE < 800)
+// If the user requested an old version of POSIX then we might need to
+// redeclare some C++11 and C++17 functions that were added in POSIX.1-2024.
+
+#if __cplusplus >= 201103L
+# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT
+  extern "C" int at_quick_exit(void (*)(void));
+# endif
+# ifdef _GLIBCXX_HAVE_QUICK_EXIT
+  extern "C" void quick_exit(int);
+# endif
+# if _GLIBCXX_USE_C99_STDLIB
+  extern "C" void _Exit(int);
+# endif
+#endif
+
+#if __cplusplus >= 201703L
+# ifdef _GLIBCXX_HAVE_ALIGNED_ALLOC
+extern "C" void *aligned_alloc(size_t alignment, size_t size);
+# endif
+#endif
+
+#endif // _POSIX_C_SOURCE || _XOPEN_SOURCE
+
 #endif

Reply via email to