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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27528 invoked from network); 31 May 2023 09:26:21 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 31 May 2023 09:26:21 -0000 Received: (qmail 1942 invoked by uid 550); 31 May 2023 09:23:47 -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 1245 invoked from network); 31 May 2023 09:23:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=/KKzb/cCFPD4Td+yvMcacTsMfULhM9d9sSB9Y7FtCcY=; b=F3X9W9jizG02HJkphN5RYDRa62LsYKOAkGBnmuUDQMs3tTBV5PWM530A gkCdAfx76pfXB4eCg2bt9WjtKsQkshFlRWB65nhyIQUs5Y8MxYf37UyFd 00SMLlTqW29tfwI9XI5EGW1UrylRMeUv08W8eHp8W4W3T0Q9Q5XqRnP3t Q=; 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,205,1681164000"; d="scan'208";a="57428761" From: Jens Gustedt To: musl@lists.openwall.com Date: Wed, 31 May 2023 11:23:03 +0200 Message-Id: <46ea0a8a0f85fc68d26c6a4019d5215b6387ce9e.1685522953.git.Jens.Gustedt@inria.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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