glibc/stdlib
Joseph Myers a7ddbf456d Add once_flag, ONCE_FLAG_INIT and call_once to stdlib.h for C23
C23 adds once_flag, ONCE_FLAG_INIT and call_once to stdlib.h (in C11
they were only in threads.h, in C23 they are in both headers; this
change came from N2840).  Implement this change, with a
bits/types/once_flag.h header for the common type and initializer
definitions.

Note that there's an omnibus bug (bug 33001) that covers more than
just these missing definitions.

This doesn't seem a significant enough feature to be worth mentioning
in NEWS.

ISO C is not concerned with whether functions are in libc or
libpthread, but POSIX links this to what header they are declared in,
so functions declared in stdlib.h are supposed to be in libc.
However, the current edition of POSIX is based on C17; hopefully Hurd
glibc will have completed the merge of libpthread into libc (in
particular, moving call_once) well before a future edition of POSIX
based on C23 (or a later version of ISO C) is released.

Tested for x86_64 and x86.
2025-10-01 15:15:15 +00:00
..
bits
sys
Depend
Makefile Add once_flag, ONCE_FLAG_INIT and call_once to stdlib.h for C23 2025-10-01 15:15:15 +00:00
Versions stdlib: Implement C2Y uabs, ulabs, ullabs and uimaxabs 2025-04-08 12:51:51 +00:00
a64l.c
abort.c stdlib: resolve a double lock init issue after fork [BZ #32994] 2025-07-31 19:11:08 +02:00
abs.c
add_n.c
addmul_1.c
alloca.h
arc4random.c
arc4random_uniform.c
at_quick_exit.c
atexit.c
atof.c
atoi.c
atol.c
atoll.c
bsearch.c
bug-fmtmsg1.c
bug-getcontext.c
bug-strtod.c
bug-strtod2.c
canonicalize.c Remove eloop-threshold.h 2025-03-21 15:46:48 -03:00
cmp.c
cxa_at_quick_exit.c
cxa_atexit.c
cxa_finalize.c
cxa_thread_atexit_impl.c
dbl2mpn.c
div.c
divmod_1.c
divrem.c
drand48-iter.c
drand48.c
drand48_r.c
erand48.c
erand48_r.c
errno.h
exit.c
exit.h
fmtmsg.c
fmtmsg.h
fpioconst.c
fpioconst.h
gen-fpioconst.c
gen-tst-strtod-round.c
getcontext.c
getentropy.c
getenv.c posix: Move environ helper variables next to environ definition (bug 32541) 2025-03-07 21:40:55 +01:00
getrandom.c
getsubopt.c
gmp-impl.h
gmp.h
grouping.c
grouping.h
groupingwc.c
inlines.c
inttypes.h stdlib: Implement C2Y uabs, ulabs, ullabs and uimaxabs 2025-04-08 12:51:51 +00:00
isomac.c
jrand48.c
jrand48_r.c
l64a.c
labs.c
lcong48.c
lcong48_r.c
ldbl2mpn.c
ldiv.c
llabs.c
lldiv.c
longlong.h
lrand48.c
lrand48_r.c
lshift.c
makecontext.c
mblen.c
mbstowcs.c
mbtowc.c
mod_1.c
monetary.h
mp_clz_tab.c
mpn2dbl.c
mpn2flt.c
mpn2ldbl.c
mrand48.c
mrand48_r.c
mul.c
mul_1.c
mul_n.c
nrand48.c
nrand48_r.c
old_atexit.c
on_exit.c
putenv.c
qsort.c stdlib: Fix qsort memory leak if callback throws (BZ 32058) 2025-04-02 18:01:55 +00:00
quick_exit.c
rand.c
rand_r.c
random.c stdlib: Add single-threaded fast path to rand() 2025-02-24 14:13:43 +00:00
random_r.c
rpmatch.c
rshift.c
secure-getenv.c
seed48.c
seed48_r.c
setcontext.c
setenv.c stdlib: Re-implement free (environ) compatibility kludge for setenv 2025-01-24 22:37:49 +01:00
setenv.h stdlib: Re-implement free (environ) compatibility kludge for setenv 2025-01-24 22:37:49 +01:00
srand48.c
srand48_r.c
stdbit.h
stdc_bit_ceil_uc.c
stdc_bit_ceil_ui.c
stdc_bit_ceil_ul.c
stdc_bit_ceil_ull.c
stdc_bit_ceil_us.c
stdc_bit_floor_uc.c
stdc_bit_floor_ui.c
stdc_bit_floor_ul.c
stdc_bit_floor_ull.c
stdc_bit_floor_us.c
stdc_bit_width_uc.c
stdc_bit_width_ui.c
stdc_bit_width_ul.c
stdc_bit_width_ull.c
stdc_bit_width_us.c
stdc_count_ones_uc.c
stdc_count_ones_ui.c
stdc_count_ones_ul.c
stdc_count_ones_ull.c
stdc_count_ones_us.c
stdc_count_zeros_uc.c
stdc_count_zeros_ui.c
stdc_count_zeros_ul.c
stdc_count_zeros_ull.c
stdc_count_zeros_us.c
stdc_first_leading_one_uc.c
stdc_first_leading_one_ui.c
stdc_first_leading_one_ul.c
stdc_first_leading_one_ull.c
stdc_first_leading_one_us.c
stdc_first_leading_zero_uc.c
stdc_first_leading_zero_ui.c
stdc_first_leading_zero_ul.c
stdc_first_leading_zero_ull.c
stdc_first_leading_zero_us.c
stdc_first_trailing_one_uc.c
stdc_first_trailing_one_ui.c
stdc_first_trailing_one_ul.c
stdc_first_trailing_one_ull.c
stdc_first_trailing_one_us.c
stdc_first_trailing_zero_uc.c
stdc_first_trailing_zero_ui.c
stdc_first_trailing_zero_ul.c
stdc_first_trailing_zero_ull.c
stdc_first_trailing_zero_us.c
stdc_has_single_bit_uc.c
stdc_has_single_bit_ui.c
stdc_has_single_bit_ul.c
stdc_has_single_bit_ull.c
stdc_has_single_bit_us.c
stdc_leading_ones_uc.c
stdc_leading_ones_ui.c
stdc_leading_ones_ul.c
stdc_leading_ones_ull.c
stdc_leading_ones_us.c
stdc_leading_zeros_uc.c
stdc_leading_zeros_ui.c
stdc_leading_zeros_ul.c
stdc_leading_zeros_ull.c
stdc_leading_zeros_us.c
stdc_trailing_ones_uc.c
stdc_trailing_ones_ui.c
stdc_trailing_ones_ul.c
stdc_trailing_ones_ull.c
stdc_trailing_ones_us.c
stdc_trailing_zeros_uc.c
stdc_trailing_zeros_ui.c
stdc_trailing_zeros_ul.c
stdc_trailing_zeros_ull.c
stdc_trailing_zeros_us.c
stdint.h
stdlib.h Add once_flag, ONCE_FLAG_INIT and call_once to stdlib.h for C23 2025-10-01 15:15:15 +00:00
strfmon.c
strfmon_l.c
strfrom-skeleton.c
strfromd.c
strfromf.c
strfroml.c
strtod.c
strtod_l.c
strtod_nan.c
strtod_nan_main.c
strtod_nan_narrow.h
strtod_nan_wide.h
strtof.c
strtof_l.c
strtof_nan.c
strtol.c
strtol_l.c
strtold.c
strtold_l.c
strtold_nan.c
strtoll.c
strtoll_l.c
strtoul.c
strtoul_l.c
strtoull.c
strtoull_l.c
sub_n.c
submul_1.c
swapcontext.c
system.c
tens_in_limb.c
test-a64l.c
test-at_quick_exit-race.c
test-atexit-race-common.c
test-atexit-race.c
test-atexit-recursive.c
test-bz22786.c stdlib: Use support_accept_oom in test-bz22786 2025-09-18 19:11:38 +02:00
test-canon.c Tests: Create files with mode 0666, not 0777 (bug 33171) 2025-09-01 15:12:28 +02:00
test-canon2.c
test-cxa_atexit-race.c
test-cxa_atexit-race2.c
test-dlclose-exit-race-helper.c
test-dlclose-exit-race.c
test-on_exit-race.c
testdiv.c
testdiv.input
testmb.c
testmb2.c
testrand.c
testsort.c
tst-abs.c
tst-arc4random-fork.c
tst-arc4random-stats.c
tst-arc4random-thread.c
tst-at_quick_exit.c
tst-atexit-common.c
tst-atexit.c
tst-atof1.c
tst-atof2.c
tst-bsearch.c
tst-bz20544.c
tst-canon-bz26341.c Remove eloop-threshold.h 2025-03-21 15:46:48 -03:00
tst-concurrent-exit-skeleton.c
tst-concurrent-exit.c
tst-concurrent-quick_exit.c
tst-cxa_atexit.c
tst-empty-env.c
tst-environ-change-1.c stdlib: Re-implement free (environ) compatibility kludge for setenv 2025-01-24 22:37:49 +01:00
tst-environ-change-2.c stdlib: Re-implement free (environ) compatibility kludge for setenv 2025-01-24 22:37:49 +01:00
tst-environ-change-3.c stdlib: Re-implement free (environ) compatibility kludge for setenv 2025-01-24 22:37:49 +01:00
tst-environ-change-4.c stdlib: Re-implement free (environ) compatibility kludge for setenv 2025-01-24 22:37:49 +01:00
tst-environ-change-skeleton.c stdlib: Re-implement free (environ) compatibility kludge for setenv 2025-01-24 22:37:49 +01:00
tst-environ.c
tst-fmtmsg.c
tst-fmtmsg.sh
tst-getenv-signal.c
tst-getenv-static.c posix: Move environ helper variables next to environ definition (bug 32541) 2025-03-07 21:40:55 +01:00
tst-getenv-thread.c
tst-getenv-unsetenv.c
tst-getrandom-errno.c
tst-getrandom.c
tst-getrandom2.c
tst-labs.c
tst-limits.c
tst-llabs.c
tst-makecontext-align.c
tst-makecontext.c
tst-makecontext2.c
tst-makecontext3.c
tst-on_exit.c
tst-putenv.c
tst-putenvmod.c
tst-qsort.c
tst-qsort2.c
tst-qsort3.c
tst-qsort4.c stdlib: Fix qsort memory leak if callback throws (BZ 32058) 2025-04-02 18:01:55 +00:00
tst-qsort6.c
tst-qsort7.c stdlib: Fix qsort memory leak if callback throws (BZ 32058) 2025-04-02 18:01:55 +00:00
tst-qsortx7.c stdlib: Fix qsort memory leak if callback throws (BZ 32058) 2025-04-02 18:01:55 +00:00
tst-quick_exit.cc
tst-rand-sequence.c
tst-rand48-2.c
tst-rand48.c
tst-random-bz30584.c
tst-random.c
tst-random2.c
tst-realpath-toolong.c
tst-realpath.c
tst-secure-getenv.c Fix error reporting (false negatives) in SGID tests 2025-05-22 14:36:37 +02:00
tst-setcontext.c
tst-setcontext2.c
tst-setcontext3.c
tst-setcontext3.sh
tst-setcontext4.c
tst-setcontext5.c
tst-setcontext6.c
tst-setcontext7.c
tst-setcontext8.c
tst-setcontext9.c
tst-setcontext10.c
tst-setcontext11.c
tst-setenv-environ.c stdlib: Test using setenv with updated environ [BZ #32588] 2025-01-25 07:31:41 +08:00
tst-stdbit-Wconversion.c
tst-stdbit-builtins.c
tst-stdbit.h
tst-stdc_bit_ceil.c
tst-stdc_bit_floor.c
tst-stdc_bit_width.c
tst-stdc_count_ones.c
tst-stdc_count_zeros.c
tst-stdc_first_leading_one.c
tst-stdc_first_leading_zero.c
tst-stdc_first_trailing_one.c
tst-stdc_first_trailing_zero.c
tst-stdc_has_single_bit.c
tst-stdc_leading_ones.c
tst-stdc_leading_zeros.c
tst-stdc_trailing_ones.c
tst-stdc_trailing_zeros.c
tst-strfmon_l.c
tst-strfrom-locale.c
tst-strfrom.c
tst-strfrom.h
tst-strtod-nan-locale-main.c
tst-strtod-nan-locale.c
tst-strtod-nan-sign-main.c
tst-strtod-nan-sign.c
tst-strtod-overflow.c
tst-strtod-round-data
tst-strtod-round-data.h
tst-strtod-round-skeleton.c
tst-strtod-round.c
tst-strtod-underflow.c
tst-strtod.c
tst-strtod.h
tst-strtod1i.c
tst-strtod2.c
tst-strtod3.c
tst-strtod4.c
tst-strtod5.c
tst-strtod5i.c
tst-strtod6.c
tst-strtol-binary-c11.c
tst-strtol-binary-c23.c
tst-strtol-binary-gnu11.c
tst-strtol-binary-gnu23.c
tst-strtol-binary-main.c
tst-strtol-locale-main.c
tst-strtol-locale.c
tst-strtol.c
tst-strtoll.c
tst-swapcontext1.c
tst-swapcontext2.c
tst-system.c
tst-thread-quick_exit.cc
tst-tininess.c
tst-tls-atexit-lib.c
tst-tls-atexit-nodelete.c
tst-tls-atexit.c
tst-uabs.c stdlib: Implement C2Y uabs, ulabs, ullabs and uimaxabs 2025-04-08 12:51:51 +00:00
tst-uimaxabs.c stdlib: Implement C2Y uabs, ulabs, ullabs and uimaxabs 2025-04-08 12:51:51 +00:00
tst-ulabs.c stdlib: Implement C2Y uabs, ulabs, ullabs and uimaxabs 2025-04-08 12:51:51 +00:00
tst-ullabs.c stdlib: Implement C2Y uabs, ulabs, ullabs and uimaxabs 2025-04-08 12:51:51 +00:00
tst-unsetenv1.c
tst-width-stdint.c
tst-width.c
tst-xpg-basename.c
uabs.c stdlib: Implement C2Y uabs, ulabs, ullabs and uimaxabs 2025-04-08 12:51:51 +00:00
ucontext.h
udiv_qrnnd.c
ulabs.c stdlib: Implement C2Y uabs, ulabs, ullabs and uimaxabs 2025-04-08 12:51:51 +00:00
ullabs.c stdlib: Implement C2Y uabs, ulabs, ullabs and uimaxabs 2025-04-08 12:51:51 +00:00
wcstombs.c
wctomb.c
xpg_basename.c