Skip to content

Commit

Permalink
test: suppress non-const global variable warnings by the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed Jan 9, 2024
1 parent 4e9cc97 commit f920a84
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 20 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Checks: >
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-const-or-ref-data-members,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-pro-*,
misc-*,
-misc-no-recursion,
Expand Down
4 changes: 2 additions & 2 deletions test/entt/core/any.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct empty {
++counter;
}

inline static int counter = 0;
inline static int counter = 0; // NOLINT
};

struct fat {
Expand All @@ -43,7 +43,7 @@ struct fat {
return std::equal(std::begin(value), std::end(value), std::begin(other.value), std::end(other.value));
}

inline static int counter{0};
inline static int counter{0}; // NOLINT
double value[4];
};

Expand Down
6 changes: 3 additions & 3 deletions test/entt/meta/meta_any.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct clazz_t {
return value;
}

inline static char c = 'c';
inline static char c = 'c'; // NOLINT
int value{0};
};

Expand All @@ -42,8 +42,8 @@ struct empty_t {
++destroy_counter;
}

inline static int destroy_counter = 0;
inline static int destructor_counter = 0;
inline static int destroy_counter = 0; // NOLINT
inline static int destructor_counter = 0; // NOLINT
};

struct fat_t: empty_t {
Expand Down
4 changes: 2 additions & 2 deletions test/entt/meta/meta_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct clazz: base {
}

int value{};
inline static int bucket{};
inline static int bucket{}; // NOLINT
};

struct argument {
Expand Down Expand Up @@ -137,7 +137,7 @@ class MetaContext: public ::testing::Test {
entt::meta_reset();
}

[[nodiscard]] const entt::meta_ctx& ctx() const noexcept {
[[nodiscard]] const entt::meta_ctx &ctx() const noexcept {
return context;
}

Expand Down
8 changes: 4 additions & 4 deletions test/entt/meta/meta_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct base_t {
++counter;
}

inline static int counter = 0;
inline static int counter = 0; // NOLINT
int value{3};
};

Expand All @@ -37,8 +37,8 @@ struct clazz_t {
int i{0};
const int j{1};
base_t base{};
inline static int h{2};
inline static const int k{3};
inline static int h{2}; // NOLINT
inline static const int k{3}; // NOLINT
};

struct setter_getter_t {
Expand Down Expand Up @@ -82,7 +82,7 @@ struct multi_setter_t {
};

struct array_t {
inline static int global[3];
inline static int global[3]; // NOLINT
int local[5];
};

Expand Down
2 changes: 1 addition & 1 deletion test/entt/meta/meta_dtor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct clazz_t {
++counter;
}

inline static int counter = 0;
inline static int counter = 0; // NOLINT
};

struct MetaDtor: ::testing::Test {
Expand Down
4 changes: 2 additions & 2 deletions test/entt/meta/meta_func.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct base_t {
ref.value = v;
}

inline static int counter = 0;
inline static int counter = 0; // NOLINT
int value{3};
};

Expand Down Expand Up @@ -86,7 +86,7 @@ struct func_t {
return value;
}

inline static int value = 0;
inline static int value = 0; // NOLINT
};

double double_member(const double &value) {
Expand Down
6 changes: 3 additions & 3 deletions test/entt/meta/meta_utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ struct clazz {

int member{};
const int cmember{};
inline static int value{};
inline static const int cvalue{};
inline static int arr[3u]{};
inline static int value{}; // NOLINT
inline static const int cvalue{}; // NOLINT
inline static int arr[3u]{}; // NOLINT
};

struct MetaUtility: ::testing::Test {
Expand Down
4 changes: 2 additions & 2 deletions test/entt/process/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct succeeded_process: entt::process<succeeded_process, entt::scheduler::delt
succeed();
}

inline static unsigned int invoked;
inline static unsigned int invoked; // NOLINT
};

struct failed_process: entt::process<failed_process, entt::scheduler::delta_type> {
Expand All @@ -36,7 +36,7 @@ struct failed_process: entt::process<failed_process, entt::scheduler::delta_type
fail();
}

inline static unsigned int invoked;
inline static unsigned int invoked; // NOLINT
};

struct Scheduler: ::testing::Test {
Expand Down

0 comments on commit f920a84

Please sign in to comment.