Skip to content

Provide compile_commands.json #16002

@chrysn

Description

@chrysn

There is a convention of how CFLAGS etc are transported to build-related tools in compile_commands.json; AFAICT they always describe a single file, so the process would need to produce a compile_commands.json file that describes how any given input file would be processed (although it may be that it's actually immaterial to the rest of the commands which file that is).

Producing these from the build system would be beneficial for two reasons:

  • IDEs can use them to provide suitable development support (@jnohlgard and @bergzand probably know more about that, judging from recent IRC discussions)
  • In Rust support (Rust support for RIOT #9799) I currently build my own compile_commands.json using data snooped from the environment inside the Makefiles. Having a possibility to get them out without being part of the build system would have the advantage that I could get the CFLAGS that RIOT would use for LLVM out of the build system, immaterial of which toolchain it's currently being run for (which may be GCC because that may produce better object files for the C code in a particular situation) -- thus solving riot-sys/#3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: build systemArea: Build systemType: new featureThe issue requests / The PR implemements a new feature for RIOT

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions