From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19773 invoked from network); 24 May 2023 14:02:27 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 24 May 2023 14:02:27 -0000 Received: (qmail 32037 invoked by uid 550); 24 May 2023 14:01:37 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 31872 invoked from network); 24 May 2023 14:01:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=message-id:in-reply-to:references:from:date:to: resent-date:resent-from:subject:resent-message-id: resent-to; bh=B9OViTC9liq/wiK8q+4rvheRuiPHPq2n5FN9SpTM0Us=; b=KBSlfVymr1PROKQkxWtiHjf+IwMcxq2Co9f4lfIZc72BBx79gw+vSUAt eGpQAJgKmkki/6ljpNTrOCB/tmpybgY5ojh7ReooejFyMwy84HOvlqec5 OyI/h0T5ZF9iOH+Kh0h4XOh0mGlnOvUb6g4T512IYaG6GmEJoun7Xt9ZS E=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=jens.gustedt@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.00,189,1681164000"; d="scan'208";a="56883748" Message-Id: <9985ac5610d2e36d01032e1685ca3d629fccac64.1684932861.git.Jens.Gustedt@inria.fr> In-Reply-To: References: From: Jens Gustedt Date: Wed, 19 Apr 2023 08:42:15 +0200 To: musl@lists.openwall.com Resent-Date: Wed, 24 May 2023 15:59:26 +0200 Resent-From: =?UTF-8?B?SuKCkeKCmeKCmw==?= Gustedt Resent-Message-ID: <20230524155926.0d49b342@inria.fr> Resent-To: musl@lists.openwall.com Subject: [musl] [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 clang there are better feature test macros, namely __is_identifier(nullptr) can be used to test if nullptr is an identifier or a keyword. In particular, this feature now seems to work with clang 16.0.2. --- include/stddef.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/stddef.h b/include/stddef.h index 09be5fb6..e4d6b2ef 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -26,4 +26,14 @@ #define unreachable() __builtin_unreachable() +#if __STDC_VERSION__ >= 202311L +typedef typeof(nullptr) nullptr_t; +#else +#if __clang__ +#if !__is_identifier(nullptr) +typedef typeof(nullptr) nullptr_t; +#endif +#endif +#endif + #endif -- 2.34.1