Page MenuHomeFreeBSD

gitignore: Add compile_commands.json
ClosedPublic

Authored by khng on Sep 21 2020, 4:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 12, 1:13 PM
Unknown Object (File)
Wed, Apr 10, 8:21 PM
Unknown Object (File)
Thu, Mar 28, 7:23 AM
Unknown Object (File)
Feb 8 2024, 11:33 PM
Unknown Object (File)
Feb 1 2024, 4:35 AM
Unknown Object (File)
Jan 14 2024, 2:25 AM
Unknown Object (File)
Jan 2 2024, 5:48 PM
Unknown Object (File)
Dec 23 2023, 2:30 PM

Details

Summary

The purpose of this change is to make sure no one would accidentally
include their own workspace leftover into a commit.

compile_commands.json is a generated file which contains build commands.
The file is consumed by Language Servers such as clangd and ccls.

Sponsored by: The FreeBSD Foundation

Diff Detail

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

Event Timeline

khng requested review of this revision.Sep 21 2020, 4:23 PM
khng 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.

khng retitled this revision from Add compile_commands*.json to .gitignore to gitignore: Add compile_commands.json.Jun 4 2021, 8:00 AM
khng edited the summary of this revision. (Show Details)
This revision now requires review to proceed.Jun 4 2021, 8:01 AM
This revision is now accepted and ready to land.Jun 4 2021, 8:02 AM
This revision was automatically updated to reflect the committed changes.

I want to read some rtld-elf and libc code on Linux. I cannot run buildworld but want to generate a compile_commands.json to make my ccls happy. What should I do?