<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/tests/stdlib/Makefile, branch release/14.4.0</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=release%2F14.4.0</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=release%2F14.4.0'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2025-08-27T18:49:58Z</updated>
<entry>
<title>libc: Drop incorrect qsort optimization</title>
<updated>2025-08-27T18:49:58Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-08-15T07:22:33Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=f1e93df44ba0b494c6eda01958a71fec501bc32b'/>
<id>urn:sha1:f1e93df44ba0b494c6eda01958a71fec501bc32b</id>
<content type='text'>
As pointed out in the PR and the article linked below, the switch to
insertion sort in the BSD qsort code is based on a misunderstanding of
Knuth's TAOCP and is actually a pessimization.  As demonstrated by the
added test, it is trivially easy to construct pathological input which
results in quadratic runtime.  Without that misguided optimization, the
same input runs in nearly linearithmic time.

https://www.raygard.net/2022/02/26/Re-engineering-a-qsort-part-3

PR:		287089
MFC after:	1 week
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D51907

(cherry picked from commit 5205b32de3fb7702e96b3991f5b1a61eee406d8b)
</content>
</entry>
<entry>
<title>libc: tests: add some tests for __cxa_atexit handling</title>
<updated>2025-04-17T01:01:46Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2025-04-05T00:47:54Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=df4b8eff7b19311f6cc5c339aebb41ecafd2e52c'/>
<id>urn:sha1:df4b8eff7b19311f6cc5c339aebb41ecafd2e52c</id>
<content type='text'>
This adds a basic test that __cxa_atexit works, and also adds some tests
for __cxa_atexit handlers registered in the middle of __cxa_finalize.

PR:		285870

(cherry picked from commit ee9ce1078c596f5719f312feedd616ab0fb41dc9)
</content>
</entry>
<entry>
<title>libc: Rewrite quick_exit() and at_quick_exit() using C11 atomics.</title>
<updated>2023-10-04T23:59:43Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2023-09-26T20:06:27Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b9c361e4af26547b7a373d5dda4eb7a6fee4f7c6'/>
<id>urn:sha1:b9c361e4af26547b7a373d5dda4eb7a6fee4f7c6</id>
<content type='text'>
Compiler memory barriers do not prevent the CPU from executing the code
out of order.  Switch to C11 atomics.  This also lets us get rid of the
mutex; instead, loop until the compare_exchange succeeds.

While here, change the return value of at_quick_exit() on failure to
the more traditional -1, matching atexit().

Sponsored by:	Klara, Inc.
Reviewed by:	Olivier Certner, kevans, kib
Differential Revision:	https://reviews.freebsd.org/D41936

(cherry picked from commit 1dc3abb052430279e47c8922d22b30922adcf0f6)

libc: Add a rudimentary test for quick_exit(3).

Sponsored by:	Klara, Inc.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D41937

(cherry picked from commit c7dd4601aeebbc1bbe131cbe6747476c124b47fe)
</content>
</entry>
<entry>
<title>Remove $FreeBSD$: one-line sh pattern</title>
<updated>2023-08-16T17:55:03Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:55:03Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf'/>
<id>urn:sha1:d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf</id>
<content type='text'>
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
</content>
</entry>
<entry>
<title>qsort_b_test: Only build on clang.</title>
<updated>2022-10-03T23:14:39Z</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2022-10-03T23:14:39Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=ab9293239c7def9b93e3892f60ec3e7212b29bab'/>
<id>urn:sha1:ab9293239c7def9b93e3892f60ec3e7212b29bab</id>
<content type='text'>
GCC doesn't support -fblocks.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D36809
</content>
</entry>
<entry>
<title>Alter the prototype of qsort_r(3) to match POSIX, which adopted the</title>
<updated>2022-09-30T22:26:30Z</updated>
<author>
<name>Ed Schouten</name>
<email>ed@FreeBSD.org</email>
</author>
<published>2022-09-30T22:26:30Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=af3c78886fd8d4ca5eebdbe581a459a6f6d29d6a'/>
<id>urn:sha1:af3c78886fd8d4ca5eebdbe581a459a6f6d29d6a</id>
<content type='text'>
glibc-based interface.

