[PATCH] C11 support for <stdlib.h>

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Sep 24 11:22:57 UTC 2015


Import some <stdlib.h> function declarations from latest FreeBSD.

newlib/ChangeLog
2015-09-24  Sebastian Huber  <sebastian.huber at embedded-brains.de>

	* libc/include/stdlib.h (alloc_aligned): Declare.
	(at_quick_exit): Likewise.
	(quick_exit): Likewise.
---
 newlib/libc/include/stdlib.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h
index 38ac296..51a6f0a 100644
--- a/newlib/libc/include/stdlib.h
+++ b/newlib/libc/include/stdlib.h
@@ -280,6 +280,17 @@ extern long double strtold (const char *__restrict, char **__restrict);
 #endif
 #endif /* _HAVE_LONG_DOUBLE */
 
+/*
+ * If we're in a mode greater than C99, expose C11 functions.
+ */
+#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
+void *	aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1)
+	    __alloc_size(2);
+int	at_quick_exit(void (*)(void));
+_Noreturn void
+	quick_exit(int);
+#endif /* __ISO_C_VISIBLE >= 2011 */
+
 _END_STD_C
 
 #endif /* _STDLIB_H_ */
-- 
1.8.4.5



More information about the devel mailing list