path: root/lib/libgcc_eh
diff options
authorEd Schouten <ed@FreeBSD.org>2016-10-13 18:25:40 +0000
committerEd Schouten <ed@FreeBSD.org>2016-10-13 18:25:40 +0000
commit4ef9bd22ed091dd6513f89cdca2dfd03b6e3ffd2 (patch)
treeed6ec4af5a29fb0742ce420a77c6d309f9e4221f /lib/libgcc_eh
parentec7bbf1f794aab97014387c2e4f907263dfc49af (diff)
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
Notes: svn path=/head/; revision=307227
Diffstat (limited to 'lib/libgcc_eh')
0 files changed, 0 insertions, 0 deletions