<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/glibc.git/stdlib/stdlib.h, branch master</title>
<subtitle>GNU C Library
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/glibc.git/atom?h=master</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/glibc.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/glibc.git/'/>
<updated>2026-01-01T21:42:29Z</updated>
<entry>
<title>Update copyright dates with scripts/update-copyrights</title>
<updated>2026-01-01T21:42:29Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2026-01-01T17:32:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/glibc.git/commit/?id=66f3e9219d8f86b977d9be04ad469b5d72af0da2'/>
<id>urn:sha1:66f3e9219d8f86b977d9be04ad469b5d72af0da2</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Define C23 header version macros</title>
<updated>2025-11-27T19:32:49Z</updated>
<author>
<name>Joseph Myers</name>
<email>josmyers@redhat.com</email>
</author>
<published>2025-11-27T19:32:49Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/glibc.git/commit/?id=e535fb910cd6fa5fea157e74a30caf5759372928'/>
<id>urn:sha1:e535fb910cd6fa5fea157e74a30caf5759372928</id>
<content type='text'>
C23 defines library macros __STDC_VERSION_&lt;header&gt;_H__ to indicate
that a header has support for new / changed features from C23.  Now
that all the required library features are implemented in glibc,
define these macros.  I'm not sure this is sufficiently much of a
user-visible feature to be worth a mention in NEWS.

Tested for x86_64.

There are various optional C23 features we don't yet have, of which I
might look at the Annex H ones (floating-point encoding conversion
functions and _Float16 functions) next.

* Optional time bases TIME_MONOTONIC, TIME_ACTIVE, TIME_THREAD_ACTIVE.
  See
  &lt;https://sourceware.org/pipermail/libc-alpha/2023-June/149264.html&gt;
  - we need to review / update that patch.  (I think patch 2/2,
  inventing new names for all the nonstandard CLOCK_* supported by the
  Linux kernel, is rather more dubious.)

* Updating conform/ tests for C23.

* Defining the rounding mode macro FE_TONEARESTFROMZERO for RISC-V (as
  far as I know, the only architecture supported by glibc that has
  hardware support for this rounding mode for binary floating point)
  and supporting it throughout glibc and its tests (especially the
  string/numeric conversions in both directions that explicitly handle
  each possible rounding mode, and various tests that do likewise).

* Annex H floating-point encoding conversion functions.  (It's not
  entirely clear which are optional even given support for Annex H;
  there's some wording applied inconsistently about only being
  required when non-arithmetic interchange formats are supported; see
  the comments I raised on the WG14 reflector on 23 Oct 2025.)

* _Float16 functions (and other header and testcase support for this
  type).

* Decimal floating-point support.

* Fully supporting __int128 and unsigned __int128 as integer types
  wider than intmax_t, as permitted by C23.  Would need doing in
  coordination with GCC, see GCC bug 113887 for more discussion of
  what's involved.
