coverity static analysis and meson/ninja

440 views
Skip to first unread message

Todd Lindstrom

unread,
Feb 23, 2018, 11:02:23 AM2/23/18
to The Meson Build System
Are there any regulations or best practices associated with building static analysis runs on a code-base?

Our project uses Coverity - and it uses existing make or other build infrastructure and uses the coverity compiler instead of gcc/cross compiler.   With this in mind - would I need to add another separate configuration with a different compiler setting and flags necessary for coverity to run?

OR is there any long term plan for meson to be able to support static analysis directly (like the test feature)

(example:   ninja sa same as ninja test command)

Thanks,
TODDL

Jussi Pakkanen

unread,
Feb 23, 2018, 12:44:02 PM2/23/18
to Todd Lindstrom, The Meson Build System
On Fri, Feb 23, 2018 at 6:02 PM, Todd Lindstrom <tla...@gmail.com> wrote:
> Are there any regulations or best practices associated with building static
> analysis runs on a code-base?
>
> Our project uses Coverity - and it uses existing make or other build
> infrastructure and uses the coverity compiler instead of gcc/cross compiler.
> With this in mind - would I need to add another separate configuration with
> a different compiler setting and flags necessary for coverity to run?
>
> OR is there any long term plan for meson to be able to support static
> analysis directly (like the test feature)

Meson supports this in the same way as any other static analysis tool:

CC=/path/to/c-tool CXX=/path/to/cpp-tool meson <new_build_directory>

This provides for 90% of all use cases. If there are more complicated
steps that need to be taken we may consider adding support for that.
As an example we add a "ninja scan-build" target to run the analysis
and output the result in the private log directory.

Todd Lindstrom

unread,
Feb 26, 2018, 10:21:24 AM2/26/18
to The Meson Build System

>..........

As an example we add a "ninja scan-build" target to run the analysis
and output the result in the private log directory.

In order to add additional actions to the ninja build file, do you manually add these commands after running the first meson initialization? 
or do you use the run_target command to add a new command?

I guess the question is - do you find that run_target is sufficient to get this done - or does it take more detailed operations only doable from manually adding to the ninja build file?

--toddL
Reply all
Reply to author
Forward
0 new messages