Unfortunately, the glibc maintainers, despite knowing the existence
of the FreeBSD qsort_r(3) interface in 2004 and refused to add the
same interface to glibc based on grounds of the lack of standardization
and portability concerns, has decided it was a good idea to introduce
their own qsort_r(3) interface in 2007 as a GNU extension with a
slightly different and incompatible interface.

With the adoption of their interface as POSIX standard, let's switch
to the same prototype, there is no need to remain incompatible.

C++ and C applications written for the historical FreeBSD interface
get source level compatibility when building in C++ mode, or when
building with a C compiler with C11 generics support, provided that
the caller passes a fifth parameter of qsort_r() that exactly matches
the historical FreeBSD comparator function pointer type and does not
redefine the historical qsort_r(3) prototype in their source code.

Symbol versioning is used to keep old binaries working.

MFC:			never
Relnotes:		yes
Reviewed by:		cem, imp, hps, pauamma
Differential revision:	https://reviews.freebsd.org/D17083
</content>
</entry>
<entry>
<title>libc: add test case for qsort_b(3)</title>
<updated>2022-09-07T06:11:46Z</updated>
<author>
<name>Xin LI</name>
<email>delphij@FreeBSD.org</email>
</author>
<published>2022-09-07T06:11:46Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=c65e42dbde4198ce46aef7ddac061390abe672dc'/>
<id>urn:sha1:c65e42dbde4198ce46aef7ddac061390abe672dc</id>
<content type='text'>
Reviewed by: 	markj
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D36463
</content>
</entry>
<entry>
<title>libc: add clearenv function</title>
<updated>2021-11-07T15:20:15Z</updated>
<author>
<name>Mariusz Zaborski</name>
<email>oshogbo@FreeBSD.org</email>
</author>
<published>2021-11-07T15:15:28Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=597b02675751e48dd04777f1e91fee382bf3a966'/>
<id>urn:sha1:597b02675751e48dd04777f1e91fee382bf3a966</id>
<content type='text'>
The clearenv(3) function allows us to clear all environment
variable in one shot. This may be useful for security programs that
want to control the environment or what variables are passed to new
spawned programs.

Reviewed by:	scf, markj (secteam), 0mp (manpages)
Differential Revision:	https://reviews.freebsd.org/D28223
</content>
</entry>
<entry>
<title>Remove remaining uses of ${COMPILER_FEATURES:Mc++11}</title>
<updated>2021-01-19T21:37:36Z</updated>
<author>
<name>Alex Richardson</name>
<email>arichardson@FreeBSD.org</email>
</author>
<published>2021-01-19T15:05:43Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=c1a3d7f20696ab5b72eee45863f3e04410d81fc8'/>
<id>urn:sha1:c1a3d7f20696ab5b72eee45863f3e04410d81fc8</id>
<content type='text'>
All supported compilers have C++11 support so these checks can be replaced
with MK_CXX guards.
See also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252759

PR:		252759
Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D28234
</content>
</entry>
<entry>
<title>Enable long double tests on RISC-V</title>
<updated>2020-06-24T13:11:19Z</updated>
<author>
<name>Mitchell Horne</name>
<email>mhorne@FreeBSD.org</email>
</author>
<published>2020-06-24T13:11:19Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=2d143336dec8a43803bfba507c5f29a625bc4137'/>
<id>urn:sha1:2d143336dec8a43803bfba507c5f29a625bc4137</id>
<content type='text'>
Some of the NetBSD contributed tests are gated behind the
__HAVE_LONG_DOUBLE flag. This flag seems to be defined only for
platforms whose long double is larger than their double. I could not
find this explicitly documented anywhere, but it is implied by the
definitions in NetBSD's sys/arch/${arch}/include/math.h headers, and the
following assertion from the UBSAN code:

  #ifdef __HAVE_LONG_DOUBLE
      long double LD;
      ASSERT(sizeof(LD) &gt; sizeof(uint64_t));
  #endif

RISC-V has 128-bit long doubles, so enable the tests on this platform,
and update the comments to better explain the purpose of this flag.

Reviewed by:	ngie
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25419
</content>
</entry>
</feed>
