]> git.ipfire.org Git - thirdparty/systemd.git/commit
bpf: register compile_commands.json entries for bpf programs
authorDaan De Meyer <daan@amutable.com>
Tue, 21 Apr 2026 20:31:22 +0000 (20:31 +0000)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 22 Apr 2026 14:49:36 +0000 (16:49 +0200)
commitb779c52d4c26dc3d241458106495ca844de7fa96
tree97105104356208b911ea8645df32318e46ef3120
parente6fc73350f9485064302e687b964f70b28b2e4f6
bpf: register compile_commands.json entries for bpf programs

compile_commands.json is generated by ninja from c_COMPILER rules, so
BPF programs (built via custom_target and thus emitted as CUSTOM_COMMAND
rules) never show up there. Clangd consequently falls back to
heuristics when opening .bpf.c files, with poor diagnostic fidelity.

Register a meson postconf script per BPF program that upserts an entry
into compile_commands.json using the same argv meson constructed for
the custom_target. The script runs after meson has written the DB,
substitutes @INPUT@/@OUTPUT@, and keys entries by source path so
repeated reconfigures don't accumulate duplicates.
src/bpf/merge-bpf-compdb.py [new file with mode: 0755]
src/bpf/meson.build