mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 06:40:48 -06:00
Merge topic 'ci-clang-analyzer'
da14f4e19egitlab-ci: add job to build with clang-analyzeradc38da49fci: add clang-analyzer to Fedora base imageb6c4d93dcdclang-analyzer: Suppress warnings in intentional use-after-move casesc1b575f4d1clang-analyzer: rename from scan-build in commentsdbfb50cd72cmFileAPICodemodel: Assert input in DirectoryObject::DumpInstaller410bf8ed4fcmStandardLevelResolver: Fix size assertion in constructor82584b99e3jsoncpp: Revert "Code style: add missed explicit 'this->'" Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Ben Boeckel <ben.boeckel@kitware.com> Merge-request: !6189
This commit is contained in:
@@ -129,6 +129,15 @@ lint:fedora34-sphinx:
|
||||
CMAKE_CI_JOB_CONTINUOUS: "true"
|
||||
CMAKE_CI_JOB_HELP: "true"
|
||||
|
||||
lint:fedora34-clang-analyzer:
|
||||
extends:
|
||||
- .fedora34_clang_analyzer
|
||||
- .cmake_build_linux
|
||||
- .linux_builder_tags_qt
|
||||
- .run_automatically
|
||||
variables:
|
||||
CMAKE_CI_JOB_NIGHTLY: "true"
|
||||
|
||||
# Linux builds
|
||||
|
||||
build:centos6-x86_64:
|
||||
|
||||
1
.gitlab/ci/configure_fedora34_clang_analyzer.cmake
Normal file
1
.gitlab/ci/configure_fedora34_clang_analyzer.cmake
Normal file
@@ -0,0 +1 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora34_common.cmake")
|
||||
@@ -25,6 +25,7 @@ dnf install --setopt=install_weak_deps=False -y \
|
||||
|
||||
# Install lint tools.
|
||||
dnf install --setopt=install_weak_deps=False -y \
|
||||
clang-analyzer \
|
||||
codespell
|
||||
|
||||
# Tools needed for the test suite.
|
||||
|
||||
2
.gitlab/ci/env_fedora34_clang_analyzer.sh
Normal file
2
.gitlab/ci/env_fedora34_clang_analyzer.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
export CC=/usr/libexec/ccc-analyzer
|
||||
export CXX=/usr/libexec/c++-analyzer
|
||||
@@ -69,7 +69,7 @@
|
||||
### Fedora
|
||||
|
||||
.fedora34:
|
||||
image: "kitware/cmake:ci-fedora34-x86_64-2021-05-21"
|
||||
image: "kitware/cmake:ci-fedora34-x86_64-2021-06-03"
|
||||
|
||||
variables:
|
||||
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes"
|
||||
@@ -85,6 +85,15 @@
|
||||
CTEST_NO_WARNINGS_ALLOWED: 1
|
||||
CMake_SKIP_INSTALL: 1
|
||||
|
||||
.fedora34_clang_analyzer:
|
||||
extends: .fedora34
|
||||
|
||||
variables:
|
||||
CMAKE_CONFIGURATION: fedora34_clang_analyzer
|
||||
CMAKE_BUILD_TYPE: Debug
|
||||
CTEST_NO_WARNINGS_ALLOWED: 1
|
||||
CMake_SKIP_INSTALL: 1
|
||||
|
||||
.fedora34_sphinx:
|
||||
extends: .fedora34
|
||||
|
||||
|
||||
@@ -83,28 +83,21 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
|
||||
"compilation completed with warnings" # PGI
|
||||
"[0-9]+ Warning\\(s\\) detected" # SunPro
|
||||
|
||||
# scanbuild exceptions
|
||||
"char_traits.h:.*: warning: Null pointer argument in call to string length function"
|
||||
"stl_construct.h:.*: warning: Forming reference to null pointer"
|
||||
".*stl_uninitialized.h:75:19: warning: Forming reference to null pointer.*"
|
||||
".*stl_vector.h:.*: warning: Returning null reference.*"
|
||||
"warning: Value stored to 'yymsg' is never read"
|
||||
"warning: Value stored to 'yytoken' is never read"
|
||||
"index_encoder.c.241.2. warning: Value stored to .out_start. is never read"
|
||||
"index.c.*warning: Access to field.*results in a dereference of a null pointer.*loaded from variable.*"
|
||||
"cmCommandArgumentLexer.cxx:[0-9]+:[0-9]+: warning: Call to 'realloc' has an allocation size of 0 bytes"
|
||||
"cmDependsJavaLexer.cxx:[0-9]+:[0-9]+: warning: Call to 'realloc' has an allocation size of 0 bytes"
|
||||
"cmExprLexer.cxx:[0-9]+:[0-9]+: warning: Call to 'realloc' has an allocation size of 0 bytes"
|
||||
"cmListFileLexer.c:[0-9]+:[0-9]+: warning: Call to 'realloc' has an allocation size of 0 bytes"
|
||||
"cmFortranLexer.cxx:[0-9]+:[0-9]+: warning: Call to 'realloc' has an allocation size of 0 bytes"
|
||||
"testProcess.*warning: Dereference of null pointer .loaded from variable .invalidAddress.."
|
||||
# clang-analyzer exceptions
|
||||
"cmListFileLexer.c:[0-9]+:[0-9]+: warning: Array subscript is undefined"
|
||||
"jsoncpp/src/.*:[0-9]+:[0-9]+: warning: Value stored to .* is never read"
|
||||
"liblzma/common/index_encoder.c:[0-9]+:[0-9]+: warning: Value stored to '[^']+' during its initialization is never read"
|
||||
"liblzma/liblzma/common/index.c:[0-9]+:[0-9]+: warning: Access to field '[^']+' results in a dereference of a null pointer"
|
||||
"liblzma/simple/x86.c:[0-9]+:[0-9]+: warning: The result of the '<<' expression is undefined"
|
||||
"liblzma/common/index_encoder.c:[0-9]+:[0-9]+: warning: Value stored to .* during its initialization is never read"
|
||||
"libuv/src/.*:[0-9]+:[0-9]+: warning: Dereference of null pointer"
|
||||
"libuv/src/.*:[0-9]+:[0-9]+: warning: The left operand of '==' is a garbage value"
|
||||
"librhash/librhash/.*:[0-9]+:[0-9]+: warning: The left operand of '[^']+' is a garbage value"
|
||||
"libuv/src/.*:[0-9]+:[0-9]+: warning: 1st function call argument is an uninitialized value"
|
||||
"libuv/src/.*:[0-9]+:[0-9]+: warning: Dereference of null pointer"
|
||||
"libuv/src/.*:[0-9]+:[0-9]+: warning: The left operand of '[^']+' is a garbage value"
|
||||
"nghttp2/lib/.*:[0-9]+:[0-9]+: warning: Access to field '[^']+' results in a dereference of a null pointer"
|
||||
"nghttp2/lib/.*:[0-9]+:[0-9]+: warning: Dereference of null pointer"
|
||||
"nghttp2/lib/.*:[0-9]+:[0-9]+: warning: Value stored to .* is never read"
|
||||
"nghttp2/lib/.*:[0-9]+:[0-9]+: warning: Value stored to '[^']+' is never read"
|
||||
"zstd/lib/.*:[0-9]+:[0-9]+: warning: Assigned value is garbage or undefined"
|
||||
"zstd/lib/.*:[0-9]+:[0-9]+: warning: Dereference of null pointer"
|
||||
)
|
||||
|
||||
if(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode")
|
||||
|
||||
@@ -659,7 +659,7 @@ Modify cmCTestResourceGroupsLexer.cxx:
|
||||
|
||||
/* IWYU pragma: no_forward_declare yyguts_t */
|
||||
|
||||
#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */
|
||||
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
|
||||
|
||||
#include "cmCTestResourceGroupsLexerHelper.h"
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ Modify cmCTestResourceGroupsLexer.cxx:
|
||||
|
||||
/* IWYU pragma: no_forward_declare yyguts_t */
|
||||
|
||||
#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */
|
||||
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
|
||||
|
||||
#include "cmCTestResourceGroupsLexerHelper.h"
|
||||
|
||||
|
||||
@@ -664,7 +664,7 @@ Modify cmCommandArgumentLexer.cxx:
|
||||
|
||||
/* IWYU pragma: no_forward_declare yyguts_t */
|
||||
|
||||
#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */
|
||||
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
|
||||
|
||||
#include "cmCommandArgumentParserHelper.h"
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ Modify cmCommandArgumentLexer.cxx:
|
||||
|
||||
/* IWYU pragma: no_forward_declare yyguts_t */
|
||||
|
||||
#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */
|
||||
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
|
||||
|
||||
#include "cmCommandArgumentParserHelper.h"
|
||||
|
||||
|
||||
@@ -860,7 +860,7 @@ Modify cmDependsJavaLexer.cxx:
|
||||
|
||||
/* IWYU pragma: no_forward_declare yyguts_t */
|
||||
|
||||
#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */
|
||||
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ Modify cmDependsJavaLexer.cxx:
|
||||
|
||||
/* IWYU pragma: no_forward_declare yyguts_t */
|
||||
|
||||
#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */
|
||||
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
@@ -664,7 +664,7 @@ Modify cmExprLexer.cxx:
|
||||
|
||||
/* IWYU pragma: no_forward_declare yyguts_t */
|
||||
|
||||
#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */
|
||||
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
|
||||
|
||||
#include "cmExprParserHelper.h"
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ Modify cmExprLexer.cxx:
|
||||
|
||||
/* IWYU pragma: no_forward_declare yyguts_t */
|
||||
|
||||
#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */
|
||||
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
|
||||
|
||||
#include "cmExprParserHelper.h"
|
||||
|
||||
|
||||
@@ -838,7 +838,7 @@ Modify cmFortranLexer.cxx:
|
||||
|
||||
/* IWYU pragma: no_forward_declare yyguts_t */
|
||||
|
||||
#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */
|
||||
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
|
||||
|
||||
#undef YY_NO_UNPUT
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ Modify cmFortranLexer.cxx:
|
||||
|
||||
/* IWYU pragma: no_forward_declare yyguts_t */
|
||||
|
||||
#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */
|
||||
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
|
||||
|
||||
#undef YY_NO_UNPUT
|
||||
|
||||
|
||||
@@ -645,7 +645,7 @@ static const flex_int16_t yy_chk[46] =
|
||||
|
||||
/* IWYU pragma: no_forward_declare yyguts_t */
|
||||
|
||||
#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */
|
||||
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
|
||||
|
||||
#include <cmGccDepfileLexerHelper.h>
|
||||
#include <string>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
/* IWYU pragma: no_forward_declare yyguts_t */
|
||||
|
||||
#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */
|
||||
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
|
||||
|
||||
#include <cmGccDepfileLexerHelper.h>
|
||||
#include <string>
|
||||
|
||||
@@ -874,6 +874,7 @@ Json::Value DirectoryObject::DumpInstallers()
|
||||
|
||||
Json::Value DirectoryObject::DumpInstaller(cmInstallGenerator* gen)
|
||||
{
|
||||
assert(gen);
|
||||
Json::Value installer = Json::objectValue;
|
||||
|
||||
// Exclude subdirectory installers. They are implementation details.
|
||||
|
||||
@@ -62,7 +62,7 @@ struct StanardLevelComputer
|
||||
, Levels(std::move(levels))
|
||||
, LevelsAsStrings(std::move(levelsStr))
|
||||
{
|
||||
assert(levels.size() == levelsStr.size());
|
||||
assert(this->Levels.size() == this->LevelsAsStrings.size());
|
||||
}
|
||||
|
||||
std::string GetCompileOptionDef(cmMakefile* makefile,
|
||||
|
||||
@@ -301,12 +301,14 @@ static bool testMoveConstruct(std::vector<Event>& expected)
|
||||
cm::optional<EventLogger> o3{};
|
||||
const cm::optional<EventLogger> o4{ std::move(o3) };
|
||||
|
||||
#ifndef __clang_analyzer__ /* cplusplus.Move */
|
||||
expected = {
|
||||
{ Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 },
|
||||
{ Event::MOVE_CONSTRUCT, &*o2, &*o1, 4 },
|
||||
{ Event::DESTRUCT, &*o2, nullptr, 4 },
|
||||
{ Event::DESTRUCT, &*o1, nullptr, 4 },
|
||||
};
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -326,12 +326,14 @@ static bool testConstructMove()
|
||||
std::cout << "testConstructMove()\n";
|
||||
cm::String s1 = std::string("abc");
|
||||
cm::String s2 = std::move(s1);
|
||||
#ifndef __clang_analyzer__ /* cplusplus.Move */
|
||||
ASSERT_TRUE(s1.data() == nullptr);
|
||||
ASSERT_TRUE(s1.size() == 0);
|
||||
ASSERT_TRUE(s2.size() == 3);
|
||||
ASSERT_TRUE(std::strncmp(s2.data(), "abc", 3) == 0);
|
||||
ASSERT_TRUE(s1.is_stable());
|
||||
ASSERT_TRUE(s2.is_stable());
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -356,12 +358,14 @@ static bool testAssignMove()
|
||||
cm::String s1 = std::string("abc");
|
||||
cm::String s2;
|
||||
s2 = std::move(s1);
|
||||
#ifndef __clang_analyzer__ /* cplusplus.Move */
|
||||
ASSERT_TRUE(s1.data() == nullptr);
|
||||
ASSERT_TRUE(s1.size() == 0);
|
||||
ASSERT_TRUE(s2.size() == 3);
|
||||
ASSERT_TRUE(std::strncmp(s2.data(), "abc", 3) == 0);
|
||||
ASSERT_TRUE(s1.is_stable());
|
||||
ASSERT_TRUE(s2.is_stable());
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user