A library of generic data structures & macro helpers for C.
- templated data structures
- gdb pretty printers
- derives for equality, clone, ord, etc
In a CMakeLists.txt
include(FetchContent)
FetchContent_Declare(
derive-c
GIT_REPOSITORY https://github.com/OliverKillane/derive-C
GIT_TAG <Chosen derive-c version>
)
FetchContent_MakeAvailable(derive-c)
- See usage examples in ./examples
nix-shell is included to setup the C/C++ toolchain.
nix-shell # from repo root
cmake -S . -B build -GNinja -DDEVELOP=On -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cd build
ninja
ninja format
ninja docs
ninja coverage
ctest # includes examples/ as well as test/
For using infer
, infer must be installed separately (it is not yet packaged with nix - see here)
- Build with clang
cmake -S . -B build -DEXTERNALS=Off -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
infer run --compilation-database build/compile_commands.json --bufferoverrun --liveness --pulse
infer explore
- Statically detects generic bugs (e.g. use after free, buffer overrun, integer overflow)
In development, remaining tasks:
- Fix remaining infer-detected casting issues
- Finish gdb pretty printers
- Increase coverage for hashmap
- Regression benchmarks