</content>
</entry>
<entry>
<title>Implement C23 const-preserving standard library macros</title>
<updated>2025-11-20T19:31:04Z</updated>
<author>
<name>Joseph Myers</name>
<email>josmyers@redhat.com</email>
</author>
<published>2025-11-20T19:30:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/glibc.git/commit/?id=cd748a63ab1a7ae846175c532a3daab341c62690'/>
<id>urn:sha1:cd748a63ab1a7ae846175c532a3daab341c62690</id>
<content type='text'>
C23 makes various standard library functions, that return a pointer
into an input array, into macros that return a pointer to const when
the relevant argument passed to the macro is a pointer to const.  (The
requirement is for macros, with the existing function types applying
when macro expansion is suppressed.  When a null pointer constant is
passed, such as integer 0, that's the same as a pointer to non-const.)

Implement this feature.  This only applies to C, not C++, since such
macros are not an appropriate way of doing this for C++ and all the
affected functions other than bsearch have overloads to implement an
equivalent feature for C++ anyway.  Nothing is done to apply such a
change to any non-C23 functions with the same property of returning a
pointer into an input array.

The feature is also disabled when _LIBC is defined, since there are
various places in glibc that either redefine these identifiers as
macros, or define the functions themselves, and would need changing to
work in the presence of these macro definitions.  A natural question
is whether we should in fact change those places and not disable the
macro definitions for _LIBC.  If so, we'd need a solution for the
places in glibc that define the macro *before* including the relevant
header (in order in effect to disable the header declaration of the
function by renaming that declaration).

One testcase has #undef added to avoid conflicting with this feature
and another has const added; -Wno-discarded-qualifiers is added for
building zic (but could be removed once there's a new upstream tzcode
release that's const-safe with this C23 change and glibc has updated
to code from that new release).  Probably other places in glibc proper
would need const added if we remove the _LIBC conditionals.

Another question would be whether some GCC extension should be added
to support this feature better with macros that only expand each
argument once (as well as reducing duplication of diagnostics for bad
usages such as non-pointer and pointer-to-volatile-qualfied
arguments).

Tested for x86_64.
</content>
</entry>
<entry>
<title>malloc: add free_sized and free_aligned_sized from C23</title>
<updated>2025-11-19T16:47:53Z</updated>
<author>
<name>Justin King</name>
<email>jcking@google.com</email>
</author>
<published>2025-10-22T12:51:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/glibc.git/commit/?id=56549264d1e1723dc8ad9675141f316dc83626b3'/>
<id>urn:sha1:56549264d1e1723dc8ad9675141f316dc83626b3</id>
<content type='text'>
Signed-off-by: Justin King &lt;jcking@google.com&gt;
Reviewed-by: Adhemerval Zanella  &lt;adhemerval.zanella@linaro.org&gt;
</content>
</entry>
<entry>
<title>stdlib: Do not define once_flag, ONCE_FLAG_INIT for C++</title>
<updated>2025-11-11T17:20:10Z</updated>
<author>
<name>Florian Weimer</name>
<email>fweimer@redhat.com</email>
</author>
<published>2025-11-11T17:20:10Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/glibc.git/commit/?id=2eff71d28946896d085fbd0836ed1394bb55d352'/>
<id>urn:sha1:2eff71d28946896d085fbd0836ed1394bb55d352</id>
<content type='text'>
The definition of once_flag conflicts with std::once_flag in
if “using namespace std;” is active.

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

Suggested-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Reviewed-by: Collin Funk &lt;collin.funk1@gmail.com&gt;
</content>
</entry>
<entry>
<title>Implement C23 memalignment</title>
<updated>2025-10-17T16:56:59Z</updated>
<author>
<name>Joseph Myers</name>
<email>josmyers@redhat.com</email>
</author>
<published>2025-10-17T16:56:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/glibc.git/commit/?id=ea18d5a4c2583726060326b8a348de0845c22aa1'/>
<id>urn:sha1:ea18d5a4c2583726060326b8a348de0845c22aa1</id>
<content type='text'>
Add the C23 memalignment function (query the alignment of a pointer)
to glibc.

Given how simple this operation is, it would make sense for compilers
to inline calls to this function, but I'm treating that as a compiler
matter (compilers should add it as a built-in function) rather than
adding an inline version to glibc headers (although such an inline
version would be reasonable as well).  I've filed
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122117 for this feature
in GCC.

Tested for x86_64 and x86.
</content>
</entry>
<entry>
<title>Add once_flag, ONCE_FLAG_INIT and call_once to stdlib.h for C23</title>
<updated>2025-10-01T15:15:15Z</updated>
<author>
<name>Joseph Myers</name>
<email>josmyers@redhat.com</email>
</author>
<published>2025-10-01T15:15:15Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/glibc.git/commit/?id=a7ddbf456d97ac8d1aa7afd735e196a1488bd874'/>
<id>urn:sha1:a7ddbf456d97ac8d1aa7afd735e196a1488bd874</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>stdlib: Implement C2Y uabs, ulabs, ullabs and uimaxabs</title>
<updated>2025-04-08T12:51:51Z</updated>
<author>
<name>Lenard Mollenkopf</name>
<email>glibc@lenardmollenkopf.de</email>
</author>
<published>2025-04-08T12:16:54Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/glibc.git/commit/?id=5b132ec2b7712dbc055838b3b538b83ad1196414'/>
<id>urn:sha1:5b132ec2b7712dbc055838b3b538b83ad1196414</id>
<content type='text'>
C2Y adds unsigned versions of the abs functions (see C2Y draft N3467 and
proposal N3349).

Tested for x86_64.

Signed-off-by: Lenard Mollenkopf &lt;glibc@lenardmollenkopf.de&gt;
</content>
</entry>
<entry>
<title>Update copyright dates with scripts/update-copyrights</title>
<updated>2025-01-01T19:22:09Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2025-01-01T18:14:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/glibc.git/commit/?id=2642002380aafb71a1d3b569b6d7ebeab3284816'/>
<id>urn:sha1:2642002380aafb71a1d3b569b6d7ebeab3284816</id>
<content type='text'>
</content>
</entry>
<entry>
<title>stdlib: Mark `abort` as `cold`</title>
<updated>2024-07-31T06:26:00Z</updated>
<author>
<name>Noah Goldstein</name>
<email>goldstein.w.n@gmail.com</email>
</author>
<published>2024-07-29T07:34:33Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/glibc.git/commit/?id=e3b0b3484cac61f9eae373751ac6eaf816a2c9c3'/>
<id>urn:sha1:e3b0b3484cac61f9eae373751ac6eaf816a2c9c3</id>
<content type='text'>
This helps HotColdSplitting in GCC/LLVM.

Thought about doing `exit` as well since its only called once per
process, but since its easy to imagine a hot path leading into
`exit(0)`, its less clear if its profitable.

Reviewed-by: Carlos O'Donell &lt;carlos@redhat.com&gt;
</content>
</entry>
</feed>
