Skip to content

Commit 48629a1

Browse files
committed
Address clang-tidy-21 remarks
1 parent fc572e8 commit 48629a1

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Checks: >
3636
-misc-non-private-member-variables-in-classes,
3737
-modernize-avoid-c-arrays,
3838
-modernize-use-trailing-return-type,
39+
-portability-avoid-pragma-once,
3940
-portability-template-virtual-member-function,
4041
-readability-magic-numbers
4142

modules/performance/include/performance.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ struct PerfAttr {
3030
struct PerfResults {
3131
/// @brief Measured execution time in seconds.
3232
double time_sec = 0.0;
33-
enum TypeOfRunning : uint8_t { kPipeline, kTaskRun, kNone } type_of_running = kNone;
33+
enum class TypeOfRunning : uint8_t { kPipeline, kTaskRun, kNone };
34+
TypeOfRunning type_of_running = TypeOfRunning::kNone;
3435
constexpr static double kMaxTime = 10.0;
3536
};
3637

@@ -116,10 +117,10 @@ class Perf {
116117
};
117118

118119
inline std::string GetStringParamName(PerfResults::TypeOfRunning type_of_running) {
119-
if (type_of_running == PerfResults::kTaskRun) {
120+
if (type_of_running == PerfResults::TypeOfRunning::kTaskRun) {
120121
return "task_run";
121122
}
122-
if (type_of_running == PerfResults::kPipeline) {
123+
if (type_of_running == PerfResults::TypeOfRunning::kPipeline) {
123124
return "pipeline";
124125
}
125126
return "none";

modules/task/include/task.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace ppc::task {
2020

2121
/// @brief Represents the type of task (parallelization technology).
2222
/// @details Used to select the implementation type in tests and execution logic.
23-
enum TypeOfTask : uint8_t {
23+
enum class TypeOfTask : uint8_t {
2424
/// Use all available implementations
2525
kALL,
2626
/// MPI (Message Passing Interface)
@@ -57,7 +57,7 @@ inline std::string TypeOfTaskToString(TypeOfTask type) {
5757
}
5858

5959
/// @brief Indicates whether a task is enabled or disabled.
60-
enum StatusOfTask : uint8_t {
60+
enum class StatusOfTask : uint8_t {
6161
/// Task is enabled and should be executed
6262
kEnabled,
6363
/// Task is disabled and will be skipped
@@ -68,7 +68,7 @@ enum StatusOfTask : uint8_t {
6868
/// @param status_of_task Task status (enabled or disabled).
6969
/// @return "enabled" if the task is enabled, otherwise "disabled".
7070
inline std::string GetStringTaskStatus(StatusOfTask status_of_task) {
71-
if (status_of_task == kDisabled) {
71+
if (status_of_task == StatusOfTask::kDisabled) {
7272
return "disabled";
7373
}
7474
return "enabled";
@@ -96,7 +96,7 @@ inline std::string GetStringTaskType(TypeOfTask type_of_task, const std::string
9696
return type_str + "_" + std::string((*list_settings)["tasks"][type_str]);
9797
}
9898

99-
enum StateOfTesting : uint8_t { kFunc, kPerf };
99+
enum class StateOfTesting : uint8_t { kFunc, kPerf };
100100

101101
template <typename InType, typename OutType>
102102
/// @brief Base abstract class representing a generic task with a defined pipeline.
@@ -257,9 +257,9 @@ class Task {
257257
private:
258258
InType input_{};
259259
OutType output_{};
260-
StateOfTesting state_of_testing_ = kFunc;
261-
TypeOfTask type_of_task_ = kUnknown;
262-
StatusOfTask status_of_task_ = kEnabled;
260+
StateOfTesting state_of_testing_ = StateOfTesting::kFunc;
261+
TypeOfTask type_of_task_ = TypeOfTask::kUnknown;
262+
StatusOfTask status_of_task_ = StatusOfTask::kEnabled;
263263
std::chrono::high_resolution_clock::time_point tmp_time_point_;
264264
enum class PipelineStage : uint8_t {
265265
kNone,

modules/util/include/util.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class DestructorFailureFlag {
5353
inline static std::atomic<bool> failure_flag{false};
5454
};
5555

56-
enum GTestParamIndex : uint8_t { kTaskGetter, kNameTest, kTestParams };
56+
enum class GTestParamIndex : uint8_t { kTaskGetter, kNameTest, kTestParams };
5757

5858
std::string GetAbsoluteTaskPath(const std::string& id_path, const std::string& relative_path);
5959
int GetNumThreads();
@@ -70,7 +70,7 @@ std::string GetNamespace() {
7070
std::free};
7171
name = (status == 0) ? demangled.get() : name;
7272
#endif
73-
#if defined(_MSC_VER)
73+
#ifdef _MSC_VER
7474
const std::string prefixes[] = {"class ", "struct ", "enum ", "union "};
7575
for (const auto& prefix : prefixes) {
7676
if (name.starts_with(prefix)) {

0 commit comments

Comments
 (0)