CI-unixish.yml: added step to compile democlient (#4997)

* democlient.cpp: added missing copyright header

* CI-unixish.yml: added step to build democlient

* democlient.cpp: fixed GCC compiler warnings
This commit is contained in:
Oliver Stöneberg 2023-04-21 18:58:04 +02:00 committed by GitHub
parent 6e5375f7b7
commit 89b47e725f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 4 deletions

View File

@ -408,6 +408,12 @@ jobs:
run: | run: |
./cppcheck --addon=misra addons/test/misra/crash1.c | ( ! grep 'Bailing out from checking' ) ./cppcheck --addon=misra addons/test/misra/crash1.c | ( ! grep 'Bailing out from checking' )
- name: Build democlient
if: matrix.os == 'ubuntu-22.04'
run: |
warnings="-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar"
g++ $warnings -c -Ilib -Iexternals/tinyxml2 democlient/democlient.cpp
selfcheck: selfcheck:
needs: build # wait for all tests to be successful first needs: build # wait for all tests to be successful first

View File

@ -1,3 +1,21 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2023 Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <ctime> #include <ctime>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
@ -44,7 +62,7 @@ public:
cppcheck.check("test.cpp", code); cppcheck.check("test.cpp", code);
} }
void reportOut(const std::string &outmsg, Color c) override {} void reportOut(const std::string & /*outmsg*/, Color /*c*/) override {}
void reportErr(const ErrorMessage &msg) override { void reportErr(const ErrorMessage &msg) override {
const std::string s = msg.toString(true); const std::string s = msg.toString(true);
@ -54,9 +72,9 @@ public:
std::fprintf(logfile, "%s\n", s.c_str()); std::fprintf(logfile, "%s\n", s.c_str());
} }
void reportProgress(const std::string& filename, void reportProgress(const std::string& /*filename*/,
const char stage[], const char /*stage*/[],
const std::size_t value) override { const std::size_t /*value*/) override {
if (std::time(nullptr) >= stoptime) { if (std::time(nullptr) >= stoptime) {
std::cout << "Time to analyse the code exceeded 2 seconds. Terminating.\n\n"; std::cout << "Time to analyse the code exceeded 2 seconds. Terminating.\n\n";
Settings::terminate(); Settings::terminate();