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 18758 invoked from network); 24 May 2023 13:48:22 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 24 May 2023 13:48:22 -0000 Received: (qmail 18011 invoked by uid 550); 24 May 2023 13:44:53 -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 17912 invoked from network); 24 May 2023 13:44:52 -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=aDsYX0QwKzSo3hsHYutSpMmsGvbZxlAuKsKEceWCo6o=; b=M4b9II1d27r1uaRD3ch+U/4oOOuqsc/wyyDN+eCiAI8w7QCrsJr7bTgn EgQfelFRio+nVeAH79DGwDUMgKnh7++gZuVl+W043lanYUjeCNiLGKQWx lbJVwLPqph/TLz34aE4k+lySI1FQQDSy2Fvz/Tw9I10QnobjTcoWIQ59x U=; 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="56881458" Message-Id: In-Reply-To: References: From: Jens Gustedt Date: Wed, 10 May 2023 14:48:02 +0200 To: musl@lists.openwall.com Resent-Date: Wed, 24 May 2023 15:44:51 +0200 Resent-From: =?UTF-8?B?SuKCkeKCmeKCmw==?= Gustedt Resent-Message-ID: <20230524154451.7567f2fc@inria.fr> Resent-To: musl@lists.openwall.com Subject: [musl] [C23 feature tests 5/6] add a `__inline_or_static` macro for pre-C99 compilers pre-C99 may not have `inline`. To be able to emulate `inline` for those compilers we use `__inline_or_static`, which for all other compilers is set to `inline`. For pre-C99 compilers it is set in the application visible header to `static`. For the compilation of musl itself it is set to empty, such that the symbol is produced and available in musl. So under all circumstances the symbol will be available as external symbol in musl. Applications that link against such a compiled library and that don't have inline, a compilation will produce a `static` symbol in each TU. This is not completely conforming, but we cannot expect much more for pre-C99 compilers. On the other hand if the application is compiled with existing `inline`, this does whatever the compiler thinks is best. If it then needs an external symbol in the C library, that symbol is available under all versions. --- include/features.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/features.h b/include/features.h index f200a6b4..5d460800 100644 --- a/include/features.h +++ b/include/features.h @@ -24,9 +24,13 @@ #if __STDC_VERSION__ >= 199901L || defined(__cplusplus) #define __inline inline -#elif !defined(__GNUC__) +#define __inline_or_static inline +#else +#if !defined(__GNUC__) #define __inline #endif +#define __inline_or_static static +#endif #if __STDC_VERSION__ >= 201112L #elif defined(__GNUC__) -- 2.34.1