1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-11-30 11:41:39 +03:00

stdlib: Do not define once_flag, ONCE_FLAG_INIT for C++

The definition of once_flag conflicts with std::once_flag in
if “using namespace std;” is active.

Updates commit a7ddbf456d
("Add once_flag, ONCE_FLAG_INIT and call_once to stdlib.h for C23").

Suggested-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
This commit is contained in:
Florian Weimer
2025-11-11 18:20:10 +01:00
parent 71d9f47b5a
commit 2eff71d289
2 changed files with 18 additions and 3 deletions

View File

@@ -1159,11 +1159,13 @@ extern int ttyslot (void) __THROW;
#endif
#if __GLIBC_USE (ISOC23)
# include <bits/types/once_flag.h>
# ifndef __cplusplus
# include <bits/types/once_flag.h>
/* Call function __FUNC exactly once, even if invoked from several threads.
All calls must be made with the same __FLAGS object. */
extern void call_once (once_flag *__flag, void (*__func)(void));
# endif /* !__cplusplus */
/* Return the alignment of P. */
extern size_t memalignment (const void *__p);