Skip to content

Commit

Permalink
cleaned up includes based on include-what-you-use / iwyu.yml: updated…
Browse files Browse the repository at this point in the history
… to yet another distro to get the latest version and updated the Chaotic-AUR key (#5267)

This is a mess. The version is AUR is still outdated and also doesn't
install anymore. Fedora 38 carries the latest version of it so use that
now. Keep the old steps in case we need to switch again in the future.
  • Loading branch information
firewave committed Aug 2, 2023
1 parent 389e446 commit 45de338
Show file tree
Hide file tree
Showing 53 changed files with 90 additions and 75 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/iwyu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-22.04

container:
image: "archlinux:latest"
image: "fedora:latest"

steps:
- uses: actions/checkout@v3
Expand All @@ -34,15 +34,23 @@ jobs:
pacman -Sy
pacman -S cmake make gcc qt5-base qt5-tools qt5-charts pcre wget --noconfirm
pacman-key --init
pacman-key --recv-key FBA220DFC880C036 --keyserver keyserver.ubuntu.com
pacman-key --lsign-key FBA220DFC880C036
pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com
pacman-key --lsign-key 3056513887B78AEB
pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' --noconfirm
echo "[chaotic-aur]" >> /etc/pacman.conf
echo "Include = /etc/pacman.d/chaotic-mirrorlist" >> /etc/pacman.conf
pacman -Sy
pacman -S include-what-you-use --noconfirm
ln -s iwyu-tool /usr/sbin/iwyu_tool
# TODO: the necessary packages are excessive - mostly because of Qt - use a pre-built image
- name: Install missing software on Fedora
run: |
dnf install -y cmake gcc-c++ qt5-qtbase-devel qt5-linguist qt5-qttools-devel qt5-qtcharts-devel pcre-devel
dnf install -y wget iwyu
ln -s iwyu_tool.py /usr/bin/iwyu_tool
ln -s qt5 /usr/include/qt
- name: Prepare CMake
run: |
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ cli/stacktrace.o: cli/stacktrace.cpp cli/stacktrace.h lib/config.h lib/utils.h
cli/threadexecutor.o: cli/threadexecutor.cpp cli/cppcheckexecutor.h cli/executor.h cli/threadexecutor.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h
$(CXX) ${INCLUDE_FOR_CLI} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ cli/threadexecutor.cpp

test/fixture.o: test/fixture.cpp externals/tinyxml2/tinyxml2.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h test/options.h test/redirect.h
test/fixture.o: test/fixture.cpp externals/tinyxml2/tinyxml2.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h test/options.h test/redirect.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/fixture.cpp

test/helpers.o: test/helpers.cpp externals/simplecpp/simplecpp.h lib/config.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/helpers.h
Expand Down Expand Up @@ -862,7 +862,7 @@ test/testunusedprivfunc.o: test/testunusedprivfunc.cpp externals/simplecpp/simpl
test/testunusedvar.o: test/testunusedvar.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkunusedvar.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testunusedvar.cpp

test/testutils.o: test/testutils.cpp lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h
test/testutils.o: test/testutils.cpp lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testutils.cpp

test/testvaarg.o: test/testvaarg.cpp lib/check.h lib/checkvaarg.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h
Expand Down
5 changes: 0 additions & 5 deletions cli/cmdlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include <list>
#include <set>
#include <sstream> // IWYU pragma: keep
#include <stdexcept>
#include <unordered_set>
#include <utility>

Expand All @@ -53,10 +52,6 @@
#include <tinyxml2.h>
#endif

#ifdef __linux__
#include <unistd.h>
#endif

static bool addFilesToList(const std::string& fileList, std::vector<std::string>& pathNames)
{
std::istream *files;
Expand Down
1 change: 1 addition & 0 deletions cli/cmdlineparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#ifndef CMDLINE_PARSER_H
#define CMDLINE_PARSER_H

#include <cstddef>
#include <string>
#include <vector>

Expand Down
19 changes: 19 additions & 0 deletions gui/compliancereportdialog.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 "compliancereportdialog.h"

#include "ui_compliancereportdialog.h"
Expand All @@ -16,6 +34,7 @@

#include <QByteArray>
#include <QCheckBox>
#include <QComboBox>
#include <QCoreApplication>
#include <QDialogButtonBox>
#include <QDir>
Expand Down
18 changes: 18 additions & 0 deletions gui/compliancereportdialog.h
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/>.
*/

#ifndef COMPLIANCEREPORTDIALOG_H
#define COMPLIANCEREPORTDIALOG_H

Expand Down
2 changes: 0 additions & 2 deletions gui/librarydialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

#include "ui_librarydialog.h"

#include <string>

#include <QCheckBox>
#include <QComboBox>
#include <QFile>
Expand Down
1 change: 0 additions & 1 deletion gui/projectfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "importproject.h"
#include "settings.h"

#include <string>
#include <utility>

#include <QFile>
Expand Down
3 changes: 0 additions & 3 deletions gui/projectfiledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,13 @@
#include <string>

#include <QByteArray>
#include <QChar>
#include <QCheckBox>
#include <QComboBox>
#include <QCoreApplication>
#include <QDialogButtonBox>
#include <QDir>
#include <QFile>
#include <QFileDialog>
#include <QFileInfo>
#include <QFileInfoList>
#include <QFlags>
#include <QLabel>
#include <QLineEdit>
Expand Down
2 changes: 0 additions & 2 deletions gui/resultstree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
#include "threadhandler.h"
#include "xmlreportv2.h"

#include <string>

#include <QAction>
#include <QApplication>
#include <QClipboard>
Expand Down
1 change: 0 additions & 1 deletion lib/checkclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <iterator>
#include <utility>
Expand Down
1 change: 0 additions & 1 deletion lib/checkmemoryleak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "tokenize.h"

#include <algorithm>
#include <unordered_set>
#include <utility>
#include <vector>

Expand Down
1 change: 1 addition & 0 deletions lib/checksizeof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "checksizeof.h"

#include "errortypes.h"
#include "library.h"
#include "settings.h"
#include "symboldatabase.h"
#include "token.h"
Expand Down
1 change: 0 additions & 1 deletion lib/checkunusedfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <fstream> // IWYU pragma: keep
#include <map>
Expand Down
1 change: 0 additions & 1 deletion lib/clangimport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <iterator>
Expand Down
1 change: 0 additions & 1 deletion lib/errorlogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <array>
#include <cassert>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream> // IWYU pragma: keep
Expand Down
2 changes: 1 addition & 1 deletion lib/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
#include <algorithm>
#include <cctype>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <list>
#include <memory>
#include <sstream> // IWYU pragma: keep
#include <stack>
#include <stdexcept>
#include <string>

#include <tinyxml2.h>
Expand Down
1 change: 0 additions & 1 deletion lib/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "vfvalue.h"

#include <fstream>
#include <utility>

#define PICOJSON_USE_INT64
#include <picojson.h>
Expand Down
1 change: 0 additions & 1 deletion lib/suppressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

#include <algorithm>
#include <cctype> // std::isdigit, std::isalnum, etc
#include <cstdlib>
#include <cstring>
#include <functional> // std::bind, std::placeholders
#include <sstream> // IWYU pragma: keep
Expand Down
1 change: 1 addition & 0 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <sstream> // IWYU pragma: keep
#include <stack>
Expand Down
1 change: 0 additions & 1 deletion lib/token.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <cctype>
#include <climits>
#include <cstdio>
#include <cstdint>
#include <cstring>
#include <functional>
#include <iostream>
Expand Down
1 change: 1 addition & 0 deletions lib/token.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "utils.h"
#include "vfvalue.h"

#include <cassert>
#include <cstdint>
#include <cstddef>
#include <functional>
Expand Down
1 change: 1 addition & 0 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "token.h"
#include "utils.h"
#include "valueflow.h"
#include "vfvalue.h"

#include <algorithm>
#include <cassert>
Expand Down
2 changes: 0 additions & 2 deletions lib/valueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,8 @@
#include <cassert>
#include <chrono>
#include <climits>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <exception>
#include <functional>
#include <initializer_list>
Expand Down
2 changes: 1 addition & 1 deletion test/fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

#include "errortypes.h"
#include "options.h"
#include "path.h"
#include "redirect.h"

#include <cstdio>
#include <cctype>
#include <exception>
#include <iostream>
#include <set>
#include <sstream>
#include <string>

Expand Down
7 changes: 5 additions & 2 deletions test/fixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,20 @@
#include "color.h"
#include "config.h"
#include "errorlogger.h"
#include "errortypes.h"
#include "library.h"
#include "platform.h"
#include "settings.h"
#include "standards.h"

#include <cstddef>
#include <list>
#include <set>
#include <sstream>
#include <stdexcept>
#include <string>
#include <utility>

class options;
class Settings;
class Tokenizer;

class TestFixture : public ErrorLogger {
Expand Down
4 changes: 3 additions & 1 deletion test/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
#include "path.h"
#include "preprocessor.h"

#include <cerrno>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <fstream> // IWYU pragma: keep
#include <list>
#include <stdexcept>
#include <utility>
#include <vector>
Expand Down
1 change: 0 additions & 1 deletion test/testassert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "fixture.h"
#include "tokenize.h"

#include <list>
#include <sstream> // IWYU pragma: keep


Expand Down
2 changes: 0 additions & 2 deletions test/testautovariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
#include "fixture.h"
#include "tokenize.h"

#include <list>
#include <sstream> // IWYU pragma: keep
#include <string>

class TestAutoVariables : public TestFixture {
public:
Expand Down
1 change: 0 additions & 1 deletion test/testbool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "fixture.h"
#include "tokenize.h"

#include <list>
#include <sstream> // IWYU pragma: keep

class TestBool : public TestFixture {
Expand Down
1 change: 0 additions & 1 deletion test/testboost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "fixture.h"
#include "tokenize.h"

#include <list>
#include <sstream> // IWYU pragma: keep

class TestBoost : public TestFixture {
Expand Down
1 change: 0 additions & 1 deletion test/testbufferoverrun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "ctu.h"
#include "errortypes.h"
#include "standards.h"
#include "library.h"
#include "platform.h"
#include "settings.h"
#include "fixture.h"
Expand Down
Loading

0 comments on commit 45de338

Please sign in to comment.