1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

Libraries: Fix -Wunreachable-code warnings from clang

This commit is contained in:
Nico Weber 2021-10-08 08:34:12 -04:00 committed by Andreas Kling
parent 96666f3209
commit b8dc3661ac
10 changed files with 7 additions and 27 deletions

View file

@ -111,8 +111,6 @@ bool IODevice::can_read_line() const
if (m_buffered_data.contains_in_range('\n', previous_buffer_size, new_buffer_size - 1))
return true;
}
return true;
}
bool IODevice::can_read() const

View file

@ -43,7 +43,6 @@ static constexpr float wrap(float value, GLint mode)
case GL_MIRRORED_REPEAT:
return wrap_mirrored_repeat(value);
break;
default:
VERIFY_NOT_REACHED();

View file

@ -865,8 +865,6 @@ bool RemoveTextCommand::merge_with(GUI::Command const& other)
m_text = builder.to_string();
m_range.set_start(typed_other.m_range.start());
return true;
return false;
}
void RemoveTextCommand::redo()

View file

@ -784,7 +784,8 @@ static bool decode_dds(DDSLoadingContext& context)
return false;
}
for (size_t mipmap_level = 0; mipmap_level < max(context.header.mip_map_count, 1u); mipmap_level++) {
// We support parsing mipmaps, but we only care about the largest one :^) (At least for now)
if (size_t mipmap_level = 0; mipmap_level < max(context.header.mip_map_count, 1u)) {
u64 width = get_width(context.header, mipmap_level);
u64 height = get_height(context.header, mipmap_level);
@ -795,9 +796,6 @@ static bool decode_dds(DDSLoadingContext& context)
context.bitmap = Bitmap::try_create(BitmapFormat::BGRA8888, { width, height });
decode_bitmap(stream, context, format, width, height);
// We support parsing mipmaps, but we only care about the largest one :^) (At least for now)
break;
}
context.state = DDSLoadingContext::State::BitmapDecoded;

View file

@ -847,8 +847,6 @@ Token Lexer::force_slash_as_regex()
TokenType Lexer::consume_regex_literal()
{
TokenType token_type = TokenType::RegexLiteral;
while (!is_eof()) {
if (is_line_terminator() || (!m_regex_is_in_character_class && m_current_char == '/')) {
break;
@ -868,10 +866,9 @@ TokenType Lexer::consume_regex_literal()
if (m_current_char == '/') {
consume();
return TokenType::RegexLiteral;
} else {
return TokenType::UnterminatedRegexLiteral;
}
return token_type;
return TokenType::UnterminatedRegexLiteral;
}
}

View file

@ -986,7 +986,7 @@ void Editor::handle_read_event()
dbgln("LibLine: Unhandled final: {:02x} ({:c})", code_point, code_point);
continue;
}
break;
VERIFY_NOT_REACHED();
}
case InputState::Verbatim:
m_state = InputState::Free;

View file

@ -163,7 +163,6 @@ bool Database::update(Row& tuple)
return m_serializer.serialize_and_write<Tuple>(tuple, tuple.pointer());
// TODO update indexes defined on table.
return true;
}
}

View file

@ -1881,10 +1881,8 @@ Optional<float> Parser::try_parse_float(StringView string)
continue;
}
if (str[i] < '0' || str[i] > '9' || exp_val != 0) {
if (str[i] < '0' || str[i] > '9' || exp_val != 0)
return {};
continue;
}
if (is_fractional) {
fraction *= 10;

View file

@ -30,27 +30,20 @@ static bool matches_attribute(CSS::Selector::SimpleSelector::Attribute const& at
switch (attribute.match_type) {
case CSS::Selector::SimpleSelector::Attribute::MatchType::HasAttribute:
return element.has_attribute(attribute.name);
break;
case CSS::Selector::SimpleSelector::Attribute::MatchType::ExactValueMatch:
return element.attribute(attribute.name) == attribute.value;
break;
case CSS::Selector::SimpleSelector::Attribute::MatchType::ContainsWord:
return element.attribute(attribute.name).split_view(' ').contains_slow(attribute.value);
break;
case CSS::Selector::SimpleSelector::Attribute::MatchType::ContainsString:
return element.attribute(attribute.name).contains(attribute.value);
break;
case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithSegment: {
auto segments = element.attribute(attribute.name).split_view('-');
return !segments.is_empty() && segments.first() == attribute.value;
break;
}
case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithString:
return element.attribute(attribute.name).starts_with(attribute.value);
break;
case CSS::Selector::SimpleSelector::Attribute::MatchType::EndsWithString:
return element.attribute(attribute.name).ends_with(attribute.value);
break;
case CSS::Selector::SimpleSelector::Attribute::MatchType::None:
VERIFY_NOT_REACHED();
break;

View file

@ -61,7 +61,7 @@ void TextNode::paint_text_decoration(Gfx::Painter& painter, LineBoxFragment cons
line_start_point = fragment_box.top_left().translated(0, baseline - x_height / 2);
line_end_point = fragment_box.top_right().translated(0, baseline - x_height / 2);
break;
} break;
}
case CSS::TextDecorationLine::Blink:
// Conforming user agents may simply not blink the text
return;