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.7 required=5.0 tests=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 20939 invoked from network); 24 May 2023 14:23:37 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 24 May 2023 14:23:37 -0000 Received: (qmail 22435 invoked by uid 550); 24 May 2023 14:23:34 -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 22388 invoked from network); 24 May 2023 14:23:33 -0000 Date: Wed, 24 May 2023 10:23:20 -0400 From: Rich Felker To: Jens Gustedt Cc: musl@lists.openwall.com Message-ID: <20230524142320.GX4163@brightrain.aerifal.cx> References: <4ce3bedd2525d07509e9514d4b8274b4470878bb.1684932861.git.Jens.Gustedt@inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4ce3bedd2525d07509e9514d4b8274b4470878bb.1684932861.git.Jens.Gustedt@inria.fr> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] [C23 divers headers 03/17] C23: add call_once to stdlib.h On Mon, Apr 17, 2023 at 11:09:20AM +0200, Jens Gustedt wrote: > 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 This is borderline whether it matters (the name is unlikely to clash and eventually we will only support namespace rules for latest C) but it's probably better to guard it with C version check. Rich