Skip to content

Commit

Permalink
add clang-tidy fixes for version 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
marenz2569 committed Jan 17, 2025
1 parent 6221f39 commit 4dd5516
Show file tree
Hide file tree
Showing 45 changed files with 294 additions and 40 deletions.
5 changes: 3 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ CheckOptions:
- { key: readability-implicit-bool-conversion.AllowPointerConditions, value: 1 }
- { key: readability-function-cognitive-complexity.IgnoreMacros, value: 1 }
- { key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic, value: "true" }
# disable warnings is asmjit
- { key: 'clang-analyzer-optin.cplusplus.UninitializedObject:IgnoreRecordsWithField', value: 'asmjit::Operand_::Signature' }
# disable warnings is external libraries
- { key: 'clang-analyzer-optin.cplusplus.UninitializedObject:IgnoreRecordsWithField', value: 'asmjit::Operand_::Signature' }
- { key: 'misc-include-cleaner.IgnoreHeaders', value: '.*asmjit.*;.*hwloc.*' }
1 change: 1 addition & 0 deletions include/firestarter/CPUTopology.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <set>

extern "C" {
// NOLINTNEXTLINE(misc-header-include-cycle) internal cycle inside hwloc
#include <hwloc.h>
}

Expand Down
2 changes: 1 addition & 1 deletion include/firestarter/DumpRegisterWorkerData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class DumpRegisterWorkerData {
/// which the registers are dumped as well as getting the size and count of registers.
std::shared_ptr<LoadWorkerData> LoadWorkerDataPtr;
/// Every this number of seconds the register content will be dumped.
const std::chrono::seconds DumpTimeDelta;
std::chrono::seconds DumpTimeDelta;
/// The folder in which the hamming_distance.csv file will be created.
std::string DumpFilePath;
};
Expand Down
3 changes: 1 addition & 2 deletions include/firestarter/Payload/PayloadSettings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ struct PayloadSettings {

/// The available instruction cache size. This refers to the L1i-Cache per thread on the physical CPU core.
[[nodiscard]] auto instructionCacheSizePerThread() const -> std::optional<unsigned> {
auto InstructionCacheSize = this->InstructionCacheSize;
if (*InstructionCacheSize) {
if (InstructionCacheSize) {
return *InstructionCacheSize / thread();
}
return {};
Expand Down
5 changes: 3 additions & 2 deletions include/firestarter/Platform/PlatformConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ class PlatformConfig {
<< " thread(s) per core\n"
<< " Used buffersizes per thread:";

if (settings().instructionCacheSizePerThread()) {
log::info() << " - L1i-Cache: " << *settings().instructionCacheSizePerThread() << " Bytes";
const auto ICacheSizePerThread = settings().instructionCacheSizePerThread();
if (ICacheSizePerThread) {
log::info() << " - L1i-Cache: " << *ICacheSizePerThread << " Bytes";
}

unsigned I = 1;
Expand Down
4 changes: 0 additions & 4 deletions include/firestarter/ProcessorInformation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
#include <sstream>
#include <string>

extern "C" {
#include <hwloc.h>
}

namespace firestarter {

/// This class models the properties of a processor.
Expand Down
1 change: 1 addition & 0 deletions include/firestarter/X86/Payload/AVX512Payload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#pragma once

#include "firestarter/Payload/PayloadSettings.hpp"
#include "firestarter/X86/Payload/X86Payload.hpp"

namespace firestarter::x86::payload {
Expand Down
1 change: 1 addition & 0 deletions include/firestarter/X86/Payload/AVXPayload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#pragma once

#include "firestarter/Payload/PayloadSettings.hpp"
#include "firestarter/X86/Payload/X86Payload.hpp"

namespace firestarter::x86::payload {
Expand Down
1 change: 1 addition & 0 deletions include/firestarter/X86/Payload/FMA4Payload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#pragma once

#include "firestarter/Payload/PayloadSettings.hpp"
#include "firestarter/X86/Payload/X86Payload.hpp"

namespace firestarter::x86::payload {
Expand Down
1 change: 1 addition & 0 deletions include/firestarter/X86/Payload/FMAPayload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#pragma once

#include "firestarter/Payload/PayloadSettings.hpp"
#include "firestarter/X86/Payload/X86Payload.hpp"

namespace firestarter::x86::payload {
Expand Down
1 change: 1 addition & 0 deletions include/firestarter/X86/Payload/SSE2Payload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#pragma once

#include "firestarter/Payload/PayloadSettings.hpp"
#include "firestarter/X86/Payload/X86Payload.hpp"

namespace firestarter::x86::payload {
Expand Down
7 changes: 3 additions & 4 deletions include/firestarter/X86/Payload/X86Payload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

#pragma once

#include "firestarter/Constants.hpp" // IWYU pragma: keep
#include "firestarter/Constants.hpp"
#include "firestarter/DumpRegisterStruct.hpp" // IWYU pragma: keep
#include "firestarter/LoadWorkerMemory.hpp"
#include "firestarter/Logging/Log.hpp" // IWYU pragma: keep
#include "firestarter/Logging/Log.hpp"
#include "firestarter/Payload/Payload.hpp"
#include "firestarter/X86/X86CpuFeatures.hpp"

Expand Down Expand Up @@ -87,9 +87,8 @@ class X86Payload : public firestarter::payload::Payload {
/// \arg Builder The builder that contains the assembler code.
static void printAssembler(asmjit::BaseBuilder& Builder) {
asmjit::String Sb;
asmjit::FormatOptions FormatOptions{};

asmjit::Formatter::formatNodeList(Sb, FormatOptions, &Builder);
asmjit::Formatter::formatNodeList(Sb, asmjit::FormatOptions{}, &Builder);
log::info() << Sb.data();
}

Expand Down
2 changes: 1 addition & 1 deletion include/firestarter/X86/Payload/ZENFMAPayload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#pragma once

#include "asmjit/core/cpuinfo.h"
#include "firestarter/Payload/PayloadSettings.hpp"
#include "firestarter/X86/Payload/X86Payload.hpp"

namespace firestarter::x86::payload {
Expand Down
4 changes: 4 additions & 0 deletions src/firestarter/CPUTopology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
#include "firestarter/CPUTopology.hpp"
#include "firestarter/Logging/Log.hpp"

#include <algorithm>
#include <array>
#include <optional>
#include <sstream>
#include <vector>

#if defined(__APPLE__)
#include <mach/thread_act.h>
Expand Down
10 changes: 10 additions & 0 deletions src/firestarter/Config/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,20 @@

#include "firestarter/Config/Config.hpp"
#include "firestarter/Config/CpuBind.hpp"
#include "firestarter/Config/InstructionGroups.hpp"
#include "firestarter/Constants.hpp"
#include "firestarter/Logging/Log.hpp"
#include "firestarter/SafeExit.hpp"

#include <algorithm>
#include <cstdlib>
#include <cxxopts.hpp>
#include <exception>
#include <nitro/log/severity.hpp>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>

namespace {

Expand Down
4 changes: 4 additions & 0 deletions src/firestarter/Config/CpuBind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@

#include "firestarter/Config/CpuBind.hpp"

#include <cstdint>
#include <regex>
#include <set>
#include <sstream>
#include <stdexcept>
#include <string>

namespace firestarter {

Expand Down
6 changes: 6 additions & 0 deletions src/firestarter/Config/InstructionGroups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
#include "firestarter/Config/InstructionGroups.hpp"

#include <cassert>
#include <cstring>
#include <regex>
#include <sstream>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>

namespace firestarter {

Expand Down
12 changes: 12 additions & 0 deletions src/firestarter/DumpRegisterWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,22 @@
* Contact: [email protected]
*****************************************************************************/

#include "firestarter/Constants.hpp"
#include "firestarter/DumpRegisterStruct.hpp"
#include "firestarter/DumpRegisterWorkerData.hpp"
#include "firestarter/Firestarter.hpp"

#include <chrono>
#include <cstdint>
#include <cstring>
#include <fstream>
#include <memory>
#include <ostream>
#include <sstream>
#include <string>
#include <thread>
#include <utility>
#include <vector>

namespace {
auto hammingDistance(uint64_t X, uint64_t Y) -> unsigned {
Expand Down Expand Up @@ -66,6 +77,7 @@ void Firestarter::joinDumpRegisterWorker() { this->DumpRegisterWorkerThread.join

void Firestarter::dumpRegisterWorker(std::unique_ptr<DumpRegisterWorkerData> Data) {
#if defined(linux) || defined(__linux__)
// NOLINTNEXTLINE(misc-include-cleaner)
pthread_setname_np(pthread_self(), "DumpRegWorker");
#endif

Expand Down
20 changes: 20 additions & 0 deletions src/firestarter/Firestarter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,37 @@
*****************************************************************************/

#include "firestarter/Firestarter.hpp"
#include "firestarter/Config/Config.hpp"
#include "firestarter/Config/InstructionGroups.hpp"
#include "firestarter/Constants.hpp"
#include "firestarter/Cuda/Cuda.hpp"
#include "firestarter/FunctionSelection.hpp"
#include "firestarter/Logging/Log.hpp"
#include "firestarter/Measurement/MeasurementWorker.hpp"
#include "firestarter/Measurement/Metric/IPCEstimate.hpp"
#include "firestarter/OneAPI/OneAPI.hpp"
#include "firestarter/Optimizer/Algorithm/NSGA2.hpp"
#include "firestarter/Optimizer/History.hpp"
#include "firestarter/Optimizer/Population.hpp"
#include "firestarter/Optimizer/Problem/CLIArgumentProblem.hpp"
#include "firestarter/SafeExit.hpp"
#include "firestarter/ThreadAffinity.hpp"
#include "firestarter/X86/X86CpuFeatures.hpp"
#include "firestarter/X86/X86FunctionSelection.hpp"
#include "firestarter/X86/X86ProcessorInformation.hpp"

#include <algorithm>
#include <chrono>
#include <csignal>
#include <cstdint>
#include <cstdlib>
#include <iomanip>
#include <limits>
#include <memory>
#include <mutex>
#include <stdexcept>
#include <string>
#include <utility>

namespace firestarter {

Expand Down Expand Up @@ -187,6 +206,7 @@ Firestarter::Firestarter(Config&& ProvidedConfig)

// add some signal handler for aborting FIRESTARTER
if constexpr (!firestarter::OptionalFeatures.IsWin32) {
// NOLINTNEXTLINE(misc-include-cleaner)
(void)std::signal(SIGALRM, Firestarter::sigalrmHandler);
}

Expand Down
11 changes: 10 additions & 1 deletion src/firestarter/FunctionSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,29 @@
*****************************************************************************/

#include "firestarter/FunctionSelection.hpp"
#include "firestarter/CPUTopology.hpp"
#include "firestarter/CpuFeatures.hpp"
#include "firestarter/CpuModel.hpp"
#include "firestarter/Logging/Log.hpp"
#include "firestarter/Platform/PlatformConfig.hpp"
#include "firestarter/Platform/PlatformConfigAndThreads.hpp"
#include "firestarter/ProcessorInformation.hpp"

#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <ios>
#include <memory>
#include <optional>
#include <stdexcept>
#include <string>

namespace firestarter {

auto FunctionSelection::selectAvailableFunction(
unsigned FunctionId, const CpuFeatures& Features, std::optional<unsigned> InstructionCacheSize,
bool AllowUnavailablePayload) const -> std::unique_ptr<platform::PlatformConfig> {
unsigned Id = 1;
std::optional<std::string> DefaultPayloadName;

for (const auto& Platform : platform::PlatformConfigAndThreads::fromPlatformConfigs(platformConfigs())) {
// the selected function
Expand Down
15 changes: 15 additions & 0 deletions src/firestarter/LoadWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@

#include "firestarter/AlignedAlloc.hpp"
#include "firestarter/Constants.hpp"
#include "firestarter/DumpRegisterStruct.hpp"
#include "firestarter/ErrorDetectionStruct.hpp"
#include "firestarter/Firestarter.hpp"
#include "firestarter/LoadWorkerData.hpp"
#include "firestarter/LoadWorkerMemory.hpp"
#include "firestarter/Logging/FirstWorkerThreadFilter.hpp"
#include "firestarter/Logging/Log.hpp"
#include "firestarter/ThreadAffinity.hpp"

#if defined(linux) || defined(__linux__)
#include "firestarter/Measurement/Metric/IPCEstimate.hpp"
Expand All @@ -37,13 +41,23 @@
#include <SCOREP_User.h>
#endif

#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <ios>
#include <limits>
#include <memory>
#include <sstream>
#include <string>
#include <thread>
#include <utility>
#include <vector>

namespace firestarter {

Expand Down Expand Up @@ -276,6 +290,7 @@ void Firestarter::loadThreadWorker(const std::shared_ptr<LoadWorkerData>& Td) {
auto OldState = LoadThreadState::ThreadWait;

#if defined(linux) || defined(__linux__)
// NOLINTNEXTLINE(misc-include-cleaner)
pthread_setname_np(pthread_self(), "LoadWorker");
#endif

Expand Down
5 changes: 5 additions & 0 deletions src/firestarter/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@
* Contact: [email protected]
*****************************************************************************/

#include "firestarter/Config/Config.hpp"
#include "firestarter/Firestarter.hpp"
#include "firestarter/Logging/Log.hpp"

#include <cstdlib>
#include <exception>
#include <utility>

auto main(int argc, const char** argv) -> int {
firestarter::log::info() << "FIRESTARTER - A Processor Stress Test Utility, Version " << _FIRESTARTER_VERSION_STRING
<< "\n"
Expand Down
Loading

0 comments on commit 4dd5516

Please sign in to comment.