Skip to content

Commit de63cc9

Browse files
committed
fixup! Fix clang-tidy warnings
1 parent 02bd751 commit de63cc9

File tree

9 files changed

+19
-22
lines changed

9 files changed

+19
-22
lines changed

.clang-tidy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ Checks: >
33
bugprone-*,
44
-bugprone-exception-escape,
55
-bugprone-easily-swappable-parameters,
6-
clang-analyzer-*,
6+
-clang-analyzer-*,
77
misc-*,
88
-misc-const-correctness,
99
-misc-definitions-in-headers,
10+
-misc-include-cleaner,
1011
-misc-no-recursion,
1112
-misc-non-private-member-variables-in-classes,
1213
-misc-static-assert,
1314
-misc-unused-alias-decls,
1415
-misc-use-anonymous-namespace,
1516
performance-*,
17+
-performance-enum-size,
1618
readability-*,
1719
-readability-braces-around-statements,
1820
-readability-convert-member-functions-to-static,

include/lexy/_detail/code_point.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ constexpr std::size_t encode_code_point(char32_t cp, typename Encoding::char_typ
101101
{
102102
LEXY_PRECONDITION(size >= 1);
103103

104-
*buffer = char32_t(cp);
104+
*buffer = cp;
105105
return 1;
106106
}
107107
else

include/lexy/action/base.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@ namespace _detail
4747
T value;
4848

4949
explicit constexpr parse_context_var(T&& value)
50-
: parse_context_var_base(&type_id), value(LEXY_MOV(value))
50+
: parse_context_var_base(static_cast<const void*>(&type_id) /* NOLINT */),
51+
value(LEXY_MOV(value))
5152
{}
5253

5354
template <typename ControlBlock>
5455
static constexpr T& get(const ControlBlock* cb)
5556
{
5657
for (auto cur = cb->vars; cur; cur = cur->next)
57-
if (cur->id == &type_id)
58+
if (cur->id == static_cast<const void*>(&type_id) /* NOLINT */)
5859
return static_cast<parse_context_var*>(cur)->value;
5960

6061
LEXY_ASSERT(false, "context variable hasn't been created");

include/lexy/encoding.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace lexy
1313
{
1414
/// The endianness used by an encoding.
15-
enum class encoding_endianness // NOLINT(performance-enum-size)
15+
enum class encoding_endianness
1616
{
1717
/// Little endian.
1818
little,

include/lexy_ext/shell.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
namespace lexy_ext
1616
{
17-
#if 0
17+
#if 0 // NOLINT
1818
/// Controls how the shell performs I/O.
1919
class Prompt
2020
{

tests/lexy/callback/string.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ TEST_CASE("as_string")
148148
std::string from_unicode_cp_alloc
149149
= lexy::as_string<std::string, lexy::utf8_encoding>(std::allocator<char>{},
150150
lexy::code_point(0x00E4));
151-
CHECK(from_unicode_cp == "\u00E4");
151+
CHECK(from_unicode_cp_alloc == "\u00E4");
152152

153153
std::string from_sink = [&] {
154154
auto sink = lexy::as_string<std::string, lexy::utf8_encoding>.sink();
@@ -209,7 +209,7 @@ TEST_CASE("as_string")
209209
std::string from_cp = callback(lexy::code_point(0x00C4));
210210
CHECK(from_cp == "\u00C4");
211211
std::string from_cp_alloc = callback(std::allocator<char>{}, lexy::code_point(0x00C4));
212-
CHECK(from_cp == "\u00C4");
212+
CHECK(from_cp_alloc == "\u00C4");
213213

214214
std::string from_sink = [&] {
215215
auto sink = callback.sink();
@@ -255,7 +255,7 @@ TEST_CASE("as_string")
255255
std::string from_cp = callback(lexy::code_point(0x00C4));
256256
CHECK(from_cp == "\u00E4");
257257
std::string from_cp_alloc = callback(std::allocator<char>{}, lexy::code_point(0x00C4));
258-
CHECK(from_cp == "\u00E4");
258+
CHECK(from_cp_alloc == "\u00E4");
259259

260260
std::string from_sink = [&] {
261261
auto sink = callback.sink();

tests/lexy/detail/swar.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ TEST_CASE("swar_pack")
6666
TEST_CASE("swar_find_difference")
6767
{
6868
REQUIRE(sizeof(swar_int) == 8);
69-
constexpr auto a = swar_pack(char('a')).value;
70-
constexpr auto A = swar_pack(char('A')).value;
71-
constexpr auto abc = swar_pack(char('a'), char('b'), char('c')).value;
72-
constexpr auto aBc = swar_pack(char('a'), char('B'), char('c')).value;
69+
constexpr auto a = swar_pack('a').value;
70+
constexpr auto A = swar_pack('A').value;
71+
constexpr auto abc = swar_pack('a', 'b', 'c').value;
72+
constexpr auto aBc = swar_pack('a', 'B', 'c').value;
7373

7474
CHECK(swar_find_difference<char>(a, a) == 8);
7575
CHECK(swar_find_difference<char>(a, A) == 0);
@@ -89,9 +89,7 @@ TEST_CASE("swar_has_zero")
8989
constexpr auto all_high = swar_fill(char(0xAB));
9090
CHECK(!swar_has_zero<char>(all_high));
9191

92-
constexpr auto contains_zero = swar_pack(char('a'), char('b'), char('c'), char(0),
93-
char('d'), char('e'), char('f'), char('g'))
94-
.value;
92+
constexpr auto contains_zero = swar_pack('a', 'b', 'c', char(0), 'd', 'e', 'f', 'g').value;
9593
CHECK(swar_has_zero<char>(contains_zero));
9694
}
9795
SUBCASE("char32_t")
@@ -123,9 +121,7 @@ TEST_CASE("swar_has_char")
123121
constexpr auto all_high = swar_fill(char(0xAB));
124122
CHECK(!swar_has_char<char, 1>(all_high));
125123

126-
constexpr auto contains_one = swar_pack(char('a'), char('b'), char('c'), char(1), char('d'),
127-
char('e'), char('f'), char('g'))
128-
.value;
124+
constexpr auto contains_one = swar_pack('a', 'b', 'c', char(1), 'd', 'e', 'f', 'g').value;
129125
CHECK(swar_has_char<char, 1>(contains_one));
130126
}
131127
SUBCASE("char32_t")

tests/lexy/dsl/any.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ TEST_CASE("dsl::any")
1212

1313
constexpr auto callback = token_callback;
1414

15-
#if 0
1615
auto empty = LEXY_VERIFY("");
1716
CHECK(empty.status == test_result::success);
1817
CHECK(empty.trace == test_trace().token("any", ""));
@@ -32,7 +31,6 @@ TEST_CASE("dsl::any")
3231
auto swar_long = LEXY_VERIFY(lexy::utf8_char_encoding{}, "123456789012345678901234567890");
3332
CHECK(swar_long.status == test_result::success);
3433
CHECK(swar_long.trace == test_trace().token("any", "123456789012345678901234567890"));
35-
#endif
3634

3735
auto swar_unicode
3836
= LEXY_VERIFY(lexy::utf8_char_encoding{}, "123456789\u00E401234567890\u00E51234567890");

tests/lexy/dsl/integer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ TEST_CASE("dsl::code_unit_id")
934934
CHECK(lexy::is_branch_rule<decltype(id)>);
935935

936936
constexpr auto callback
937-
= lexy::callback<int>([](const char*) { return int(0); },
937+
= lexy::callback<int>([](const char*) { return 0; },
938938
[](const char*, LEXY_CHAR8_T c) { return int(c); });
939939

940940
SUBCASE("as rule")

0 commit comments

Comments
 (0)