contrib: add a tartan static analysis script and description

This commit is contained in:
Kate Hsuan 2025-12-29 15:47:24 +08:00
parent f6e63cfc40
commit bf3d20378f
2 changed files with 23 additions and 0 deletions

View file

@ -51,3 +51,15 @@ logs. There are two ways of doing so:
3. `sudo systemctl restart upower.service`
4. Grab logs using `journalctl -u upower.service` or similar
## Using tartan
[Tartan](https://gitlab.freedesktop.org/tartan/tartan/-/wikis/home) is a LLVM static
analysis plugin built to analyze GLib code. It can be installed and then run using:
```shell
mkdir build
cd build
meson setup ..
SCANBUILD=../contrib/tartan.sh ninja scan-build
```

11
contrib/tartan.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
/usr/bin/scan-build-20 \
-load-plugin /usr/lib64/tartan/20.1/libtartan.so \
-disable-checker core.CallAndMessage \
-disable-checker core.NullDereference \
-disable-checker deadcode.DeadStores \
-disable-checker unix.Malloc \
-enable-checker tartan.GErrorChecker \
--exclude meson-private \
--status-bugs -v "$@"