Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/CI-unixish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,12 @@ jobs:
run: |
./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:
needs: build # wait for all tests to be successful first

Expand Down
26 changes: 22 additions & 4 deletions democlient/democlient.cpp
Original file line number Diff line number Diff line change
@@ -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 <cstdio>
#include <cstdlib>
Expand Down Expand Up @@ -44,7 +62,7 @@ class CppcheckExecutor : public ErrorLogger {
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 {
const std::string s = msg.toString(true);

Expand All @@ -54,9 +72,9 @@ class CppcheckExecutor : public ErrorLogger {
std::fprintf(logfile, "%s\n", s.c_str());
}

void reportProgress(const std::string& filename,
const char stage[],
const std::size_t value) override {
void reportProgress(const std::string& /*filename*/,
const char /*stage*/[],
const std::size_t /*value*/) override {
if (std::time(nullptr) >= stoptime) {
std::cout << "Time to analyse the code exceeded 2 seconds. Terminating.\n\n";
Settings::terminate();
Expand Down