From 5247af0f000a479d6b5fda932f14bb1fae8c70a1 Mon Sep 17 00:00:00 2001 From: millert Date: Sun, 29 Oct 2023 14:26:13 +0000 Subject: [PATCH] Enable ISO C11 APIs when building libc, even with an older compiler. Otherwise, the prototypes for timespec_get() and aligned_alloc() are not visible. OK guenther@ --- lib/libc/include/namespace.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/libc/include/namespace.h b/lib/libc/include/namespace.h index b42c00e4a10..8503de47bee 100644 --- a/lib/libc/include/namespace.h +++ b/lib/libc/include/namespace.h @@ -1,4 +1,4 @@ -/* $OpenBSD: namespace.h,v 1.15 2019/11/25 22:57:28 guenther Exp $ */ +/* $OpenBSD: namespace.h,v 1.16 2023/10/29 14:26:13 millert Exp $ */ #ifndef _LIBC_NAMESPACE_H_ #define _LIBC_NAMESPACE_H_ @@ -19,6 +19,14 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +/* + * ISO C11 or higher is required to build libc. + * This must come _before_ sys/cdefs.h is included. + */ +#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112 +#define _ISOC11_SOURCE 1 +#endif + /* * For explanations of how to use these, see README * For explanations of why we use them and how they work, see DETAILS -- 2.20.1