Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <46ea0a8a0f85fc68d26c6a4019d5215b6387ce9e.1685522953.git.Jens.Gustedt@inria.fr>
Date: Wed, 31 May 2023 11:23:03 +0200
From: Jens Gustedt <Jens.Gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: [C23 divers headers 16/17] C23: add the nullptr_t type

This will only work with compilers that implement typeof and
nullptr. Currently this doesn't work for gcc but this will probably be
in gcc-13. Therefore the version test uses the future date of 202311L
which is the foreseen value for C23 final.

For transition time this feature will not yet be implement on all
compilers that people will try out. Use a heuristic that finds out if
it is enabled for c2x compilers.
---
 include/stddef.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/stddef.h b/include/stddef.h
index f77a1b49..70f299a6 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -28,4 +28,13 @@
 #define unreachable() __builtin_unreachable()
 #endif
 
+#if __STDC_VERSION__ >= 202311L
+typedef typeof(nullptr) nullptr_t;
+// Some compilers still only have partial support for C23
+#elif __STDC_VERSION__ >= 202000L && defined(__is_identifier)
+#if !__is_identifier(nullptr)
+typedef typeof(nullptr) nullptr_t;
+#endif
+#endif
+
 #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.