updated CI to latest ubuntu and clang (#4004)

This commit is contained in:
Oliver Stöneberg 2022-05-22 15:27:32 +02:00 committed by GitHub
parent 03c9253962
commit d299d22fa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 51 additions and 32 deletions

View File

@ -1,5 +1,5 @@
---
Checks: '*,-abseil-*,-altera-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-use-override,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-misc-unused-using-decls,-modernize-use-emplace,-readability-const-return-type,-performance-unnecessary-value-param,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-modernize-use-equals-delete,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument'
Checks: '*,-abseil-*,-altera-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-use-override,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-misc-unused-using-decls,-modernize-use-emplace,-readability-const-return-type,-performance-unnecessary-value-param,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-modernize-use-equals-delete,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument,-readability-identifier-length,-readability-container-data-pointer'
WarningsAsErrors: '*'
CheckOptions:
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic

View File

@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:21.10"]
image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:22.04"]
fail-fast: false # Prefer quick result
runs-on: ubuntu-20.04
@ -23,19 +23,19 @@ jobs:
- name: Install missing software on CentOS 7
if: matrix.image == 'centos:7'
run: |
yum install -y cmake gcc-c++ make
yum install -y cmake gcc-c++ make which python3
yum install -y pcre-devel
- name: Install missing software on ubuntu
if: matrix.image != 'centos:7'
run: |
apt-get update
apt-get install -y cmake g++ make python libxml2-utils
apt-get install -y cmake g++ make python3 libxml2-utils
apt-get install -y libpcre3-dev
# tests require CMake 3.4
- name: Test CMake build (no tests)
if: matrix.image != 'ubuntu:21.10'
if: matrix.image != 'ubuntu:22.04'
run: |
mkdir cmake.output
cd cmake.output
@ -44,7 +44,7 @@ jobs:
cd ..
- name: Test CMake build
if: matrix.image == 'ubuntu:21.10'
if: matrix.image == 'ubuntu:22.04'
run: |
mkdir cmake.output
cd cmake.output

View File

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-20.04
container:
image: "ubuntu:21.10"
image: "ubuntu:22.04"
env:
ASAN_OPTIONS: detect_stack_use_after_return=1
@ -27,13 +27,13 @@ jobs:
run: |
apt-get update
apt-get install -y make libpcre3-dev
apt-get install -y clang-13
apt-get install -y clang-14
- name: Build
run: make -j$(nproc) cppcheck testrunner HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
env:
CC: clang-13
CXX: clang++-13
CC: clang-14
CXX: clang++-14
CXXFLAGS: "-fsanitize=address -O2 -g3 -DCPPCHK_GLIBCXX_DEBUG"
CPPFLAGS: "-DCHECK_INTERNAL"

View File

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-20.04
container:
image: "ubuntu:21.10"
image: "ubuntu:22.04"
env:
QT_VERSION: 5.15.2
@ -21,10 +21,10 @@ jobs:
- name: Install missing software
run: |
apt-get update
apt-get install -y cmake clang-13 make
apt-get install -y cmake clang-14 make
apt-get install -y libpcre3-dev
apt-get install -y libffi7 # work around missing dependency for Qt install step
apt-get install -y clang-tidy-13
apt-get install -y clang-tidy-14
- name: Cache Qt ${{ env.QT_VERSION }}
id: cache-qt
@ -48,8 +48,8 @@ jobs:
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off ..
cd ..
env:
CC: clang-13
CXX: clang++-13
CC: clang-14
CXX: clang++-14
- name: Prepare CMake dependencies
run: |

View File

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-20.04
container:
image: "ubuntu:21.10"
image: "ubuntu:22.04"
env:
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1
@ -27,13 +27,13 @@ jobs:
run: |
apt-get update
apt-get install -y make libpcre3-dev
apt-get install -y clang-13
apt-get install -y clang-14
- name: Build
run: make -j$(nproc) cppcheck testrunner HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
env:
CC: clang-13
CXX: clang++-13
CC: clang-14
CXX: clang++-14
CXXFLAGS: "-fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow -O2 -g3 -DCPPCHK_GLIBCXX_DEBUG"
CPPFLAGS: "-DCHECK_INTERNAL"

View File

@ -12,13 +12,13 @@ ifeq ($(SRCDIR),build)
endif
ifeq ($(MATCHCOMPILER),yes)
# Find available Python interpreter
ifndef PYTHON_INTERPRETER
ifeq ($(PYTHON_INTERPRETER),)
PYTHON_INTERPRETER := $(shell which python3)
endif
ifndef PYTHON_INTERPRETER
ifeq ($(PYTHON_INTERPRETER),)
PYTHON_INTERPRETER := $(shell which python)
endif
ifndef PYTHON_INTERPRETER
ifeq ($(PYTHON_INTERPRETER),)
$(error Did not find a Python interpreter)
endif
ifdef VERIFY
@ -304,7 +304,7 @@ run-dmake: dmake
./dmake
clean:
rm -f build/*.o lib/*.o cli/*.o test/*.o tools/*.o externals/*/*.o testrunner dmake cppcheck cppcheck.exe cppcheck.1
rm -f build/*.cpp build/*.o lib/*.o cli/*.o test/*.o tools/*.o externals/*/*.o testrunner dmake cppcheck cppcheck.exe cppcheck.1
man: man/cppcheck.1
@ -383,7 +383,10 @@ validateXML: createXMLExamples
xmllint --noout --relaxng cppcheck-errors.rng /tmp/example.xml
checkCWEEntries: /tmp/errorlist.xml
./tools/listErrorsWithoutCWE.py -F /tmp/errorlist.xml
$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(shell which python3)))
$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(shell which python)))
$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(error Did not find a Python interpreter)))
$(PYTHON_INTERPRETER) tools/listErrorsWithoutCWE.py -F /tmp/errorlist.xml
.PHONY: validateRules
validateRules:
xmllint --noout rules/*.xml

View File

@ -7,7 +7,7 @@ if (NOT NPROC)
endif()
message(STATUS "NPROC=${NPROC}")
find_program(RUN_CLANG_TIDY NAMES run-clang-tidy run-clang-tidy-13 run-clang-tidy-12 run-clang-tidy-11 run-clang-tidy-10 run-clang-tidy-9 run-clang-tidy-8)
find_program(RUN_CLANG_TIDY NAMES run-clang-tidy run-clang-tidy-14 run-clang-tidy-13 run-clang-tidy-12 run-clang-tidy-11 run-clang-tidy-10 run-clang-tidy-9 run-clang-tidy-8)
message(STATUS "RUN_CLANG_TIDY=${RUN_CLANG_TIDY}")
if (RUN_CLANG_TIDY)
# disable all compiler warnings since we are just interested in the tidy ones

View File

@ -51,6 +51,15 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_compile_options(-Wsuggest-attribute=noreturn)
add_compile_options(-Wno-shadow) # whenever a local variable or type declaration shadows another one
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 14)
if (CMAKE_BUILD_TYPE MATCHES "Release" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo")
# work around performance regression - see https://github.com/llvm/llvm-project/issues/53555
add_compile_options(-mllvm -inline-deferral)
endif()
# use force DWARF 4 debug format since not all tools might be able to handle DWARF 5 yet - e.g. valgrind on ubuntu 20.04
add_compile_options(-gdwarf-4)
endif()
add_compile_options_safe(-Wno-documentation-unknown-command)
@ -86,6 +95,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options_safe(-Wno-tautological-type-limit-compare)
add_compile_options_safe(-Wno-unused-member-function)
add_compile_options(-Wno-disabled-macro-expansion)
add_compile_options_safe(-Wno-bitwise-instead-of-logical) # TODO: fix these
# warnings we are not interested in
add_compile_options(-Wno-four-char-constants)

View File

@ -242,15 +242,17 @@ int main(int argc, char **argv)
<< " $(warning Usage of SRCDIR to activate match compiler is deprecated. Use MATCHCOMPILER=yes instead.)\n"
<< " MATCHCOMPILER:=yes\n"
<< "endif\n";
// TODO: bail out when matchcompiler.py fails (i.e. invalid PYTHON_INTERPRETER specified)
// TODO: handle "PYTHON_INTERPRETER="
fout << "ifeq ($(MATCHCOMPILER),yes)\n"
<< " # Find available Python interpreter\n"
<< " ifndef PYTHON_INTERPRETER\n"
<< " ifeq ($(PYTHON_INTERPRETER),)\n"
<< " PYTHON_INTERPRETER := $(shell which python3)\n"
<< " endif\n"
<< " ifndef PYTHON_INTERPRETER\n"
<< " ifeq ($(PYTHON_INTERPRETER),)\n"
<< " PYTHON_INTERPRETER := $(shell which python)\n"
<< " endif\n"
<< " ifndef PYTHON_INTERPRETER\n"
<< " ifeq ($(PYTHON_INTERPRETER),)\n"
<< " $(error Did not find a Python interpreter)\n"
<< " endif\n"
<< " ifdef VERIFY\n"
@ -424,7 +426,7 @@ int main(int argc, char **argv)
fout << "run-dmake: dmake\n";
fout << "\t./dmake\n\n";
fout << "clean:\n";
fout << "\trm -f build/*.o lib/*.o cli/*.o test/*.o tools/*.o externals/*/*.o testrunner dmake cppcheck cppcheck.exe cppcheck.1\n\n";
fout << "\trm -f build/*.cpp build/*.o lib/*.o cli/*.o test/*.o tools/*.o externals/*/*.o testrunner dmake cppcheck cppcheck.exe cppcheck.1\n\n";
fout << "man:\tman/cppcheck.1\n\n";
fout << "man/cppcheck.1:\t$(MAN_SOURCE)\n\n";
fout << "\t$(XP) $(DB2MAN) $(MAN_SOURCE)\n\n";
@ -494,7 +496,11 @@ int main(int argc, char **argv)
fout << "\txmllint --noout --relaxng cppcheck-errors.rng /tmp/errorlist.xml\n";
fout << "\txmllint --noout --relaxng cppcheck-errors.rng /tmp/example.xml\n";
fout << "\ncheckCWEEntries: /tmp/errorlist.xml\n";
fout << "\t./tools/listErrorsWithoutCWE.py -F /tmp/errorlist.xml\n";
// TODO: handle "PYTHON_INTERPRETER="
fout << "\t$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(shell which python3)))\n";
fout << "\t$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(shell which python)))\n";
fout << "\t$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(error Did not find a Python interpreter)))\n";
fout << "\t$(PYTHON_INTERPRETER) tools/listErrorsWithoutCWE.py -F /tmp/errorlist.xml\n";
fout << ".PHONY: validateRules\n";
fout << "validateRules:\n";
fout << "\txmllint --noout rules/*.xml\n";

View File

@ -11,7 +11,7 @@ if test -f ./bin/cppcheck; then
CPPCHECK=$(pwd)/bin/cppcheck
fi
python $DIR/extracttests.py --code=$(pwd)/test1 $1
python3 $DIR/extracttests.py --code=$(pwd)/test1 $1
cd test1

View File

@ -263,7 +263,7 @@ void MainWindow::showResult(QListWidgetItem *item)
const QStringList lines = item->text().split("\n");
if (lines.size() < 2)
return;
const QString url = lines[0];
const QString &url = lines[0];
QString msg = lines[1];
const QRegularExpressionMatch matchRes = mVersionRe.match(msg);
if (matchRes.hasMatch())