Skip to content

[BUG] scan-build doesn't work when clang is have major version suffix but not a minor version suffix #1452

@DanAlbert

Description

@DanAlbert

I'm mostly filing this for documentation purposes. The fix is to simply switch to clang-tidy since it can do all the same checks with better UX than scan-build. We can do that more or less transparently.

scan-build (the perl script that interposes the compiler in an arbitrary build to replace it with the static analyzer) seems to have bit rot upstream quite a while ago. When determining the name of the C++ compiler, it trims -X.Y off the end of the clang binary name before appending ++. Clang has been creating a binary named clang-X rather than clang-X.Y for the past handful of releases, so scan-build has been broken for a while. But because the NDK was flattening those symlinks we didn't notice: clang-12 wasn't used, clang was.

We're not flatting symlinks any more since the SDK manager can install them correctly and we can save a bunch of disk space, so this bug is now exposed.

However, it seems that we don't actually need scan-build for ndk-build any more. clang-tidy can run all the same checks (and enables the same checks by default), and we have clang-tidy support. The only difference is that clang-tidy will not generate an HTML report; analyzer output is printed to the terminal along with all the other build warnings.

(this has no effect on CMake, which didn't use scan-build anyway).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions