Skip to content

Add clang-static analyzer to linux CI builds #122

@jonesmz

Description

@jonesmz

This is trivial to add to a project, just add "scan-build" before any call to cmake. E.g.

scan-build --exclude someFolderToExclude -o folderToOutputLogs cmake -B build -DCMAKE_BUILD_TYPE=Release
scan-build --exclude someFolderToExclude -o folderToOutputLogs cmake --build build --parallel --config Release --target myTarget

I see nags from scan-build coming from Corrade in several places in my own project. Note that I'm not claiming that the nags from scan-build are 100% correct. Just that they're nagging.

In file included from /home/jonesmz/osp-magnum/3rdparty/magnum/src/Magnum/GL/Implementation/driverSpecific.cpp:27:
In file included from /home/jonesmz/osp-magnum/3rdparty/corrade/src/Corrade/Containers/GrowableArray.h:39:
In file included from /home/jonesmz/osp-magnum/3rdparty/corrade/src/Corrade/Containers/Array.h:40:
/home/jonesmz/osp-magnum/3rdparty/corrade/src/Corrade/Containers/constructHelpers.h:67:5: warning: Storage provided to placement new is only -2305843009213693936 bytes, whereas the allocated type requires 16 bytes [cplusplus.PlacementNew]
    new(&value) T{std::forward<First>(first), std::forward<Next>(next)...};
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jonesmz/osp-magnum/3rdparty/corrade/src/Corrade/Containers/constructHelpers.h:67:5: warning: Storage provided to placement new is only 0 bytes, whereas the allocated type requires 24 bytes [cplusplus.PlacementNew]
    new(&value) T{std::forward<First>(first), std::forward<Next>(next)...};
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/jonesmz/osp-magnum/3rdparty/magnum/src/Magnum/GL/Implementation/driverSpecific.cpp:27:
/home/jonesmz/osp-magnum/3rdparty/corrade/src/Corrade/Containers/GrowableArray.h:923:9: warning: Storage provided to placement new is only 0 bytes, whereas the allocated type requires 24 bytes [cplusplus.PlacementNew]
        new(dst) T{std::move(*src)};
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jonesmz/osp-magnum/3rdparty/corrade/src/Corrade/Containers/GrowableArray.h:1024:65: warning: Method called on moved-from object of type 'std::pair' [cplusplus.Move]
    for(T *it = array, *end = array + prevSize; it < end; ++it) it->~T();
                                                                ^~~~~~~~
4 warnings generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    TODO

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions