Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <4ce3bedd2525d07509e9514d4b8274b4470878bb.1684932861.git.Jens.Gustedt@inria.fr>
Date: Mon, 17 Apr 2023 11:09:20 +0200
From: Jens Gustedt <Jens.Gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: [C23 divers headers 03/17] C23: add call_once to stdlib.h

Since C23, call_once, once_flag and ONCE_FLAG_INIT are also accessible
even if the platform does not have the threads option. Add them to the
header.

The identifiers once_flag and ONCE_FLAG_INIT were not reserved in C17
if the header threads.h was not included, so this potentially creates
naming conflicts.
---
 include/stdlib.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/stdlib.h b/include/stdlib.h
index 475190bf..c635d99b 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -172,6 +172,10 @@ long double strtold_l(const char *__restrict, char **__restrict, struct __locale
 #endif
 #endif
 
+#define ONCE_FLAG_INIT 0
+typedef int once_flag;
+void call_once(once_flag *, void (*)(void));
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.34.1

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.