srctree

Robin Linden parent f7e00327 58d545b5
meta/clang-tidy: Enable clang-analyzer-optin.core.EnumCastOutOfRange

inlinesplit
.clang-tidy added: 10, removed: 7, total 3
@@ -29,7 +29,6 @@
# haven't been doing so far.
#
# TODO(robinlinden): Look into and enable:
# * clang-analyzer-optin.core.EnumCastOutOfRange
# * performance-enum-size
Checks: >
bugprone-*,
@@ -66,7 +65,6 @@ Checks: >
-bugprone-narrowing-conversions,
-bugprone-unchecked-optional-access,
-cert-dcl21-cpp,
-clang-analyzer-optin.core.EnumCastOutOfRange,
-google-build-using-namespace,
-misc-const-correctness,
-misc-no-recursion,
 
azm/amd64/assembler_test.cpp added: 10, removed: 7, total 3
@@ -23,6 +23,7 @@ int main() {
a.expect_eq(register_index(Reg32::Ecx), 1);
a.expect_eq(register_index(Reg32::Edx), 2);
a.expect_eq(register_index(Reg32::Ebx), 3);
// NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
a.expect_eq(register_index(static_cast<Reg32>(std::underlying_type_t<Reg32>{30})), std::nullopt);
});
 
 
gfx/sfml_canvas.cpp added: 10, removed: 7, total 3
@@ -105,6 +105,7 @@ sf::Glsl::Vec4 to_vec4(Color const &color) {
}
 
sf::Text::Style to_sfml(FontStyle style) {
// NOLINTBEGIN(clang-analyzer-optin.core.EnumCastOutOfRange)
auto sf_style = sf::Text::Style::Regular;
if (style.bold) {
sf_style = static_cast<sf::Text::Style>(sf_style | sf::Text::Style::Bold);
@@ -123,6 +124,7 @@ sf::Text::Style to_sfml(FontStyle style) {
}
 
return sf_style;
// NOLINTEND(clang-analyzer-optin.core.EnumCastOutOfRange)
}
 
} // namespace
 
protocol/response_test.cpp added: 10, removed: 7, total 3
@@ -44,6 +44,7 @@ int main() {
expect_eq(to_string(Error::Unhandled), "Unhandled"sv);
expect_eq(to_string(Error::InvalidResponse), "InvalidResponse"sv);
expect_eq(to_string(Error::RedirectLimit), "RedirectLimit"sv);
// NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
expect_eq(to_string(static_cast<Error>(std::underlying_type_t<Error>{20})), "Unknown"sv);
});
 
 
wasm/byte_code_parser_test.cpp added: 10, removed: 7, total 3
@@ -78,6 +78,7 @@ void parse_error_to_string_tests() {
expect_eq(wasm::to_string(ModuleParseError::UnhandledSection), "Unhandled section");
 
auto last_error_value = static_cast<int>(ModuleParseError::UnhandledSection);
// NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
expect_eq(wasm::to_string(static_cast<ModuleParseError>(last_error_value + 1)), "Unknown error");
});
}