Menu

How does --clang interact with --project=foobar.json?

vilox
2021-01-29
2021-01-29
  • vilox

    vilox - 2021-01-29

    On the on hand I see that cppcheck tries to execute clang:

    $ cppcheck --clang=/bin/nonexistent --project=/tmp/R/chkr/bar.json
    Checking /tmp/R/bar/part_2/bar.c...
    Failed to execute '/bin/nonexistent -fsyntax-only -Xclang -ast-dump ...

    and even executes it:

    $ cppcheck --clang=/bin/clang --project=/tmp/R/chkr/bar.json
    Checking /tmp/R/bar/part_2/bar.c...
    Checking /tmp/R/bar/part_2/bar.c ...

    On the other hand the diagnostic messages persist that peculiar strictly to cppcheck's built-in C parser:

    $ cppcheck --clang=/bin/clang --project=/tmp/R/chkr/bar.json
    Checking /tmp/R/bar/part_2/bar.c...
    Checking /tmp/R/bar/part_2/bar.c ...
    /tmp/R/include/foo.h:7:0: error: #error Foo was not configured [preprocessorErrorDirective]
    # error Foo was not configured

    (the example is from [checking json project: different results for different starting directories] topic)

    Are the both parses really invoked when --clang is combined with --project=foobar.json, is it intended, and why it is needed?

     
  • Daniel Marjamäki

    Are the both parses really invoked when --clang is combined with --project=foobar.json, is it intended, and why it is needed?

    Good catch. at first sight this looks like some kind of bug. we do not intend to execute the internal parser at all as far as I know.
    I will investigate..

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.