opnsense-src/lib/libc/tests/stdlib
Ed Schouten 4ef9bd22ed Improve typing of POSIX search tree functions.
Back in 2015 when I reimplemented these functions to use an AVL tree, I
was annoyed by the weakness of the typing of these functions. Both tree
nodes and keys are represented by 'void *', meaning that things like the
documentation for these functions are an absolute train wreck.

To make things worse, users of these functions need to cast the return
value of tfind()/tsearch() from 'void *' to 'type_of_key **' in order to
access the key. Technically speaking such casts violate aliasing rules.
I've observed actual breakages as a result of this by enabling features
like LTO.

I've filed a bug report at the Austin Group. Looking at the way the bug
got resolved, they made a pretty good step in the right direction. A new
type 'posix_tnode' has been added to correspond to tree nodes. It is
still defined as 'void' for source-level compatibility, but in the very
far future it could be replaced by a proper structure type containing a
key pointer.

MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8205
2016-10-13 18:25:40 +00:00
..
cxa_thread_atexit_nothr_test.cc Add __cxa_thread_atexit(3) API implementation. 2016-08-06 13:32:40 +00:00
cxa_thread_atexit_test.cc Add __cxa_thread_atexit(3) API implementation. 2016-08-06 13:32:40 +00:00
heapsort_test.c Integrate tools/regression/lib/libc/stdlib into the FreeBSD test suite 2015-11-08 07:03:17 +00:00
Makefile Checkpoint initial integration work 2016-08-12 08:50:05 +00:00
Makefile.depend DIRDEPS_BUILD: Update dependencies. 2016-08-31 19:30:46 +00:00
mergesort_test.c Integrate tools/regression/lib/libc/stdlib into the FreeBSD test suite 2015-11-08 07:03:17 +00:00
qsort_test.c Integrate tools/regression/lib/libc/stdlib into the FreeBSD test suite 2015-11-08 07:03:17 +00:00
test-sort.h Integrate tools/regression/lib/libc/stdlib into the FreeBSD test suite 2015-11-08 07:03:17 +00:00
tsearch_test.c Improve typing of POSIX search tree functions. 2016-10-13 18:25:40 +00:00