mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-11-16 19:04:53 +08:00
The red-black tree of the score used <rtems/score/bsd-tree.h>, an import of the FreeBSD <sys/tree.h> of 2020. FreeBSD replaced this red-black tree by a rank-balanced tree, so the header has no upstream any more. The macros of the header generated the functions of the tree. Most of the header, such as the splay tree, served no code of RTEMS. Translate each macro which the score uses into a static inline function of <rtems/score/rbtree.h> or <rtems/score/rbtreeimpl.h>. Each field of a node gets a getter and a setter. The body of each generated function moves into the function which called it. Each statement of a macro maps to one statement of the translation. Remove the header with its unused parts and keep its copyright in each file which receives its code. The node keeps its layout and its field names, and the colors keep their names. The test sptree01 checked that the RTEMS_ prefixed macros of the header did not clash with the macros of <sys/tree.h>. It ran no check at runtime. Remove the test with the header. The tests sprbtree01 and ts-unit-no-clock-0 passed on the boards of eight targets. Target Processor aarch64/zynqmp_apu Cortex-A53 LS1046A Cortex-A72 arm/zynqmp_rpu_lock_step Cortex-R5F arm/samrh71_flexram Cortex-M7 arm/xilinx_zynq_zc702 Cortex-A9 riscv/mpfs_e51 E51 riscv/mpfs_u54 U54 sparc/gr740 LEON4 Update #5804. Assisted-by: Claude:claude-opus-5-5 claude-code Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>