Page MenuHomeFreeBSD

Add compile_commands*.json to .gitignore
AcceptedPublic

Authored by khng300_gmail.com on Sep 21 2020, 4:23 PM.

Details

Reviewers
cem
lwhsu
Summary

This change adds compile_commands*.json to .gitignore. The purpose is to make
sure no one would accidentally include their own workspace leftover into a
commit.

Sponsored by: The FreeBSD Foundation

Diff Detail

Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 33696
Build 30932: arc lint + arc unit

Event Timeline

khng300_gmail.com created this revision.

Just curious, what tool did you use to generate the compile commands database for FreeBSD? I have a vim linter plugin that is kind of useless for FreeBSD code without one.

Just curious, what tool did you use to generate the compile commands database for FreeBSD? I have a vim linter plugin that is kind of useless for FreeBSD code without one.

I currently use devel/bear for the purpose

What drops this file? I don’t recognize it. No objection in principle.

This revision is now accepted and ready to land.Sep 22 2020, 3:51 PM
In D26514#590312, @cem wrote:

What drops this file? I don’t recognize it. No objection in principle.

compile_commands.json is a JSON flat file containing the compiler invocation arguments. The main consumers of that file has mainly been those using libclang. Usually this file is generated by cmake, meson or ninja -t. Despite currently we do not have an official way to generate compile_commands.json, one could still use devel/bear for the purpose. The simplest example is to invoke the following:

cd freebsd-src;
bear -a make buildworld buildkernel

And after the jobs are finished, you could find compile_commands.json sit in the current directory.
For more you could take a look at https://sarcasm.github.io/notes/dev/compilation-database.html.