diff options
Diffstat (limited to 'Userland')
524 files changed, 2057 insertions, 2057 deletions
diff --git a/Userland/Applications/Browser/DownloadWidget.cpp b/Userland/Applications/Browser/DownloadWidget.cpp index 85482f4a23..3f4acbd57c 100644 --- a/Userland/Applications/Browser/DownloadWidget.cpp +++ b/Userland/Applications/Browser/DownloadWidget.cpp @@ -57,7 +57,7 @@ DownloadWidget::DownloadWidget(const URL& url) m_elapsed_timer.start(); m_download = Web::ResourceLoader::the().protocol_client().start_download("GET", url.to_string()); - ASSERT(m_download); + VERIFY(m_download); m_download->on_progress = [this](Optional<u32> total_size, u32 downloaded_size) { did_progress(total_size.value(), downloaded_size); }; @@ -109,7 +109,7 @@ DownloadWidget::DownloadWidget(const URL& url) m_cancel_button->set_fixed_size(100, 22); m_cancel_button->on_click = [this](auto) { bool success = m_download->stop(); - ASSERT(success); + VERIFY(success); window()->close(); }; diff --git a/Userland/Applications/Browser/History.cpp b/Userland/Applications/Browser/History.cpp index cecf28477c..9bc6608736 100644 --- a/Userland/Applications/Browser/History.cpp +++ b/Userland/Applications/Browser/History.cpp @@ -54,13 +54,13 @@ URL History::current() const void History::go_back() { - ASSERT(can_go_back()); + VERIFY(can_go_back()); m_current--; } void History::go_forward() { - ASSERT(can_go_forward()); + VERIFY(can_go_forward()); m_current++; } diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index 984882d2d9..e150fe38bf 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -318,7 +318,7 @@ Tab::Tab(Type type) auto view_source_action = GUI::Action::create( "View source", { Mod_Ctrl, Key_U }, [this](auto&) { if (m_type == Type::InProcessWebView) { - ASSERT(m_page_view->document()); + VERIFY(m_page_view->document()); auto url = m_page_view->document()->url().to_string(); auto source = m_page_view->document()->source(); view_source(url, source); diff --git a/Userland/Applications/Browser/WindowActions.cpp b/Userland/Applications/Browser/WindowActions.cpp index ca0b12bd84..35eb205c1c 100644 --- a/Userland/Applications/Browser/WindowActions.cpp +++ b/Userland/Applications/Browser/WindowActions.cpp @@ -35,13 +35,13 @@ static WindowActions* s_the; WindowActions& WindowActions::the() { - ASSERT(s_the); + VERIFY(s_the); return *s_the; } WindowActions::WindowActions(GUI::Window& window) { - ASSERT(!s_the); + VERIFY(!s_the); s_the = this; m_create_new_tab_action = GUI::Action::create( "New tab", { Mod_Ctrl, Key_T }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new-tab.png"), [this](auto&) { diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp index c79eeefad9..0440597cae 100644 --- a/Userland/Applications/Browser/main.cpp +++ b/Userland/Applications/Browser/main.cpp @@ -158,7 +158,7 @@ int main(int argc, char** argv) auto& tab_widget = *widget.find_descendant_of_type_named<GUI::TabWidget>("tab_widget"); auto default_favicon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-html.png"); - ASSERT(default_favicon); + VERIFY(default_favicon); tab_widget.on_change = [&](auto& active_widget) { auto& tab = static_cast<Browser::Tab&>(active_widget); diff --git a/Userland/Applications/Calculator/Calculator.cpp b/Userland/Applications/Calculator/Calculator.cpp index c324fb84b9..89e29e2b01 100644 --- a/Userland/Applications/Calculator/Calculator.cpp +++ b/Userland/Applications/Calculator/Calculator.cpp @@ -42,7 +42,7 @@ double Calculator::begin_operation(Operation operation, double argument) switch (operation) { case Operation::None: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case Operation::Add: case Operation::Subtract: @@ -128,7 +128,7 @@ double Calculator::finish_operation(double argument) case Operation::MemRecall: case Operation::MemSave: case Operation::MemAdd: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } clear_operation(); diff --git a/Userland/Applications/Calculator/Keypad.cpp b/Userland/Applications/Calculator/Keypad.cpp index 582c6fc14f..559981e03b 100644 --- a/Userland/Applications/Calculator/Keypad.cpp +++ b/Userland/Applications/Calculator/Keypad.cpp @@ -47,8 +47,8 @@ void Keypad::type_digit(int digit) m_frac_length = 0; break; case State::TypingInteger: - ASSERT(m_frac_value == 0); - ASSERT(m_frac_length == 0); + VERIFY(m_frac_value == 0); + VERIFY(m_frac_length == 0); m_int_value *= 10; m_int_value += digit; break; @@ -72,8 +72,8 @@ void Keypad::type_decimal_point() m_frac_length = 0; break; case State::TypingInteger: - ASSERT(m_frac_value == 0); - ASSERT(m_frac_length == 0); + VERIFY(m_frac_value == 0); + VERIFY(m_frac_length == 0); m_state = State::TypingDecimal; break; case State::TypingDecimal: @@ -97,12 +97,12 @@ void Keypad::type_backspace() m_frac_length--; break; } - ASSERT(m_frac_value == 0); + VERIFY(m_frac_value == 0); m_state = State::TypingInteger; [[fallthrough]]; case State::TypingInteger: - ASSERT(m_frac_value == 0); - ASSERT(m_frac_length == 0); + VERIFY(m_frac_value == 0); + VERIFY(m_frac_length == 0); m_int_value /= 10; if (m_int_value == 0) m_negative = false; diff --git a/Userland/Applications/Calendar/AddEventDialog.cpp b/Userland/Applications/Calendar/AddEventDialog.cpp index dbb70d33c1..84937840b3 100644 --- a/Userland/Applications/Calendar/AddEventDialog.cpp +++ b/Userland/Applications/Calendar/AddEventDialog.cpp @@ -135,7 +135,7 @@ String AddEventDialog::MonthListModel::column_name(int column) const case Column::Month: return "Month"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -147,7 +147,7 @@ GUI::Variant AddEventDialog::MonthListModel::data(const GUI::ModelIndex& index, case Column::Month: return month; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } return {}; diff --git a/Userland/Applications/Debugger/main.cpp b/Userland/Applications/Debugger/main.cpp index 145f71a995..aab45b43e8 100644 --- a/Userland/Applications/Debugger/main.cpp +++ b/Userland/Applications/Debugger/main.cpp @@ -227,7 +227,7 @@ int main(int argc, char** argv) return Debug::DebugSession::DebugDecision::Detach; } - ASSERT(optional_regs.has_value()); + VERIFY(optional_regs.has_value()); const PtraceRegisters& regs = optional_regs.value(); auto symbol_at_ip = g_debug_session->symbolicate(regs.eip); diff --git a/Userland/Applications/DisplaySettings/MonitorWidget.cpp b/Userland/Applications/DisplaySettings/MonitorWidget.cpp index f553fc49b6..db60aa3233 100644 --- a/Userland/Applications/DisplaySettings/MonitorWidget.cpp +++ b/Userland/Applications/DisplaySettings/MonitorWidget.cpp @@ -100,7 +100,7 @@ void MonitorWidget::paint_event(GUI::PaintEvent& event) } else if (m_desktop_wallpaper_mode == "stretch") { screen_painter.draw_scaled_bitmap(screen_bitmap->rect(), *m_desktop_wallpaper_bitmap, m_desktop_wallpaper_bitmap->rect()); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp index 2dbcd68b54..39cc184f6c 100644 --- a/Userland/Applications/FileManager/DirectoryView.cpp +++ b/Userland/Applications/FileManager/DirectoryView.cpp @@ -333,7 +333,7 @@ void DirectoryView::set_view_mode(ViewMode mode) set_active_widget(m_icon_view); return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void DirectoryView::add_path_to_history(const StringView& path) @@ -479,7 +479,7 @@ Vector<String> DirectoryView::selected_file_paths() const void DirectoryView::do_delete(bool should_confirm) { auto paths = selected_file_paths(); - ASSERT(!paths.is_empty()); + VERIFY(!paths.is_empty()); FileUtils::delete_paths(paths, should_confirm, window()); } @@ -531,7 +531,7 @@ void DirectoryView::setup_actions() return; } rc = close(fd); - ASSERT(rc >= 0); + VERIFY(rc >= 0); } }); diff --git a/Userland/Applications/FileManager/DirectoryView.h b/Userland/Applications/FileManager/DirectoryView.h index a72b63aaf5..b4121e01e4 100644 --- a/Userland/Applications/FileManager/DirectoryView.h +++ b/Userland/Applications/FileManager/DirectoryView.h @@ -107,7 +107,7 @@ public: case ViewMode::Icon: return *m_icon_view; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp index 04603268c4..53c86f425e 100644 --- a/Userland/Applications/FileManager/PropertiesWindow.cpp +++ b/Userland/Applications/FileManager/PropertiesWindow.cpp @@ -47,7 +47,7 @@ PropertiesWindow::PropertiesWindow(const String& path, bool disable_rename, Wind : Window(parent_window) { auto lexical_path = LexicalPath(path); - ASSERT(lexical_path.is_valid()); + VERIFY(lexical_path.is_valid()); auto& main_widget = set_main_widget<GUI::Widget>(); main_widget.set_layout<GUI::VerticalBoxLayout>(); @@ -122,7 +122,7 @@ PropertiesWindow::PropertiesWindow(const String& path, bool disable_rename, Wind perror("readlink"); } else { auto link_directory = LexicalPath(link_destination); - ASSERT(link_directory.is_valid()); + VERIFY(link_directory.is_valid()); auto link_parent = URL::create_with_file_protocol(link_directory.dirname()); properties.append({ "Link target:", link_destination, Optional(link_parent) }); } diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp index 568ef53f94..a9a1200794 100644 --- a/Userland/Applications/FileManager/main.cpp +++ b/Userland/Applications/FileManager/main.cpp @@ -130,7 +130,7 @@ int main(int argc, char** argv) void do_copy(const Vector<String>& selected_file_paths, FileUtils::FileOperation file_operation) { if (selected_file_paths.is_empty()) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); StringBuilder copy_text; if (file_operation == FileUtils::FileOperation::Cut) { @@ -227,7 +227,7 @@ int run_in_desktop_mode([[maybe_unused]] RefPtr<Core::ConfigFile> config) auto paths = directory_view.selected_file_paths(); if (paths.is_empty()) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); do_copy(paths, FileUtils::FileOperation::Copy); }, @@ -239,7 +239,7 @@ int run_in_desktop_mode([[maybe_unused]] RefPtr<Core::ConfigFile> config) auto paths = directory_view.selected_file_paths(); if (paths.is_empty()) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); do_copy(paths, FileUtils::FileOperation::Cut); }, @@ -539,7 +539,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio paths = tree_view_selected_file_paths(); if (paths.is_empty()) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); do_copy(paths, FileUtils::FileOperation::Copy); refresh_tree_view(); @@ -555,7 +555,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio paths = tree_view_selected_file_paths(); if (paths.is_empty()) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); do_copy(paths, FileUtils::FileOperation::Cut); refresh_tree_view(); diff --git a/Userland/Applications/Help/History.cpp b/Userland/Applications/Help/History.cpp index bb4c822dcb..beb26beac3 100644 --- a/Userland/Applications/Help/History.cpp +++ b/Userland/Applications/Help/History.cpp @@ -42,13 +42,13 @@ String History::current() void History::go_back() { - ASSERT(can_go_back()); + VERIFY(can_go_back()); m_current_history_item--; } void History::go_forward() { - ASSERT(can_go_forward()); + VERIFY(can_go_forward()); m_current_history_item++; } diff --git a/Userland/Applications/Help/ManualModel.cpp b/Userland/Applications/Help/ManualModel.cpp index 18e22979b1..8d5ca7eb7c 100644 --- a/Userland/Applications/Help/ManualModel.cpp +++ b/Userland/Applications/Help/ManualModel.cpp @@ -134,14 +134,14 @@ GUI::ModelIndex ManualModel::parent_index(const GUI::ModelIndex& index) const for (size_t row = 0; row < sizeof(s_sections) / sizeof(s_sections[0]); row++) if (&s_sections[row] == parent) return create_index(row, 0, parent); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } for (size_t row = 0; row < parent->parent()->children().size(); row++) { ManualNode* child_at_row = &parent->parent()->children()[row]; if (child_at_row == parent) return create_index(row, 0, parent); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int ManualModel::row_count(const GUI::ModelIndex& index) const diff --git a/Userland/Applications/Help/main.cpp b/Userland/Applications/Help/main.cpp index f6bf6adc75..02089b1d59 100644 --- a/Userland/Applications/Help/main.cpp +++ b/Userland/Applications/Help/main.cpp @@ -167,7 +167,7 @@ int main(int argc, char* argv[]) String html; { auto md_document = Markdown::Document::parse(source); - ASSERT(md_document); + VERIFY(md_document); html = md_document->render_to_html(); } diff --git a/Userland/Applications/HexEditor/FindDialog.cpp b/Userland/Applications/HexEditor/FindDialog.cpp index 5c52f5738b..b24cc02660 100644 --- a/Userland/Applications/HexEditor/FindDialog.cpp +++ b/Userland/Applications/HexEditor/FindDialog.cpp @@ -101,7 +101,7 @@ Result<ByteBuffer, String> FindDialog::process_input(String text_value, OptionId } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Applications/HexEditor/HexEditor.cpp b/Userland/Applications/HexEditor/HexEditor.cpp index a4652866c1..392ddb2d4b 100644 --- a/Userland/Applications/HexEditor/HexEditor.cpp +++ b/Userland/Applications/HexEditor/HexEditor.cpp @@ -418,8 +418,8 @@ void HexEditor::hex_mode_keydown_event(GUI::KeyEvent& event) if ((event.key() >= KeyCode::Key_0 && event.key() <= KeyCode::Key_9) || (event.key() >= KeyCode::Key_A && event.key() <= KeyCode::Key_F)) { if (m_buffer.is_empty()) return; - ASSERT(m_position >= 0); - ASSERT(m_position < static_cast<int>(m_buffer.size())); + VERIFY(m_position >= 0); + VERIFY(m_position < static_cast<int>(m_buffer.size())); // yes, this is terrible... but it works. auto value = (event.key() >= KeyCode::Key_0 && event.key() <= KeyCode::Key_9) @@ -447,8 +447,8 @@ void HexEditor::text_mode_keydown_event(GUI::KeyEvent& event) { if (m_buffer.is_empty()) return; - ASSERT(m_position >= 0); - ASSERT(m_position < static_cast<int>(m_buffer.size())); + VERIFY(m_position >= 0); + VERIFY(m_position < static_cast<int>(m_buffer.size())); if (event.code_point() == 0) // This is a control key return; diff --git a/Userland/Applications/IRCClient/IRCAppWindow.cpp b/Userland/Applications/IRCClient/IRCAppWindow.cpp index 726bba39b4..4e9706da15 100644 --- a/Userland/Applications/IRCClient/IRCAppWindow.cpp +++ b/Userland/Applications/IRCClient/IRCAppWindow.cpp @@ -50,7 +50,7 @@ IRCAppWindow& IRCAppWindow::the() IRCAppWindow::IRCAppWindow(String server, int port) : m_client(IRCClient::construct(server, port)) { - ASSERT(!s_the); + VERIFY(!s_the); s_the = this; set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-irc-client.png")); @@ -100,7 +100,7 @@ void IRCAppWindow::setup_client() } update_title(); bool success = m_client->connect(); - ASSERT(success); + VERIFY(success); } void IRCAppWindow::setup_actions() diff --git a/Userland/Applications/IRCClient/IRCChannelMemberListModel.cpp b/Userland/Applications/IRCClient/IRCChannelMemberListModel.cpp index 22cdcd710f..d39a952681 100644 --- a/Userland/Applications/IRCClient/IRCChannelMemberListModel.cpp +++ b/Userland/Applications/IRCClient/IRCChannelMemberListModel.cpp @@ -54,7 +54,7 @@ String IRCChannelMemberListModel::column_name(int column) const case Column::Name: return "Name"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } GUI::Variant IRCChannelMemberListModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const diff --git a/Userland/Applications/IRCClient/IRCClient.cpp b/Userland/Applications/IRCClient/IRCClient.cpp index ef8338b9a1..2eb7c03705 100644 --- a/Userland/Applications/IRCClient/IRCClient.cpp +++ b/Userland/Applications/IRCClient/IRCClient.cpp @@ -116,7 +116,7 @@ void IRCClient::on_socket_connected() bool IRCClient::connect() { if (m_socket->is_connected()) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); m_socket->on_connected = [this] { on_socket_connected(); }; @@ -132,7 +132,7 @@ void IRCClient::receive_from_server() outln("IRCClient: Connection closed!"); exit(1); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } process_line(line); } diff --git a/Userland/Applications/IRCClient/IRCClient.h b/Userland/Applications/IRCClient/IRCClient.h index 06f7e59289..f009743323 100644 --- a/Userland/Applications/IRCClient/IRCClient.h +++ b/Userland/Applications/IRCClient/IRCClient.h @@ -102,7 +102,7 @@ public: if (m_windows[i] == &window) return i; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void did_part_from_channel(Badge<IRCChannel>, IRCChannel&); diff --git a/Userland/Applications/IRCClient/IRCWindowListModel.cpp b/Userland/Applications/IRCClient/IRCWindowListModel.cpp index 7ee68c429e..11cd37eee9 100644 --- a/Userland/Applications/IRCClient/IRCWindowListModel.cpp +++ b/Userland/Applications/IRCClient/IRCWindowListModel.cpp @@ -53,7 +53,7 @@ String IRCWindowListModel::column_name(int column) const case Column::Name: return "Name"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } GUI::Variant IRCWindowListModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp index 180b2a4837..e3ef6cd259 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp @@ -69,10 +69,10 @@ void KeyboardMapperWidget::create_frame() String value; if (GUI::InputBox::show(window(), value, "New Character:", "Select Character") == GUI::InputBox::ExecOK) { int i = m_keys.find_first_index(&tmp_button).value_or(0); - ASSERT(i > 0); + VERIFY(i > 0); auto index = keys[i].map_index; - ASSERT(index > 0); + VERIFY(index > 0); tmp_button.set_text(value); u32* map; @@ -88,7 +88,7 @@ void KeyboardMapperWidget::create_frame() } else if (m_current_map_name == "shift_altgr_map") { map = m_character_map.shift_altgr_map; } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (value.length() == 0) @@ -146,7 +146,7 @@ void KeyboardMapperWidget::create_frame() void KeyboardMapperWidget::load_from_file(String file_name) { auto result = Keyboard::CharacterMapFile::load_from_file(file_name); - ASSERT(result.has_value()); + VERIFY(result.has_value()); m_file_name = file_name; m_character_map = result.value(); @@ -163,7 +163,7 @@ void KeyboardMapperWidget::load_from_file(String file_name) void KeyboardMapperWidget::load_from_system() { auto result = Keyboard::CharacterMap::fetch_system_map(); - ASSERT(!result.is_error()); + VERIFY(!result.is_error()); m_file_name = String::formatted("/res/keymaps/{}.json", result.value().character_map_name()); m_character_map = result.value().character_map_data(); @@ -274,7 +274,7 @@ void KeyboardMapperWidget::set_current_map(const String current_map) } else if (m_current_map_name == "shift_altgr_map") { map = m_character_map.shift_altgr_map; } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } for (unsigned k = 0; k < KEY_COUNT; k++) { diff --git a/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h b/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h index 4fcd1d8123..5c5c6cb8b1 100644 --- a/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h +++ b/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h @@ -50,8 +50,8 @@ public: virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override { - ASSERT(index.is_valid()); - ASSERT(index.column() == 0); + VERIFY(index.is_valid()); + VERIFY(index.column() == 0); if (role == GUI::ModelRole::Display) return m_file_names.at(index.row()); diff --git a/Userland/Applications/KeyboardSettings/main.cpp b/Userland/Applications/KeyboardSettings/main.cpp index fd372cf433..cc099d598a 100644 --- a/Userland/Applications/KeyboardSettings/main.cpp +++ b/Userland/Applications/KeyboardSettings/main.cpp @@ -82,12 +82,12 @@ int main(int argc, char** argv) auto proc_keymap = Core::File::construct("/proc/keymap"); if (!proc_keymap->open(Core::IODevice::OpenMode::ReadOnly)) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); auto json = JsonValue::from_string(proc_keymap->read_all()); - ASSERT(json.has_value()); + VERIFY(json.has_value()); JsonObject keymap_object = json.value().as_object(); - ASSERT(keymap_object.has("keymap")); + VERIFY(keymap_object.has("keymap")); String current_keymap = keymap_object.get("keymap").to_string(); dbgln("KeyboardSettings thinks the current keymap is: {}", current_keymap); @@ -110,7 +110,7 @@ int main(int argc, char** argv) if (character_map_files[i].equals_ignoring_case(current_keymap)) initial_keymap_index = i; } - ASSERT(initial_keymap_index < character_map_files.size()); + VERIFY(initial_keymap_index < character_map_files.size()); auto window = GUI::Window::construct(); window->set_title("Keyboard Settings"); diff --git a/Userland/Applications/Piano/KeysWidget.cpp b/Userland/Applications/Piano/KeysWidget.cpp index 65fcdc39b5..4d5079c276 100644 --- a/Userland/Applications/Piano/KeysWidget.cpp +++ b/Userland/Applications/Piano/KeysWidget.cpp @@ -58,7 +58,7 @@ void KeysWidget::set_key(int key, Switch switch_key) if (m_key_on[key] >= 1) --m_key_on[key]; } - ASSERT(m_key_on[key] <= 2); + VERIFY(m_key_on[key] <= 2); m_track_manager.set_note_current_octave(key, switch_key); } diff --git a/Userland/Applications/Piano/KnobsWidget.cpp b/Userland/Applications/Piano/KnobsWidget.cpp index 4b9e4360c2..1989247293 100644 --- a/Userland/Applications/Piano/KnobsWidget.cpp +++ b/Userland/Applications/Piano/KnobsWidget.cpp @@ -82,7 +82,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget) int new_octave = octave_max - value; if (m_change_underlying) m_main_widget.set_octave_and_ensure_note_change(new_octave); - ASSERT(new_octave == m_track_manager.octave()); + VERIFY(new_octave == m_track_manager.octave()); m_octave_value->set_text(String::number(new_octave)); }; @@ -94,7 +94,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget) int new_wave = last_wave - value; if (m_change_underlying) m_track_manager.current_track().set_wave(new_wave); - ASSERT(new_wave == m_track_manager.current_track().wave()); + VERIFY(new_wave == m_track_manager.current_track().wave()); m_wave_value->set_text(wave_strings[new_wave]); }; @@ -106,7 +106,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget) int new_attack = max_attack - value; if (m_change_underlying) m_track_manager.current_track().set_attack(new_attack); - ASSERT(new_attack == m_track_manager.current_track().attack()); + VERIFY(new_attack == m_track_manager.current_track().attack()); m_attack_value->set_text(String::number(new_attack)); }; @@ -118,7 +118,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget) int new_decay = max_decay - value; if (m_change_underlying) m_track_manager.current_track().set_decay(new_decay); - ASSERT(new_decay == m_track_manager.current_track().decay()); + VERIFY(new_decay == m_track_manager.current_track().decay()); m_decay_value->set_text(String::number(new_decay)); }; @@ -130,7 +130,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget) int new_sustain = max_sustain - value; if (m_change_underlying) m_track_manager.current_track().set_sustain(new_sustain); - ASSERT(new_sustain == m_track_manager.current_track().sustain()); + VERIFY(new_sustain == m_track_manager.current_track().sustain()); m_sustain_value->set_text(String::number(new_sustain)); }; @@ -142,7 +142,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget) int new_release = max_release - value; if (m_change_underlying) m_track_manager.current_track().set_release(new_release); - ASSERT(new_release == m_track_manager.current_track().release()); + VERIFY(new_release == m_track_manager.current_track().release()); m_release_value->set_text(String::number(new_release)); }; @@ -153,7 +153,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget) int new_delay = max_delay - value; if (m_change_underlying) m_track_manager.current_track().set_delay(new_delay); - ASSERT(new_delay == m_track_manager.current_track().delay()); + VERIFY(new_delay == m_track_manager.current_track().delay()); m_delay_value->set_text(String::number(new_delay)); }; } diff --git a/Userland/Applications/Piano/Track.cpp b/Userland/Applications/Piano/Track.cpp index 61d4351d06..b560889339 100644 --- a/Userland/Applications/Piano/Track.cpp +++ b/Userland/Applications/Piano/Track.cpp @@ -83,7 +83,7 @@ void Track::fill_sample(Sample& sample) } break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Audio::Sample note_sample; @@ -107,7 +107,7 @@ void Track::fill_sample(Sample& sample) note_sample = recorded_sample(note); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } new_sample.left += note_sample.left * m_power[note] * volume; new_sample.right += note_sample.right * m_power[note] * volume; @@ -242,7 +242,7 @@ static inline double calculate_step(double distance, int milliseconds) void Track::set_note(int note, Switch switch_note) { - ASSERT(note >= 0 && note < note_count); + VERIFY(note >= 0 && note < note_count); if (switch_note == On) { if (m_note_on[note] == 0) { @@ -260,8 +260,8 @@ void Track::set_note(int note, Switch switch_note) } } - ASSERT(m_note_on[note] != NumericLimits<u8>::max()); - ASSERT(m_power[note] >= 0); + VERIFY(m_note_on[note] != NumericLimits<u8>::max()); + VERIFY(m_power[note] >= 0); } void Track::sync_roll(int note) @@ -277,9 +277,9 @@ void Track::set_roll_note(int note, u32 on_sample, u32 off_sample) { RollNote new_roll_note = { on_sample, off_sample }; - ASSERT(note >= 0 && note < note_count); - ASSERT(new_roll_note.off_sample < roll_length); - ASSERT(new_roll_note.length() >= 2); + VERIFY(note >= 0 && note < note_count); + VERIFY(new_roll_note.off_sample < roll_length); + VERIFY(new_roll_note.length() >= 2); for (auto it = m_roll_notes[note].begin(); !it.is_end();) { if (it->on_sample > new_roll_note.off_sample) { @@ -310,7 +310,7 @@ void Track::set_roll_note(int note, u32 on_sample, u32 off_sample) void Track::set_wave(int wave) { - ASSERT(wave >= first_wave && wave <= last_wave); + VERIFY(wave >= first_wave && wave <= last_wave); m_wave = wave; } @@ -327,21 +327,21 @@ void Track::set_wave(Direction direction) void Track::set_attack(int attack) { - ASSERT(attack >= 0); + VERIFY(attack >= 0); m_attack = attack; m_attack_step = calculate_step(1, m_attack); } void Track::set_decay(int decay) { - ASSERT(decay >= 0); + VERIFY(decay >= 0); m_decay = decay; m_decay_step = calculate_step(1 - m_sustain_level, m_decay); } void Track::set_sustain_impl(int sustain) { - ASSERT(sustain >= 0); + VERIFY(sustain >= 0); m_sustain = sustain; m_sustain_level = sustain / 1000.0; } @@ -354,13 +354,13 @@ void Track::set_sustain(int sustain) void Track::set_release(int release) { - ASSERT(release >= 0); + VERIFY(release >= 0); m_release = release; } void Track::set_delay(int delay) { - ASSERT(delay >= 0); + VERIFY(delay >= 0); m_delay = delay; m_delay_samples = m_delay == 0 ? 0 : (sample_rate / (beats_per_minute / 60)) / m_delay; m_delay_buffer.resize(m_delay_samples); diff --git a/Userland/Applications/PixelPaint/BucketTool.cpp b/Userland/Applications/PixelPaint/BucketTool.cpp index 6cffddac20..da788f3c8c 100644 --- a/Userland/Applications/PixelPaint/BucketTool.cpp +++ b/Userland/Applications/PixelPaint/BucketTool.cpp @@ -55,7 +55,7 @@ static float color_distance_squared(const Gfx::Color& lhs, const Gfx::Color& rhs static void flood_fill(Gfx::Bitmap& bitmap, const Gfx::IntPoint& start_position, Color target_color, Color fill_color, int threshold) { - ASSERT(bitmap.bpp() == 32); + VERIFY(bitmap.bpp() == 32); if (target_color == fill_color) return; diff --git a/Userland/Applications/PixelPaint/EllipseTool.cpp b/Userland/Applications/PixelPaint/EllipseTool.cpp index 0501e2fb96..ec7a5f54d4 100644 --- a/Userland/Applications/PixelPaint/EllipseTool.cpp +++ b/Userland/Applications/PixelPaint/EllipseTool.cpp @@ -50,7 +50,7 @@ void EllipseTool::draw_using(GUI::Painter& painter, const Gfx::IntRect& ellipse_ painter.draw_ellipse_intersecting(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button), m_thickness); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Applications/PixelPaint/Image.cpp b/Userland/Applications/PixelPaint/Image.cpp index 78eebc2b2d..248ccc1bb0 100644 --- a/Userland/Applications/PixelPaint/Image.cpp +++ b/Userland/Applications/PixelPaint/Image.cpp @@ -168,7 +168,7 @@ void Image::export_png(const String& file_path) void Image::add_layer(NonnullRefPtr<Layer> layer) { for (auto& existing_layer : m_layers) { - ASSERT(&existing_layer != layer.ptr()); + VERIFY(&existing_layer != layer.ptr()); } m_layers.append(move(layer)); @@ -206,7 +206,7 @@ size_t Image::index_of(const Layer& layer) const if (&m_layers.at(i) == &layer) return i; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Image::move_layer_to_back(Layer& layer) @@ -255,8 +255,8 @@ void Image::move_layer_up(Layer& layer) void Image::change_layer_index(size_t old_index, size_t new_index) { - ASSERT(old_index < m_layers.size()); - ASSERT(new_index < m_layers.size()); + VERIFY(old_index < m_layers.size()); + VERIFY(new_index < m_layers.size()); auto layer = m_layers.take(old_index); m_layers.insert(new_index, move(layer)); did_modify_layer_stack(); @@ -290,13 +290,13 @@ void Image::select_layer(Layer* layer) void Image::add_client(ImageClient& client) { - ASSERT(!m_clients.contains(&client)); + VERIFY(!m_clients.contains(&client)); m_clients.set(&client); } void Image::remove_client(ImageClient& client) { - ASSERT(m_clients.contains(&client)); + VERIFY(m_clients.contains(&client)); m_clients.remove(&client); } diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index f29551c050..829210e39c 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -341,7 +341,7 @@ Color ImageEditor::color_for(GUI::MouseButton button) const return m_primary_color; if (button == GUI::MouseButton::Right) return m_secondary_color; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Color ImageEditor::color_for(const GUI::MouseEvent& event) const @@ -350,7 +350,7 @@ Color ImageEditor::color_for(const GUI::MouseEvent& event) const return m_primary_color; if (event.buttons() & GUI::MouseButton::Right) return m_secondary_color; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void ImageEditor::set_primary_color(Color color) diff --git a/Userland/Applications/PixelPaint/LayerListWidget.cpp b/Userland/Applications/PixelPaint/LayerListWidget.cpp index 756772bb87..e12ac673a7 100644 --- a/Userland/Applications/PixelPaint/LayerListWidget.cpp +++ b/Userland/Applications/PixelPaint/LayerListWidget.cpp @@ -161,7 +161,7 @@ void LayerListWidget::mousemove_event(GUI::MouseEvent& event) auto delta = event.position() - m_moving_event_origin; auto& gadget = m_gadgets[m_moving_gadget_index.value()]; - ASSERT(gadget.is_moving); + VERIFY(gadget.is_moving); gadget.movement_delta = delta; relayout_gadgets(); } @@ -221,7 +221,7 @@ static constexpr int vertical_step = gadget_height + gadget_spacing; size_t LayerListWidget::hole_index_during_move() const { - ASSERT(is_moving_gadget()); + VERIFY(is_moving_gadget()); auto& moving_gadget = m_gadgets[m_moving_gadget_index.value()]; int center_y_of_moving_gadget = moving_gadget.rect.translated(0, moving_gadget.movement_delta.y()).center().y(); return center_y_of_moving_gadget / vertical_step; diff --git a/Userland/Applications/PixelPaint/RectangleTool.cpp b/Userland/Applications/PixelPaint/RectangleTool.cpp index a5b023f18b..3ac941ba72 100644 --- a/Userland/Applications/PixelPaint/RectangleTool.cpp +++ b/Userland/Applications/PixelPaint/RectangleTool.cpp @@ -56,7 +56,7 @@ void RectangleTool::draw_using(GUI::Painter& painter, const Gfx::IntRect& rect) painter.fill_rect_with_gradient(rect, m_editor->primary_color(), m_editor->secondary_color()); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Applications/PixelPaint/SprayTool.cpp b/Userland/Applications/PixelPaint/SprayTool.cpp index 9997c29674..a5d0a176d8 100644 --- a/Userland/Applications/PixelPaint/SprayTool.cpp +++ b/Userland/Applications/PixelPaint/SprayTool.cpp @@ -66,7 +66,7 @@ void SprayTool::paint_it() auto& bitmap = layer->bitmap(); GUI::Painter painter(bitmap); - ASSERT(bitmap.bpp() == 32); + VERIFY(bitmap.bpp() == 32); m_editor->update(); const double minimal_radius = 2; const double base_radius = minimal_radius * m_thickness; diff --git a/Userland/Applications/PixelPaint/main.cpp b/Userland/Applications/PixelPaint/main.cpp index 0680b05583..e7c88d3849 100644 --- a/Userland/Applications/PixelPaint/main.cpp +++ b/Userland/Applications/PixelPaint/main.cpp @@ -201,7 +201,7 @@ int main(int argc, char** argv) auto& edit_menu = menubar->add_menu("Edit"); auto paste_action = GUI::CommonActions::make_paste_action([&](auto&) { - ASSERT(image_editor.image()); + VERIFY(image_editor.image()); auto bitmap = GUI::Clipboard::the().bitmap(); if (!bitmap) return; @@ -217,13 +217,13 @@ int main(int argc, char** argv) edit_menu.add_action(paste_action); auto undo_action = GUI::CommonActions::make_undo_action([&](auto&) { - ASSERT(image_editor.image()); + VERIFY(image_editor.image()); image_editor.undo(); }); edit_menu.add_action(undo_action); auto redo_action = GUI::CommonActions::make_redo_action([&](auto&) { - ASSERT(image_editor.image()); + VERIFY(image_editor.image()); image_editor.redo(); }); edit_menu.add_action(redo_action); diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp index 95644d00d6..fb1892656c 100644 --- a/Userland/Applications/SpaceAnalyzer/main.cpp +++ b/Userland/Applications/SpaceAnalyzer/main.cpp @@ -99,7 +99,7 @@ static void fill_mounts(Vector<MountInfo>& output) auto content = df->read_all(); auto json = JsonValue::from_string(content); - ASSERT(json.has_value()); + VERIFY(json.has_value()); json.value().as_array().for_each([&output](auto& value) { auto filesystem_object = value.as_object(); @@ -150,7 +150,7 @@ struct QueueEntry { static void populate_filesize_tree(TreeNode& root, Vector<MountInfo>& mounts, HashMap<int, int>& error_accumulator) { - ASSERT(!root.m_name.ends_with("/")); + VERIFY(!root.m_name.ends_with("/")); Queue<QueueEntry> queue; queue.enqueue(QueueEntry(root.m_name, &root)); @@ -247,7 +247,7 @@ static void analyze(RefPtr<Tree> tree, SpaceAnalyzer::TreeMapWidget& treemapwidg static bool is_removable(const String& absolute_path) { - ASSERT(!absolute_path.is_empty()); + VERIFY(!absolute_path.is_empty()); int access_result = access(absolute_path.characters(), W_OK); if (access_result != 0 && errno != EACCES) perror("access"); @@ -353,7 +353,7 @@ int main(int argc, char* argv[]) // Configure event handlers. breadcrumbbar.on_segment_click = [&](size_t index) { - ASSERT(index < treemapwidget.path_size()); + VERIFY(index < treemapwidget.path_size()); treemapwidget.set_viewpoint(index); }; treemapwidget.on_path_change = [&]() { diff --git a/Userland/Applications/Spreadsheet/Cell.cpp b/Userland/Applications/Spreadsheet/Cell.cpp index d2f511753f..25788ed580 100644 --- a/Userland/Applications/Spreadsheet/Cell.cpp +++ b/Userland/Applications/Spreadsheet/Cell.cpp @@ -73,7 +73,7 @@ void Cell::set_type(const StringView& name) return set_type(cell_type); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Cell::set_type_metadata(CellTypeMetadata&& metadata) diff --git a/Userland/Applications/Spreadsheet/CellType/Type.cpp b/Userland/Applications/Spreadsheet/CellType/Type.cpp index cd64e8f239..659f47929c 100644 --- a/Userland/Applications/Spreadsheet/CellType/Type.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Type.cpp @@ -56,7 +56,7 @@ Vector<StringView> CellType::names() CellType::CellType(const StringView& name) : m_name(name) { - ASSERT(!s_cell_types.contains(name)); + VERIFY(!s_cell_types.contains(name)); s_cell_types.set(name, this); } diff --git a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp index 68c801ebb4..8f1dcf8cb9 100644 --- a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp +++ b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp @@ -52,7 +52,7 @@ namespace Spreadsheet { CellTypeDialog::CellTypeDialog(const Vector<Position>& positions, Sheet& sheet, GUI::Window* parent) : GUI::Dialog(parent) { - ASSERT(!positions.is_empty()); + VERIFY(!positions.is_empty()); StringBuilder builder; @@ -239,7 +239,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po m_horizontal_alignment = HorizontalAlignment::Right; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }; } @@ -271,7 +271,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po m_vertical_alignment = VerticalAlignment::Bottom; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }; } @@ -444,7 +444,7 @@ ConditionsView::ConditionsView() void ConditionsView::set_formats(Vector<ConditionalFormat>* formats) { - ASSERT(!m_formats); + VERIFY(!m_formats); m_formats = formats; @@ -454,7 +454,7 @@ void ConditionsView::set_formats(Vector<ConditionalFormat>* formats) void ConditionsView::add_format() { - ASSERT(m_formats); + VERIFY(m_formats); m_formats->empend(); auto& last = m_formats->last(); @@ -466,7 +466,7 @@ void ConditionsView::add_format() void ConditionsView::remove_top() { - ASSERT(m_formats); + VERIFY(m_formats); if (m_formats->is_empty()) return; diff --git a/Userland/Applications/Spreadsheet/HelpWindow.cpp b/Userland/Applications/Spreadsheet/HelpWindow.cpp index eecd0bbb45..dcfb85b4c9 100644 --- a/Userland/Applications/Spreadsheet/HelpWindow.cpp +++ b/Userland/Applications/Spreadsheet/HelpWindow.cpp @@ -100,7 +100,7 @@ HelpWindow::HelpWindow(GUI::Window* parent) m_webview = splitter.add<Web::OutOfProcessWebView>(); m_webview->on_link_click = [this](auto& url, auto&, auto&&) { - ASSERT(url.protocol() == "spreadsheet"); + VERIFY(url.protocol() == "spreadsheet"); if (url.host() == "example") { auto entry = LexicalPath(url.path()).basename(); auto doc_option = m_docs.get(entry); @@ -159,19 +159,19 @@ HelpWindow::HelpWindow(GUI::Window* parent) String HelpWindow::render(const StringView& key) { auto doc_option = m_docs.get(key); - ASSERT(doc_option.is_object()); + VERIFY(doc_option.is_object()); auto& doc = doc_option.as_object(); auto name = doc.get("name").to_string(); auto argc = doc.get("argc").to_u32(0); auto argnames_value = doc.get("argnames"); - ASSERT(argnames_value.is_array()); + VERIFY(argnames_value.is_array()); auto& argnames = argnames_value.as_array(); auto docstring = doc.get("doc").to_string(); auto examples_value = doc.get_or("examples", JsonObject {}); - ASSERT(examples_value.is_object()); + VERIFY(examples_value.is_object()); auto& examples = examples_value.as_object(); StringBuilder markdown_builder; diff --git a/Userland/Applications/Spreadsheet/Readers/XSV.cpp b/Userland/Applications/Spreadsheet/Readers/XSV.cpp index 99a61b0abc..fca9742ace 100644 --- a/Userland/Applications/Spreadsheet/Readers/XSV.cpp +++ b/Userland/Applications/Spreadsheet/Readers/XSV.cpp @@ -243,9 +243,9 @@ XSV::Field XSV::read_one_unquoted_field() StringView XSV::Row::operator[](StringView name) const { - ASSERT(!m_xsv.m_names.is_empty()); + VERIFY(!m_xsv.m_names.is_empty()); auto it = m_xsv.m_names.find_if([&](const auto& entry) { return name == entry; }); - ASSERT(!it.is_end()); + VERIFY(!it.is_end()); return (*this)[it.index()]; } @@ -265,7 +265,7 @@ const XSV::Row XSV::operator[](size_t index) const XSV::Row XSV::operator[](size_t index) { - ASSERT(m_rows.size() > index); + VERIFY(m_rows.size() > index); return Row { *this, index }; } diff --git a/Userland/Applications/Spreadsheet/Readers/XSV.h b/Userland/Applications/Spreadsheet/Readers/XSV.h index 0b32ca767d..a3fab2edd3 100644 --- a/Userland/Applications/Spreadsheet/Readers/XSV.h +++ b/Userland/Applications/Spreadsheet/Readers/XSV.h @@ -98,7 +98,7 @@ public: ENUMERATE_READ_ERRORS(); #undef E } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } size_t size() const { return m_rows.size(); } diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp index 6a86c016bc..be17602955 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp +++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp @@ -103,7 +103,7 @@ static String convert_to_string(size_t value, unsigned base = 26, StringView map if (map.is_null()) map = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - ASSERT(base >= 2 && base <= map.length()); + VERIFY(base >= 2 && base <= map.length()); // The '8 bits per byte' assumption may need to go? Array<char, round_up_to_power_of_two(sizeof(size_t) * 8 + 1, 2)> buffer; @@ -130,7 +130,7 @@ static size_t convert_from_string(StringView str, unsigned base = 26, StringView if (map.is_null()) map = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - ASSERT(base >= 2 && base <= map.length()); + VERIFY(base >= 2 && base <= map.length()); size_t value = 0; for (size_t i = str.length(); i > 0; --i) { @@ -295,7 +295,7 @@ Optional<Position> Sheet::position_from_url(const URL& url) const } // FIXME: Figure out a way to do this cross-process. - ASSERT(url.path() == String::formatted("/{}", getpid())); + VERIFY(url.path() == String::formatted("/{}", getpid())); return parse_cell_name(url.fragment()); } diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.h b/Userland/Applications/Spreadsheet/Spreadsheet.h index bbef6c8116..66c87f6a45 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.h +++ b/Userland/Applications/Spreadsheet/Spreadsheet.h @@ -106,12 +106,12 @@ public: for (size_t i = column_count(); i < index; ++i) add_column(); - ASSERT(column_count() > index); + VERIFY(column_count() > index); return m_columns[index]; } const String& column(size_t index) const { - ASSERT(column_count() > index); + VERIFY(column_count() > index); return m_columns[index]; } diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp index 70193e4b63..1ea04f2f60 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp @@ -132,7 +132,7 @@ RefPtr<Core::MimeData> SheetModel::mime_data(const GUI::ModelSelection& selectio first = false; }); - ASSERT(cursor); + VERIFY(cursor); Position cursor_position { m_sheet->column(cursor->column()), (size_t)cursor->row() }; auto new_data = String::formatted("{}\n{}", diff --git a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp index 9762f77578..45dbf275a2 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp @@ -284,7 +284,7 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet) if (event.mime_data().has_text()) { auto* target_cell = m_sheet->at({ m_sheet->column(index.column()), (size_t)index.row() }); - ASSERT(target_cell); + VERIFY(target_cell); target_cell->set_data(event.text()); return; diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index 4dea836926..036bd5a6c0 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -96,7 +96,7 @@ SpreadsheetWidget::SpreadsheetWidget(NonnullRefPtrVector<Sheet>&& sheets, bool s m_tab_context_menu = GUI::Menu::construct(); auto rename_action = GUI::Action::create("Rename...", [this](auto&) { - ASSERT(m_tab_context_menu_sheet_view); + VERIFY(m_tab_context_menu_sheet_view); auto& sheet = m_tab_context_menu_sheet_view->sheet(); String new_name; @@ -321,7 +321,7 @@ void SpreadsheetWidget::add_sheet() void SpreadsheetWidget::add_sheet(NonnullRefPtr<Sheet>&& sheet) { - ASSERT(m_workbook == &sheet->workbook()); + VERIFY(m_workbook == &sheet->workbook()); NonnullRefPtrVector<Sheet> new_sheets; new_sheets.append(move(sheet)); diff --git a/Userland/Applications/Spreadsheet/Writers/XSV.h b/Userland/Applications/Spreadsheet/Writers/XSV.h index 7a065f87d1..27d1e7e34f 100644 --- a/Userland/Applications/Spreadsheet/Writers/XSV.h +++ b/Userland/Applications/Spreadsheet/Writers/XSV.h @@ -109,7 +109,7 @@ public: ENUMERATE_WRITE_ERRORS(); #undef E } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } private: diff --git a/Userland/Applications/Spreadsheet/main.cpp b/Userland/Applications/Spreadsheet/main.cpp index d77b48c68c..1f6539f324 100644 --- a/Userland/Applications/Spreadsheet/main.cpp +++ b/Userland/Applications/Spreadsheet/main.cpp @@ -165,7 +165,7 @@ int main(int argc, char* argv[]) /// - currently selected cell /// - selected cell+ auto& cells = spreadsheet_widget.current_worksheet().selected_cells(); - ASSERT(!cells.is_empty()); + VERIFY(!cells.is_empty()); StringBuilder text_builder, url_builder; bool first = true; auto cursor = spreadsheet_widget.current_selection_cursor(); @@ -201,7 +201,7 @@ int main(int argc, char* argv[]) ScopeGuard update_after_paste { [&] { spreadsheet_widget.update(); } }; auto& cells = spreadsheet_widget.current_worksheet().selected_cells(); - ASSERT(!cells.is_empty()); + VERIFY(!cells.is_empty()); const auto& data = GUI::Clipboard::the().data_and_type(); if (auto spreadsheet_data = data.metadata.get("text/x-spreadsheet-data"); spreadsheet_data.has_value()) { Vector<Spreadsheet::Position> source_positions, target_positions; diff --git a/Userland/Applications/SystemMonitor/DevicesModel.cpp b/Userland/Applications/SystemMonitor/DevicesModel.cpp index 2efc4a117d..44a05fb550 100644 --- a/Userland/Applications/SystemMonitor/DevicesModel.cpp +++ b/Userland/Applications/SystemMonitor/DevicesModel.cpp @@ -69,13 +69,13 @@ String DevicesModel::column_name(int column) const case Column::Type: return "Type"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } GUI::Variant DevicesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const { - ASSERT(is_valid(index)); + VERIFY(is_valid(index)); if (role == GUI::ModelRole::TextAlignment) { switch (index.column()) { @@ -107,7 +107,7 @@ GUI::Variant DevicesModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol case Column::Type: return device.type; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -129,10 +129,10 @@ GUI::Variant DevicesModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol case DeviceInfo::Type::Character: return "Character"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -143,10 +143,10 @@ void DevicesModel::update() { auto proc_devices = Core::File::construct("/proc/devices"); if (!proc_devices->open(Core::IODevice::OpenMode::ReadOnly)) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); auto json = JsonValue::from_string(proc_devices->read_all()); - ASSERT(json.has_value()); + VERIFY(json.has_value()); m_devices.clear(); json.value().as_array().for_each([this](auto& value) { @@ -163,7 +163,7 @@ void DevicesModel::update() else if (type_str == "character") device_info.type = DeviceInfo::Type::Character; else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); m_devices.append(move(device_info)); }); @@ -175,7 +175,7 @@ void DevicesModel::update() auto path = String::formatted("{}/{}", dir, name); struct stat statbuf; if (lstat(path.characters(), &statbuf) != 0) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (!S_ISBLK(statbuf.st_mode) && !S_ISCHR(statbuf.st_mode)) continue; diff --git a/Userland/Applications/SystemMonitor/GraphWidget.cpp b/Userland/Applications/SystemMonitor/GraphWidget.cpp index e1ad40afe1..54676143c3 100644 --- a/Userland/Applications/SystemMonitor/GraphWidget.cpp +++ b/Userland/Applications/SystemMonitor/GraphWidget.cpp @@ -88,7 +88,7 @@ void GraphWidget::paint_event(GUI::PaintEvent& event) Gfx::IntPoint current_point { x, inner_rect.bottom() - (int)scaled_value }; m_calculated_points.append(current_point); } - ASSERT(m_calculated_points.size() <= m_values.size()); + VERIFY(m_calculated_points.size() <= m_values.size()); if (format.graph_color_role != ColorRole::Base) { // Fill the background for the area we have values for Gfx::Path path; @@ -100,8 +100,8 @@ void GraphWidget::paint_event(GUI::PaintEvent& event) if (!started_path) return; if (points_in_path > 1) { - ASSERT(current_point); - ASSERT(first_point); + VERIFY(current_point); + VERIFY(first_point); path.line_to({ current_point->x() - 1, inner_rect.bottom() + 1 }); path.line_to({ first_point->x() + 1, inner_rect.bottom() + 1 }); path.close(); diff --git a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp index 6675ea8c4a..787ff57ba6 100644 --- a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp +++ b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp @@ -48,7 +48,7 @@ MemoryStatsWidget* MemoryStatsWidget::the() MemoryStatsWidget::MemoryStatsWidget(GraphWidget& graph) : m_graph(graph) { - ASSERT(!s_the); + VERIFY(!s_the); s_the = this; set_fixed_height(110); @@ -98,11 +98,11 @@ void MemoryStatsWidget::refresh() { auto proc_memstat = Core::File::construct("/proc/memstat"); if (!proc_memstat->open(Core::IODevice::OpenMode::ReadOnly)) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); auto file_contents = proc_memstat->read_all(); auto json_result = JsonValue::from_string(file_contents); - ASSERT(json_result.has_value()); + VERIFY(json_result.has_value()); auto json = json_result.value().as_object(); [[maybe_unused]] unsigned kmalloc_eternal_allocated = json.get("kmalloc_eternal_allocated").to_u32(); diff --git a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp index 62df60c951..90f40b8506 100644 --- a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp +++ b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp @@ -55,7 +55,7 @@ public: else if (c == 'P') // Physical (a resident page) color = Color::Black; else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); painter.draw_line({ x, rect.top() }, { x, rect.bottom() }, color); } diff --git a/Userland/Applications/SystemMonitor/ProcessModel.cpp b/Userland/Applications/SystemMonitor/ProcessModel.cpp index a028b23956..2cee462db4 100644 --- a/Userland/Applications/SystemMonitor/ProcessModel.cpp +++ b/Userland/Applications/SystemMonitor/ProcessModel.cpp @@ -35,13 +35,13 @@ static ProcessModel* s_the; ProcessModel& ProcessModel::the() { - ASSERT(s_the); + VERIFY(s_the); return *s_the; } ProcessModel::ProcessModel() { - ASSERT(!s_the); + VERIFY(!s_the); s_the = this; m_generic_process_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/gear.png"); @@ -138,7 +138,7 @@ String ProcessModel::column_name(int column) const case Column::Veil: return "Veil"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -149,7 +149,7 @@ static String pretty_byte_size(size_t size) GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const { - ASSERT(is_valid(index)); + VERIFY(is_valid(index)); if (role == GUI::ModelRole::TextAlignment) { switch (index.column()) { @@ -186,7 +186,7 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol case Column::IPv4SocketWriteBytes: return Gfx::TextAlignment::CenterRight; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -256,7 +256,7 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol case Column::Veil: return thread.current_state.veil; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (role == GUI::ModelRole::Display) { @@ -391,7 +391,7 @@ void ProcessModel::update() m_threads.set(thread.tid, make<Thread>()); } auto pit = m_threads.find(thread.tid); - ASSERT(pit != m_threads.end()); + VERIFY(pit != m_threads.end()); (*pit).value->previous_state = (*pit).value->current_state; (*pit).value->current_state = state; diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index bc282835f4..7b3a6ef182 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -171,7 +171,7 @@ static pid_t run_command(int ptm_fd, String command) perror("execve"); exit(1); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return pid; diff --git a/Userland/Demos/CatDog/main.cpp b/Userland/Demos/CatDog/main.cpp index 7238b2c0a7..cc0c9576f8 100644 --- a/Userland/Demos/CatDog/main.cpp +++ b/Userland/Demos/CatDog/main.cpp @@ -150,9 +150,9 @@ public: void track_cursor_globally() { - ASSERT(window()); + VERIFY(window()); auto window_id = window()->window_id(); - ASSERT(window_id >= 0); + VERIFY(window_id >= 0); set_global_cursor_tracking(true); GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetGlobalCursorTracking>(window_id, true); diff --git a/Userland/Demos/Eyes/EyesWidget.cpp b/Userland/Demos/Eyes/EyesWidget.cpp index c31d4782e1..6372c9e137 100644 --- a/Userland/Demos/Eyes/EyesWidget.cpp +++ b/Userland/Demos/Eyes/EyesWidget.cpp @@ -37,9 +37,9 @@ EyesWidget::~EyesWidget() void EyesWidget::track_cursor_globally() { - ASSERT(window()); + VERIFY(window()); auto window_id = window()->window_id(); - ASSERT(window_id >= 0); + VERIFY(window_id >= 0); set_global_cursor_tracking(true); GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetGlobalCursorTracking>(window_id, true); @@ -124,7 +124,7 @@ Gfx::IntPoint EyesWidget::pupil_center(Gfx::IntRect& eyeball_bounds) const (slope_squared / width_squared + 1 / height_squared) ); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // clang-format on diff --git a/Userland/Demos/LibGfxScaleDemo/main.cpp b/Userland/Demos/LibGfxScaleDemo/main.cpp index cf46179701..9a60b911d1 100644 --- a/Userland/Demos/LibGfxScaleDemo/main.cpp +++ b/Userland/Demos/LibGfxScaleDemo/main.cpp @@ -110,7 +110,7 @@ void Canvas::draw(Gfx::Painter& painter) // grid does not have an alpha channel. auto grid = Gfx::Bitmap::load_from_file("/res/wallpapers/grid.png"); - ASSERT(!grid->has_alpha_channel()); + VERIFY(!grid->has_alpha_channel()); painter.fill_rect({ 25, 122, 62, 20 }, Color::Green); painter.blit({ 25, 122 }, *grid, { (grid->width() - 62) / 2, (grid->height() - 20) / 2 + 40, 62, 20 }, 0.9); diff --git a/Userland/Demos/WidgetGallery/main.cpp b/Userland/Demos/WidgetGallery/main.cpp index e94072146a..ab4782cdf1 100644 --- a/Userland/Demos/WidgetGallery/main.cpp +++ b/Userland/Demos/WidgetGallery/main.cpp @@ -66,8 +66,8 @@ public: virtual int column_count(const GUI::ModelIndex&) const override { return 1; } virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override { - ASSERT(index.is_valid()); - ASSERT(index.column() == 0); + VERIFY(index.is_valid()); + VERIFY(index.column() == 0); if (role == GUI::ModelRole::Display) return m_model_items.at(index.row()); return {}; diff --git a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp index fe0f6a31f5..748ba70781 100644 --- a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp @@ -68,7 +68,7 @@ Vector<BacktraceModel::FrameInfo> BacktraceModel::create_backtrace(const Debug:: frames.append({ name, current_instruction, current_ebp }); auto frame_info = Debug::StackFrameUtils::get_info(*Debugger::the().session(), current_ebp); - ASSERT(frame_info.has_value()); + VERIFY(frame_info.has_value()); current_instruction = frame_info.value().return_address; current_ebp = frame_info.value().next_ebp; } while (current_ebp && current_instruction); diff --git a/Userland/DevTools/HackStudio/Debugger/Debugger.cpp b/Userland/DevTools/HackStudio/Debugger/Debugger.cpp index 20527e379d..55bc4faef3 100644 --- a/Userland/DevTools/HackStudio/Debugger/Debugger.cpp +++ b/Userland/DevTools/HackStudio/Debugger/Debugger.cpp @@ -33,7 +33,7 @@ static Debugger* s_the; Debugger& Debugger::the() { - ASSERT(s_the); + VERIFY(s_the); return *s_the; } @@ -90,10 +90,10 @@ void Debugger::on_breakpoint_change(const String& file, size_t line, BreakpointC if (change_type == BreakpointChange::Added) { bool success = session->insert_breakpoint(reinterpret_cast<void*>(address.value().address)); - ASSERT(success); + VERIFY(success); } else { bool success = session->remove_breakpoint(reinterpret_cast<void*>(address.value().address)); - ASSERT(success); + VERIFY(success); } } @@ -113,14 +113,14 @@ int Debugger::start_static() void Debugger::start() { m_debug_session = Debug::DebugSession::exec_and_attach(m_executable_path, m_source_root); - ASSERT(!!m_debug_session); + VERIFY(!!m_debug_session); for (const auto& breakpoint : m_breakpoints) { dbgln("inserting breakpoint at: {}:{}", breakpoint.file_path, breakpoint.line_number); auto address = m_debug_session->get_address_from_source_position(breakpoint.file_path, breakpoint.line_number); if (address.has_value()) { bool success = m_debug_session->insert_breakpoint(reinterpret_cast<void*>(address.value().address)); - ASSERT(success); + VERIFY(success); } else { dbgln("couldn't insert breakpoint"); } @@ -131,7 +131,7 @@ void Debugger::start() int Debugger::debugger_loop() { - ASSERT(m_debug_session); + VERIFY(m_debug_session); m_debug_session->run(Debug::DebugSession::DesiredInitialDebugeeState::Running, [this](Debug::DebugSession::DebugBreakReason reason, Optional<PtraceRegisters> optional_regs) { if (reason == Debug::DebugSession::DebugBreakReason::Exited) { @@ -140,7 +140,7 @@ int Debugger::debugger_loop() return Debug::DebugSession::DebugDecision::Detach; } remove_temporary_breakpoints(); - ASSERT(optional_regs.has_value()); + VERIFY(optional_regs.has_value()); const PtraceRegisters& regs = optional_regs.value(); auto source_position = m_debug_session->get_source_position(regs.eip); @@ -151,7 +151,7 @@ int Debugger::debugger_loop() if (source_position.value().file_path.ends_with(".S")) return Debug::DebugSession::DebugDecision::SingleStep; - ASSERT(source_position.has_value()); + VERIFY(source_position.has_value()); if (m_state.get() == Debugger::DebuggingState::SingleStepping) { if (m_state.should_stop_single_stepping(source_position.value())) { m_state.set_normal(); @@ -196,7 +196,7 @@ int Debugger::debugger_loop() dbgln("Debugger exiting"); return Debug::DebugSession::DebugDecision::Detach; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }); m_debug_session.clear(); return 0; @@ -216,16 +216,16 @@ void Debugger::DebuggingState::set_single_stepping(Debug::DebugInfo::SourcePosit bool Debugger::DebuggingState::should_stop_single_stepping(const Debug::DebugInfo::SourcePosition& current_source_position) const { - ASSERT(m_state == State::SingleStepping); + VERIFY(m_state == State::SingleStepping); return m_original_source_position.value() != current_source_position; } void Debugger::remove_temporary_breakpoints() { for (auto breakpoint_address : m_state.temporary_breakpoints()) { - ASSERT(m_debug_session->breakpoint_exists((void*)breakpoint_address)); + VERIFY(m_debug_session->breakpoint_exists((void*)breakpoint_address)); bool rc = m_debug_session->remove_breakpoint((void*)breakpoint_address); - ASSERT(rc); + VERIFY(rc); } m_state.clear_temporary_breakpoints(); } @@ -259,7 +259,7 @@ void Debugger::do_step_over(const PtraceRegisters& regs) dbgln("cannot perform step_over, failed to find containing function of: {:p}", regs.eip); return; } - ASSERT(current_function.has_value()); + VERIFY(current_function.has_value()); auto lines_in_current_function = lib->debug_info->source_lines_in_scope(current_function.value()); for (const auto& line : lines_in_current_function) { insert_temporary_breakpoint(line.address_of_first_statement.value() + lib->base_address); @@ -270,7 +270,7 @@ void Debugger::do_step_over(const PtraceRegisters& regs) void Debugger::insert_temporary_breakpoint_at_return_address(const PtraceRegisters& regs) { auto frame_info = Debug::StackFrameUtils::get_info(*m_debug_session, regs.ebp); - ASSERT(frame_info.has_value()); + VERIFY(frame_info.has_value()); u32 return_address = frame_info.value().return_address; insert_temporary_breakpoint(return_address); } @@ -280,7 +280,7 @@ void Debugger::insert_temporary_breakpoint(FlatPtr address) if (m_debug_session->breakpoint_exists((void*)address)) return; bool success = m_debug_session->insert_breakpoint(reinterpret_cast<void*>(address)); - ASSERT(success); + VERIFY(success); m_state.add_temporary_breakpoint(address); } diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp index cb7822c60a..4ede317691 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp @@ -63,7 +63,7 @@ DisassemblyModel::DisassemblyModel(const Debug::DebugSession& debug_session, con auto symbol = elf->find_symbol(containing_function.value().address_low); if (!symbol.has_value()) return; - ASSERT(symbol.has_value()); + VERIFY(symbol.has_value()); auto view = symbol.value().raw_data(); @@ -104,7 +104,7 @@ String DisassemblyModel::column_name(int column) const case Column::Disassembly: return "Disassembly"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } } diff --git a/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp b/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp index 92199a4c6f..33310d422f 100644 --- a/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp @@ -87,7 +87,7 @@ String RegistersModel::column_name(int column) const case Column::Value: return "Value"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } } diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp index 425129046c..e010fa997c 100644 --- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp @@ -52,14 +52,14 @@ GUI::ModelIndex VariablesModel::parent_index(const GUI::ModelIndex& index) const for (size_t row = 0; row < m_variables.size(); row++) if (m_variables.ptr_at(row).ptr() == parent) return create_index(row, 0, parent); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } for (size_t row = 0; row < parent->parent->members.size(); row++) { Debug::DebugInfo::VariableInfo* child_at_row = parent->parent->members.ptr_at(row).ptr(); if (child_at_row == parent) return create_index(row, 0, parent); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int VariablesModel::row_count(const GUI::ModelIndex& index) const @@ -79,29 +79,29 @@ static String variable_value_as_string(const Debug::DebugInfo::VariableInfo& var if (variable.is_enum_type()) { auto value = Debugger::the().session()->peek((u32*)variable_address); - ASSERT(value.has_value()); + VERIFY(value.has_value()); auto it = variable.type->members.find_if([&enumerator_value = value.value()](const auto& enumerator) { return enumerator->constant_data.as_u32 == enumerator_value; }); - ASSERT(!it.is_end()); + VERIFY(!it.is_end()); return String::formatted("{}::{}", variable.type_name, (*it)->name); } if (variable.type_name == "int") { auto value = Debugger::the().session()->peek((u32*)variable_address); - ASSERT(value.has_value()); + VERIFY(value.has_value()); return String::formatted("{}", static_cast<int>(value.value())); } if (variable.type_name == "char") { auto value = Debugger::the().session()->peek((u32*)variable_address); - ASSERT(value.has_value()); + VERIFY(value.has_value()); return String::formatted("'{0:c}' ({0:d})", value.value()); } if (variable.type_name == "bool") { auto value = Debugger::the().session()->peek((u32*)variable_address); - ASSERT(value.has_value()); + VERIFY(value.has_value()); return (value.value() & 1) ? "true" : "false"; } @@ -151,7 +151,7 @@ void VariablesModel::set_variable_value(const GUI::ModelIndex& index, const Stri if (value.has_value()) { auto success = Debugger::the().session()->poke((u32*)variable->location_data.address, value.value()); - ASSERT(success); + VERIFY(success); return; } diff --git a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp index 692804def0..d9f09c9d3e 100644 --- a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp @@ -135,7 +135,7 @@ RefPtr<ProjectTemplate> NewProjectDialog::selected_template() } auto project_template = m_model->template_for_index(m_icon_view->selection().first()); - ASSERT(!project_template.is_null()); + VERIFY(!project_template.is_null()); return project_template; } diff --git a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp index a2dd21e0b1..ba948d3f86 100644 --- a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp @@ -78,7 +78,7 @@ String ProjectTemplatesModel::column_name(int column) const case Column::Name: return "Name"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } GUI::Variant ProjectTemplatesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const diff --git a/Userland/DevTools/HackStudio/Editor.cpp b/Userland/DevTools/HackStudio/Editor.cpp index 52952fbe1f..f865ffef2c 100644 --- a/Userland/DevTools/HackStudio/Editor.cpp +++ b/Userland/DevTools/HackStudio/Editor.cpp @@ -385,7 +385,7 @@ const Gfx::Bitmap& Editor::current_position_icon_bitmap() const CodeDocument& Editor::code_document() const { const auto& doc = document(); - ASSERT(doc.is_code_document()); + VERIFY(doc.is_code_document()); return static_cast<const CodeDocument&>(doc); } @@ -396,7 +396,7 @@ CodeDocument& Editor::code_document() void Editor::set_document(GUI::TextDocument& doc) { - ASSERT(doc.is_code_document()); + VERIFY(doc.is_code_document()); GUI::TextEditor::set_document(doc); set_override_cursor(Gfx::StandardCursor::IBeam); @@ -487,7 +487,7 @@ void Editor::on_edit_action(const GUI::Command& command) return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Editor::undo() diff --git a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp index 8347e73c81..2d24f9c2b2 100644 --- a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp +++ b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp @@ -69,7 +69,7 @@ public: case Column::MatchedText: return "Text"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/DevTools/HackStudio/FormEditorWidget.h b/Userland/DevTools/HackStudio/FormEditorWidget.h index a913eed01e..0a78681106 100644 --- a/Userland/DevTools/HackStudio/FormEditorWidget.h +++ b/Userland/DevTools/HackStudio/FormEditorWidget.h @@ -85,7 +85,7 @@ public: void remove(GUI::Widget& widget) { - ASSERT(m_widgets.contains(&widget)); + VERIFY(m_widgets.contains(&widget)); m_widgets.remove(&widget); if (m_hooks_enabled && on_remove) on_remove(widget); diff --git a/Userland/DevTools/HackStudio/Git/DiffViewer.cpp b/Userland/DevTools/HackStudio/Git/DiffViewer.cpp index 8e81b6ce4f..39785998fc 100644 --- a/Userland/DevTools/HackStudio/Git/DiffViewer.cpp +++ b/Userland/DevTools/HackStudio/Git/DiffViewer.cpp @@ -86,7 +86,7 @@ void DiffViewer::paint_event(GUI::PaintEvent& event) right_y_offset += line_height(); } - ASSERT(left_y_offset == right_y_offset); + VERIFY(left_y_offset == right_y_offset); y_offset = left_y_offset; } for (size_t i = current_original_line_index; i < m_original_lines.size(); ++i) { diff --git a/Userland/DevTools/HackStudio/Git/GitFilesView.cpp b/Userland/DevTools/HackStudio/Git/GitFilesView.cpp index 76aa3abda8..0a7afa3c99 100644 --- a/Userland/DevTools/HackStudio/Git/GitFilesView.cpp +++ b/Userland/DevTools/HackStudio/Git/GitFilesView.cpp @@ -75,7 +75,7 @@ void GitFilesView::mousedown_event(GUI::MouseEvent& event) auto data = model()->index(item_index, model_column()).data(); - ASSERT(data.is_string()); + VERIFY(data.is_string()); m_action_callback(LexicalPath(data.to_string())); } diff --git a/Userland/DevTools/HackStudio/Git/GitRepo.cpp b/Userland/DevTools/HackStudio/Git/GitRepo.cpp index ea68c88ff6..971febbaee 100644 --- a/Userland/DevTools/HackStudio/Git/GitRepo.cpp +++ b/Userland/DevTools/HackStudio/Git/GitRepo.cpp @@ -49,7 +49,7 @@ RefPtr<GitRepo> GitRepo::initialize_repository(const LexicalPath& repository_roo if (res.is_null()) return {}; - ASSERT(git_repo_exists(repository_root)); + VERIFY(git_repo_exists(repository_root)); return adopt(*new GitRepo(repository_root)); } diff --git a/Userland/DevTools/HackStudio/Git/GitWidget.cpp b/Userland/DevTools/HackStudio/Git/GitWidget.cpp index 8be825760f..e15583ff8d 100644 --- a/Userland/DevTools/HackStudio/Git/GitWidget.cpp +++ b/Userland/DevTools/HackStudio/Git/GitWidget.cpp @@ -109,7 +109,7 @@ bool GitWidget::initialize() return true; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -128,7 +128,7 @@ void GitWidget::refresh() return; } - ASSERT(!m_git_repo.is_null()); + VERIFY(!m_git_repo.is_null()); m_unstaged_files->set_model(GitFilesModel::create(m_git_repo->unstaged_files())); m_staged_files->set_model(GitFilesModel::create(m_git_repo->staged_files())); @@ -138,7 +138,7 @@ void GitWidget::stage_file(const LexicalPath& file) { dbgln("staging: {}", file); bool rc = m_git_repo->stage(file); - ASSERT(rc); + VERIFY(rc); refresh(); } @@ -146,7 +146,7 @@ void GitWidget::unstage_file(const LexicalPath& file) { dbgln("unstaging: {}", file); bool rc = m_git_repo->unstage(file); - ASSERT(rc); + VERIFY(rc); refresh(); } @@ -172,7 +172,7 @@ void GitWidget::show_diff(const LexicalPath& file_path) auto file = Core::File::construct(file_path.string()); if (!file->open(Core::IODevice::ReadOnly)) { perror("open"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto content = file->read_all(); @@ -182,7 +182,7 @@ void GitWidget::show_diff(const LexicalPath& file_path) } const auto& original_content = m_git_repo->original_file_content(file_path); const auto& diff = m_git_repo->unstaged_diff(file_path); - ASSERT(original_content.has_value() && diff.has_value()); + VERIFY(original_content.has_value() && diff.has_value()); m_view_diff_callback(original_content.value(), diff.value()); } } diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index 13ebbd5165..69a734c3c9 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -191,7 +191,7 @@ void HackStudioWidget::open_project(const String& root_path) exit(1); } m_project = Project::open_with_root_path(root_path); - ASSERT(m_project); + VERIFY(m_project); if (m_project_tree_view) { m_project_tree_view->set_model(m_project->model()); m_project_tree_view->update(); @@ -222,7 +222,7 @@ void HackStudioWidget::open_file(const String& full_filename) if (!currently_open_file().is_empty()) { // Since the file is previously open, it should always be in m_open_files. - ASSERT(m_open_files.find(currently_open_file()) != m_open_files.end()); + VERIFY(m_open_files.find(currently_open_file()) != m_open_files.end()); auto previous_open_project_file = m_open_files.get(currently_open_file()).value(); // Update the scrollbar values of the previous_open_project_file and save them to m_open_files. @@ -272,7 +272,7 @@ void HackStudioWidget::open_file(const String& full_filename) EditorWrapper& HackStudioWidget::current_editor_wrapper() { - ASSERT(m_current_editor_wrapper); + VERIFY(m_current_editor_wrapper); return *m_current_editor_wrapper; } @@ -290,7 +290,7 @@ void HackStudioWidget::set_edit_mode(EditMode mode) } else if (mode == EditMode::Diff) { m_right_hand_stack->set_active_widget(m_diff_viewer); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_right_hand_stack->active_widget()->update(); } @@ -563,7 +563,7 @@ void HackStudioWidget::initialize_debugger() Debugger::initialize( m_project->root_path(), [this](const PtraceRegisters& regs) { - ASSERT(Debugger::the().session()); + VERIFY(Debugger::the().session()); const auto& debug_session = *Debugger::the().session(); auto source_position = debug_session.get_source_position(regs.eip); if (!source_position.has_value()) { @@ -610,7 +610,7 @@ void HackStudioWidget::initialize_debugger() String HackStudioWidget::get_full_path_of_serenity_source(const String& file) { auto path_parts = LexicalPath(file).parts(); - ASSERT(path_parts[0] == ".."); + VERIFY(path_parts[0] == ".."); path_parts.remove(0); StringBuilder relative_path_builder; relative_path_builder.join("/", path_parts); diff --git a/Userland/DevTools/HackStudio/LanguageClient.cpp b/Userland/DevTools/HackStudio/LanguageClient.cpp index cc54bc5d71..07a234bb19 100644 --- a/Userland/DevTools/HackStudio/LanguageClient.cpp +++ b/Userland/DevTools/HackStudio/LanguageClient.cpp @@ -117,7 +117,7 @@ void LanguageClient::set_active_client() void LanguageClient::on_server_crash() { - ASSERT(m_server_connection); + VERIFY(m_server_connection); auto project_path = m_server_connection->projcet_path(); ServerConnection::remove_instance_for_project(project_path); m_server_connection = nullptr; diff --git a/Userland/DevTools/HackStudio/LanguageClient.h b/Userland/DevTools/HackStudio/LanguageClient.h index 846e24f8fc..8ec45ede12 100644 --- a/Userland/DevTools/HackStudio/LanguageClient.h +++ b/Userland/DevTools/HackStudio/LanguageClient.h @@ -105,14 +105,14 @@ public: : m_server_connection(move(connection)) { m_previous_client = m_server_connection->language_client(); - ASSERT(m_previous_client.ptr() != this); + VERIFY(m_previous_client.ptr() != this); m_server_connection->attach(*this); } virtual ~LanguageClient() { m_server_connection->detach(); - ASSERT(m_previous_client.ptr() != this); + VERIFY(m_previous_client.ptr() != this); if (m_previous_client) m_server_connection->attach(*m_previous_client); } diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/FileDB.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/FileDB.cpp index f354a2beb8..5c289d8014 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/FileDB.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/FileDB.cpp @@ -65,7 +65,7 @@ String FileDB::to_absolute_path(const String& file_name) const if (LexicalPath { file_name }.is_absolute()) { return file_name; } - ASSERT(!m_project_root.is_null()); + VERIFY(!m_project_root.is_null()); return LexicalPath { String::formatted("{}/{}", m_project_root, file_name) }.string(); } diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/LexerAutoComplete.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/LexerAutoComplete.cpp index 721b6de953..14031432a6 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/LexerAutoComplete.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/LexerAutoComplete.cpp @@ -65,8 +65,8 @@ Vector<GUI::AutocompleteProvider::Entry> LexerAutoComplete::get_suggestions(cons StringView LexerAutoComplete::text_of_token(const Vector<String>& lines, const Cpp::Token& token) { - ASSERT(token.m_start.line == token.m_end.line); - ASSERT(token.m_start.column <= token.m_end.column); + VERIFY(token.m_start.line == token.m_end.line); + VERIFY(token.m_start.column <= token.m_end.column); return lines[token.m_start.line].substring_view(token.m_start.column, token.m_end.column - token.m_start.column + 1); } diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp index 8257bc667c..50bc03ba8b 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp @@ -53,14 +53,14 @@ const ParserAutoComplete::DocumentData& ParserAutoComplete::get_document_data(co { auto absolute_path = filedb().to_absolute_path(file); auto document_data = m_documents.get(absolute_path); - ASSERT(document_data.has_value()); + VERIFY(document_data.has_value()); return *document_data.value(); } OwnPtr<ParserAutoComplete::DocumentData> ParserAutoComplete::create_document_data_for(const String& file) { auto document = filedb().get(file); - ASSERT(document); + VERIFY(document); auto content = document->text(); auto document_data = make<DocumentData>(document->text(), file); auto root = document_data->parser.parse(); @@ -107,7 +107,7 @@ Vector<GUI::AutocompleteProvider::Entry> ParserAutoComplete::get_suggestions(con } if (is_empty_property(document, *node, position)) { - ASSERT(node->is_member_expression()); + VERIFY(node->is_member_expression()); return autocomplete_property(document, (MemberExpression&)(*node), ""); } @@ -235,7 +235,7 @@ String ParserAutoComplete::type_of(const DocumentData& document, const Expressio return type_of_property(document, *member_expression.m_property); } if (!expression.is_identifier()) { - ASSERT_NOT_REACHED(); // TODO + VERIFY_NOT_REACHED(); // TODO } auto& identifier = (const Identifier&)expression; @@ -350,7 +350,7 @@ RefPtr<Declaration> ParserAutoComplete::find_declaration_of(const DocumentData& } if (is_property(node) && decl.is_struct_or_class()) { for (auto& member : ((Cpp::StructOrClassDeclaration&)decl).m_members) { - ASSERT(node.is_identifier()); + VERIFY(node.is_identifier()); if (member.m_name == ((const Identifier&)node).m_name) return member; } diff --git a/Userland/DevTools/HackStudio/TerminalWrapper.cpp b/Userland/DevTools/HackStudio/TerminalWrapper.cpp index 42d91cfc91..0488352970 100644 --- a/Userland/DevTools/HackStudio/TerminalWrapper.cpp +++ b/Userland/DevTools/HackStudio/TerminalWrapper.cpp @@ -55,15 +55,15 @@ void TerminalWrapper::run_command(const String& command) int ptm_fd = posix_openpt(O_RDWR | O_CLOEXEC); if (ptm_fd < 0) { perror("posix_openpt"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (grantpt(ptm_fd) < 0) { perror("grantpt"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (unlockpt(ptm_fd) < 0) { perror("unlockpt"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_terminal_widget->set_pty_master_fd(ptm_fd); @@ -72,7 +72,7 @@ void TerminalWrapper::run_command(const String& command) int rc = waitpid(m_pid, &wstatus, 0); if (rc < 0) { perror("waitpid"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (WIFEXITED(wstatus)) { m_terminal_widget->inject_string(String::formatted("\033[{};1m(Command exited with code {})\033[0m\n", wstatus == 0 ? 32 : 31, WEXITSTATUS(wstatus))); @@ -147,7 +147,7 @@ void TerminalWrapper::run_command(const String& command) setenv("TERM", "xterm", true); auto parts = command.split(' '); - ASSERT(!parts.is_empty()); + VERIFY(!parts.is_empty()); const char** args = (const char**)calloc(parts.size() + 1, sizeof(const char*)); for (size_t i = 0; i < parts.size(); i++) { args[i] = parts[i].characters(); @@ -157,7 +157,7 @@ void TerminalWrapper::run_command(const String& command) perror("execve"); exit(1); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // (In parent process) @@ -166,7 +166,7 @@ void TerminalWrapper::run_command(const String& command) void TerminalWrapper::kill_running_command() { - ASSERT(m_pid != -1); + VERIFY(m_pid != -1); // Kill our child process and its whole process group. [[maybe_unused]] auto rc = killpg(m_pid, SIGTERM); diff --git a/Userland/DevTools/HackStudio/WidgetTreeModel.cpp b/Userland/DevTools/HackStudio/WidgetTreeModel.cpp index c0f8b403dc..5dbf7f5232 100644 --- a/Userland/DevTools/HackStudio/WidgetTreeModel.cpp +++ b/Userland/DevTools/HackStudio/WidgetTreeModel.cpp @@ -69,7 +69,7 @@ GUI::ModelIndex WidgetTreeModel::parent_index(const GUI::ModelIndex& index) cons ++grandparent_child_index; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } diff --git a/Userland/DevTools/IPCCompiler/main.cpp b/Userland/DevTools/IPCCompiler/main.cpp index d654191209..bacee6e0ba 100644 --- a/Userland/DevTools/IPCCompiler/main.cpp +++ b/Userland/DevTools/IPCCompiler/main.cpp @@ -83,7 +83,7 @@ int main(int argc, char** argv) if (lexer.peek() != ch) warnln("assert_specific: wanted '{}', but got '{}' at index {}", ch, lexer.peek(), lexer.tell()); bool saw_expected = lexer.consume_specific(ch); - ASSERT(saw_expected); + VERIFY(saw_expected); }; auto consume_whitespace = [&] { @@ -153,7 +153,7 @@ int main(int argc, char** argv) else if (type == '|') message.is_synchronous = false; else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); consume_whitespace(); diff --git a/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp b/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp index 32caac30ec..cc1aed8013 100644 --- a/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp +++ b/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp @@ -72,7 +72,7 @@ GUI::ModelIndex RemoteObjectGraphModel::parent_index(const GUI::ModelIndex& inde if (&m_process.roots()[row] == remote_object.parent) return create_index(row, 0, remote_object.parent); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } @@ -81,7 +81,7 @@ GUI::ModelIndex RemoteObjectGraphModel::parent_index(const GUI::ModelIndex& inde return create_index(row, 0, remote_object.parent); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } diff --git a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp index 6c9e82f3a7..a01b3bf502 100644 --- a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp +++ b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp @@ -61,7 +61,7 @@ String RemoteObjectPropertyModel::column_name(int column) const case Column::Value: return "Value"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } GUI::Variant RemoteObjectPropertyModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const diff --git a/Userland/DevTools/Inspector/RemoteProcess.cpp b/Userland/DevTools/Inspector/RemoteProcess.cpp index da3fd14a0d..c2670d09dc 100644 --- a/Userland/DevTools/Inspector/RemoteProcess.cpp +++ b/Userland/DevTools/Inspector/RemoteProcess.cpp @@ -52,7 +52,7 @@ RemoteProcess::RemoteProcess(pid_t pid) void RemoteProcess::handle_identify_response(const JsonObject& response) { int pid = response.get("pid").to_int(); - ASSERT(pid == m_pid); + VERIFY(pid == m_pid); m_process_name = response.get("process_name").as_string_or({}); @@ -70,7 +70,7 @@ void RemoteProcess::handle_get_all_objects_response(const JsonObject& response) HashMap<FlatPtr, RemoteObject*> objects_by_address; for (auto& value : object_array.values()) { - ASSERT(value.is_object()); + VERIFY(value.is_object()); auto& object = value.as_object(); auto remote_object = make<RemoteObject>(); remote_object->address = object.get("address").to_number<FlatPtr>(); @@ -169,12 +169,12 @@ void RemoteProcess::update() remaining_bytes -= packet.size(); } - ASSERT(data.size() == length); + VERIFY(data.size() == length); dbgln("Got data size {} and read that many bytes", length); auto json_value = JsonValue::from_string(data); - ASSERT(json_value.has_value()); - ASSERT(json_value.value().is_object()); + VERIFY(json_value.has_value()); + VERIFY(json_value.value().is_object()); dbgln("Got JSON response {}", json_value.value()); diff --git a/Userland/DevTools/Profiler/DisassemblyModel.cpp b/Userland/DevTools/Profiler/DisassemblyModel.cpp index 4195f103cd..c9bf70ab2c 100644 --- a/Userland/DevTools/Profiler/DisassemblyModel.cpp +++ b/Userland/DevTools/Profiler/DisassemblyModel.cpp @@ -47,7 +47,7 @@ static const Gfx::Bitmap& heat_gradient() static Color color_for_percent(int percent) { - ASSERT(percent >= 0 && percent <= 100); + VERIFY(percent >= 0 && percent <= 100); return heat_gradient().get_pixel(percent, 0); } @@ -77,14 +77,14 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node) base_address = library_data->base; } - ASSERT(elf != nullptr); + VERIFY(elf != nullptr); auto symbol = elf->find_symbol(node.address() - base_address); if (!symbol.has_value()) { dbgln("DisassemblyModel: symbol not found"); return; } - ASSERT(symbol.has_value()); + VERIFY(symbol.has_value()); auto view = symbol.value().raw_data(); @@ -132,7 +132,7 @@ String DisassemblyModel::column_name(int column) const case Column::Disassembly: return "Disassembly"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } } diff --git a/Userland/DevTools/Profiler/Profile.h b/Userland/DevTools/Profiler/Profile.h index 0acf3e917f..18a93c75a9 100644 --- a/Userland/DevTools/Profiler/Profile.h +++ b/Userland/DevTools/Profiler/Profile.h @@ -72,7 +72,7 @@ public: { if (child.m_parent == this) return; - ASSERT(!child.m_parent); + VERIFY(!child.m_parent); child.m_parent = this; m_children.append(child); } diff --git a/Userland/DevTools/Profiler/ProfileModel.cpp b/Userland/DevTools/Profiler/ProfileModel.cpp index caf1819446..d9798069f1 100644 --- a/Userland/DevTools/Profiler/ProfileModel.cpp +++ b/Userland/DevTools/Profiler/ProfileModel.cpp @@ -67,7 +67,7 @@ GUI::ModelIndex ProfileModel::parent_index(const GUI::ModelIndex& index) const return create_index(row, index.column(), node.parent()); } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } @@ -76,7 +76,7 @@ GUI::ModelIndex ProfileModel::parent_index(const GUI::ModelIndex& index) const return create_index(row, index.column(), node.parent()); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } @@ -103,7 +103,7 @@ String ProfileModel::column_name(int column) const case Column::StackFrame: return "Stack Frame"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } } diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp index 7a40897f92..732c18f27a 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp @@ -70,7 +70,7 @@ static Emulator* s_the; Emulator& Emulator::the() { - ASSERT(s_the); + VERIFY(s_the); return *s_the; } @@ -95,7 +95,7 @@ Emulator::Emulator(const String& executable_path, const Vector<String>& argument m_range_allocator.initialize_with_range(VirtualAddress(base), userspace_range_ceiling - base); - ASSERT(!s_the); + VERIFY(!s_the); s_the = this; // setup_stack(arguments, environment); register_signal_handlers(); @@ -190,7 +190,7 @@ bool Emulator::load_elf() if (!executable_elf.is_dynamic()) { // FIXME: Support static objects - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } String interpreter_path; @@ -199,18 +199,18 @@ bool Emulator::load_elf() return false; } - ASSERT(!interpreter_path.is_null()); + VERIFY(!interpreter_path.is_null()); dbgln("interpreter: {}", interpreter_path); auto interpreter_file_or_error = MappedFile::map(interpreter_path); - ASSERT(!interpreter_file_or_error.is_error()); + VERIFY(!interpreter_file_or_error.is_error()); auto interpreter_image_data = interpreter_file_or_error.value()->bytes(); ELF::Image interpreter_image(interpreter_image_data); constexpr FlatPtr interpreter_load_offset = 0x08000000; interpreter_image.for_each_program_header([&](const ELF::Image::ProgramHeader& program_header) { // Loader is not allowed to have its own TLS regions - ASSERT(program_header.type() != PT_TLS); + VERIFY(program_header.type() != PT_TLS); if (program_header.type() == PT_LOAD) { auto region = make<SimpleRegion>(program_header.vaddr().offset(interpreter_load_offset).get(), program_header.size_in_memory()); @@ -983,7 +983,7 @@ int Emulator::virt$pipe(FlatPtr vm_pipefd, int flags) u32 Emulator::virt$munmap(FlatPtr address, u32 size) { auto* region = mmu().find_region({ 0x23, address }); - ASSERT(region); + VERIFY(region); if (region->size() != round_up_to_power_of_two(size, PAGE_SIZE)) TODO(); m_range_allocator.deallocate(region->range()); @@ -1024,7 +1024,7 @@ u32 Emulator::virt$mmap(u32 params_addr) auto region = MmapRegion::create_file_backed(final_address, final_size, params.prot, params.flags, params.fd, params.offset, name_str); if (region->name() == "libc.so: .text (Emulated)") { bool rc = find_malloc_symbols(*region); - ASSERT(rc); + VERIFY(rc); } mmu().add_region(move(region)); } @@ -1040,7 +1040,7 @@ FlatPtr Emulator::virt$mremap(FlatPtr params_addr) if (auto* region = mmu().find_region({ m_cpu.ds(), params.old_address })) { if (!is<MmapRegion>(*region)) return -EINVAL; - ASSERT(region->size() == params.old_size); + VERIFY(region->size() == params.old_size); auto& mmap_region = *(MmapRegion*)region; auto* ptr = mremap(mmap_region.data(), mmap_region.size(), mmap_region.size(), params.flags); if (ptr == MAP_FAILED) @@ -1089,7 +1089,7 @@ u32 Emulator::virt$mprotect(FlatPtr base, size_t size, int prot) if (auto* region = mmu().find_region({ m_cpu.ds(), base })) { if (!is<MmapRegion>(*region)) return -EINVAL; - ASSERT(region->size() == size); + VERIFY(region->size() == size); auto& mmap_region = *(MmapRegion*)region; mmap_region.set_prot(prot); return 0; @@ -1420,7 +1420,7 @@ enum class DefaultSignalAction { static DefaultSignalAction default_signal_action(int signal) { - ASSERT(signal && signal < NSIG); + VERIFY(signal && signal < NSIG); switch (signal) { case SIGHUP: @@ -1460,7 +1460,7 @@ static DefaultSignalAction default_signal_action(int signal) case SIGTTOU: return DefaultSignalAction::Stop; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Emulator::dispatch_one_pending_signal() @@ -1471,7 +1471,7 @@ void Emulator::dispatch_one_pending_signal() if (m_pending_signals & mask) break; } - ASSERT(signum != -1); + VERIFY(signum != -1); m_pending_signals &= ~(1 << signum); auto& handler = m_signal_handler[signum]; @@ -1516,7 +1516,7 @@ void Emulator::dispatch_one_pending_signal() m_cpu.push32(shadow_wrap_as_initialized(handler.handler)); m_cpu.push32(shadow_wrap_as_initialized(0u)); - ASSERT((m_cpu.esp().value() % 16) == 0); + VERIFY((m_cpu.esp().value() % 16) == 0); m_cpu.set_eip(m_signal_trampoline); } diff --git a/Userland/DevTools/UserspaceEmulator/MallocTracer.cpp b/Userland/DevTools/UserspaceEmulator/MallocTracer.cpp index f946803db2..f2a0a98935 100644 --- a/Userland/DevTools/UserspaceEmulator/MallocTracer.cpp +++ b/Userland/DevTools/UserspaceEmulator/MallocTracer.cpp @@ -60,8 +60,8 @@ void MallocTracer::target_did_malloc(Badge<SoftCPU>, FlatPtr address, size_t siz if (m_emulator.is_in_loader_code()) return; auto* region = m_emulator.mmu().find_region({ 0x23, address }); - ASSERT(region); - ASSERT(is<MmapRegion>(*region)); + VERIFY(region); + VERIFY(is<MmapRegion>(*region)); auto& mmap_region = static_cast<MmapRegion&>(*region); // Mark the containing mmap region as a malloc block! @@ -71,7 +71,7 @@ void MallocTracer::target_did_malloc(Badge<SoftCPU>, FlatPtr address, size_t siz memset(shadow_bits, 0, size); if (auto* existing_mallocation = find_mallocation(address)) { - ASSERT(existing_mallocation->freed); + VERIFY(existing_mallocation->freed); existing_mallocation->size = size; existing_mallocation->freed = false; existing_mallocation->malloc_backtrace = m_emulator.raw_backtrace(); @@ -110,7 +110,7 @@ ALWAYS_INLINE size_t MallocRegionMetadata::chunk_index_for_address(FlatPtr addre return 0; } auto chunk_offset = address - (this->address + sizeof(ChunkedBlock)); - ASSERT(this->chunk_size); + VERIFY(this->chunk_size); return chunk_offset / this->chunk_size; } @@ -143,15 +143,15 @@ void MallocTracer::target_did_realloc(Badge<SoftCPU>, FlatPtr address, size_t si if (m_emulator.is_in_loader_code()) return; auto* region = m_emulator.mmu().find_region({ 0x23, address }); - ASSERT(region); - ASSERT(is<MmapRegion>(*region)); + VERIFY(region); + VERIFY(is<MmapRegion>(*region)); auto& mmap_region = static_cast<MmapRegion&>(*region); - ASSERT(mmap_region.is_malloc_block()); + VERIFY(mmap_region.is_malloc_block()); auto* existing_mallocation = find_mallocation(address); - ASSERT(existing_mallocation); - ASSERT(!existing_mallocation->freed); + VERIFY(existing_mallocation); + VERIFY(!existing_mallocation->freed); size_t old_size = existing_mallocation->size; @@ -296,7 +296,7 @@ void MallocTracer::audit_write(const Region& region, FlatPtr address, size_t siz bool MallocTracer::is_reachable(const Mallocation& mallocation) const { - ASSERT(!mallocation.freed); + VERIFY(!mallocation.freed); bool reachable = false; diff --git a/Userland/DevTools/UserspaceEmulator/MallocTracer.h b/Userland/DevTools/UserspaceEmulator/MallocTracer.h index 53da97acf1..473f4bf2ea 100644 --- a/Userland/DevTools/UserspaceEmulator/MallocTracer.h +++ b/Userland/DevTools/UserspaceEmulator/MallocTracer.h @@ -105,7 +105,7 @@ ALWAYS_INLINE Mallocation* MallocTracer::find_mallocation(const Region& region, auto& mallocation = malloc_data->mallocation_for_address(address); if (!mallocation.used) return nullptr; - ASSERT(mallocation.contains(address)); + VERIFY(mallocation.contains(address)); return &mallocation; } diff --git a/Userland/DevTools/UserspaceEmulator/MmapRegion.cpp b/Userland/DevTools/UserspaceEmulator/MmapRegion.cpp index a5686cf273..70ea7ab2b3 100644 --- a/Userland/DevTools/UserspaceEmulator/MmapRegion.cpp +++ b/Userland/DevTools/UserspaceEmulator/MmapRegion.cpp @@ -48,7 +48,7 @@ NonnullOwnPtr<MmapRegion> MmapRegion::create_file_backed(u32 base, u32 size, u32 region->m_name = name; } region->m_data = (u8*)mmap_with_name(nullptr, size, prot, flags, fd, offset, name.is_empty() ? nullptr : name.characters()); - ASSERT(region->m_data != MAP_FAILED); + VERIFY(region->m_data != MAP_FAILED); return region; } @@ -82,7 +82,7 @@ ValueWithShadow<u8> MmapRegion::read8(FlatPtr offset) tracer->audit_read(*this, base() + offset, 1); } - ASSERT(offset < size()); + VERIFY(offset < size()); return { *reinterpret_cast<const u8*>(m_data + offset), *reinterpret_cast<const u8*>(m_shadow_data + offset) }; } @@ -99,7 +99,7 @@ ValueWithShadow<u16> MmapRegion::read16(u32 offset) tracer->audit_read(*this, base() + offset, 2); } - ASSERT(offset + 1 < size()); + VERIFY(offset + 1 < size()); return { *reinterpret_cast<const u16*>(m_data + offset), *reinterpret_cast<const u16*>(m_shadow_data + offset) }; } @@ -116,7 +116,7 @@ ValueWithShadow<u32> MmapRegion::read32(u32 offset) tracer->audit_read(*this, base() + offset, 4); } - ASSERT(offset + 3 < size()); + VERIFY(offset + 3 < size()); return { *reinterpret_cast<const u32*>(m_data + offset), *reinterpret_cast<const u32*>(m_shadow_data + offset) }; } @@ -133,7 +133,7 @@ ValueWithShadow<u64> MmapRegion::read64(u32 offset) tracer->audit_read(*this, base() + offset, 8); } - ASSERT(offset + 7 < size()); + VERIFY(offset + 7 < size()); return { *reinterpret_cast<const u64*>(m_data + offset), *reinterpret_cast<const u64*>(m_shadow_data + offset) }; } @@ -150,7 +150,7 @@ void MmapRegion::write8(u32 offset, ValueWithShadow<u8> value) tracer->audit_write(*this, base() + offset, 1); } - ASSERT(offset < size()); + VERIFY(offset < size()); *reinterpret_cast<u8*>(m_data + offset) = value.value(); *reinterpret_cast<u8*>(m_shadow_data + offset) = value.shadow(); } @@ -168,7 +168,7 @@ void MmapRegion::write16(u32 offset, ValueWithShadow<u16> value) tracer->audit_write(*this, base() + offset, 2); } - ASSERT(offset + 1 < size()); + VERIFY(offset + 1 < size()); *reinterpret_cast<u16*>(m_data + offset) = value.value(); *reinterpret_cast<u16*>(m_shadow_data + offset) = value.shadow(); } @@ -186,8 +186,8 @@ void MmapRegion::write32(u32 offset, ValueWithShadow<u32> value) tracer->audit_write(*this, base() + offset, 4); } - ASSERT(offset + 3 < size()); - ASSERT(m_data != m_shadow_data); + VERIFY(offset + 3 < size()); + VERIFY(m_data != m_shadow_data); *reinterpret_cast<u32*>(m_data + offset) = value.value(); *reinterpret_cast<u32*>(m_shadow_data + offset) = value.shadow(); } @@ -205,8 +205,8 @@ void MmapRegion::write64(u32 offset, ValueWithShadow<u64> value) tracer->audit_write(*this, base() + offset, 8); } - ASSERT(offset + 7 < size()); - ASSERT(m_data != m_shadow_data); + VERIFY(offset + 7 < size()); + VERIFY(m_data != m_shadow_data); *reinterpret_cast<u64*>(m_data + offset) = value.value(); *reinterpret_cast<u64*>(m_shadow_data + offset) = value.shadow(); } diff --git a/Userland/DevTools/UserspaceEmulator/Range.cpp b/Userland/DevTools/UserspaceEmulator/Range.cpp index af6b09d19d..635e8cf8c6 100644 --- a/Userland/DevTools/UserspaceEmulator/Range.cpp +++ b/Userland/DevTools/UserspaceEmulator/Range.cpp @@ -31,7 +31,7 @@ namespace UserspaceEmulator { Vector<Range, 2> Range::carve(const Range& taken) { - ASSERT((taken.size() % PAGE_SIZE) == 0); + VERIFY((taken.size() % PAGE_SIZE) == 0); Vector<Range, 2> parts; if (taken == *this) return {}; diff --git a/Userland/DevTools/UserspaceEmulator/RangeAllocator.cpp b/Userland/DevTools/UserspaceEmulator/RangeAllocator.cpp index f4f6fc1341..78135d923b 100644 --- a/Userland/DevTools/UserspaceEmulator/RangeAllocator.cpp +++ b/Userland/DevTools/UserspaceEmulator/RangeAllocator.cpp @@ -61,11 +61,11 @@ void RangeAllocator::dump() const void RangeAllocator::carve_at_index(int index, const Range& range) { auto remaining_parts = m_available_ranges[index].carve(range); - ASSERT(remaining_parts.size() >= 1); - ASSERT(m_total_range.contains(remaining_parts[0])); + VERIFY(remaining_parts.size() >= 1); + VERIFY(m_total_range.contains(remaining_parts[0])); m_available_ranges[index] = remaining_parts[0]; if (remaining_parts.size() == 2) { - ASSERT(m_total_range.contains(remaining_parts[1])); + VERIFY(m_total_range.contains(remaining_parts[1])); m_available_ranges.insert(index + 1, move(remaining_parts[1])); } } @@ -75,8 +75,8 @@ Optional<Range> RangeAllocator::allocate_randomized(size_t size, size_t alignmen if (!size) return {}; - ASSERT((size % PAGE_SIZE) == 0); - ASSERT((alignment % PAGE_SIZE) == 0); + VERIFY((size % PAGE_SIZE) == 0); + VERIFY((alignment % PAGE_SIZE) == 0); // FIXME: I'm sure there's a smarter way to do this. static constexpr size_t maximum_randomization_attempts = 1000; @@ -100,8 +100,8 @@ Optional<Range> RangeAllocator::allocate_anywhere(size_t size, size_t alignment) if (!size) return {}; - ASSERT((size % PAGE_SIZE) == 0); - ASSERT((alignment % PAGE_SIZE) == 0); + VERIFY((size % PAGE_SIZE) == 0); + VERIFY((alignment % PAGE_SIZE) == 0); #ifdef VM_GUARD_PAGES // NOTE: We pad VM allocations with a guard page on each side. @@ -128,7 +128,7 @@ Optional<Range> RangeAllocator::allocate_anywhere(size_t size, size_t alignment) FlatPtr aligned_base = round_up_to_power_of_two(initial_base, alignment); Range allocated_range(VirtualAddress(aligned_base), size); - ASSERT(m_total_range.contains(allocated_range)); + VERIFY(m_total_range.contains(allocated_range)); if (available_range == allocated_range) { m_available_ranges.remove(i); @@ -146,13 +146,13 @@ Optional<Range> RangeAllocator::allocate_specific(VirtualAddress base, size_t si if (!size) return {}; - ASSERT(base.is_page_aligned()); - ASSERT((size % PAGE_SIZE) == 0); + VERIFY(base.is_page_aligned()); + VERIFY((size % PAGE_SIZE) == 0); Range allocated_range(base, size); for (size_t i = 0; i < m_available_ranges.size(); ++i) { auto& available_range = m_available_ranges[i]; - ASSERT(m_total_range.contains(allocated_range)); + VERIFY(m_total_range.contains(allocated_range)); if (!available_range.contains(base, size)) continue; if (available_range == allocated_range) { @@ -167,11 +167,11 @@ Optional<Range> RangeAllocator::allocate_specific(VirtualAddress base, size_t si void RangeAllocator::deallocate(const Range& range) { - ASSERT(m_total_range.contains(range)); - ASSERT(range.size()); - ASSERT((range.size() % PAGE_SIZE) == 0); - ASSERT(range.base() < range.end()); - ASSERT(!m_available_ranges.is_empty()); + VERIFY(m_total_range.contains(range)); + VERIFY(range.size()); + VERIFY((range.size() % PAGE_SIZE) == 0); + VERIFY(range.base() < range.end()); + VERIFY(!m_available_ranges.is_empty()); size_t nearby_index = 0; auto* existing_range = binary_search( diff --git a/Userland/DevTools/UserspaceEmulator/SimpleRegion.cpp b/Userland/DevTools/UserspaceEmulator/SimpleRegion.cpp index 173efd0e32..cdfb299c46 100644 --- a/Userland/DevTools/UserspaceEmulator/SimpleRegion.cpp +++ b/Userland/DevTools/UserspaceEmulator/SimpleRegion.cpp @@ -45,52 +45,52 @@ SimpleRegion::~SimpleRegion() ValueWithShadow<u8> SimpleRegion::read8(FlatPtr offset) { - ASSERT(offset < size()); + VERIFY(offset < size()); return { *reinterpret_cast<const u8*>(m_data + offset), *reinterpret_cast<const u8*>(m_shadow_data + offset) }; } ValueWithShadow<u16> SimpleRegion::read16(u32 offset) { - ASSERT(offset + 1 < size()); + VERIFY(offset + 1 < size()); return { *reinterpret_cast<const u16*>(m_data + offset), *reinterpret_cast<const u16*>(m_shadow_data + offset) }; } ValueWithShadow<u32> SimpleRegion::read32(u32 offset) { - ASSERT(offset + 3 < size()); + VERIFY(offset + 3 < size()); return { *reinterpret_cast<const u32*>(m_data + offset), *reinterpret_cast<const u32*>(m_shadow_data + offset) }; } ValueWithShadow<u64> SimpleRegion::read64(u32 offset) { - ASSERT(offset + 7 < size()); + VERIFY(offset + 7 < size()); return { *reinterpret_cast<const u64*>(m_data + offset), *reinterpret_cast<const u64*>(m_shadow_data + offset) }; } void SimpleRegion::write8(u32 offset, ValueWithShadow<u8> value) { - ASSERT(offset < size()); + VERIFY(offset < size()); *reinterpret_cast<u8*>(m_data + offset) = value.value(); *reinterpret_cast<u8*>(m_shadow_data + offset) = value.shadow(); } void SimpleRegion::write16(u32 offset, ValueWithShadow<u16> value) { - ASSERT(offset + 1 < size()); + VERIFY(offset + 1 < size()); *reinterpret_cast<u16*>(m_data + offset) = value.value(); *reinterpret_cast<u16*>(m_shadow_data + offset) = value.shadow(); } void SimpleRegion::write32(u32 offset, ValueWithShadow<u32> value) { - ASSERT(offset + 3 < size()); + VERIFY(offset + 3 < size()); *reinterpret_cast<u32*>(m_data + offset) = value.value(); *reinterpret_cast<u32*>(m_shadow_data + offset) = value.shadow(); } void SimpleRegion::write64(u32 offset, ValueWithShadow<u64> value) { - ASSERT(offset + 7 < size()); + VERIFY(offset + 7 < size()); *reinterpret_cast<u64*>(m_data + offset) = value.value(); *reinterpret_cast<u64*>(m_shadow_data + offset) = value.shadow(); } diff --git a/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp b/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp index 17a03900d9..3ab0509ba0 100644 --- a/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp +++ b/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp @@ -124,14 +124,14 @@ void SoftCPU::did_receive_secret_data() if (auto* tracer = m_emulator.malloc_tracer()) tracer->target_did_realloc({}, m_secret_data[2], m_secret_data[1]); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } void SoftCPU::update_code_cache() { auto* region = m_emulator.mmu().find_region({ cs(), eip() }); - ASSERT(region); + VERIFY(region); if (!region->is_executable()) { reportln("SoftCPU::update_code_cache: Non-executable region @ {:p}", eip()); @@ -146,7 +146,7 @@ void SoftCPU::update_code_cache() ValueWithShadow<u8> SoftCPU::read_memory8(X86::LogicalAddress address) { - ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b); + VERIFY(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b); auto value = m_emulator.mmu().read8(address); #if MEMORY_DEBUG outln("\033[36;1mread_memory8: @{:04x}:{:08x} -> {:02x} ({:02x})\033[0m", address.selector(), address.offset(), value, value.shadow()); @@ -156,7 +156,7 @@ ValueWithShadow<u8> SoftCPU::read_memory8(X86::LogicalAddress address) ValueWithShadow<u16> SoftCPU::read_memory16(X86::LogicalAddress address) { - ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b); + VERIFY(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b); auto value = m_emulator.mmu().read16(address); #if MEMORY_DEBUG outln("\033[36;1mread_memory16: @{:04x}:{:08x} -> {:04x} ({:04x})\033[0m", address.selector(), address.offset(), value, value.shadow()); @@ -166,7 +166,7 @@ ValueWithShadow<u16> SoftCPU::read_memory16(X86::LogicalAddress address) ValueWithShadow<u32> SoftCPU::read_memory32(X86::LogicalAddress address) { - ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b); + VERIFY(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b); auto value = m_emulator.mmu().read32(address); #if MEMORY_DEBUG outln("\033[36;1mread_memory32: @{:04x}:{:08x} -> {:08x} ({:08x})\033[0m", address.selector(), address.offset(), value, value.shadow()); @@ -176,7 +176,7 @@ ValueWithShadow<u32> SoftCPU::read_memory32(X86::LogicalAddress address) ValueWithShadow<u64> SoftCPU::read_memory64(X86::LogicalAddress address) { - ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b); + VERIFY(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b); auto value = m_emulator.mmu().read64(address); #if MEMORY_DEBUG outln("\033[36;1mread_memory64: @{:04x}:{:08x} -> {:016x} ({:016x})\033[0m", address.selector(), address.offset(), value, value.shadow()); @@ -186,7 +186,7 @@ ValueWithShadow<u64> SoftCPU::read_memory64(X86::LogicalAddress address) void SoftCPU::write_memory8(X86::LogicalAddress address, ValueWithShadow<u8> value) { - ASSERT(address.selector() == 0x23 || address.selector() == 0x2b); + VERIFY(address.selector() == 0x23 || address.selector() == 0x2b); #if MEMORY_DEBUG outln("\033[36;1mwrite_memory8: @{:04x}:{:08x} <- {:02x} ({:02x})\033[0m", address.selector(), address.offset(), value, value.shadow()); #endif @@ -195,7 +195,7 @@ void SoftCPU::write_memory8(X86::LogicalAddress address, ValueWithShadow<u8> val void SoftCPU::write_memory16(X86::LogicalAddress address, ValueWithShadow<u16> value) { - ASSERT(address.selector() == 0x23 || address.selector() == 0x2b); + VERIFY(address.selector() == 0x23 || address.selector() == 0x2b); #if MEMORY_DEBUG outln("\033[36;1mwrite_memory16: @{:04x}:{:08x} <- {:04x} ({:04x})\033[0m", address.selector(), address.offset(), value, value.shadow()); #endif @@ -204,7 +204,7 @@ void SoftCPU::write_memory16(X86::LogicalAddress address, ValueWithShadow<u16> v void SoftCPU::write_memory32(X86::LogicalAddress address, ValueWithShadow<u32> value) { - ASSERT(address.selector() == 0x23 || address.selector() == 0x2b); + VERIFY(address.selector() == 0x23 || address.selector() == 0x2b); #if MEMORY_DEBUG outln("\033[36;1mwrite_memory32: @{:04x}:{:08x} <- {:08x} ({:08x})\033[0m", address.selector(), address.offset(), value, value.shadow()); #endif @@ -213,7 +213,7 @@ void SoftCPU::write_memory32(X86::LogicalAddress address, ValueWithShadow<u32> v void SoftCPU::write_memory64(X86::LogicalAddress address, ValueWithShadow<u64> value) { - ASSERT(address.selector() == 0x23 || address.selector() == 0x2b); + VERIFY(address.selector() == 0x23 || address.selector() == 0x2b); #if MEMORY_DEBUG outln("\033[36;1mwrite_memory64: @{:04x}:{:08x} <- {:016x} ({:016x})\033[0m", address.selector(), address.offset(), value, value.shadow()); #endif @@ -363,7 +363,7 @@ ALWAYS_INLINE static T op_xor(SoftCPU& cpu, const T& dest, const T& src) : "=a"(result) : "a"(dest.value()), "c"(src.value())); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } asm volatile( @@ -395,7 +395,7 @@ ALWAYS_INLINE static T op_or(SoftCPU& cpu, const T& dest, const T& src) : "=a"(result) : "a"(dest.value()), "c"(src.value())); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } asm volatile( @@ -427,7 +427,7 @@ ALWAYS_INLINE static T op_sub(SoftCPU& cpu, const T& dest, const T& src) : "=a"(result) : "a"(dest.value()), "c"(src.value())); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } asm volatile( @@ -464,7 +464,7 @@ ALWAYS_INLINE static T op_sbb_impl(SoftCPU& cpu, const T& dest, const T& src) : "=a"(result) : "a"(dest.value()), "c"(src.value())); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } asm volatile( @@ -505,7 +505,7 @@ ALWAYS_INLINE static T op_add(SoftCPU& cpu, T& dest, const T& src) : "=a"(result) : "a"(dest.value()), "c"(src.value())); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } asm volatile( @@ -542,7 +542,7 @@ ALWAYS_INLINE static T op_adc_impl(SoftCPU& cpu, T& dest, const T& src) : "=a"(result) : "a"(dest.value()), "c"(src.value())); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } asm volatile( @@ -583,7 +583,7 @@ ALWAYS_INLINE static T op_and(SoftCPU& cpu, const T& dest, const T& src) : "=a"(result) : "a"(dest.value()), "c"(src.value())); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } asm volatile( @@ -1152,7 +1152,7 @@ ALWAYS_INLINE void BTx_RM16_imm8(SoftCPU& cpu, const X86::Instruction& insn, Op unsigned bit_index = insn.imm8() & (X86::TypeTrivia<u16>::mask); // FIXME: Support higher bit indices - ASSERT(bit_index < 16); + VERIFY(bit_index < 16); auto original = insn.modrm().read16(cpu, insn); u16 bit_mask = 1 << bit_index; @@ -1169,7 +1169,7 @@ ALWAYS_INLINE void BTx_RM32_imm8(SoftCPU& cpu, const X86::Instruction& insn, Op unsigned bit_index = insn.imm8() & (X86::TypeTrivia<u32>::mask); // FIXME: Support higher bit indices - ASSERT(bit_index < 32); + VERIFY(bit_index < 32); auto original = insn.modrm().read32(cpu, insn); u32 bit_mask = 1 << bit_index; @@ -1551,7 +1551,7 @@ void SoftCPU::FLD_RM32(const X86::Instruction& insn) void SoftCPU::FXCH(const X86::Instruction& insn) { - ASSERT(insn.modrm().is_register()); + VERIFY(insn.modrm().is_register()); auto tmp = fpu_get(0); fpu_set(0, fpu_get(insn.modrm().register_index())); fpu_set(insn.modrm().register_index(), tmp); @@ -1559,7 +1559,7 @@ void SoftCPU::FXCH(const X86::Instruction& insn) void SoftCPU::FST_RM32(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); float f32 = (float)fpu_get(0); // FIXME: Respect shadow values insn.modrm().write32(*this, insn, shadow_wrap_as_initialized(bit_cast<u32>(f32))); @@ -1645,7 +1645,7 @@ void SoftCPU::FCOS(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::FIADD_RM32(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m32int = (i32)insn.modrm().read32(*this, insn).value(); // FIXME: Respect shadow values fpu_set(0, fpu_get(0) + (long double)m32int); @@ -1655,7 +1655,7 @@ void SoftCPU::FCMOVB(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::FIMUL_RM32(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m32int = (i32)insn.modrm().read32(*this, insn).value(); // FIXME: Respect shadow values fpu_set(0, fpu_get(0) * (long double)m32int); @@ -1675,7 +1675,7 @@ void SoftCPU::FCMOVU(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::FISUB_RM32(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m32int = (i32)insn.modrm().read32(*this, insn).value(); // FIXME: Respect shadow values fpu_set(0, fpu_get(0) - (long double)m32int); @@ -1683,7 +1683,7 @@ void SoftCPU::FISUB_RM32(const X86::Instruction& insn) void SoftCPU::FISUBR_RM32(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m32int = (i32)insn.modrm().read32(*this, insn).value(); // FIXME: Respect shadow values fpu_set(0, (long double)m32int - fpu_get(0)); @@ -1693,7 +1693,7 @@ void SoftCPU::FUCOMPP(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::FIDIV_RM32(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m32int = (i32)insn.modrm().read32(*this, insn).value(); // FIXME: Respect shadow values // FIXME: Raise IA on 0 / _=0, raise Z on finite / +-0 @@ -1702,7 +1702,7 @@ void SoftCPU::FIDIV_RM32(const X86::Instruction& insn) void SoftCPU::FIDIVR_RM32(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m32int = (i32)insn.modrm().read32(*this, insn).value(); // FIXME: Respect shadow values // FIXME: Raise IA on 0 / _=0, raise Z on finite / +-0 @@ -1711,7 +1711,7 @@ void SoftCPU::FIDIVR_RM32(const X86::Instruction& insn) void SoftCPU::FILD_RM32(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m32int = (i32)insn.modrm().read32(*this, insn).value(); // FIXME: Respect shadow values fpu_push((long double)m32int); @@ -1723,7 +1723,7 @@ void SoftCPU::FCMOVNE(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::FIST_RM32(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto f = fpu_get(0); // FIXME: Respect rounding mode in m_fpu_cw. auto i32 = static_cast<int32_t>(f); @@ -1871,7 +1871,7 @@ void SoftCPU::FDIVR_RM64(const X86::Instruction& insn) void SoftCPU::FLD_RM64(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto new_f64 = insn.modrm().read64(*this, insn); // FIXME: Respect shadow values fpu_push(bit_cast<double>(new_f64.value())); @@ -1905,7 +1905,7 @@ void SoftCPU::FNSTSW(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::FIADD_RM16(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m16int = (i16)insn.modrm().read16(*this, insn).value(); // FIXME: Respect shadow values fpu_set(0, fpu_get(0) + (long double)m16int); @@ -1913,14 +1913,14 @@ void SoftCPU::FIADD_RM16(const X86::Instruction& insn) void SoftCPU::FADDP(const X86::Instruction& insn) { - ASSERT(insn.modrm().is_register()); + VERIFY(insn.modrm().is_register()); fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) + fpu_get(0)); fpu_pop(); } void SoftCPU::FIMUL_RM16(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m16int = (i16)insn.modrm().read16(*this, insn).value(); // FIXME: Respect shadow values fpu_set(0, fpu_get(0) * (long double)m16int); @@ -1928,7 +1928,7 @@ void SoftCPU::FIMUL_RM16(const X86::Instruction& insn) void SoftCPU::FMULP(const X86::Instruction& insn) { - ASSERT(insn.modrm().is_register()); + VERIFY(insn.modrm().is_register()); fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) * fpu_get(0)); fpu_pop(); } @@ -1939,7 +1939,7 @@ void SoftCPU::FCOMPP(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::FISUB_RM16(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m16int = (i16)insn.modrm().read16(*this, insn).value(); // FIXME: Respect shadow values fpu_set(0, fpu_get(0) - (long double)m16int); @@ -1947,14 +1947,14 @@ void SoftCPU::FISUB_RM16(const X86::Instruction& insn) void SoftCPU::FSUBRP(const X86::Instruction& insn) { - ASSERT(insn.modrm().is_register()); + VERIFY(insn.modrm().is_register()); fpu_set(insn.modrm().register_index(), fpu_get(0) - fpu_get(insn.modrm().register_index())); fpu_pop(); } void SoftCPU::FISUBR_RM16(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m16int = (i16)insn.modrm().read16(*this, insn).value(); // FIXME: Respect shadow values fpu_set(0, (long double)m16int - fpu_get(0)); @@ -1962,14 +1962,14 @@ void SoftCPU::FISUBR_RM16(const X86::Instruction& insn) void SoftCPU::FSUBP(const X86::Instruction& insn) { - ASSERT(insn.modrm().is_register()); + VERIFY(insn.modrm().is_register()); fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) - fpu_get(0)); fpu_pop(); } void SoftCPU::FIDIV_RM16(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m16int = (i16)insn.modrm().read16(*this, insn).value(); // FIXME: Respect shadow values // FIXME: Raise IA on 0 / _=0, raise Z on finite / +-0 @@ -1978,7 +1978,7 @@ void SoftCPU::FIDIV_RM16(const X86::Instruction& insn) void SoftCPU::FDIVRP(const X86::Instruction& insn) { - ASSERT(insn.modrm().is_register()); + VERIFY(insn.modrm().is_register()); // FIXME: Raise IA on + infinity / +-infinitiy, +-0 / +-0, raise Z on finite / +-0 fpu_set(insn.modrm().register_index(), fpu_get(0) / fpu_get(insn.modrm().register_index())); fpu_pop(); @@ -1986,7 +1986,7 @@ void SoftCPU::FDIVRP(const X86::Instruction& insn) void SoftCPU::FIDIVR_RM16(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m16int = (i16)insn.modrm().read16(*this, insn).value(); // FIXME: Respect shadow values // FIXME: Raise IA on 0 / _=0, raise Z on finite / +-0 @@ -1995,7 +1995,7 @@ void SoftCPU::FIDIVR_RM16(const X86::Instruction& insn) void SoftCPU::FDIVP(const X86::Instruction& insn) { - ASSERT(insn.modrm().is_register()); + VERIFY(insn.modrm().is_register()); // FIXME: Raise IA on + infinity / +-infinitiy, +-0 / +-0, raise Z on finite / +-0 fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) / fpu_get(0)); fpu_pop(); @@ -2003,7 +2003,7 @@ void SoftCPU::FDIVP(const X86::Instruction& insn) void SoftCPU::FILD_RM16(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m16int = (i16)insn.modrm().read16(*this, insn).value(); // FIXME: Respect shadow values fpu_push((long double)m16int); @@ -2014,7 +2014,7 @@ void SoftCPU::FISTTP_RM16(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::FIST_RM16(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto f = fpu_get(0); // FIXME: Respect rounding mode in m_fpu_cw. auto i16 = static_cast<int16_t>(f); @@ -2033,7 +2033,7 @@ void SoftCPU::FNSTSW_AX(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::FILD_RM64(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto m64int = (i64)insn.modrm().read64(*this, insn).value(); // FIXME: Respect shadow values fpu_push((long double)m64int); @@ -2055,7 +2055,7 @@ void SoftCPU::FCOMIP(const X86::Instruction& insn) void SoftCPU::FISTP_RM64(const X86::Instruction& insn) { - ASSERT(!insn.modrm().is_register()); + VERIFY(!insn.modrm().is_register()); auto f = fpu_pop(); // FIXME: Respect rounding mode in m_fpu_cw. auto i64 = static_cast<int64_t>(f); @@ -2241,7 +2241,7 @@ void SoftCPU::INTO(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::INT_imm8(const X86::Instruction& insn) { - ASSERT(insn.imm8() == 0x82); + VERIFY(insn.imm8() == 0x82); // FIXME: virt_syscall should take ValueWithShadow and whine about uninitialized arguments set_eax(shadow_wrap_as_initialized(m_emulator.virt_syscall(eax().value(), edx().value(), ecx().value(), ebx().value()))); } @@ -2745,7 +2745,7 @@ void SoftCPU::PUSH_imm32(const X86::Instruction& insn) void SoftCPU::PUSH_imm8(const X86::Instruction& insn) { - ASSERT(!insn.has_operand_size_override_prefix()); + VERIFY(!insn.has_operand_size_override_prefix()); push32(shadow_wrap_as_initialized<u32>(sign_extended_to<i32>(insn.imm8()))); } @@ -2872,7 +2872,7 @@ void SoftCPU::RDTSC(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::RET(const X86::Instruction& insn) { - ASSERT(!insn.has_operand_size_override_prefix()); + VERIFY(!insn.has_operand_size_override_prefix()); auto ret_address = pop32(); warn_if_uninitialized(ret_address, "ret"); set_eip(ret_address.value()); @@ -2883,7 +2883,7 @@ void SoftCPU::RETF_imm16(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::RET_imm16(const X86::Instruction& insn) { - ASSERT(!insn.has_operand_size_override_prefix()); + VERIFY(!insn.has_operand_size_override_prefix()); auto ret_address = pop32(); warn_if_uninitialized(ret_address, "ret imm16"); set_eip(ret_address.value()); diff --git a/Userland/DevTools/UserspaceEmulator/SoftCPU.h b/Userland/DevTools/UserspaceEmulator/SoftCPU.h index 89ece8976d..21619c0c0d 100644 --- a/Userland/DevTools/UserspaceEmulator/SoftCPU.h +++ b/Userland/DevTools/UserspaceEmulator/SoftCPU.h @@ -118,7 +118,7 @@ public: case X86::RegisterDH: return { m_gpr[X86::RegisterEDX].high_u8, m_gpr_shadow[X86::RegisterEDX].high_u8 }; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } ValueWithShadow<u8> const_gpr8(X86::RegisterIndex8 reg) const @@ -141,7 +141,7 @@ public: case X86::RegisterDH: return { m_gpr[X86::RegisterEDX].high_u8, m_gpr_shadow[X86::RegisterEDX].high_u8 }; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } ValueWithShadow<u16> const_gpr16(X86::RegisterIndex16 reg) const @@ -431,7 +431,7 @@ public: case 15: return !((sf() ^ of()) | zf()); // NLE, G default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return 0; } @@ -1140,12 +1140,12 @@ private: } long double fpu_get(int i) { - ASSERT(i >= 0 && i <= m_fpu_top); + VERIFY(i >= 0 && i <= m_fpu_top); return m_fpu[m_fpu_top - i]; } void fpu_set(int i, long double n) { - ASSERT(i >= 0 && i <= m_fpu_top); + VERIFY(i >= 0 && i <= m_fpu_top); m_fpu[m_fpu_top - i] = n; } diff --git a/Userland/DevTools/UserspaceEmulator/SoftMMU.cpp b/Userland/DevTools/UserspaceEmulator/SoftMMU.cpp index 1822cb36d2..af835347e6 100644 --- a/Userland/DevTools/UserspaceEmulator/SoftMMU.cpp +++ b/Userland/DevTools/UserspaceEmulator/SoftMMU.cpp @@ -40,7 +40,7 @@ SoftMMU::SoftMMU(Emulator& emulator) void SoftMMU::add_region(NonnullOwnPtr<Region> region) { - ASSERT(!find_region({ 0x23, region->base() })); + VERIFY(!find_region({ 0x23, region->base() })); size_t first_page_in_region = region->base() / PAGE_SIZE; size_t last_page_in_region = (region->base() + region->size() - 1) / PAGE_SIZE; @@ -63,7 +63,7 @@ void SoftMMU::remove_region(Region& region) void SoftMMU::set_tls_region(NonnullOwnPtr<Region> region) { - ASSERT(!m_tls_region); + VERIFY(!m_tls_region); m_tls_region = move(region); } diff --git a/Userland/DynamicLoader/main.cpp b/Userland/DynamicLoader/main.cpp index d1c7a2d029..43545dcd48 100644 --- a/Userland/DynamicLoader/main.cpp +++ b/Userland/DynamicLoader/main.cpp @@ -55,7 +55,7 @@ static void perform_self_relocations(auxv_t* auxvp) found_base_address = true; } } - ASSERT(found_base_address); + VERIFY(found_base_address); Elf32_Ehdr* header = (Elf32_Ehdr*)(base_address); Elf32_Phdr* pheader = (Elf32_Phdr*)(base_address + header->e_phoff); u32 dynamic_section_addr = 0; @@ -131,10 +131,10 @@ void _start(int argc, char** argv, char** envp) _exit(1); } - ASSERT(main_program_fd >= 0); - ASSERT(!main_program_name.is_empty()); + VERIFY(main_program_fd >= 0); + VERIFY(!main_program_name.is_empty()); ELF::DynamicLinker::linker_main(move(main_program_name), main_program_fd, is_secure, argc, argv, envp); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Games/2048/BoardView.cpp b/Userland/Games/2048/BoardView.cpp index 230c1eedc5..5730c494d6 100644 --- a/Userland/Games/2048/BoardView.cpp +++ b/Userland/Games/2048/BoardView.cpp @@ -165,7 +165,7 @@ Gfx::Color BoardView::background_color_for_cell(u32 value) case 2048: return Color::from_rgb(0xedc22e); default: - ASSERT(value > 2048); + VERIFY(value > 2048); return Color::from_rgb(0x3c3a32); } } diff --git a/Userland/Games/Chess/ChessWidget.cpp b/Userland/Games/Chess/ChessWidget.cpp index c3c083f8d0..ec622f012f 100644 --- a/Userland/Games/Chess/ChessWidget.cpp +++ b/Userland/Games/Chess/ChessWidget.cpp @@ -270,7 +270,7 @@ void ChessWidget::mouseup_event(GUI::MouseEvent& event) msg = "Draw by insufficient material."; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (over) { set_drag_enabled(false); @@ -420,7 +420,7 @@ void ChessWidget::input_engine_move() if (!want_engine_move()) return; set_drag_enabled(drag_was_enabled); - ASSERT(board().apply_move(move)); + VERIFY(board().apply_move(move)); m_playback_move_number = m_board.moves().size(); m_playback = false; m_board_markings.clear(); @@ -464,7 +464,7 @@ void ChessWidget::playback_move(PlaybackDirection direction) } break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } update(); } diff --git a/Userland/Games/Chess/Engine.cpp b/Userland/Games/Chess/Engine.cpp index f02a4a5f5b..a0ccc72ba7 100644 --- a/Userland/Games/Chess/Engine.cpp +++ b/Userland/Games/Chess/Engine.cpp @@ -43,12 +43,12 @@ Engine::Engine(const StringView& command) int rpipefds[2]; if (pipe2(wpipefds, O_CLOEXEC) < 0) { perror("pipe2"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (pipe2(rpipefds, O_CLOEXEC) < 0) { perror("pipe2"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } posix_spawn_file_actions_t file_actions; @@ -60,7 +60,7 @@ Engine::Engine(const StringView& command) const char* argv[] = { cstr.characters(), nullptr }; if (posix_spawnp(&m_pid, cstr.characters(), &file_actions, nullptr, const_cast<char**>(argv), environ) < 0) { perror("posix_spawnp"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } posix_spawn_file_actions_destroy(&file_actions); diff --git a/Userland/Games/Conway/Game.cpp b/Userland/Games/Conway/Game.cpp index 83823eca92..52105fe447 100644 --- a/Userland/Games/Conway/Game.cpp +++ b/Userland/Games/Conway/Game.cpp @@ -177,6 +177,6 @@ void Game::interact_at(const Gfx::IntPoint& point) m_universe[cell_y][cell_x] = false; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Games/Minesweeper/Field.cpp b/Userland/Games/Minesweeper/Field.cpp index 2bec8dcc27..a859486884 100644 --- a/Userland/Games/Minesweeper/Field.cpp +++ b/Userland/Games/Minesweeper/Field.cpp @@ -416,7 +416,7 @@ void Field::on_square_right_clicked(Square& square) void Field::set_flag(Square& square, bool flag) { - ASSERT(!square.is_swept); + VERIFY(!square.is_swept); if (square.has_flag == flag) return; square.is_considering = false; @@ -425,7 +425,7 @@ void Field::set_flag(Square& square, bool flag) ++m_flags_left; } else { - ASSERT(m_flags_left); + VERIFY(m_flags_left); --m_flags_left; } square.has_flag = flag; diff --git a/Userland/Games/Solitaire/Card.cpp b/Userland/Games/Solitaire/Card.cpp index 23c3473632..1887393bb0 100644 --- a/Userland/Games/Solitaire/Card.cpp +++ b/Userland/Games/Solitaire/Card.cpp @@ -85,7 +85,7 @@ Card::Card(Type type, uint8_t value) , m_type(type) , m_value(value) { - ASSERT(value < card_count); + VERIFY(value < card_count); Gfx::IntRect paint_rect({ 0, 0 }, { width, height }); if (s_background.is_null()) { @@ -94,7 +94,7 @@ Card::Card(Type type, uint8_t value) s_background->fill(Color::White); auto image = Gfx::Bitmap::load_from_file("/res/icons/solitaire/buggie-deck.png"); - ASSERT(!image.is_null()); + VERIFY(!image.is_null()); float aspect_ratio = image->width() / static_cast<float>(image->height()); auto target_size = Gfx::IntSize(static_cast<int>(aspect_ratio * (height - 5)), height - 5); @@ -132,7 +132,7 @@ Card::Card(Type type, uint8_t value) symbol = s_heart; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } painter.draw_bitmap( @@ -152,7 +152,7 @@ Card::~Card() void Card::draw(GUI::Painter& painter) const { - ASSERT(!s_background.is_null()); + VERIFY(!s_background.is_null()); painter.blit(position(), m_upside_down ? *s_background : *m_front, m_front->rect()); } diff --git a/Userland/Games/Solitaire/CardStack.cpp b/Userland/Games/Solitaire/CardStack.cpp index bb2b1bade5..4e5953420b 100644 --- a/Userland/Games/Solitaire/CardStack.cpp +++ b/Userland/Games/Solitaire/CardStack.cpp @@ -39,7 +39,7 @@ CardStack::CardStack(const Gfx::IntPoint& position, Type type) , m_rules(rules_for_type(type)) , m_base(m_position, { Card::width, Card::height }) { - ASSERT(type != Invalid); + VERIFY(type != Invalid); calculate_bounding_box(); } @@ -77,7 +77,7 @@ void CardStack::draw(GUI::Painter& painter, const Gfx::Color& background_color) painter.draw_rect(m_base, background_color.darkened(0.5)); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (is_empty()) @@ -99,7 +99,7 @@ void CardStack::draw(GUI::Painter& painter, const Gfx::Color& background_color) void CardStack::rebound_cards() { - ASSERT(m_stack_positions.size() == m_stack.size()); + VERIFY(m_stack_positions.size() == m_stack.size()); size_t card_index = 0; for (auto& card : m_stack) @@ -108,7 +108,7 @@ void CardStack::rebound_cards() void CardStack::add_all_grabbed_cards(const Gfx::IntPoint& click_location, NonnullRefPtrVector<Card>& grabbed) { - ASSERT(grabbed.is_empty()); + VERIFY(grabbed.is_empty()); if (m_type != Normal) { auto& top_card = peek(); @@ -171,7 +171,7 @@ bool CardStack::is_allowed_to_push(const Card& card) const return top_card.color() != card.color() && top_card.value() == card.value() + 1; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return true; diff --git a/Userland/Games/Solitaire/SolitaireWidget.cpp b/Userland/Games/Solitaire/SolitaireWidget.cpp index d6497db677..fbf1cc7eb1 100644 --- a/Userland/Games/Solitaire/SolitaireWidget.cpp +++ b/Userland/Games/Solitaire/SolitaireWidget.cpp @@ -71,7 +71,7 @@ void SolitaireWidget::tick(GUI::Window& window) return; if (m_game_over_animation) { - ASSERT(!m_animation.card().is_null()); + VERIFY(!m_animation.card().is_null()); if (m_animation.card()->position().x() > SolitaireWidget::width || m_animation.card()->rect().right() < 0) create_new_animation_card(); diff --git a/Userland/Games/Solitaire/SolitaireWidget.h b/Userland/Games/Solitaire/SolitaireWidget.h index 213251715d..e32cf05a24 100644 --- a/Userland/Games/Solitaire/SolitaireWidget.h +++ b/Userland/Games/Solitaire/SolitaireWidget.h @@ -60,7 +60,7 @@ private: void tick() { - ASSERT(!m_animation_card.is_null()); + VERIFY(!m_animation_card.is_null()); m_y_velocity += m_gravity; if (m_animation_card->position().y() + Card::height + m_y_velocity > SolitaireWidget::height + 1 && m_y_velocity > 0) { diff --git a/Userland/Libraries/LibAudio/Buffer.cpp b/Userland/Libraries/LibAudio/Buffer.cpp index 7ee2c88343..274f01af90 100644 --- a/Userland/Libraries/LibAudio/Buffer.cpp +++ b/Userland/Libraries/LibAudio/Buffer.cpp @@ -70,7 +70,7 @@ static void read_samples_from_stream(InputMemoryStream& stream, SampleReader rea } break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -127,13 +127,13 @@ RefPtr<Buffer> Buffer::from_pcm_stream(InputMemoryStream& stream, ResampleHelper read_samples_from_stream(stream, read_norm_sample_24, fdata, resampler, num_channels); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // We should handle this in a better way above, but for now -- // just make sure we're good. Worst case we just write some 0s where they // don't belong. - ASSERT(!stream.handle_any_error()); + VERIFY(!stream.handle_any_error()); return Buffer::create_with_samples(move(fdata)); } diff --git a/Userland/Libraries/LibAudio/WavLoader.cpp b/Userland/Libraries/LibAudio/WavLoader.cpp index d456c91dfd..23c013ef50 100644 --- a/Userland/Libraries/LibAudio/WavLoader.cpp +++ b/Userland/Libraries/LibAudio/WavLoader.cpp @@ -174,7 +174,7 @@ bool WavLoaderPlugin::parse_header() u32 sz = read_u32(); ok = ok && sz < 1024 * 1024 * 1024; // arbitrary CHECK_OK("File size"); - ASSERT(sz < 1024 * 1024 * 1024); + VERIFY(sz < 1024 * 1024 * 1024); u32 wave = read_u32(); ok = ok && wave == 0x45564157; // "WAVE" @@ -187,12 +187,12 @@ bool WavLoaderPlugin::parse_header() u32 fmt_size = read_u32(); ok = ok && fmt_size == 16; CHECK_OK("FMT size"); - ASSERT(fmt_size == 16); + VERIFY(fmt_size == 16); u16 audio_format = read_u16(); CHECK_OK("Audio format"); // incomplete read check ok = ok && audio_format == 1; // WAVE_FORMAT_PCM - ASSERT(audio_format == 1); + VERIFY(audio_format == 1); CHECK_OK("Audio format"); // value check m_num_channels = read_u16(); @@ -211,7 +211,7 @@ bool WavLoaderPlugin::parse_header() m_bits_per_sample = read_u16(); CHECK_OK("Bits per sample"); // incomplete read check ok = ok && (m_bits_per_sample == 8 || m_bits_per_sample == 16 || m_bits_per_sample == 24); - ASSERT(m_bits_per_sample == 8 || m_bits_per_sample == 16 || m_bits_per_sample == 24); + VERIFY(m_bits_per_sample == 8 || m_bits_per_sample == 16 || m_bits_per_sample == 24); CHECK_OK("Bits per sample"); // value check // Read chunks until we find DATA @@ -241,7 +241,7 @@ bool WavLoaderPlugin::parse_header() ok = ok && found_data; CHECK_OK("Found no data chunk"); - ASSERT(found_data); + VERIFY(found_data); ok = ok && data_sz < INT32_MAX; CHECK_OK("Data was too large"); diff --git a/Userland/Libraries/LibAudio/WavWriter.cpp b/Userland/Libraries/LibAudio/WavWriter.cpp index e60c5ccfd9..84eb7e8b2b 100644 --- a/Userland/Libraries/LibAudio/WavWriter.cpp +++ b/Userland/Libraries/LibAudio/WavWriter.cpp @@ -68,7 +68,7 @@ void WavWriter::write_samples(const u8* samples, size_t size) void WavWriter::finalize() { - ASSERT(!m_finalized); + VERIFY(!m_finalized); m_finalized = true; if (m_file) { m_file->seek(0); diff --git a/Userland/Libraries/LibC/assert.h b/Userland/Libraries/LibC/assert.h index 055553514b..7b8d26de9d 100644 --- a/Userland/Libraries/LibC/assert.h +++ b/Userland/Libraries/LibC/assert.h @@ -39,18 +39,18 @@ __attribute__((noreturn)) void __assertion_failed(const char* msg); if (__builtin_expect(!(expr), 0)) \ __assertion_failed(#expr "\n" __FILE__ ":" __stringify(__LINE__)); \ } while (0) -# define ASSERT_NOT_REACHED() assert(false) +# define VERIFY_NOT_REACHED() assert(false) #else # define assert(expr) ((void)(0)) -# define ASSERT_NOT_REACHED() CRASH() +# define VERIFY_NOT_REACHED() CRASH() #endif #define CRASH() \ do { \ asm volatile("ud2"); \ } while (0) -#define ASSERT assert +#define VERIFY assert #define RELEASE_ASSERT assert -#define TODO ASSERT_NOT_REACHED +#define TODO VERIFY_NOT_REACHED __END_DECLS diff --git a/Userland/Libraries/LibC/cxxabi.cpp b/Userland/Libraries/LibC/cxxabi.cpp index cfb5283e35..073956c189 100644 --- a/Userland/Libraries/LibC/cxxabi.cpp +++ b/Userland/Libraries/LibC/cxxabi.cpp @@ -110,7 +110,7 @@ void __cxa_finalize(void* dso_handle) [[noreturn]] void __cxa_pure_virtual() { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } // extern "C" diff --git a/Userland/Libraries/LibC/dirent.cpp b/Userland/Libraries/LibC/dirent.cpp index 504fa70367..e727c5ec1c 100644 --- a/Userland/Libraries/LibC/dirent.cpp +++ b/Userland/Libraries/LibC/dirent.cpp @@ -194,7 +194,7 @@ int readdir_r(DIR* dirp, struct dirent* entry, struct dirent** result) int dirfd(DIR* dirp) { - ASSERT(dirp); + VERIFY(dirp); return dirp->fd; } } diff --git a/Userland/Libraries/LibC/dlfcn.cpp b/Userland/Libraries/LibC/dlfcn.cpp index 49cd5b3930..9565246406 100644 --- a/Userland/Libraries/LibC/dlfcn.cpp +++ b/Userland/Libraries/LibC/dlfcn.cpp @@ -104,7 +104,7 @@ void* dlopen(const char* filename, int flags) void* dlsym(void* handle, const char* symbol_name) { // FIXME: When called with a NULL handle we're supposed to search every dso in the process... that'll get expensive - ASSERT(handle); + VERIFY(handle); auto* dso = reinterpret_cast<ELF::DynamicLoader*>(handle); void* symbol = dso->symbol_for_name(symbol_name); if (!symbol) { diff --git a/Userland/Libraries/LibC/getopt.cpp b/Userland/Libraries/LibC/getopt.cpp index a8142262d7..f12032a5ec 100644 --- a/Userland/Libraries/LibC/getopt.cpp +++ b/Userland/Libraries/LibC/getopt.cpp @@ -142,7 +142,7 @@ int OptionParser::getopt() if (should_reorder_argv) shift_argv(); else - ASSERT(optind == static_cast<int>(m_arg_index)); + VERIFY(optind == static_cast<int>(m_arg_index)); optind += m_consumed_args; return res; @@ -152,7 +152,7 @@ bool OptionParser::lookup_short_option(char option, int& needs_value) const { Vector<StringView> parts = m_short_options.split_view(option, true); - ASSERT(parts.size() <= 2); + VERIFY(parts.size() <= 2); if (parts.size() < 2) { // Haven't found the option in the spec. return false; @@ -175,7 +175,7 @@ bool OptionParser::lookup_short_option(char option, int& needs_value) const int OptionParser::handle_short_option() { StringView arg = m_argv[m_arg_index]; - ASSERT(arg.starts_with('-')); + VERIFY(arg.starts_with('-')); if (s_index_into_multioption_argument == 0) { // Just starting to parse this argument, skip the "-". @@ -245,7 +245,7 @@ const option* OptionParser::lookup_long_option(char* raw) const optarg = nullptr; return &option; } - ASSERT(arg.length() > name.length()); + VERIFY(arg.length() > name.length()); if (arg[name.length()] == '=') { optarg = raw + name.length() + 1; return &option; @@ -257,7 +257,7 @@ const option* OptionParser::lookup_long_option(char* raw) const int OptionParser::handle_long_option() { - ASSERT(StringView(m_argv[m_arg_index]).starts_with("--")); + VERIFY(StringView(m_argv[m_arg_index]).starts_with("--")); // We cannot set optopt to anything sensible for long options, so set it to 0. optopt = 0; @@ -298,7 +298,7 @@ int OptionParser::handle_long_option() } break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // Now that we've figured the value out, see about reporting this option to @@ -314,7 +314,7 @@ void OptionParser::shift_argv() { // We've just parsed an option (which perhaps has a value). // Put the option (along with it value, if any) in front of other arguments. - ASSERT(optind <= static_cast<int>(m_arg_index)); + VERIFY(optind <= static_cast<int>(m_arg_index)); if (optind == static_cast<int>(m_arg_index) || m_consumed_args == 0) { // Nothing to do! diff --git a/Userland/Libraries/LibC/libgen.cpp b/Userland/Libraries/LibC/libgen.cpp index 13b6e668b8..7d198a802c 100644 --- a/Userland/Libraries/LibC/libgen.cpp +++ b/Userland/Libraries/LibC/libgen.cpp @@ -75,8 +75,8 @@ char* basename(char* path) return path; if (len == 1) { - ASSERT(last_slash == path); - ASSERT(path[0] == '/'); + VERIFY(last_slash == path); + VERIFY(path[0] == '/'); return slash; } diff --git a/Userland/Libraries/LibC/malloc.cpp b/Userland/Libraries/LibC/malloc.cpp index e06412c3bb..a340e04c9f 100644 --- a/Userland/Libraries/LibC/malloc.cpp +++ b/Userland/Libraries/LibC/malloc.cpp @@ -156,7 +156,7 @@ extern "C" { static void* os_alloc(size_t size, const char* name) { auto* ptr = serenity_mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0, ChunkedBlock::block_size, name); - ASSERT(ptr != MAP_FAILED); + VERIFY(ptr != MAP_FAILED); return ptr; } @@ -192,11 +192,11 @@ static void* malloc_impl(size_t size) bool this_block_was_purged = rc == 1; if (rc < 0) { perror("madvise"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (mprotect(block, real_size, PROT_READ | PROT_WRITE) < 0) { perror("mprotect"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (this_block_was_purged) { g_malloc_stats.number_of_big_allocator_purge_hits++; @@ -229,12 +229,12 @@ static void* malloc_impl(size_t size) bool this_block_was_purged = rc == 1; if (rc < 0) { perror("madvise"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } rc = mprotect(block, ChunkedBlock::block_size, PROT_READ | PROT_WRITE); if (rc < 0) { perror("mprotect"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (this_block_was_purged) { g_malloc_stats.number_of_empty_block_purge_hits++; @@ -255,7 +255,7 @@ static void* malloc_impl(size_t size) --block->m_free_chunks; void* ptr = block->m_freelist; - ASSERT(ptr); + VERIFY(ptr); block->m_freelist = block->m_freelist->next; if (block->is_full()) { g_malloc_stats.number_of_blocks_full++; @@ -296,11 +296,11 @@ static void free_impl(void* ptr) size_t this_block_size = block->m_size; if (mprotect(block, this_block_size, PROT_NONE) < 0) { perror("mprotect"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (madvise(block, this_block_size, MADV_SET_VOLATILE) != 0) { perror("madvise"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return; } @@ -390,7 +390,7 @@ size_t malloc_size(void* ptr) if (header->m_magic == MAGIC_BIGALLOC_HEADER) size -= sizeof(CommonHeader); else - ASSERT(header->m_magic == MAGIC_PAGE_HEADER); + VERIFY(header->m_magic == MAGIC_PAGE_HEADER); return size; } diff --git a/Userland/Libraries/LibC/netdb.cpp b/Userland/Libraries/LibC/netdb.cpp index f428948dd6..881e1beffe 100644 --- a/Userland/Libraries/LibC/netdb.cpp +++ b/Userland/Libraries/LibC/netdb.cpp @@ -142,13 +142,13 @@ hostent* gethostbyname(const char* name) perror("write"); return nullptr; } - ASSERT((size_t)nsent == sizeof(request_header)); + VERIFY((size_t)nsent == sizeof(request_header)); nsent = write(fd, name, name_length); if (nsent < 0) { perror("write"); return nullptr; } - ASSERT((size_t)nsent == name_length); + VERIFY((size_t)nsent == name_length); struct [[gnu::packed]] { u32 message_size; @@ -163,7 +163,7 @@ hostent* gethostbyname(const char* name) perror("recv"); return nullptr; } - ASSERT((size_t)nrecv == sizeof(response_header)); + VERIFY((size_t)nrecv == sizeof(response_header)); if (response_header.endpoint_magic != lookup_server_endpoint_magic || response_header.message_id != 2) { dbgln("Received an unexpected message"); return nullptr; @@ -172,7 +172,7 @@ hostent* gethostbyname(const char* name) // TODO: return a specific error. return nullptr; } - ASSERT(response_header.addresses_count > 0); + VERIFY(response_header.addresses_count > 0); i32 response_length; nrecv = read(fd, &response_length, sizeof(response_length)); @@ -180,15 +180,15 @@ hostent* gethostbyname(const char* name) perror("recv"); return nullptr; } - ASSERT((size_t)nrecv == sizeof(response_length)); - ASSERT(response_length == sizeof(__gethostbyname_address)); + VERIFY((size_t)nrecv == sizeof(response_length)); + VERIFY(response_length == sizeof(__gethostbyname_address)); nrecv = read(fd, &__gethostbyname_address, response_length); if (nrecv < 0) { perror("recv"); return nullptr; } - ASSERT(nrecv == response_length); + VERIFY(nrecv == response_length); gethostbyname_name_buffer = name; __gethostbyname_buffer.h_name = const_cast<char*>(gethostbyname_name_buffer.characters()); @@ -243,13 +243,13 @@ hostent* gethostbyaddr(const void* addr, socklen_t addr_size, int type) perror("write"); return nullptr; } - ASSERT((size_t)nsent == sizeof(request_header)); + VERIFY((size_t)nsent == sizeof(request_header)); nsent = write(fd, &in_addr, sizeof(in_addr)); if (nsent < 0) { perror("write"); return nullptr; } - ASSERT((size_t)nsent == sizeof(in_addr)); + VERIFY((size_t)nsent == sizeof(in_addr)); struct [[gnu::packed]] { u32 message_size; @@ -264,7 +264,7 @@ hostent* gethostbyaddr(const void* addr, socklen_t addr_size, int type) perror("recv"); return nullptr; } - ASSERT((size_t)nrecv == sizeof(response_header)); + VERIFY((size_t)nrecv == sizeof(response_header)); if (response_header.endpoint_magic != lookup_server_endpoint_magic || response_header.message_id != 4) { dbgln("Received an unexpected message"); return nullptr; @@ -281,7 +281,7 @@ hostent* gethostbyaddr(const void* addr, socklen_t addr_size, int type) perror("recv"); return nullptr; } - ASSERT(nrecv == response_header.name_length); + VERIFY(nrecv == response_header.name_length); gethostbyaddr_name_buffer = move(string_impl); __gethostbyaddr_buffer.h_name = buffer; @@ -661,12 +661,12 @@ int getaddrinfo(const char* __restrict node, const char* __restrict service, con (void)service; (void)hints; (void)res; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void freeaddrinfo(struct addrinfo* res) { (void)res; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } const char* gai_strerror(int errcode) { diff --git a/Userland/Libraries/LibC/pwd.cpp b/Userland/Libraries/LibC/pwd.cpp index 1d104e29c9..932b265d13 100644 --- a/Userland/Libraries/LibC/pwd.cpp +++ b/Userland/Libraries/LibC/pwd.cpp @@ -178,7 +178,7 @@ static void construct_pwd(struct passwd* pwd, char* buf, struct passwd** result) ok = ok || s_dir.copy_characters_to_buffer(buf_dir, s_dir.length() + 1); ok = ok || s_shell.copy_characters_to_buffer(buf_shell, s_shell.length() + 1); - ASSERT(ok); + VERIFY(ok); *result = pwd; pwd->pw_name = buf_name; diff --git a/Userland/Libraries/LibC/qsort.cpp b/Userland/Libraries/LibC/qsort.cpp index 145cb1b19f..f2270c2e7b 100644 --- a/Userland/Libraries/LibC/qsort.cpp +++ b/Userland/Libraries/LibC/qsort.cpp @@ -50,7 +50,7 @@ namespace AK { template<> inline void swap(const SizedObject& a, const SizedObject& b) { - ASSERT(a.size() == b.size()); + VERIFY(a.size() == b.size()); const size_t size = a.size(); const auto a_data = reinterpret_cast<char*>(a.data()); const auto b_data = reinterpret_cast<char*>(b.data()); diff --git a/Userland/Libraries/LibC/scanf.cpp b/Userland/Libraries/LibC/scanf.cpp index bb51aad92d..7ec13da4ee 100644 --- a/Userland/Libraries/LibC/scanf.cpp +++ b/Userland/Libraries/LibC/scanf.cpp @@ -104,7 +104,7 @@ struct read_element_concrete<int, ApT, kind> { return false; auto diff = endptr - nptr; - ASSERT(diff > 0); + VERIFY(diff > 0); lexer.ignore((size_t)diff); *ptr = value; @@ -155,7 +155,7 @@ struct read_element_concrete<unsigned, ApT, kind> { return false; auto diff = endptr - nptr; - ASSERT(diff > 0); + VERIFY(diff > 0); lexer.ignore((size_t)diff); *ptr = value; @@ -189,7 +189,7 @@ struct read_element_concrete<unsigned long long, ApT, kind> { return false; auto diff = endptr - nptr; - ASSERT(diff > 0); + VERIFY(diff > 0); lexer.ignore((size_t)diff); *ptr = value; @@ -220,7 +220,7 @@ struct read_element_concrete<float, ApT, kind> { return false; auto diff = endptr - nptr; - ASSERT(diff > 0); + VERIFY(diff > 0); lexer.ignore((size_t)diff); *ptr = value; @@ -235,7 +235,7 @@ struct read_element { switch (length_modifier) { default: case None: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case Default: return read_element_concrete<T, T, kind> {}(input_lexer, ap); case Char: @@ -510,7 +510,7 @@ extern "C" int vsscanf(const char* input, const char* format, va_list ap) default: // "undefined behaviour", let's be nice and crash. dbgln("Invalid conversion specifier {} in scanf!", (int)conversion_specifier); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case Decimal: if (!read_element<int, ReadKind::Normal> {}(length_modifier, input_lexer, &ap)) format_lexer.consume_all(); diff --git a/Userland/Libraries/LibC/semaphore.cpp b/Userland/Libraries/LibC/semaphore.cpp index 165c14eddc..618c3335f0 100644 --- a/Userland/Libraries/LibC/semaphore.cpp +++ b/Userland/Libraries/LibC/semaphore.cpp @@ -29,37 +29,37 @@ int sem_close(sem_t*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int sem_destroy(sem_t*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int sem_getvalue(sem_t*, int*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int sem_init(sem_t*, int, unsigned int) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } sem_t* sem_open(const char*, int, ...) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int sem_post(sem_t*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int sem_trywait(sem_t*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int sem_unlink(const char*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int sem_wait(sem_t*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } diff --git a/Userland/Libraries/LibC/signal.cpp b/Userland/Libraries/LibC/signal.cpp index cea5e149f4..661a3b371e 100644 --- a/Userland/Libraries/LibC/signal.cpp +++ b/Userland/Libraries/LibC/signal.cpp @@ -227,7 +227,7 @@ static_assert(sizeof(signal_names) == sizeof(const char*) * NSIG); int getsignalbyname(const char* name) { - ASSERT(name); + VERIFY(name); for (size_t i = 0; i < NSIG; ++i) { auto* signal_name = signal_names[i]; if (!strcmp(signal_name, name)) diff --git a/Userland/Libraries/LibC/stdio.cpp b/Userland/Libraries/LibC/stdio.cpp index cecb0aef2a..1ff78cc413 100644 --- a/Userland/Libraries/LibC/stdio.cpp +++ b/Userland/Libraries/LibC/stdio.cpp @@ -141,7 +141,7 @@ private: FILE::~FILE() { bool already_closed = m_fd == -1; - ASSERT(already_closed); + VERIFY(already_closed); } FILE* FILE::create(int fd, int mode) @@ -222,7 +222,7 @@ bool FILE::read_into_buffer() size_t available_size; u8* data = m_buffer.begin_enqueue(available_size); // If we want to read, the buffer must have some space! - ASSERT(available_size); + VERIFY(available_size); ssize_t nread = do_read(data, available_size); @@ -238,7 +238,7 @@ bool FILE::write_from_buffer() size_t size; const u8* data = m_buffer.begin_dequeue(size); // If we want to write, the buffer must have something in it! - ASSERT(size); + VERIFY(size); ssize_t nwritten = do_write(data, size); @@ -378,7 +378,7 @@ bool FILE::gets(u8* data, size_t size) *data = 0; return total_read > 0; } - ASSERT(nread == 1); + VERIFY(nread == 1); *data = byte; total_read++; data++; @@ -508,17 +508,17 @@ const u8* FILE::Buffer::begin_dequeue(size_t& available_size) const void FILE::Buffer::did_dequeue(size_t actual_size) { - ASSERT(actual_size > 0); + VERIFY(actual_size > 0); if (m_ungotten) { - ASSERT(actual_size == 1); + VERIFY(actual_size == 1); m_ungotten = false; return; } m_begin += actual_size; - ASSERT(m_begin <= m_capacity); + VERIFY(m_begin <= m_capacity); if (m_begin == m_capacity) { // Wrap around. m_begin = 0; @@ -534,7 +534,7 @@ void FILE::Buffer::did_dequeue(size_t actual_size) u8* FILE::Buffer::begin_enqueue(size_t& available_size) const { - ASSERT(m_data != nullptr); + VERIFY(m_data != nullptr); if (m_begin < m_end || m_empty) available_size = m_capacity - m_end; @@ -546,12 +546,12 @@ u8* FILE::Buffer::begin_enqueue(size_t& available_size) const void FILE::Buffer::did_enqueue(size_t actual_size) { - ASSERT(m_data != nullptr); - ASSERT(actual_size > 0); + VERIFY(m_data != nullptr); + VERIFY(actual_size > 0); m_end += actual_size; - ASSERT(m_end <= m_capacity); + VERIFY(m_end <= m_capacity); if (m_end == m_capacity) { // Wrap around. m_end = 0; @@ -590,7 +590,7 @@ void __stdio_init() int setvbuf(FILE* stream, char* buf, int mode, size_t size) { - ASSERT(stream); + VERIFY(stream); if (mode != _IONBF && mode != _IOLBF && mode != _IOFBF) { errno = EINVAL; return -1; @@ -611,13 +611,13 @@ void setlinebuf(FILE* stream) int fileno(FILE* stream) { - ASSERT(stream); + VERIFY(stream); return stream->fileno(); } int feof(FILE* stream) { - ASSERT(stream); + VERIFY(stream); return stream->eof(); } @@ -632,14 +632,14 @@ int fflush(FILE* stream) char* fgets(char* buffer, int size, FILE* stream) { - ASSERT(stream); + VERIFY(stream); bool ok = stream->gets(reinterpret_cast<u8*>(buffer), size); return ok ? buffer : nullptr; } int fgetc(FILE* stream) { - ASSERT(stream); + VERIFY(stream); char ch; size_t nread = fread(&ch, sizeof(char), 1, stream); if (nread == 1) @@ -715,19 +715,19 @@ ssize_t getline(char** lineptr, size_t* n, FILE* stream) int ungetc(int c, FILE* stream) { - ASSERT(stream); + VERIFY(stream); bool ok = stream->ungetc(c); return ok ? c : EOF; } int fputc(int ch, FILE* stream) { - ASSERT(stream); + VERIFY(stream); u8 byte = ch; size_t nwritten = stream->write(&byte, 1); if (nwritten == 0) return EOF; - ASSERT(nwritten == 1); + VERIFY(nwritten == 1); return byte; } @@ -743,7 +743,7 @@ int putchar(int ch) int fputs(const char* s, FILE* stream) { - ASSERT(stream); + VERIFY(stream); size_t len = strlen(s); size_t nwritten = stream->write(reinterpret_cast<const u8*>(s), len); if (nwritten < len) @@ -761,20 +761,20 @@ int puts(const char* s) void clearerr(FILE* stream) { - ASSERT(stream); + VERIFY(stream); stream->clear_err(); } int ferror(FILE* stream) { - ASSERT(stream); + VERIFY(stream); return stream->error(); } size_t fread(void* ptr, size_t size, size_t nmemb, FILE* stream) { - ASSERT(stream); - ASSERT(!Checked<size_t>::multiplication_would_overflow(size, nmemb)); + VERIFY(stream); + VERIFY(!Checked<size_t>::multiplication_would_overflow(size, nmemb)); size_t nread = stream->read(reinterpret_cast<u8*>(ptr), size * nmemb); return nread / size; @@ -782,8 +782,8 @@ size_t fread(void* ptr, size_t size, size_t nmemb, FILE* stream) size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream) { - ASSERT(stream); - ASSERT(!Checked<size_t>::multiplication_would_overflow(size, nmemb)); + VERIFY(stream); + VERIFY(!Checked<size_t>::multiplication_would_overflow(size, nmemb)); size_t nwritten = stream->write(reinterpret_cast<const u8*>(ptr), size * nmemb); return nwritten / size; @@ -791,32 +791,32 @@ size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream) int fseek(FILE* stream, long offset, int whence) { - ASSERT(stream); + VERIFY(stream); return stream->seek(offset, whence); } int fseeko(FILE* stream, off_t offset, int whence) { - ASSERT(stream); + VERIFY(stream); return stream->seek(offset, whence); } long ftell(FILE* stream) { - ASSERT(stream); + VERIFY(stream); return stream->tell(); } off_t ftello(FILE* stream) { - ASSERT(stream); + VERIFY(stream); return stream->tell(); } int fgetpos(FILE* stream, fpos_t* pos) { - ASSERT(stream); - ASSERT(pos); + VERIFY(stream); + VERIFY(pos); off_t val = stream->tell(); if (val == -1L) @@ -828,17 +828,17 @@ int fgetpos(FILE* stream, fpos_t* pos) int fsetpos(FILE* stream, const fpos_t* pos) { - ASSERT(stream); - ASSERT(pos); + VERIFY(stream); + VERIFY(pos); return stream->seek(*pos, SEEK_SET); } void rewind(FILE* stream) { - ASSERT(stream); + VERIFY(stream); int rc = stream->seek(0, SEEK_SET); - ASSERT(rc == 0); + VERIFY(rc == 0); } ALWAYS_INLINE void stdout_putch(char*&, char ch) @@ -991,7 +991,7 @@ FILE* fopen(const char* pathname, const char* mode) FILE* freopen(const char* pathname, const char* mode, FILE* stream) { - ASSERT(stream); + VERIFY(stream); if (!pathname) { // FIXME: Someone should probably implement this path. TODO(); @@ -1022,7 +1022,7 @@ static inline bool is_default_stream(FILE* stream) int fclose(FILE* stream) { - ASSERT(stream); + VERIFY(stream); bool ok = stream->close(); ScopedValueRollback errno_restorer(errno); @@ -1124,8 +1124,8 @@ FILE* popen(const char* command, const char* type) int pclose(FILE* stream) { - ASSERT(stream); - ASSERT(stream->popen_child() != 0); + VERIFY(stream); + VERIFY(stream->popen_child() != 0); int wstatus = 0; int rc = waitpid(stream->popen_child(), &wstatus, 0); diff --git a/Userland/Libraries/LibC/stdlib.cpp b/Userland/Libraries/LibC/stdlib.cpp index 049733dc6b..0b599202a8 100644 --- a/Userland/Libraries/LibC/stdlib.cpp +++ b/Userland/Libraries/LibC/stdlib.cpp @@ -289,7 +289,7 @@ int unsetenv(const char* name) for (; environ[environ_size]; ++environ_size) { char* old_var = environ[environ_size]; char* old_eq = strchr(old_var, '='); - ASSERT(old_eq); + VERIFY(old_eq); size_t old_var_len = old_eq - old_var; if (new_var_len != old_var_len) @@ -343,7 +343,7 @@ int putenv(char* new_var) for (; environ[environ_size]; ++environ_size) { char* old_var = environ[environ_size]; char* old_eq = strchr(old_var, '='); - ASSERT(old_eq); + VERIFY(old_eq); auto old_var_len = old_eq - old_var; if (new_var_len != old_var_len) @@ -491,7 +491,7 @@ double strtod(const char* str, char** endptr) is_a_digit = false; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -547,7 +547,7 @@ double strtod(const char* str, char** endptr) is_a_digit = false; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -955,7 +955,7 @@ long long strtoll(const char* str, char** endptr, int base) is_a_digit = false; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -1039,7 +1039,7 @@ unsigned long long strtoull(const char* str, char** endptr, int base) is_a_digit = false; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibC/sys/wait.cpp b/Userland/Libraries/LibC/sys/wait.cpp index 2cde5e2821..70b1bb90e9 100644 --- a/Userland/Libraries/LibC/sys/wait.cpp +++ b/Userland/Libraries/LibC/sys/wait.cpp @@ -86,7 +86,7 @@ pid_t waitpid(pid_t waitee, int* wstatus, int options) *wstatus = 0; return 0; // return 0 if running default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibC/syslog.cpp b/Userland/Libraries/LibC/syslog.cpp index 650347da96..b2242f6212 100644 --- a/Userland/Libraries/LibC/syslog.cpp +++ b/Userland/Libraries/LibC/syslog.cpp @@ -66,7 +66,7 @@ static const char* get_syslog_ident(struct syslog_data* data) else if (program_name_set) return program_name_buffer; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void openlog_r(const char* ident, int logopt, int facility, struct syslog_data* data) diff --git a/Userland/Libraries/LibC/termcap.cpp b/Userland/Libraries/LibC/termcap.cpp index 034663af9f..b21423ea12 100644 --- a/Userland/Libraries/LibC/termcap.cpp +++ b/Userland/Libraries/LibC/termcap.cpp @@ -137,7 +137,7 @@ int tgetnum(const char* id) auto it = caps->find(id); if (it != caps->end()) return atoi((*it).value); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static Vector<char> s_tgoto_buffer; diff --git a/Userland/Libraries/LibC/time.cpp b/Userland/Libraries/LibC/time.cpp index df7010c646..56ef7a3663 100644 --- a/Userland/Libraries/LibC/time.cpp +++ b/Userland/Libraries/LibC/time.cpp @@ -84,7 +84,7 @@ static void time_to_tm(struct tm* tm, time_t t) t += days_in_year(year - 1) * __seconds_per_day; tm->tm_year = year - 1900; - ASSERT(t >= 0); + VERIFY(t >= 0); int days = t / __seconds_per_day; tm->tm_yday = days; int remaining = t % __seconds_per_day; diff --git a/Userland/Libraries/LibC/unistd.cpp b/Userland/Libraries/LibC/unistd.cpp index 64eadb14fa..e6a29bc41b 100644 --- a/Userland/Libraries/LibC/unistd.cpp +++ b/Userland/Libraries/LibC/unistd.cpp @@ -592,7 +592,7 @@ long fpathconf([[maybe_unused]] int fd, [[maybe_unused]] int name) return _POSIX_VDISABLE; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } long pathconf([[maybe_unused]] const char* path, int name) @@ -604,13 +604,13 @@ long pathconf([[maybe_unused]] const char* path, int name) return PIPE_BUF; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void _exit(int status) { syscall(SC_exit, status); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void sync() diff --git a/Userland/Libraries/LibChess/Chess.cpp b/Userland/Libraries/LibChess/Chess.cpp index fae0c1e513..3bce22f647 100644 --- a/Userland/Libraries/LibChess/Chess.cpp +++ b/Userland/Libraries/LibChess/Chess.cpp @@ -79,7 +79,7 @@ Color opposing_color(Color color) Square::Square(const StringView& name) { - ASSERT(name.length() == 2); + VERIFY(name.length() == 2); char filec = name[0]; char rankc = name[1]; @@ -88,13 +88,13 @@ Square::Square(const StringView& name) } else if (filec >= 'A' && filec <= 'H') { file = filec - 'A'; } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (rankc >= '1' && rankc <= '8') { rank = rankc - '1'; } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -312,7 +312,7 @@ String Board::to_fen() const } // 2. Active color - ASSERT(m_turn != Color::None); + VERIFY(m_turn != Color::None); builder.append(m_turn == Color::White ? " w " : " b "); // 3. Castling availability @@ -349,15 +349,15 @@ String Board::to_fen() const Piece Board::get_piece(const Square& square) const { - ASSERT(square.rank < 8); - ASSERT(square.file < 8); + VERIFY(square.rank < 8); + VERIFY(square.file < 8); return m_board[square.rank][square.file]; } Piece Board::set_piece(const Square& square, const Piece& piece) { - ASSERT(square.rank < 8); - ASSERT(square.file < 8); + VERIFY(square.rank < 8); + VERIFY(square.file < 8); return m_board[square.rank][square.file] = piece; } @@ -913,7 +913,7 @@ String Board::result_to_string(Result result, Color turn) { switch (result) { case Result::CheckMate: - ASSERT(turn != Chess::Color::None); + VERIFY(turn != Chess::Color::None); return turn == Chess::Color::White ? "Black wins by Checkmate" : "White wins by Checkmate"; case Result::WhiteResign: return "Black wins by Resignation"; @@ -934,7 +934,7 @@ String Board::result_to_string(Result result, Color turn) case Chess::Board::Result::NotFinished: return "Game not finished"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -942,7 +942,7 @@ String Board::result_to_points(Result result, Color turn) { switch (result) { case Result::CheckMate: - ASSERT(turn != Chess::Color::None); + VERIFY(turn != Chess::Color::None); return turn == Chess::Color::White ? "0-1" : "1-0"; case Result::WhiteResign: return "0-1"; @@ -963,7 +963,7 @@ String Board::result_to_points(Result result, Color turn) case Chess::Board::Result::NotFinished: return "*"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibChess/UCICommand.cpp b/Userland/Libraries/LibChess/UCICommand.cpp index af4294c8df..f84f71a639 100644 --- a/Userland/Libraries/LibChess/UCICommand.cpp +++ b/Userland/Libraries/LibChess/UCICommand.cpp @@ -32,8 +32,8 @@ namespace Chess::UCI { UCICommand UCICommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "uci"); - ASSERT(tokens.size() == 1); + VERIFY(tokens[0] == "uci"); + VERIFY(tokens.size() == 1); return UCICommand(); } @@ -45,14 +45,14 @@ String UCICommand::to_string() const DebugCommand DebugCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "debug"); - ASSERT(tokens.size() == 2); + VERIFY(tokens[0] == "debug"); + VERIFY(tokens.size() == 2); if (tokens[1] == "on") return DebugCommand(Flag::On); if (tokens[1] == "off") return DebugCommand(Flag::On); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } String DebugCommand::to_string() const @@ -67,8 +67,8 @@ String DebugCommand::to_string() const IsReadyCommand IsReadyCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "isready"); - ASSERT(tokens.size() == 1); + VERIFY(tokens[0] == "isready"); + VERIFY(tokens.size() == 1); return IsReadyCommand(); } @@ -80,9 +80,9 @@ String IsReadyCommand::to_string() const SetOptionCommand SetOptionCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "setoption"); - ASSERT(tokens[1] == "name"); - ASSERT(tokens.size() > 2); + VERIFY(tokens[0] == "setoption"); + VERIFY(tokens[1] == "name"); + VERIFY(tokens.size() > 2); StringBuilder name; StringBuilder value; @@ -110,7 +110,7 @@ SetOptionCommand SetOptionCommand::from_string(const StringView& command) } } - ASSERT(!name.is_empty()); + VERIFY(!name.is_empty()); return SetOptionCommand(name.to_string().trim_whitespace(), value.to_string().trim_whitespace()); } @@ -131,9 +131,9 @@ String SetOptionCommand::to_string() const PositionCommand PositionCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens.size() >= 3); - ASSERT(tokens[0] == "position"); - ASSERT(tokens[2] == "moves"); + VERIFY(tokens.size() >= 3); + VERIFY(tokens[0] == "position"); + VERIFY(tokens[2] == "moves"); Optional<String> fen; if (tokens[1] != "startpos") @@ -167,40 +167,40 @@ String PositionCommand::to_string() const GoCommand GoCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "go"); + VERIFY(tokens[0] == "go"); GoCommand go_command; for (size_t i = 1; i < tokens.size(); ++i) { if (tokens[i] == "searchmoves") { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else if (tokens[i] == "ponder") { go_command.ponder = true; } else if (tokens[i] == "wtime") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.wtime = tokens[i].to_int().value(); } else if (tokens[i] == "btime") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.btime = tokens[i].to_int().value(); } else if (tokens[i] == "winc") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.winc = tokens[i].to_int().value(); } else if (tokens[i] == "binc") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.binc = tokens[i].to_int().value(); } else if (tokens[i] == "movestogo") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.movestogo = tokens[i].to_int().value(); } else if (tokens[i] == "depth") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.depth = tokens[i].to_int().value(); } else if (tokens[i] == "nodes") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.nodes = tokens[i].to_int().value(); } else if (tokens[i] == "mate") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.mate = tokens[i].to_int().value(); } else if (tokens[i] == "movetime") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.movetime = tokens[i].to_int().value(); } else if (tokens[i] == "infinite") { go_command.infinite = true; @@ -253,8 +253,8 @@ String GoCommand::to_string() const StopCommand StopCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "stop"); - ASSERT(tokens.size() == 1); + VERIFY(tokens[0] == "stop"); + VERIFY(tokens.size() == 1); return StopCommand(); } @@ -266,7 +266,7 @@ String StopCommand::to_string() const IdCommand IdCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "id"); + VERIFY(tokens[0] == "id"); StringBuilder value; for (size_t i = 2; i < tokens.size(); ++i) { if (i != 2) @@ -280,7 +280,7 @@ IdCommand IdCommand::from_string(const StringView& command) } else if (tokens[1] == "author") { return IdCommand(Type::Author, value.build()); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } String IdCommand::to_string() const @@ -300,8 +300,8 @@ String IdCommand::to_string() const UCIOkCommand UCIOkCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "uciok"); - ASSERT(tokens.size() == 1); + VERIFY(tokens[0] == "uciok"); + VERIFY(tokens.size() == 1); return UCIOkCommand(); } @@ -313,8 +313,8 @@ String UCIOkCommand::to_string() const ReadyOkCommand ReadyOkCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "readyok"); - ASSERT(tokens.size() == 1); + VERIFY(tokens[0] == "readyok"); + VERIFY(tokens.size() == 1); return ReadyOkCommand(); } @@ -326,8 +326,8 @@ String ReadyOkCommand::to_string() const BestMoveCommand BestMoveCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "bestmove"); - ASSERT(tokens.size() == 2); + VERIFY(tokens[0] == "bestmove"); + VERIFY(tokens.size() == 2); return BestMoveCommand(Move(tokens[1])); } @@ -343,13 +343,13 @@ String BestMoveCommand::to_string() const InfoCommand InfoCommand::from_string([[maybe_unused]] const StringView& command) { // FIXME: Implement this. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } String InfoCommand::to_string() const { // FIXME: Implement this. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "info"; } diff --git a/Userland/Libraries/LibChess/UCIEndpoint.cpp b/Userland/Libraries/LibChess/UCIEndpoint.cpp index 5e9066aacc..4c094b80fe 100644 --- a/Userland/Libraries/LibChess/UCIEndpoint.cpp +++ b/Userland/Libraries/LibChess/UCIEndpoint.cpp @@ -125,7 +125,7 @@ NonnullOwnPtr<Command> Endpoint::read_command() } dbgln("command line: {}", line); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }; diff --git a/Userland/Libraries/LibCompress/Deflate.cpp b/Userland/Libraries/LibCompress/Deflate.cpp index 184fe58e1e..f1749868bc 100644 --- a/Userland/Libraries/LibCompress/Deflate.cpp +++ b/Userland/Libraries/LibCompress/Deflate.cpp @@ -109,7 +109,7 @@ u32 CanonicalCode::read_symbol(InputBitStream& stream) const for (;;) { code_bits = code_bits << 1 | stream.read_bits(1); - ASSERT(code_bits < (1 << 16)); + VERIFY(code_bits < (1 << 16)); // FIXME: This is very inefficient and could greatly be improved by implementing this // algorithm: https://www.hanshq.net/zip.html#huffdec @@ -273,7 +273,7 @@ size_t DeflateDecompressor::read(Bytes bytes) return nread + read(bytes.slice(nread)); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool DeflateDecompressor::read_or_error(Bytes bytes) @@ -338,7 +338,7 @@ u32 DeflateDecompressor::decode_length(u32 symbol) if (symbol == 285) return 258; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } u32 DeflateDecompressor::decode_distance(u32 symbol) @@ -353,7 +353,7 @@ u32 DeflateDecompressor::decode_distance(u32 symbol) return ((symbol % 2 + 2) << extra_bits) + 1 + m_input_stream.read_bits(extra_bits); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void DeflateDecompressor::decode_codes(CanonicalCode& literal_code, Optional<CanonicalCode>& distance_code) @@ -401,7 +401,7 @@ void DeflateDecompressor::decode_codes(CanonicalCode& literal_code, Optional<Can code_lengths.append(0); continue; } else { - ASSERT(symbol == 16); + VERIFY(symbol == 16); if (code_lengths.is_empty()) { set_fatal_error(); diff --git a/Userland/Libraries/LibCompress/Zlib.cpp b/Userland/Libraries/LibCompress/Zlib.cpp index dc2d112ad6..852e829935 100644 --- a/Userland/Libraries/LibCompress/Zlib.cpp +++ b/Userland/Libraries/LibCompress/Zlib.cpp @@ -47,10 +47,10 @@ Zlib::Zlib(ReadonlyBytes data) m_compression_level = (flags >> 6) & 0x3; m_checksum = 0; - ASSERT(m_compression_method == 8); - ASSERT(m_compression_info == 7); - ASSERT(!m_has_dictionary); - ASSERT((compression_info * 256 + flags) % 31 == 0); + VERIFY(m_compression_method == 8); + VERIFY(m_compression_info == 7); + VERIFY(!m_has_dictionary); + VERIFY((compression_info * 256 + flags) % 31 == 0); m_data_bytes = data.slice(2, data.size() - 2 - 4); } diff --git a/Userland/Libraries/LibCore/Account.cpp b/Userland/Libraries/LibCore/Account.cpp index 5a71b1e053..2b2e5d28c0 100644 --- a/Userland/Libraries/LibCore/Account.cpp +++ b/Userland/Libraries/LibCore/Account.cpp @@ -200,9 +200,9 @@ String Account::generate_passwd_file() const void Account::load_shadow_file() { auto file_or_error = Core::File::open("/etc/shadow", Core::File::ReadOnly); - ASSERT(!file_or_error.is_error()); + VERIFY(!file_or_error.is_error()); auto shadow_file = file_or_error.release_value(); - ASSERT(shadow_file->is_open()); + VERIFY(shadow_file->is_open()); Vector<ShadowEntry> entries; @@ -250,7 +250,7 @@ bool Account::sync() auto new_shadow_file_content = generate_shadow_file(); if (new_passwd_file_content.is_null() || new_shadow_file_content.is_null()) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } char new_passwd_name[] = "/etc/passwd.XXXXXX"; @@ -260,34 +260,34 @@ bool Account::sync() auto new_passwd_fd = mkstemp(new_passwd_name); if (new_passwd_fd < 0) { perror("mkstemp"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } ScopeGuard new_passwd_fd_guard = [new_passwd_fd] { close(new_passwd_fd); }; auto new_shadow_fd = mkstemp(new_shadow_name); if (new_shadow_fd < 0) { perror("mkstemp"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } ScopeGuard new_shadow_fd_guard = [new_shadow_fd] { close(new_shadow_fd); }; if (fchmod(new_passwd_fd, 0644) < 0) { perror("fchmod"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto nwritten = write(new_passwd_fd, new_passwd_file_content.characters(), new_passwd_file_content.length()); if (nwritten < 0) { perror("write"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(static_cast<size_t>(nwritten) == new_passwd_file_content.length()); + VERIFY(static_cast<size_t>(nwritten) == new_passwd_file_content.length()); nwritten = write(new_shadow_fd, new_shadow_file_content.characters(), new_shadow_file_content.length()); if (nwritten < 0) { perror("write"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(static_cast<size_t>(nwritten) == new_shadow_file_content.length()); + VERIFY(static_cast<size_t>(nwritten) == new_shadow_file_content.length()); } if (rename(new_passwd_name, "/etc/passwd") < 0) { diff --git a/Userland/Libraries/LibCore/AnonymousBuffer.cpp b/Userland/Libraries/LibCore/AnonymousBuffer.cpp index 8f6b1bedad..e30d229c7c 100644 --- a/Userland/Libraries/LibCore/AnonymousBuffer.cpp +++ b/Userland/Libraries/LibCore/AnonymousBuffer.cpp @@ -87,10 +87,10 @@ AnonymousBufferImpl::~AnonymousBufferImpl() { if (m_fd != -1) { auto rc = close(m_fd); - ASSERT(rc == 0); + VERIFY(rc == 0); } auto rc = munmap(m_data, round_up_to_power_of_two(m_size, PAGE_SIZE)); - ASSERT(rc == 0); + VERIFY(rc == 0); } AnonymousBuffer AnonymousBuffer::create_from_anon_fd(int fd, size_t size) diff --git a/Userland/Libraries/LibCore/ArgsParser.cpp b/Userland/Libraries/LibCore/ArgsParser.cpp index 121272e38b..ae94b3a39e 100644 --- a/Userland/Libraries/LibCore/ArgsParser.cpp +++ b/Userland/Libraries/LibCore/ArgsParser.cpp @@ -104,16 +104,16 @@ bool ArgsParser::parse(int argc, char** argv, bool exit_on_failure) Option* found_option = nullptr; if (c == 0) { // It was a long option. - ASSERT(index_of_found_long_option >= 0); + VERIFY(index_of_found_long_option >= 0); found_option = &m_options[index_of_found_long_option]; index_of_found_long_option = -1; } else { // It was a short option, look it up. auto it = m_options.find_if([c](auto& opt) { return c == opt.short_name; }); - ASSERT(!it.is_end()); + VERIFY(!it.is_end()); found_option = &*it; } - ASSERT(found_option); + VERIFY(found_option); const char* arg = found_option->requires_argument ? optarg : nullptr; if (!found_option->accept_value(arg)) { @@ -264,7 +264,7 @@ void ArgsParser::add_option(bool& value, const char* help_string, const char* lo short_name, nullptr, [&value](const char* s) { - ASSERT(s == nullptr); + VERIFY(s == nullptr); value = true; return true; } diff --git a/Userland/Libraries/LibCore/Command.cpp b/Userland/Libraries/LibCore/Command.cpp index 23f9560c46..d75a645777 100644 --- a/Userland/Libraries/LibCore/Command.cpp +++ b/Userland/Libraries/LibCore/Command.cpp @@ -56,11 +56,11 @@ String command(const String& program, const Vector<String>& arguments, Optional< int stderr_pipe[2] = {}; if (pipe2(stdout_pipe, O_CLOEXEC)) { perror("pipe2"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (pipe2(stderr_pipe, O_CLOEXEC)) { perror("pipe2"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto close_pipes = ScopeGuard([stderr_pipe, stdout_pipe] { @@ -88,7 +88,7 @@ String command(const String& program, const Vector<String>& arguments, Optional< pid_t pid; if ((errno = posix_spawnp(&pid, program.characters(), &action, nullptr, const_cast<char**>(argv), environ))) { perror("posix_spawn"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int wstatus; waitpid(pid, &wstatus, 0); @@ -102,7 +102,7 @@ String command(const String& program, const Vector<String>& arguments, Optional< auto result_file = Core::File::construct(); if (!result_file->open(pipe[0], Core::IODevice::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes)) { perror("open"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return String::copy(result_file->read_all()); }; diff --git a/Userland/Libraries/LibCore/ElapsedTimer.cpp b/Userland/Libraries/LibCore/ElapsedTimer.cpp index 9d0fc95378..35a4aff3d0 100644 --- a/Userland/Libraries/LibCore/ElapsedTimer.cpp +++ b/Userland/Libraries/LibCore/ElapsedTimer.cpp @@ -43,7 +43,7 @@ void ElapsedTimer::start() int ElapsedTimer::elapsed() const { - ASSERT(is_valid()); + VERIFY(is_valid()); struct timeval now; timespec now_spec; clock_gettime(m_precise ? CLOCK_MONOTONIC : CLOCK_MONOTONIC_COARSE, &now_spec); diff --git a/Userland/Libraries/LibCore/EventLoop.cpp b/Userland/Libraries/LibCore/EventLoop.cpp index f05e9ba126..c74482f241 100644 --- a/Userland/Libraries/LibCore/EventLoop.cpp +++ b/Userland/Libraries/LibCore/EventLoop.cpp @@ -160,7 +160,7 @@ public: shutdown(); return; } - ASSERT(nread == sizeof(length)); + VERIFY(nread == sizeof(length)); auto request = m_socket->read(length); auto request_json = JsonValue::from_string(request); @@ -296,7 +296,7 @@ EventLoop::EventLoop() fcntl(s_wake_pipe_fds[1], F_SETFD, FD_CLOEXEC); #endif - ASSERT(rc == 0); + VERIFY(rc == 0); s_event_loop_stack->append(this); #ifdef __serenity__ @@ -326,20 +326,20 @@ bool EventLoop::start_rpc_server() }; return s_rpc_server->listen(String::formatted("/tmp/rpc/{}", getpid())); #else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); #endif } EventLoop& EventLoop::main() { - ASSERT(s_main_event_loop); + VERIFY(s_main_event_loop); return *s_main_event_loop; } EventLoop& EventLoop::current() { EventLoop* event_loop = s_event_loop_stack->last(); - ASSERT(event_loop != nullptr); + VERIFY(event_loop != nullptr); return *event_loop; } @@ -391,7 +391,7 @@ int EventLoop::exec() return m_exit_code; pump(); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void EventLoop::pump(WaitMode mode) @@ -415,7 +415,7 @@ void EventLoop::pump(WaitMode mode) if (!receiver) { switch (event.type()) { case Event::Quit: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return; default: #if EVENTLOOP_DEBUG @@ -485,7 +485,7 @@ void SignalHandlers::dispatch() for (auto& handler : m_handlers_pending) { if (handler.value) { auto result = m_handlers.set(handler.key, move(handler.value)); - ASSERT(result == AK::HashSetResult::InsertedNewEntry); + VERIFY(result == AK::HashSetResult::InsertedNewEntry); } else { m_handlers.remove(handler.key); } @@ -506,7 +506,7 @@ int SignalHandlers::add(Function<void(int)>&& handler) bool SignalHandlers::remove(int handler_id) { - ASSERT(handler_id != 0); + VERIFY(handler_id != 0); if (m_calling_handlers) { auto it = m_handlers.find(handler_id); if (it != m_handlers.end()) { @@ -544,7 +544,7 @@ void EventLoop::dispatch_signal(int signo) void EventLoop::handle_signal(int signo) { - ASSERT(signo != 0); + VERIFY(signo != 0); // We MUST check if the current pid still matches, because there // is a window between fork() and exec() where a signal delivered // to our fork could be inadvertedly routed to the parent process! @@ -552,7 +552,7 @@ void EventLoop::handle_signal(int signo) int nwritten = write(s_wake_pipe_fds[1], &signo, sizeof(signo)); if (nwritten < 0) { perror("EventLoop::register_signal: write"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } else { // We're a fork who received a signal, reset s_pid @@ -562,7 +562,7 @@ void EventLoop::handle_signal(int signo) int EventLoop::register_signal(int signo, Function<void(int)> handler) { - ASSERT(signo != 0); + VERIFY(signo != 0); auto& info = *signals_info(); auto handlers = info.signal_handlers.find(signo); if (handlers == info.signal_handlers.end()) { @@ -577,7 +577,7 @@ int EventLoop::register_signal(int signo, Function<void(int)> handler) void EventLoop::unregister_signal(int handler_id) { - ASSERT(handler_id != 0); + VERIFY(handler_id != 0); int remove_signo = 0; auto& info = *signals_info(); for (auto& h : info.signal_handlers) { @@ -612,7 +612,7 @@ void EventLoop::notify_forked(ForkEvent event) return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void EventLoop::wait_for_event(WaitMode mode) @@ -639,7 +639,7 @@ retry: if (notifier->event_mask() & Notifier::Write) add_fd_to_set(notifier->fd(), wfds); if (notifier->event_mask() & Notifier::Exceptional) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool queued_events_is_empty; @@ -681,16 +681,16 @@ try_select_again: dbgln("Core::EventLoop::wait_for_event: {} ({}: {})", marked_fd_count, saved_errno, strerror(saved_errno)); #endif // Blow up, similar to Core::safe_syscall. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (FD_ISSET(s_wake_pipe_fds[0], &rfds)) { int wake_events[8]; auto nread = read(s_wake_pipe_fds[0], wake_events, sizeof(wake_events)); if (nread < 0) { perror("read from wake pipe"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(nread > 0); + VERIFY(nread > 0); bool wake_requested = false; int event_count = nread / sizeof(wake_events[0]); for (int i = 0; i < event_count; i++) { @@ -729,7 +729,7 @@ try_select_again: timer.reload(now); } else { // FIXME: Support removing expired timers that don't want to reload. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -778,7 +778,7 @@ Optional<struct timeval> EventLoop::get_next_timer_expiration() int EventLoop::register_timer(Object& object, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible fire_when_not_visible) { - ASSERT(milliseconds >= 0); + VERIFY(milliseconds >= 0); auto timer = make<EventLoopTimer>(); timer->owner = object; timer->interval = milliseconds; @@ -822,7 +822,7 @@ void EventLoop::wake() int nwritten = write(s_wake_pipe_fds[1], &wake_event, sizeof(wake_event)); if (nwritten < 0) { perror("EventLoop::wake: write"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibCore/File.cpp b/Userland/Libraries/LibCore/File.cpp index f5522ed14d..d04a8982b0 100644 --- a/Userland/Libraries/LibCore/File.cpp +++ b/Userland/Libraries/LibCore/File.cpp @@ -81,7 +81,7 @@ bool File::open(IODevice::OpenMode mode) bool File::open_impl(IODevice::OpenMode mode, mode_t permissions) { - ASSERT(!m_filename.is_null()); + VERIFY(!m_filename.is_null()); int flags = 0; if ((mode & IODevice::ReadWrite) == IODevice::ReadWrite) { flags |= O_RDWR | O_CREAT; @@ -144,7 +144,7 @@ String File::real_path_for(const String& filename) bool File::ensure_parent_directories(const String& path) { - ASSERT(path.starts_with("/")); + VERIFY(path.starts_with("/")); int saved_errno = 0; ScopeGuard restore_errno = [&saved_errno] { errno = saved_errno; }; @@ -365,7 +365,7 @@ Result<void, File::CopyError> File::copy_file(const String& dst_path, const stru if (nwritten < 0) return CopyError { OSError(errno), false }; - ASSERT(nwritten > 0); + VERIFY(nwritten > 0); remaining_to_write -= nwritten; bufptr += nwritten; } diff --git a/Userland/Libraries/LibCore/FileStream.h b/Userland/Libraries/LibCore/FileStream.h index 0c8774d28a..03247aa2c2 100644 --- a/Userland/Libraries/LibCore/FileStream.h +++ b/Userland/Libraries/LibCore/FileStream.h @@ -42,7 +42,7 @@ public: static Result<InputFileStream, String> open(StringView filename, IODevice::OpenMode mode = IODevice::OpenMode::ReadOnly, mode_t permissions = 0644) { - ASSERT((mode & 0xf) == IODevice::OpenMode::ReadOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); + VERIFY((mode & 0xf) == IODevice::OpenMode::ReadOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); auto file_result = File::open(filename, mode, permissions); @@ -54,7 +54,7 @@ public: static Result<Buffered<InputFileStream>, String> open_buffered(StringView filename, IODevice::OpenMode mode = IODevice::OpenMode::ReadOnly, mode_t permissions = 0644) { - ASSERT((mode & 0xf) == IODevice::OpenMode::ReadOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); + VERIFY((mode & 0xf) == IODevice::OpenMode::ReadOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); auto file_result = File::open(filename, mode, permissions); @@ -106,7 +106,7 @@ public: static Result<OutputFileStream, String> open(StringView filename, IODevice::OpenMode mode = IODevice::OpenMode::WriteOnly, mode_t permissions = 0644) { - ASSERT((mode & 0xf) == IODevice::OpenMode::WriteOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); + VERIFY((mode & 0xf) == IODevice::OpenMode::WriteOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); auto file_result = File::open(filename, mode, permissions); @@ -118,7 +118,7 @@ public: static Result<Buffered<OutputFileStream>, String> open_buffered(StringView filename, IODevice::OpenMode mode = IODevice::OpenMode::WriteOnly, mode_t permissions = 0644) { - ASSERT((mode & 0xf) == IODevice::OpenMode::WriteOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); + VERIFY((mode & 0xf) == IODevice::OpenMode::WriteOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); auto file_result = File::open(filename, mode, permissions); diff --git a/Userland/Libraries/LibCore/FileWatcher.cpp b/Userland/Libraries/LibCore/FileWatcher.cpp index 19bb73eb8a..70ed9928bc 100644 --- a/Userland/Libraries/LibCore/FileWatcher.cpp +++ b/Userland/Libraries/LibCore/FileWatcher.cpp @@ -72,7 +72,7 @@ BlockingFileWatcher::BlockingFileWatcher(const String& path) : m_path(path) { m_watcher_fd = watch_file(path.characters(), path.length()); - ASSERT(m_watcher_fd != -1); + VERIFY(m_watcher_fd != -1); } BlockingFileWatcher::~BlockingFileWatcher() diff --git a/Userland/Libraries/LibCore/GetPassword.cpp b/Userland/Libraries/LibCore/GetPassword.cpp index dfcff21583..88bb27345a 100644 --- a/Userland/Libraries/LibCore/GetPassword.cpp +++ b/Userland/Libraries/LibCore/GetPassword.cpp @@ -58,7 +58,7 @@ Result<String, OSError> get_password(const StringView& prompt) if (line_length < 0) return OSError(saved_errno); - ASSERT(line_length != 0); + VERIFY(line_length != 0); // Remove trailing '\n' read by getline(). password[line_length - 1] = '\0'; diff --git a/Userland/Libraries/LibCore/Gzip.cpp b/Userland/Libraries/LibCore/Gzip.cpp index 25c88bb15c..4dcdbe39f1 100644 --- a/Userland/Libraries/LibCore/Gzip.cpp +++ b/Userland/Libraries/LibCore/Gzip.cpp @@ -46,7 +46,7 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data) size_t current = 0; auto read_byte = [&]() { if (current >= data.size()) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return (u8)0; } return data[current++]; @@ -108,7 +108,7 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data) Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data) { - ASSERT(is_compressed(data)); + VERIFY(is_compressed(data)); dbgln_if(GZIP_DEBUG, "Gzip::decompress: Decompressing gzip compressed data. size={}", data.size()); auto optional_payload = get_gzip_payload(data); @@ -150,7 +150,7 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data) destination.grow(destination.size() * 2); } else { dbgln("Gzip::decompress: Error. puff() returned: {}", puff_ret); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibCore/IODeviceStreamReader.h b/Userland/Libraries/LibCore/IODeviceStreamReader.h index 0339c30272..bae5815d82 100644 --- a/Userland/Libraries/LibCore/IODeviceStreamReader.h +++ b/Userland/Libraries/LibCore/IODeviceStreamReader.h @@ -47,7 +47,7 @@ public: IODeviceStreamReader& operator>>(T& value) { int nread = m_device.read((u8*)&value, sizeof(T)); - ASSERT(nread == sizeof(T)); + VERIFY(nread == sizeof(T)); if (nread != sizeof(T)) m_had_failure = true; return *this; diff --git a/Userland/Libraries/LibCore/LocalServer.cpp b/Userland/Libraries/LibCore/LocalServer.cpp index ec99d51317..46d7d3ddd2 100644 --- a/Userland/Libraries/LibCore/LocalServer.cpp +++ b/Userland/Libraries/LibCore/LocalServer.cpp @@ -112,12 +112,12 @@ bool LocalServer::listen(const String& address) ioctl(m_fd, FIONBIO, &option); fcntl(m_fd, F_SETFD, FD_CLOEXEC); #endif - ASSERT(m_fd >= 0); + VERIFY(m_fd >= 0); #ifndef __APPLE__ rc = fchmod(m_fd, 0600); if (rc < 0) { perror("fchmod"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } #endif @@ -147,7 +147,7 @@ bool LocalServer::listen(const String& address) RefPtr<LocalSocket> LocalServer::accept() { - ASSERT(m_listening); + VERIFY(m_listening); sockaddr_un un; socklen_t un_size = sizeof(un); int accepted_fd = ::accept(m_fd, (sockaddr*)&un, &un_size); diff --git a/Userland/Libraries/LibCore/NetworkJob.cpp b/Userland/Libraries/LibCore/NetworkJob.cpp index a2884d5a54..a25273a86f 100644 --- a/Userland/Libraries/LibCore/NetworkJob.cpp +++ b/Userland/Libraries/LibCore/NetworkJob.cpp @@ -55,7 +55,7 @@ void NetworkJob::did_finish(NonnullRefPtr<NetworkResponse>&& response) m_response = move(response); dbgln_if(CNETWORKJOB_DEBUG, "{} job did_finish", *this); - ASSERT(on_finish); + VERIFY(on_finish); on_finish(true); shutdown(); } @@ -68,7 +68,7 @@ void NetworkJob::did_fail(Error error) m_error = error; dbgln_if(CNETWORKJOB_DEBUG, "{}{{{:p}}} job did_fail! error: {} ({})", class_name(), this, (unsigned)error, to_string(error)); - ASSERT(on_finish); + VERIFY(on_finish); on_finish(false); shutdown(); } diff --git a/Userland/Libraries/LibCore/Object.cpp b/Userland/Libraries/LibCore/Object.cpp index 55cd102409..800f557384 100644 --- a/Userland/Libraries/LibCore/Object.cpp +++ b/Userland/Libraries/LibCore/Object.cpp @@ -84,7 +84,7 @@ void Object::event(Core::Event& event) case Core::Event::ChildRemoved: return child_event(static_cast<ChildEvent&>(event)); case Core::Event::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; case Core::Event::Custom: return custom_event(static_cast<CustomEvent&>(event)); @@ -96,7 +96,7 @@ void Object::event(Core::Event& event) void Object::add_child(Object& object) { // FIXME: Should we support reparenting objects? - ASSERT(!object.parent() || object.parent() == this); + VERIFY(!object.parent() || object.parent() == this); object.m_parent = this; m_children.append(object); Core::ChildEvent child_event(Core::Event::ChildAdded, object); @@ -106,7 +106,7 @@ void Object::add_child(Object& object) void Object::insert_child_before(Object& new_child, Object& before_child) { // FIXME: Should we support reparenting objects? - ASSERT(!new_child.parent() || new_child.parent() == this); + VERIFY(!new_child.parent() || new_child.parent() == this); new_child.m_parent = this; m_children.insert_before_matching(new_child, [&](auto& existing_child) { return existing_child.ptr() == &before_child; }); Core::ChildEvent child_event(Core::Event::ChildAdded, new_child, &before_child); @@ -126,7 +126,7 @@ void Object::remove_child(Object& object) return; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Object::remove_all_children() @@ -151,7 +151,7 @@ void Object::start_timer(int ms, TimerShouldFireWhenNotVisible fire_when_not_vis { if (m_timer_id) { dbgln("{} {:p} already has a timer!", class_name(), this); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_timer_id = Core::EventLoop::register_timer(*this, ms, true, fire_when_not_visible); @@ -162,7 +162,7 @@ void Object::stop_timer() if (!m_timer_id) return; bool success = Core::EventLoop::unregister_timer(m_timer_id); - ASSERT(success); + VERIFY(success); m_timer_id = 0; } @@ -224,7 +224,7 @@ bool Object::is_ancestor_of(const Object& other) const void Object::dispatch_event(Core::Event& e, Object* stay_within) { - ASSERT(!stay_within || stay_within == this || stay_within->is_ancestor_of(*this)); + VERIFY(!stay_within || stay_within == this || stay_within->is_ancestor_of(*this)); auto* target = this; do { target->event(e); diff --git a/Userland/Libraries/LibCore/Socket.cpp b/Userland/Libraries/LibCore/Socket.cpp index 06c30c31f5..3ebe1a9d93 100644 --- a/Userland/Libraries/LibCore/Socket.cpp +++ b/Userland/Libraries/LibCore/Socket.cpp @@ -86,21 +86,21 @@ bool Socket::connect(const String& hostname, int port) void Socket::set_blocking(bool blocking) { int flags = fcntl(fd(), F_GETFL, 0); - ASSERT(flags >= 0); + VERIFY(flags >= 0); if (blocking) flags = fcntl(fd(), F_SETFL, flags & ~O_NONBLOCK); else flags = fcntl(fd(), F_SETFL, flags | O_NONBLOCK); - ASSERT(flags == 0); + VERIFY(flags == 0); } bool Socket::connect(const SocketAddress& address, int port) { - ASSERT(!is_connected()); - ASSERT(address.type() == SocketAddress::Type::IPv4); + VERIFY(!is_connected()); + VERIFY(address.type() == SocketAddress::Type::IPv4); dbgln_if(CSOCKET_DEBUG, "{} connecting to {}...", *this, address); - ASSERT(port > 0 && port <= 65535); + VERIFY(port > 0 && port <= 65535); struct sockaddr_in addr; memset(&addr, 0, sizeof(addr)); @@ -117,8 +117,8 @@ bool Socket::connect(const SocketAddress& address, int port) bool Socket::connect(const SocketAddress& address) { - ASSERT(!is_connected()); - ASSERT(address.type() == SocketAddress::Type::Local); + VERIFY(!is_connected()); + VERIFY(address.type() == SocketAddress::Type::Local); dbgln_if(CSOCKET_DEBUG, "{} connecting to {}...", *this, address); sockaddr_un saddr; @@ -183,7 +183,7 @@ bool Socket::send(ReadonlyBytes data) set_error(errno); return false; } - ASSERT(static_cast<size_t>(nsent) == data.size()); + VERIFY(static_cast<size_t>(nsent) == data.size()); return true; } @@ -204,13 +204,13 @@ void Socket::did_update_fd(int fd) ensure_read_notifier(); } else { // I don't think it would be right if we updated the fd while not connected *but* while having a notifier.. - ASSERT(!m_read_notifier); + VERIFY(!m_read_notifier); } } void Socket::ensure_read_notifier() { - ASSERT(m_connected); + VERIFY(m_connected); m_read_notifier = Notifier::construct(fd(), Notifier::Event::Read, this); m_read_notifier->on_ready_to_read = [this] { if (!can_read()) diff --git a/Userland/Libraries/LibCore/Socket.h b/Userland/Libraries/LibCore/Socket.h index 1ecb32010b..e0bf33fee7 100644 --- a/Userland/Libraries/LibCore/Socket.h +++ b/Userland/Libraries/LibCore/Socket.h @@ -78,7 +78,7 @@ protected: virtual bool common_connect(const struct sockaddr*, socklen_t); private: - virtual bool open(IODevice::OpenMode) override { ASSERT_NOT_REACHED(); } + virtual bool open(IODevice::OpenMode) override { VERIFY_NOT_REACHED(); } void ensure_read_notifier(); Type m_type { Type::Invalid }; diff --git a/Userland/Libraries/LibCore/SocketAddress.h b/Userland/Libraries/LibCore/SocketAddress.h index 4a5334225b..695fa361aa 100644 --- a/Userland/Libraries/LibCore/SocketAddress.h +++ b/Userland/Libraries/LibCore/SocketAddress.h @@ -84,7 +84,7 @@ public: Optional<sockaddr_un> to_sockaddr_un() const { - ASSERT(type() == Type::Local); + VERIFY(type() == Type::Local); sockaddr_un address; address.sun_family = AF_LOCAL; bool fits = m_local_address.copy_characters_to_buffer(address.sun_path, sizeof(address.sun_path)); @@ -95,7 +95,7 @@ public: sockaddr_in to_sockaddr_in() const { - ASSERT(type() == Type::IPv4); + VERIFY(type() == Type::IPv4); sockaddr_in address {}; address.sin_family = AF_INET; address.sin_addr.s_addr = m_ipv4_address.to_in_addr_t(); diff --git a/Userland/Libraries/LibCore/SyscallUtils.h b/Userland/Libraries/LibCore/SyscallUtils.h index 1b577bd6c4..9fd8009c8b 100644 --- a/Userland/Libraries/LibCore/SyscallUtils.h +++ b/Userland/Libraries/LibCore/SyscallUtils.h @@ -49,7 +49,7 @@ inline int safe_syscall(Syscall syscall, Args&&... args) if (errno == EINTR) continue; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return sysret; } diff --git a/Userland/Libraries/LibCore/TCPServer.cpp b/Userland/Libraries/LibCore/TCPServer.cpp index 9a715f1ed8..79fe6f468e 100644 --- a/Userland/Libraries/LibCore/TCPServer.cpp +++ b/Userland/Libraries/LibCore/TCPServer.cpp @@ -49,7 +49,7 @@ TCPServer::TCPServer(Object* parent) ioctl(m_fd, FIONBIO, &option); fcntl(m_fd, F_SETFD, FD_CLOEXEC); #endif - ASSERT(m_fd >= 0); + VERIFY(m_fd >= 0); } TCPServer::~TCPServer() @@ -85,7 +85,7 @@ bool TCPServer::listen(const IPv4Address& address, u16 port) RefPtr<TCPSocket> TCPServer::accept() { - ASSERT(m_listening); + VERIFY(m_listening); sockaddr_in in; socklen_t in_size = sizeof(in); int accepted_fd = ::accept(m_fd, (sockaddr*)&in, &in_size); diff --git a/Userland/Libraries/LibCore/UDPServer.cpp b/Userland/Libraries/LibCore/UDPServer.cpp index 33d3609c70..fd68490b77 100644 --- a/Userland/Libraries/LibCore/UDPServer.cpp +++ b/Userland/Libraries/LibCore/UDPServer.cpp @@ -50,7 +50,7 @@ UDPServer::UDPServer(Object* parent) ioctl(m_fd, FIONBIO, &option); fcntl(m_fd, F_SETFD, FD_CLOEXEC); #endif - ASSERT(m_fd >= 0); + VERIFY(m_fd >= 0); } UDPServer::~UDPServer() diff --git a/Userland/Libraries/LibCoreDump/Reader.cpp b/Userland/Libraries/LibCoreDump/Reader.cpp index f041248832..24a97293fc 100644 --- a/Userland/Libraries/LibCoreDump/Reader.cpp +++ b/Userland/Libraries/LibCoreDump/Reader.cpp @@ -53,7 +53,7 @@ Reader::Reader(NonnullRefPtr<MappedFile> coredump_file) ++index; return IterationDecision::Continue; }); - ASSERT(m_notes_segment_index != -1); + VERIFY(m_notes_segment_index != -1); } Reader::~Reader() @@ -68,7 +68,7 @@ Reader::NotesEntryIterator::NotesEntryIterator(const u8* notes_data) ELF::Core::NotesEntryHeader::Type Reader::NotesEntryIterator::type() const { - ASSERT(m_current->header.type == ELF::Core::NotesEntryHeader::Type::ProcessInfo + VERIFY(m_current->header.type == ELF::Core::NotesEntryHeader::Type::ProcessInfo || m_current->header.type == ELF::Core::NotesEntryHeader::Type::MemoryRegionInfo || m_current->header.type == ELF::Core::NotesEntryHeader::Type::ThreadInfo || m_current->header.type == ELF::Core::NotesEntryHeader::Type::Metadata @@ -83,7 +83,7 @@ const ELF::Core::NotesEntry* Reader::NotesEntryIterator::current() const void Reader::NotesEntryIterator::next() { - ASSERT(!at_end()); + VERIFY(!at_end()); switch (type()) { case ELF::Core::NotesEntryHeader::Type::ProcessInfo: { const auto* current = reinterpret_cast<const ELF::Core::ProcessInfo*>(m_current); @@ -106,7 +106,7 @@ void Reader::NotesEntryIterator::next() break; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibCpp/AST.cpp b/Userland/Libraries/LibCpp/AST.cpp index 48752055d0..87b61c6340 100644 --- a/Userland/Libraries/LibCpp/AST.cpp +++ b/Userland/Libraries/LibCpp/AST.cpp @@ -192,7 +192,7 @@ void BinaryExpression::dump(size_t indent) const m_lhs->dump(indent + 1); print_indent(indent + 1); - ASSERT(op_string); + VERIFY(op_string); outln("{}", op_string); m_rhs->dump(indent + 1); } @@ -216,7 +216,7 @@ void AssignmentExpression::dump(size_t indent) const m_lhs->dump(indent + 1); print_indent(indent + 1); - ASSERT(op_string); + VERIFY(op_string); outln("{}", op_string); m_rhs->dump(indent + 1); } @@ -301,7 +301,7 @@ void UnaryExpression::dump(size_t indent) const op_string = "<invalid>"; } - ASSERT(op_string); + VERIFY(op_string); print_indent(indent + 1); outln("{}", op_string); m_lhs->dump(indent + 1); diff --git a/Userland/Libraries/LibCpp/AST.h b/Userland/Libraries/LibCpp/AST.h index 830b998870..e01c1aeb9e 100644 --- a/Userland/Libraries/LibCpp/AST.h +++ b/Userland/Libraries/LibCpp/AST.h @@ -53,12 +53,12 @@ public: ASTNode* parent() const { return m_parent; } Position start() const { - ASSERT(m_start.has_value()); + VERIFY(m_start.has_value()); return m_start.value(); } Position end() const { - ASSERT(m_end.has_value()); + VERIFY(m_end.has_value()); return m_end.value(); } const FlyString& filename() const diff --git a/Userland/Libraries/LibCpp/Lexer.cpp b/Userland/Libraries/LibCpp/Lexer.cpp index 0507f11ec3..c08a74bb9e 100644 --- a/Userland/Libraries/LibCpp/Lexer.cpp +++ b/Userland/Libraries/LibCpp/Lexer.cpp @@ -46,7 +46,7 @@ char Lexer::peek(size_t offset) const char Lexer::consume() { - ASSERT(m_index < m_input.length()); + VERIFY(m_index < m_input.length()); char ch = m_input[m_index++]; m_previous_position = m_position; if (ch == '\n') { @@ -660,8 +660,8 @@ Vector<Token> Lexer::lex() StringView prefix_string = m_input.substring_view(prefix_start, m_index - prefix_start); while (peek()) { if (consume() == '"') { - ASSERT(m_index >= prefix_string.length() + 2); - ASSERT(m_input[m_index - 1] == '"'); + VERIFY(m_index >= prefix_string.length() + 2); + VERIFY(m_input[m_index - 1] == '"'); if (m_input[m_index - 1 - prefix_string.length() - 1] == ')') { StringView suffix_string = m_input.substring_view(m_index - 1 - prefix_string.length(), prefix_string.length()); if (prefix_string == suffix_string) diff --git a/Userland/Libraries/LibCpp/Lexer.h b/Userland/Libraries/LibCpp/Lexer.h index 3e7188f9ae..1fff2d146d 100644 --- a/Userland/Libraries/LibCpp/Lexer.h +++ b/Userland/Libraries/LibCpp/Lexer.h @@ -124,7 +124,7 @@ struct Token { FOR_EACH_TOKEN_TYPE #undef __TOKEN } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } const char* to_string() const diff --git a/Userland/Libraries/LibCpp/Parser.cpp b/Userland/Libraries/LibCpp/Parser.cpp index e44a31b854..f3081ac0ae 100644 --- a/Userland/Libraries/LibCpp/Parser.cpp +++ b/Userland/Libraries/LibCpp/Parser.cpp @@ -657,7 +657,7 @@ void Parser::load_state() Optional<Parser::DeclarationType> Parser::match_declaration_in_function_definition() { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool Parser::done() @@ -667,8 +667,8 @@ bool Parser::done() StringView Parser::text_of_token(const Cpp::Token& token) const { - ASSERT(token.m_start.line == token.m_end.line); - ASSERT(token.m_start.column <= token.m_end.column); + VERIFY(token.m_start.line == token.m_end.line); + VERIFY(token.m_start.column <= token.m_end.column); return m_lines[token.m_start.line].substring_view(token.m_start.column, token.m_end.column - token.m_start.column + 1); } @@ -680,7 +680,7 @@ StringView Parser::text_of_node(const ASTNode& node) const StringView Parser::text_of_range(Position start, Position end) const { if (start.line == end.line) { - ASSERT(start.column <= end.column); + VERIFY(start.column <= end.column); return m_lines[start.line].substring_view(start.column, end.column - start.column + 1); } @@ -694,7 +694,7 @@ StringView Parser::text_of_range(Position start, Position end) const }); auto start_index = index_of_position(start); auto end_index = index_of_position(end); - ASSERT(end_index >= start_index); + VERIFY(end_index >= start_index); return m_program.substring_view(start_index, end_index - start_index); } @@ -741,13 +741,13 @@ Position Parser::position() const RefPtr<ASTNode> Parser::eof_node() const { - ASSERT(m_tokens.size()); + VERIFY(m_tokens.size()); return node_at(m_tokens.last().m_end); } RefPtr<ASTNode> Parser::node_at(Position pos) const { - ASSERT(!m_tokens.is_empty()); + VERIFY(!m_tokens.is_empty()); RefPtr<ASTNode> match_node; for (auto& node : m_nodes) { if (node.start() > pos || node.end() < pos) @@ -827,7 +827,7 @@ NonnullRefPtr<StringLiteral> Parser::parse_string_literal(ASTNode& parent) while (!eof()) { auto token = peek(); if (token.type() != Token::Type::DoubleQuotedString && token.type() != Token::Type::EscapeSequence) { - ASSERT(start_token_index.has_value()); + VERIFY(start_token_index.has_value()); end_token_index = m_state.token_index - 1; break; } @@ -841,8 +841,8 @@ NonnullRefPtr<StringLiteral> Parser::parse_string_literal(ASTNode& parent) end_token_index = m_tokens.size() - 1; } - ASSERT(start_token_index.has_value()); - ASSERT(end_token_index.has_value()); + VERIFY(start_token_index.has_value()); + VERIFY(end_token_index.has_value()); Token start_token = m_tokens[start_token_index.value()]; Token end_token = m_tokens[end_token_index.value()]; diff --git a/Userland/Libraries/LibCpp/Preprocessor.cpp b/Userland/Libraries/LibCpp/Preprocessor.cpp index 9ec7151aa4..3094d2b97c 100644 --- a/Userland/Libraries/LibCpp/Preprocessor.cpp +++ b/Userland/Libraries/LibCpp/Preprocessor.cpp @@ -75,7 +75,7 @@ void Preprocessor::handle_preprocessor_line(const StringView& line) } if (keyword == "else") { - ASSERT(m_current_depth > 0); + VERIFY(m_current_depth > 0); if (m_depths_of_not_taken_branches.contains_slow(m_current_depth - 1)) { m_depths_of_not_taken_branches.remove_all_matching([this](auto x) { return x == m_current_depth - 1; }); m_state = State::Normal; @@ -88,7 +88,7 @@ void Preprocessor::handle_preprocessor_line(const StringView& line) } if (keyword == "endif") { - ASSERT(m_current_depth > 0); + VERIFY(m_current_depth > 0); --m_current_depth; if (m_depths_of_not_taken_branches.contains_slow(m_current_depth)) { m_depths_of_not_taken_branches.remove_all_matching([this](auto x) { return x == m_current_depth; }); @@ -164,7 +164,7 @@ void Preprocessor::handle_preprocessor_line(const StringView& line) return; } dbgln("Unsupported preprocessor keyword: {}", keyword); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }; diff --git a/Userland/Libraries/LibCrypto/ASN1/PEM.cpp b/Userland/Libraries/LibCrypto/ASN1/PEM.cpp index 96c9e1a65e..c7fae1b6fb 100644 --- a/Userland/Libraries/LibCrypto/ASN1/PEM.cpp +++ b/Userland/Libraries/LibCrypto/ASN1/PEM.cpp @@ -62,7 +62,7 @@ ByteBuffer decode_pem(ReadonlyBytes data) lexer.consume_all(); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp index c0699018e6..5d548c23a5 100644 --- a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp +++ b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp @@ -40,7 +40,7 @@ size_t SignedBigInteger::export_data(Bytes data, bool remove_leading_zeros) cons { // FIXME: Support this: // m <0XX> -> m <XX> (if remove_leading_zeros) - ASSERT(!remove_leading_zeros); + VERIFY(!remove_leading_zeros); data[0] = m_sign; auto bytes_view = data.slice(1, data.size() - 1); diff --git a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp index 63021614bb..ec622847c8 100644 --- a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp +++ b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp @@ -106,7 +106,7 @@ String UnsignedBigInteger::to_base10() const while (temp != UnsignedBigInteger { 0 }) { divide_u16_without_allocation(temp, 10, quotient, remainder); - ASSERT(remainder.words()[0] < 10); + VERIFY(remainder.words()[0] < 10); builder.append(static_cast<char>(remainder.words()[0] + '0')); temp.set_to(quotient); } @@ -389,7 +389,7 @@ void UnsignedBigInteger::subtract_without_allocation( } // This assertion should not fail, because we verified that *this>=other at the beginning of the function - ASSERT(borrow == 0); + VERIFY(borrow == 0); } /** @@ -672,7 +672,7 @@ FLATTEN void UnsignedBigInteger::divide_u16_without_allocation( UnsignedBigInteger& quotient, UnsignedBigInteger& remainder) { - ASSERT(denominator < (1 << 16)); + VERIFY(denominator < (1 << 16)); u32 remainder_word = 0; auto numerator_length = numerator.trimmed_length(); quotient.set_to_0(); @@ -717,8 +717,8 @@ ALWAYS_INLINE u32 UnsignedBigInteger::shift_left_get_one_word( { // "<= length()" (rather than length() - 1) is intentional, // The result inedx of length() is used when calculating the carry word - ASSERT(result_word_index <= number.length()); - ASSERT(num_bits <= UnsignedBigInteger::BITS_IN_WORD); + VERIFY(result_word_index <= number.length()); + VERIFY(num_bits <= UnsignedBigInteger::BITS_IN_WORD); u32 result = 0; // we need to check for "num_bits != 0" since shifting right by 32 is apparently undefined behaviour! diff --git a/Userland/Libraries/LibCrypto/Cipher/AES.cpp b/Userland/Libraries/LibCrypto/Cipher/AES.cpp index 1ce0e12240..21107fbdc0 100644 --- a/Userland/Libraries/LibCrypto/Cipher/AES.cpp +++ b/Userland/Libraries/LibCrypto/Cipher/AES.cpp @@ -65,9 +65,9 @@ void AESCipherKey::expand_encrypt_key(ReadonlyBytes user_key, size_t bits) u32 temp; size_t i { 0 }; - ASSERT(!user_key.is_null()); - ASSERT(is_valid_key_size(bits)); - ASSERT(user_key.size() == bits / 8); + VERIFY(!user_key.is_null()); + VERIFY(is_valid_key_size(bits)); + VERIFY(user_key.size() == bits / 8); round_key = round_keys(); @@ -401,7 +401,7 @@ void AESCipherBlock::overwrite(ReadonlyBytes bytes) auto data = bytes.data(); auto length = bytes.size(); - ASSERT(length <= this->data_size()); + VERIFY(length <= this->data_size()); this->bytes().overwrite(0, data, length); if (length < this->data_size()) { switch (padding_mode()) { @@ -419,7 +419,7 @@ void AESCipherBlock::overwrite(ReadonlyBytes bytes) break; default: // FIXME: We should handle the rest of the common padding modes - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } diff --git a/Userland/Libraries/LibCrypto/Cipher/Cipher.h b/Userland/Libraries/LibCrypto/Cipher/Cipher.h index 3b16c61cd9..a17db5a8c0 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Cipher.h +++ b/Userland/Libraries/LibCrypto/Cipher/Cipher.h @@ -59,7 +59,7 @@ public: { } - static size_t block_size() { ASSERT_NOT_REACHED(); } + static size_t block_size() { VERIFY_NOT_REACHED(); } virtual ReadonlyBytes bytes() const = 0; @@ -74,11 +74,11 @@ public: template<typename T> void put(size_t offset, T value) { - ASSERT(offset + sizeof(T) <= bytes().size()); + VERIFY(offset + sizeof(T) <= bytes().size()); auto* ptr = bytes().offset_pointer(offset); auto index { 0 }; - ASSERT(sizeof(T) <= 4); + VERIFY(sizeof(T) <= 4); if constexpr (sizeof(T) > 3) ptr[index++] = (u8)(value >> 24); diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h b/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h index 68358a05ca..deec336f2f 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h @@ -66,7 +66,7 @@ public: // FIXME: We should have two of these encrypt/decrypt functions that // we SFINAE out based on whether the Cipher mode needs an ivec - ASSERT(!ivec.is_empty()); + VERIFY(!ivec.is_empty()); const auto* iv = ivec.data(); m_cipher_block.set_padding_mode(cipher.padding_mode()); @@ -77,7 +77,7 @@ public: m_cipher_block.overwrite(in.slice(offset, block_size)); m_cipher_block.apply_initialization_vector(iv); cipher.encrypt_block(m_cipher_block, m_cipher_block); - ASSERT(offset + block_size <= out.size()); + VERIFY(offset + block_size <= out.size()); __builtin_memcpy(out.offset(offset), m_cipher_block.bytes().data(), block_size); iv = out.offset(offset); length -= block_size; @@ -88,7 +88,7 @@ public: m_cipher_block.overwrite(in.slice(offset, length)); m_cipher_block.apply_initialization_vector(iv); cipher.encrypt_block(m_cipher_block, m_cipher_block); - ASSERT(offset + block_size <= out.size()); + VERIFY(offset + block_size <= out.size()); __builtin_memcpy(out.offset(offset), m_cipher_block.bytes().data(), block_size); iv = out.offset(offset); } @@ -105,14 +105,14 @@ public: auto& cipher = this->cipher(); - ASSERT(!ivec.is_empty()); + VERIFY(!ivec.is_empty()); const auto* iv = ivec.data(); auto block_size = cipher.block_size(); // if the data is not aligned, it's not correct encrypted data // FIXME (ponder): Should we simply decrypt as much as we can? - ASSERT(length % block_size == 0); + VERIFY(length % block_size == 0); m_cipher_block.set_padding_mode(cipher.padding_mode()); size_t offset { 0 }; @@ -123,7 +123,7 @@ public: cipher.decrypt_block(m_cipher_block, m_cipher_block); m_cipher_block.apply_initialization_vector(iv); auto decrypted = m_cipher_block.bytes(); - ASSERT(offset + decrypted.size() <= out.size()); + VERIFY(offset + decrypted.size() <= out.size()); __builtin_memcpy(out.offset(offset), decrypted.data(), decrypted.size()); iv = slice; length -= block_size; diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h b/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h index 26895a8fca..a2601956c4 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h @@ -160,7 +160,7 @@ protected: { size_t length; if (in) { - ASSERT(in->size() <= out.size()); + VERIFY(in->size() <= out.size()); length = in->size(); if (length == 0) return; @@ -172,8 +172,8 @@ protected: // FIXME: We should have two of these encrypt/decrypt functions that // we SFINAE out based on whether the Cipher mode needs an ivec - ASSERT(!ivec.is_empty()); - ASSERT(ivec.size() >= IV_length()); + VERIFY(!ivec.is_empty()); + VERIFY(ivec.size() >= IV_length()); m_cipher_block.set_padding_mode(cipher.padding_mode()); @@ -192,7 +192,7 @@ protected: } auto write_size = min(block_size, length); - ASSERT(offset + write_size <= out.size()); + VERIFY(offset + write_size <= out.size()); __builtin_memcpy(out.offset(offset), m_cipher_block.bytes().data(), write_size); increment(iv); diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h b/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h index 4d034f5bac..3a1d17b1d5 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h @@ -73,7 +73,7 @@ public: // FIXME: This overload throws away the auth stuff, think up a better way to return more than a single bytebuffer. virtual void encrypt(ReadonlyBytes in, Bytes& out, ReadonlyBytes ivec = {}, Bytes* = nullptr) override { - ASSERT(!ivec.is_empty()); + VERIFY(!ivec.is_empty()); static ByteBuffer dummy; diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h b/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h index a34f6a4b98..c7daba471b 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h @@ -98,7 +98,7 @@ protected: } default: // FIXME: support other padding modes - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } diff --git a/Userland/Libraries/LibCrypto/Hash/HashManager.h b/Userland/Libraries/LibCrypto/Hash/HashManager.h index 9b47149602..9da7c24526 100644 --- a/Userland/Libraries/LibCrypto/Hash/HashManager.h +++ b/Userland/Libraries/LibCrypto/Hash/HashManager.h @@ -85,7 +85,7 @@ struct MultiHashDigestVariant { return sha512.value().immutable_data(); default: case HashKind::None: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } @@ -103,7 +103,7 @@ struct MultiHashDigestVariant { return sha512.value().data_length(); default: case HashKind::None: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } @@ -179,7 +179,7 @@ public: inline void initialize(HashKind kind) { if (m_kind != HashKind::None) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_kind = kind; @@ -248,7 +248,7 @@ public: return { m_sha512->peek() }; default: case HashKind::None: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } diff --git a/Userland/Libraries/LibCrypto/Hash/MD5.cpp b/Userland/Libraries/LibCrypto/Hash/MD5.cpp index 1b2a71d30a..5cf717134f 100644 --- a/Userland/Libraries/LibCrypto/Hash/MD5.cpp +++ b/Userland/Libraries/LibCrypto/Hash/MD5.cpp @@ -88,7 +88,7 @@ void MD5::update(const u8* input, size_t length) index = 0; } - ASSERT(length < part_length || length - offset <= 64); + VERIFY(length < part_length || length - offset <= 64); m_buffer.overwrite(index, &input[offset], length - offset); } MD5::DigestType MD5::digest() diff --git a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp index ecccd2c60e..fd54602ae4 100644 --- a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp +++ b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp @@ -240,7 +240,7 @@ static bool MR_primality_test(UnsignedBigInteger n, const Vector<UnsignedBigInte { // Written using Wikipedia: // https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test#Miller%E2%80%93Rabin_test - ASSERT(!(n < 4)); + VERIFY(!(n < 4)); auto predecessor = n.minus({ 1 }); auto d = predecessor; size_t r = 0; @@ -259,8 +259,8 @@ static bool MR_primality_test(UnsignedBigInteger n, const Vector<UnsignedBigInte } for (auto& a : tests) { - // Technically: ASSERT(2 <= a && a <= n - 2) - ASSERT(a < n); + // Technically: VERIFY(2 <= a && a <= n - 2) + VERIFY(a < n); auto x = ModularPower(a, d, n); if (x == 1 || x == predecessor) continue; @@ -283,13 +283,13 @@ static bool MR_primality_test(UnsignedBigInteger n, const Vector<UnsignedBigInte UnsignedBigInteger random_number(const UnsignedBigInteger& min, const UnsignedBigInteger& max_excluded) { - ASSERT(min < max_excluded); + VERIFY(min < max_excluded); auto range = max_excluded.minus(min); UnsignedBigInteger base; auto size = range.trimmed_length() * sizeof(u32) + 2; // "+2" is intentional (see below). // Also, if we're about to crash anyway, at least produce a nice error: - ASSERT(size < 8 * MiB); + VERIFY(size < 8 * MiB); u8 buf[size]; AK::fill_with_random(buf, size); UnsignedBigInteger random { buf, size }; @@ -340,7 +340,7 @@ bool is_probably_prime(const UnsignedBigInteger& p) UnsignedBigInteger random_big_prime(size_t bits) { - ASSERT(bits >= 33); + VERIFY(bits >= 33); UnsignedBigInteger min = UnsignedBigInteger::from_base10("6074001000").shift_left(bits - 33); UnsignedBigInteger max = UnsignedBigInteger { 1 }.shift_left(bits).minus(1); for (;;) { diff --git a/Userland/Libraries/LibCrypto/PK/RSA.cpp b/Userland/Libraries/LibCrypto/PK/RSA.cpp index dc6a042b83..b4b90c187b 100644 --- a/Userland/Libraries/LibCrypto/PK/RSA.cpp +++ b/Userland/Libraries/LibCrypto/PK/RSA.cpp @@ -286,7 +286,7 @@ void RSA::import_private_key(ReadonlyBytes bytes, bool pem) auto key = parse_rsa_key(bytes); if (!key.private_key.length()) { dbgln("We expected to see a private key, but we found none"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_private_key = key.private_key; } @@ -302,7 +302,7 @@ void RSA::import_public_key(ReadonlyBytes bytes, bool pem) auto key = parse_rsa_key(bytes); if (!key.public_key.length()) { dbgln("We expected to see a public key, but we found none"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_public_key = key.public_key; } @@ -356,7 +356,7 @@ void RSA_PKCS1_EME::encrypt(ReadonlyBytes in, Bytes& out) u8 ps[ps_length]; // FIXME: Without this assertion, GCC refuses to compile due to a memcpy overflow(!?) - ASSERT(ps_length < 16384); + VERIFY(ps_length < 16384); AK::fill_with_random(ps, ps_length); // since arc4random can create zeros (shocking!) diff --git a/Userland/Libraries/LibDebug/DebugInfo.cpp b/Userland/Libraries/LibDebug/DebugInfo.cpp index 7f7b7a0d9f..eb8ab79f14 100644 --- a/Userland/Libraries/LibDebug/DebugInfo.cpp +++ b/Userland/Libraries/LibDebug/DebugInfo.cpp @@ -207,7 +207,7 @@ static Optional<Dwarf::DIE> parse_variable_type_die(const Dwarf::DIE& variable_d if (!type_die_offset.has_value()) return {}; - ASSERT(type_die_offset.value().type == Dwarf::DIE::AttributeValue::Type::DieReference); + VERIFY(type_die_offset.value().type == Dwarf::DIE::AttributeValue::Type::DieReference); auto type_die = variable_die.get_die_at_offset(type_die_offset.value().data.as_u32); auto type_name = type_die.get_attribute(Dwarf::Attribute::Name); @@ -241,7 +241,7 @@ static void parse_variable_location(const Dwarf::DIE& variable_die, DebugInfo::V auto value = Dwarf::Expression::evaluate(expression_bytes, regs); if (value.type != Dwarf::Expression::Type::None) { - ASSERT(value.type == Dwarf::Expression::Type::UnsignedIntetger); + VERIFY(value.type == Dwarf::Expression::Type::UnsignedIntetger); variable_info.location_type = DebugInfo::VariableInfo::LocationType::Address; variable_info.location_data.address = value.data.as_u32; } @@ -254,7 +254,7 @@ static void parse_variable_location(const Dwarf::DIE& variable_die, DebugInfo::V OwnPtr<DebugInfo::VariableInfo> DebugInfo::create_variable_info(const Dwarf::DIE& variable_die, const PtraceRegisters& regs) const { - ASSERT(variable_die.tag() == Dwarf::EntryTag::Variable + VERIFY(variable_die.tag() == Dwarf::EntryTag::Variable || variable_die.tag() == Dwarf::EntryTag::Member || variable_die.tag() == Dwarf::EntryTag::FormalParameter || variable_die.tag() == Dwarf::EntryTag::EnumerationType @@ -274,7 +274,7 @@ OwnPtr<DebugInfo::VariableInfo> DebugInfo::create_variable_info(const Dwarf::DIE if (variable_die.tag() == Dwarf::EntryTag::Enumerator) { auto constant = variable_die.get_attribute(Dwarf::Attribute::ConstValue); - ASSERT(constant.has_value()); + VERIFY(constant.has_value()); switch (constant.value().type) { case Dwarf::DIE::AttributeValue::Type::UnsignedNumber: variable_info->constant_data.as_u32 = constant.value().data.as_u32; @@ -286,7 +286,7 @@ OwnPtr<DebugInfo::VariableInfo> DebugInfo::create_variable_info(const Dwarf::DIE variable_info->constant_data.as_string = constant.value().data.as_string; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } else { parse_variable_location(variable_die, *variable_info, regs); @@ -302,7 +302,7 @@ OwnPtr<DebugInfo::VariableInfo> DebugInfo::create_variable_info(const Dwarf::DIE if (member.is_null()) return; auto member_variable = create_variable_info(member, regs); - ASSERT(member_variable); + VERIFY(member_variable); if (type_die.value().tag() == Dwarf::EntryTag::EnumerationType) { member_variable->parent = type_info.ptr(); @@ -311,7 +311,7 @@ OwnPtr<DebugInfo::VariableInfo> DebugInfo::create_variable_info(const Dwarf::DIE if (variable_info->location_type == DebugInfo::VariableInfo::LocationType::None) { return; } - ASSERT(variable_info->location_type == DebugInfo::VariableInfo::LocationType::Address); + VERIFY(variable_info->location_type == DebugInfo::VariableInfo::LocationType::Address); if (member_variable->location_type == DebugInfo::VariableInfo::LocationType::Address) member_variable->location_data.address += variable_info->location_data.address; diff --git a/Userland/Libraries/LibDebug/DebugSession.cpp b/Userland/Libraries/LibDebug/DebugSession.cpp index 243d05f400..e35886a734 100644 --- a/Userland/Libraries/LibDebug/DebugSession.cpp +++ b/Userland/Libraries/LibDebug/DebugSession.cpp @@ -73,7 +73,7 @@ OwnPtr<DebugSession> DebugSession::exec_and_attach(const String& command, String } auto parts = command.split(' '); - ASSERT(!parts.is_empty()); + VERIFY(!parts.is_empty()); const char** args = (const char**)calloc(parts.size() + 1, sizeof(const char*)); for (size_t i = 0; i < parts.size(); i++) { args[i] = parts[i].characters(); @@ -155,7 +155,7 @@ bool DebugSession::insert_breakpoint(void* address) if (!original_bytes.has_value()) return false; - ASSERT((original_bytes.value() & 0xff) != BREAKPOINT_INSTRUCTION); + VERIFY((original_bytes.value() & 0xff) != BREAKPOINT_INSTRUCTION); BreakPoint breakpoint { address, original_bytes.value(), BreakPointState::Disabled }; @@ -169,7 +169,7 @@ bool DebugSession::insert_breakpoint(void* address) bool DebugSession::disable_breakpoint(void* address) { auto breakpoint = m_breakpoints.get(address); - ASSERT(breakpoint.has_value()); + VERIFY(breakpoint.has_value()); if (!poke(reinterpret_cast<u32*>(reinterpret_cast<char*>(breakpoint.value().address)), breakpoint.value().original_first_word)) return false; @@ -182,9 +182,9 @@ bool DebugSession::disable_breakpoint(void* address) bool DebugSession::enable_breakpoint(void* address) { auto breakpoint = m_breakpoints.get(address); - ASSERT(breakpoint.has_value()); + VERIFY(breakpoint.has_value()); - ASSERT(breakpoint.value().state == BreakPointState::Disabled); + VERIFY(breakpoint.value().state == BreakPointState::Disabled); if (!poke(reinterpret_cast<u32*>(breakpoint.value().address), (breakpoint.value().original_first_word & ~(uint32_t)0xff) | BREAKPOINT_INSTRUCTION)) return false; @@ -214,7 +214,7 @@ PtraceRegisters DebugSession::get_registers() const PtraceRegisters regs; if (ptrace(PT_GETREGS, m_debuggee_pid, ®s, 0) < 0) { perror("PT_GETREGS"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return regs; } @@ -223,7 +223,7 @@ void DebugSession::set_registers(const PtraceRegisters& regs) { if (ptrace(PT_SETREGS, m_debuggee_pid, reinterpret_cast<void*>(&const_cast<PtraceRegisters&>(regs)), 0) < 0) { perror("PT_SETREGS"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -232,7 +232,7 @@ void DebugSession::continue_debuggee(ContinueType type) int command = (type == ContinueType::FreeRun) ? PT_CONTINUE : PT_SYSCALL; if (ptrace(command, m_debuggee_pid, 0, 0) < 0) { perror("continue"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -242,7 +242,7 @@ int DebugSession::continue_debuggee_and_wait(ContinueType type) int wstatus = 0; if (waitpid(m_debuggee_pid, &wstatus, WSTOPPED | WEXITED) != m_debuggee_pid) { perror("waitpid"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return wstatus; } @@ -264,7 +264,7 @@ void* DebugSession::single_step() if (waitpid(m_debuggee_pid, 0, WSTOPPED) != m_debuggee_pid) { perror("waitpid"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } regs = get_registers(); @@ -316,7 +316,7 @@ Optional<DebugSession::InsertBreakpointAtSourcePositionResult> DebugSession::ins return {}; auto lib = library_at(address); - ASSERT(lib); + VERIFY(lib); return InsertBreakpointAtSourcePositionResult { lib->name, address_and_source_position.value().file, address_and_source_position.value().line, address }; } @@ -325,11 +325,11 @@ void DebugSession::update_loaded_libs() { auto file = Core::File::construct(String::format("/proc/%u/vm", m_debuggee_pid)); bool rc = file->open(Core::IODevice::ReadOnly); - ASSERT(rc); + VERIFY(rc); auto file_contents = file->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); auto vm_entries = json.value().as_array(); Regex<PosixExtended> re("(.+): \\.text"); diff --git a/Userland/Libraries/LibDebug/DebugSession.h b/Userland/Libraries/LibDebug/DebugSession.h index f30174a740..50e9e96370 100644 --- a/Userland/Libraries/LibDebug/DebugSession.h +++ b/Userland/Libraries/LibDebug/DebugSession.h @@ -298,7 +298,7 @@ void DebugSession::run(DesiredInitialDebugeeState initial_debugee_state, Callbac break; } if (decision == DebugDecision::Kill) { - ASSERT_NOT_REACHED(); // TODO: implement + VERIFY_NOT_REACHED(); // TODO: implement } if (state == State::SingleStep && !did_single_step) { diff --git a/Userland/Libraries/LibDebug/Dwarf/DIE.cpp b/Userland/Libraries/LibDebug/Dwarf/DIE.cpp index 4ef58947bb..5733b33fd5 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DIE.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/DIE.cpp @@ -46,7 +46,7 @@ DIE::DIE(const CompilationUnit& unit, u32 offset) m_tag = EntryTag::None; } else { auto abbreviation_info = m_compilation_unit.abbreviations_map().get(m_abbreviation_code); - ASSERT(abbreviation_info.has_value()); + VERIFY(abbreviation_info.has_value()); m_tag = abbreviation_info.value().tag; m_has_children = abbreviation_info.value().has_children; @@ -76,7 +76,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::StringPointer: { u32 offset; debug_info_stream >> offset; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::String; auto strings_data = m_compilation_unit.dwarf_info().debug_strings_data(); @@ -86,7 +86,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Data1: { u8 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::UnsignedNumber; value.data.as_u32 = data; break; @@ -94,7 +94,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Data2: { u16 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::UnsignedNumber; value.data.as_u32 = data; break; @@ -102,7 +102,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Addr: { u32 address; debug_info_stream >> address; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::UnsignedNumber; value.data.as_u32 = address; break; @@ -110,7 +110,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::SData: { ssize_t data; debug_info_stream.read_LEB128_signed(data); - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::SignedNumber; value.data.as_i32 = data; break; @@ -118,7 +118,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::SecOffset: { u32 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::SecOffset; value.data.as_u32 = data; break; @@ -126,7 +126,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Data4: { u32 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::UnsignedNumber; value.data.as_u32 = data; break; @@ -134,7 +134,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Ref4: { u32 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::DieReference; value.data.as_u32 = data + m_compilation_unit.offset(); break; @@ -147,7 +147,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::ExprLoc: { size_t length; debug_info_stream.read_LEB128_unsigned(length); - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::DwarfExpression; assign_raw_bytes_value(length); break; @@ -156,7 +156,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, String str; u32 str_offset = debug_info_stream.offset(); debug_info_stream >> str; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::String; value.data.as_string = reinterpret_cast<const char*>(str_offset + m_compilation_unit.dwarf_info().debug_info_data().data()); break; @@ -165,7 +165,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, value.type = AttributeValue::Type::RawBytes; u8 length; debug_info_stream >> length; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); assign_raw_bytes_value(length); break; } @@ -173,7 +173,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, value.type = AttributeValue::Type::RawBytes; u16 length; debug_info_stream >> length; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); assign_raw_bytes_value(length); break; } @@ -181,7 +181,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, value.type = AttributeValue::Type::RawBytes; u32 length; debug_info_stream >> length; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); assign_raw_bytes_value(length); break; } @@ -189,13 +189,13 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, value.type = AttributeValue::Type::RawBytes; size_t length; debug_info_stream.read_LEB128_unsigned(length); - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); assign_raw_bytes_value(length); break; } default: dbgln("Unimplemented AttributeDataForm: {}", (u32)form); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return value; } @@ -206,7 +206,7 @@ Optional<DIE::AttributeValue> DIE::get_attribute(const Attribute& attribute) con stream.discard_or_error(m_data_offset); auto abbreviation_info = m_compilation_unit.abbreviations_map().get(m_abbreviation_code); - ASSERT(abbreviation_info.has_value()); + VERIFY(abbreviation_info.has_value()); for (const auto& attribute_spec : abbreviation_info.value().attribute_specifications) { auto value = get_attribute_value(attribute_spec.form, stream); @@ -251,7 +251,7 @@ void DIE::for_each_child(Function<void(const DIE& child)> callback) const DIE DIE::get_die_at_offset(u32 offset) const { - ASSERT(offset >= m_compilation_unit.offset() && offset < m_compilation_unit.offset() + m_compilation_unit.size()); + VERIFY(offset >= m_compilation_unit.offset() && offset < m_compilation_unit.offset() + m_compilation_unit.size()); return DIE(m_compilation_unit, offset); } diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp index 09717cfc71..fb1fdc2f42 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp @@ -59,8 +59,8 @@ void DwarfInfo::populate_compilation_units() CompilationUnitHeader compilation_unit_header {}; stream >> Bytes { &compilation_unit_header, sizeof(compilation_unit_header) }; - ASSERT(compilation_unit_header.address_size == sizeof(u32)); - ASSERT(compilation_unit_header.version <= 4); + VERIFY(compilation_unit_header.address_size == sizeof(u32)); + VERIFY(compilation_unit_header.version <= 4); u32 length_after_header = compilation_unit_header.length - (sizeof(CompilationUnitHeader) - offsetof(CompilationUnitHeader, version)); m_compilation_units.empend(*this, unit_offset, compilation_unit_header); diff --git a/Userland/Libraries/LibDebug/Dwarf/Expression.cpp b/Userland/Libraries/LibDebug/Dwarf/Expression.cpp index fe50d1aed3..b8f78a1e82 100644 --- a/Userland/Libraries/LibDebug/Dwarf/Expression.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/Expression.cpp @@ -55,10 +55,10 @@ Value evaluate(ReadonlyBytes bytes, const PtraceRegisters& regs) default: dbgln("DWARF expr addr: {}", (const void*)bytes.data()); dbgln("unsupported opcode: {}", (u8)opcode); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp b/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp index 649f0fe547..447bcccc99 100644 --- a/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp @@ -45,8 +45,8 @@ void LineProgram::parse_unit_header() { m_stream >> Bytes { &m_unit_header, sizeof(m_unit_header) }; - ASSERT(m_unit_header.version == DWARF_VERSION); - ASSERT(m_unit_header.opcode_base == SPECIAL_OPCODES_BASE); + VERIFY(m_unit_header.version == DWARF_VERSION); + VERIFY(m_unit_header.opcode_base == SPECIAL_OPCODES_BASE); #if DWARF_DEBUG dbgln("unit length: {}", m_unit_header.length); @@ -67,7 +67,7 @@ void LineProgram::parse_source_directories() } m_stream.handle_recoverable_error(); m_stream.discard_or_error(1); - ASSERT(!m_stream.has_any_error()); + VERIFY(!m_stream.has_any_error()); } void LineProgram::parse_source_files() @@ -87,7 +87,7 @@ void LineProgram::parse_source_files() m_source_files.append({ file_name, directory_index }); } m_stream.discard_or_error(1); - ASSERT(!m_stream.has_any_error()); + VERIFY(!m_stream.has_any_error()); } void LineProgram::append_to_line_info() @@ -131,7 +131,7 @@ void LineProgram::handle_extended_opcode() break; } case ExtendedOpcodes::SetAddress: { - ASSERT(length == sizeof(size_t) + 1); + VERIFY(length == sizeof(size_t) + 1); m_stream >> m_address; #if DWARF_DEBUG dbgln("SetAddress: {:p}", m_address); @@ -149,7 +149,7 @@ void LineProgram::handle_extended_opcode() #if DWARF_DEBUG dbgln("offset: {:p}", m_stream.offset()); #endif - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } void LineProgram::handle_standard_opcode(u8 opcode) @@ -191,7 +191,7 @@ void LineProgram::handle_standard_opcode(u8 opcode) case StandardOpcodes::AdvanceLine: { ssize_t line_delta; m_stream.read_LEB128_signed(line_delta); - ASSERT(line_delta >= 0 || m_line >= (size_t)(-line_delta)); + VERIFY(line_delta >= 0 || m_line >= (size_t)(-line_delta)); m_line += line_delta; #if DWARF_DEBUG dbgln("AdvanceLine: {}", m_line); @@ -223,7 +223,7 @@ void LineProgram::handle_standard_opcode(u8 opcode) } default: dbgln("Unhandled LineProgram opcode {}", opcode); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } void LineProgram::handle_sepcial_opcode(u8 opcode) diff --git a/Userland/Libraries/LibDesktop/AppFile.cpp b/Userland/Libraries/LibDesktop/AppFile.cpp index 41958328f5..8951bf75b0 100644 --- a/Userland/Libraries/LibDesktop/AppFile.cpp +++ b/Userland/Libraries/LibDesktop/AppFile.cpp @@ -82,14 +82,14 @@ bool AppFile::validate() const String AppFile::name() const { auto name = m_config->read_entry("App", "Name").trim_whitespace(); - ASSERT(!name.is_empty()); + VERIFY(!name.is_empty()); return name; } String AppFile::executable() const { auto executable = m_config->read_entry("App", "Executable").trim_whitespace(); - ASSERT(!executable.is_empty()); + VERIFY(!executable.is_empty()); return executable; } diff --git a/Userland/Libraries/LibDesktop/Launcher.cpp b/Userland/Libraries/LibDesktop/Launcher.cpp index 06e1caff01..c81eff8a46 100644 --- a/Userland/Libraries/LibDesktop/Launcher.cpp +++ b/Userland/Libraries/LibDesktop/Launcher.cpp @@ -38,7 +38,7 @@ auto Launcher::Details::from_details_str(const String& details_str) -> NonnullRe { auto details = adopt(*new Details); auto json = JsonValue::from_string(details_str); - ASSERT(json.has_value()); + VERIFY(json.has_value()); auto obj = json.value().as_object(); details->executable = obj.get("executable").to_string(); details->name = obj.get("name").to_string(); @@ -124,7 +124,7 @@ bool Launcher::open(const URL& url, const String& handler_name) bool Launcher::open(const URL& url, const Details& details) { - ASSERT(details.launcher_type != LauncherType::Application); // Launcher should not be used to execute arbitrary applications + VERIFY(details.launcher_type != LauncherType::Application); // Launcher should not be used to execute arbitrary applications return open(url, details.executable); } diff --git a/Userland/Libraries/LibDiff/Hunks.cpp b/Userland/Libraries/LibDiff/Hunks.cpp index d94bedfa03..b6ee4fee22 100644 --- a/Userland/Libraries/LibDiff/Hunks.cpp +++ b/Userland/Libraries/LibDiff/Hunks.cpp @@ -110,13 +110,13 @@ HunkLocation parse_hunk_location(const String& location_line) }; while (char_index < location_line.length() && location_line[char_index++] != '-') { } - ASSERT(char_index < location_line.length()); + VERIFY(char_index < location_line.length()); size_t original_location_start_index = char_index; while (char_index < location_line.length() && location_line[char_index++] != ' ') { } - ASSERT(char_index < location_line.length() && location_line[char_index] == '+'); + VERIFY(char_index < location_line.length() && location_line[char_index] == '+'); size_t original_location_end_index = char_index - 2; size_t target_location_start_index = char_index + 1; @@ -124,7 +124,7 @@ HunkLocation parse_hunk_location(const String& location_line) char_index += 1; while (char_index < location_line.length() && location_line[char_index++] != ' ') { } - ASSERT(char_index < location_line.length()); + VERIFY(char_index < location_line.length()); size_t target_location_end_index = char_index - 2; diff --git a/Userland/Libraries/LibELF/DynamicLinker.cpp b/Userland/Libraries/LibELF/DynamicLinker.cpp index 4e7842de3f..da7596ecac 100644 --- a/Userland/Libraries/LibELF/DynamicLinker.cpp +++ b/Userland/Libraries/LibELF/DynamicLinker.cpp @@ -87,7 +87,7 @@ static void map_library(const String& name, int fd) auto loader = ELF::DynamicLoader::try_create(fd, name); if (!loader) { dbgln("Failed to create ELF::DynamicLoader for fd={}, name={}", fd, name); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } loader->set_tls_offset(g_current_tls_offset); @@ -101,7 +101,7 @@ static void map_library(const String& name) // TODO: Do we want to also look for libs in other paths too? String path = String::formatted("/usr/lib/{}", name); int fd = open(path.characters(), O_RDONLY); - ASSERT(fd >= 0); + VERIFY(fd >= 0); map_library(name, fd); } @@ -162,19 +162,19 @@ static void initialize_libc(DynamicObject& libc) // Also, we can't just mark `__libc_init` with "__attribute__((constructor))" // because it uses getenv() internally, so `environ` has to be initialized before we call `__libc_init`. auto res = libc.lookup_symbol("environ"); - ASSERT(res.has_value()); + VERIFY(res.has_value()); *((char***)res.value().address.as_ptr()) = g_envp; res = libc.lookup_symbol("__environ_is_malloced"); - ASSERT(res.has_value()); + VERIFY(res.has_value()); *((bool*)res.value().address.as_ptr()) = false; res = libc.lookup_symbol("exit"); - ASSERT(res.has_value()); + VERIFY(res.has_value()); g_libc_exit = (LibCExitFunction)res.value().address.as_ptr(); res = libc.lookup_symbol("__libc_init"); - ASSERT(res.has_value()); + VERIFY(res.has_value()); typedef void libc_init_func(); ((libc_init_func*)res.value().address.as_ptr())(); } @@ -203,12 +203,12 @@ static void load_elf(const String& name) { for_each_dependency_of(name, [](auto& loader) { auto dynamic_object = loader.map(); - ASSERT(dynamic_object); + VERIFY(dynamic_object); g_global_objects.append(*dynamic_object); }); for_each_dependency_of(name, [](auto& loader) { bool success = loader.link(RTLD_GLOBAL | RTLD_LAZY, g_total_tls_size); - ASSERT(success); + VERIFY(success); }); } @@ -223,11 +223,11 @@ static NonnullRefPtr<DynamicLoader> commit_elf(const String& name) } auto object = loader->load_stage_3(RTLD_GLOBAL | RTLD_LAZY, g_total_tls_size); - ASSERT(object); + VERIFY(object); if (name == "libsystem.so") { if (syscall(SC_msyscall, object->base_address().as_ptr())) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -288,7 +288,7 @@ void ELF::DynamicLinker::linker_main(String&& main_program_name, int main_progra int rc = syscall(SC_msyscall, nullptr); if (rc < 0) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } rc = main_function(argc, argv, envp); @@ -299,7 +299,7 @@ void ELF::DynamicLinker::linker_main(String&& main_program_name, int main_progra _exit(rc); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibELF/DynamicLoader.cpp b/Userland/Libraries/LibELF/DynamicLoader.cpp index d81a410221..524253c0b8 100644 --- a/Userland/Libraries/LibELF/DynamicLoader.cpp +++ b/Userland/Libraries/LibELF/DynamicLoader.cpp @@ -60,7 +60,7 @@ RefPtr<DynamicLoader> DynamicLoader::try_create(int fd, String filename) return {}; } - ASSERT(stat.st_size >= 0); + VERIFY(stat.st_size >= 0); auto size = static_cast<size_t>(stat.st_size); if (size < sizeof(Elf32_Ehdr)) return {}; @@ -90,11 +90,11 @@ DynamicLoader::~DynamicLoader() { if (munmap(m_file_data, m_file_size) < 0) { perror("munmap"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (close(m_image_fd) < 0) { perror("close"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -109,7 +109,7 @@ const DynamicObject& DynamicLoader::dynamic_object() const } return IterationDecision::Continue; }); - ASSERT(!dynamic_section_address.is_null()); + VERIFY(!dynamic_section_address.is_null()); m_cached_dynamic_object = ELF::DynamicObject::create(VirtualAddress(m_elf_image.base_address()), dynamic_section_address); } @@ -154,7 +154,7 @@ void* DynamicLoader::symbol_for_name(const StringView& name) RefPtr<DynamicObject> DynamicLoader::map() { - ASSERT(!m_dynamic_object); + VERIFY(!m_dynamic_object); if (!m_valid) { dbgln("DynamicLoader::map failed: image is invalid"); @@ -177,10 +177,10 @@ bool DynamicLoader::link(unsigned flags, size_t total_tls_size) bool DynamicLoader::load_stage_2(unsigned flags, size_t total_tls_size) { - ASSERT(flags & RTLD_GLOBAL); + VERIFY(flags & RTLD_GLOBAL); if (m_dynamic_object->has_text_relocations()) { - ASSERT(m_text_segment_load_address.get() != 0); + VERIFY(m_text_segment_load_address.get() != 0); #ifndef AK_OS_MACOS // Remap this text region as private. @@ -205,7 +205,7 @@ void DynamicLoader::do_main_relocations(size_t total_tls_size) switch (do_relocation(total_tls_size, relocation)) { case RelocationResult::Failed: dbgln("Loader.so: {} unresolved symbol '{}'", m_filename, relocation.symbol().name()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case RelocationResult::ResolveLater: m_unresolved_relocations.append(relocation); break; @@ -254,7 +254,7 @@ void DynamicLoader::do_lazy_relocations(size_t total_tls_size) for (const auto& relocation : m_unresolved_relocations) { if (auto res = do_relocation(total_tls_size, relocation); res != RelocationResult::Success) { dbgln("Loader.so: {} unresolved symbol '{}'", m_filename, relocation.symbol().name()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } } @@ -272,27 +272,27 @@ void DynamicLoader::load_program_headers() ProgramHeaderRegion region {}; region.set_program_header(program_header.raw_header()); if (region.is_tls_template()) { - ASSERT(!tls_region.has_value()); + VERIFY(!tls_region.has_value()); tls_region = region; } else if (region.is_load()) { if (region.is_executable()) { - ASSERT(!text_region.has_value()); + VERIFY(!text_region.has_value()); text_region = region; } else { - ASSERT(!data_region.has_value()); + VERIFY(!data_region.has_value()); data_region = region; } } else if (region.is_dynamic()) { dynamic_region_desired_vaddr = region.desired_load_address(); } else if (region.is_relro()) { - ASSERT(!relro_region.has_value()); + VERIFY(!relro_region.has_value()); relro_region = region; } return IterationDecision::Continue; }); - ASSERT(text_region.has_value()); - ASSERT(data_region.has_value()); + VERIFY(text_region.has_value()); + VERIFY(data_region.has_value()); // Process regions in order: .text, .data, .tls void* requested_load_address = m_elf_image.is_dynamic() ? nullptr : text_region.value().desired_load_address().as_ptr(); @@ -303,7 +303,7 @@ void DynamicLoader::load_program_headers() else reservation_mmap_flags |= MAP_FIXED; - ASSERT(!text_region.value().is_writable()); + VERIFY(!text_region.value().is_writable()); // First, we make a dummy reservation mapping, in order to allocate enough VM // to hold both text+data contiguously in the address space. @@ -321,13 +321,13 @@ void DynamicLoader::load_program_headers() auto* reservation = mmap(requested_load_address, total_mapping_size, PROT_NONE, reservation_mmap_flags, 0, 0); if (reservation == MAP_FAILED) { perror("mmap reservation"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // Then we unmap the reservation. if (munmap(reservation, total_mapping_size) < 0) { perror("munmap reservation"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // Now we can map the text segment at the reserved address. @@ -342,10 +342,10 @@ void DynamicLoader::load_program_headers() if (text_segment_begin == MAP_FAILED) { perror("mmap text"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(requested_load_address == nullptr || requested_load_address == text_segment_begin); + VERIFY(requested_load_address == nullptr || requested_load_address == text_segment_begin); m_text_segment_size = text_segment_size; m_text_segment_load_address = VirtualAddress { (FlatPtr)text_segment_begin }; @@ -375,7 +375,7 @@ void DynamicLoader::load_program_headers() if (MAP_FAILED == data_segment) { perror("mmap data"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } VirtualAddress data_segment_start; @@ -409,7 +409,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si if (symbol.bind() == STB_WEAK) return RelocationResult::ResolveLater; dbgln("ERROR: symbol not found: {}.", symbol.name()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto symbol_address = res.value().address; *patch_ptr += symbol_address.get(); @@ -418,7 +418,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si case R_386_PC32: { auto symbol = relocation.symbol(); auto result = lookup_symbol(symbol); - ASSERT(result.has_value()); + VERIFY(result.has_value()); auto relative_offset = result.value().address - m_dynamic_object->base_address().offset(relocation.offset()); *patch_ptr += relative_offset.get(); break; @@ -440,7 +440,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si return RelocationResult::Failed; } auto symbol_location = res.value().address; - ASSERT(symbol_location != m_dynamic_object->base_address()); + VERIFY(symbol_location != m_dynamic_object->base_address()); *patch_ptr = symbol_location.get(); break; } @@ -462,7 +462,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si break; u32 symbol_value = res.value().value; auto* dynamic_object_of_symbol = res.value().dynamic_object; - ASSERT(dynamic_object_of_symbol); + VERIFY(dynamic_object_of_symbol); size_t offset_of_tls_end = dynamic_object_of_symbol->tls_offset().value() + dynamic_object_of_symbol->tls_size().value(); *patch_ptr = (offset_of_tls_end - total_tls_size - symbol_value - sizeof(Elf32_Addr)); break; @@ -484,7 +484,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si default: // Raise the alarm! Someone needs to implement this relocation type dbgln("Found a new exciting relocation type {}", relocation.type()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return RelocationResult::Success; } @@ -494,8 +494,8 @@ extern "C" void _plt_trampoline(void) __attribute__((visibility("hidden"))); void DynamicLoader::setup_plt_trampoline() { - ASSERT(m_dynamic_object); - ASSERT(m_dynamic_object->has_plt()); + VERIFY(m_dynamic_object); + VERIFY(m_dynamic_object->has_plt()); VirtualAddress got_address = m_dynamic_object->plt_got_base_address(); auto* got_ptr = (FlatPtr*)got_address.as_ptr(); diff --git a/Userland/Libraries/LibELF/DynamicObject.cpp b/Userland/Libraries/LibELF/DynamicObject.cpp index 9505a87809..5c29083505 100644 --- a/Userland/Libraries/LibELF/DynamicObject.cpp +++ b/Userland/Libraries/LibELF/DynamicObject.cpp @@ -129,7 +129,7 @@ void DynamicObject::parse() break; case DT_PLTREL: m_procedure_linkage_table_relocation_type = entry.val(); - ASSERT(m_procedure_linkage_table_relocation_type & (DT_REL | DT_RELA)); + VERIFY(m_procedure_linkage_table_relocation_type & (DT_REL | DT_RELA)); break; case DT_JMPREL: m_plt_relocation_offset_location = entry.ptr() - (FlatPtr)m_elf_base_address.as_ptr(); @@ -172,7 +172,7 @@ void DynamicObject::parse() break; default: dbgln("DynamicObject: DYNAMIC tag handling not implemented for DT_{}", name_for_dtag(entry.tag())); - ASSERT_NOT_REACHED(); // FIXME: Maybe just break out here and return false? + VERIFY_NOT_REACHED(); // FIXME: Maybe just break out here and return false? break; } return IterationDecision::Continue; @@ -193,7 +193,7 @@ void DynamicObject::parse() DynamicObject::Relocation DynamicObject::RelocationSection::relocation(unsigned index) const { - ASSERT(index < entry_count()); + VERIFY(index < entry_count()); unsigned offset_in_section = index * entry_size(); auto relocation_address = (Elf32_Rel*)address().offset(offset_in_section).as_ptr(); return Relocation(m_dynamic, *relocation_address, offset_in_section); @@ -201,7 +201,7 @@ DynamicObject::Relocation DynamicObject::RelocationSection::relocation(unsigned DynamicObject::Relocation DynamicObject::RelocationSection::relocation_at_offset(unsigned offset) const { - ASSERT(offset <= (m_section_size_bytes - m_entry_size)); + VERIFY(offset <= (m_section_size_bytes - m_entry_size)); auto relocation_address = (Elf32_Rel*)address().offset(offset).as_ptr(); return Relocation(m_dynamic, *relocation_address, offset); } @@ -323,7 +323,7 @@ const char* DynamicObject::raw_symbol_string_table_string(Elf32_Word index) cons DynamicObject::InitializationFunction DynamicObject::init_section_function() const { - ASSERT(has_init_section()); + VERIFY(has_init_section()); return (InitializationFunction)init_section().address().as_ptr(); } @@ -444,14 +444,14 @@ NonnullRefPtr<DynamicObject> DynamicObject::create(VirtualAddress base_address, VirtualAddress DynamicObject::patch_plt_entry(u32 relocation_offset) { auto relocation = plt_relocation_section().relocation_at_offset(relocation_offset); - ASSERT(relocation.type() == R_386_JMP_SLOT); + VERIFY(relocation.type() == R_386_JMP_SLOT); auto symbol = relocation.symbol(); u8* relocation_address = relocation.address().as_ptr(); auto result = DynamicLoader::lookup_symbol(symbol); if (!result.has_value()) { dbgln("did not find symbol: {}", symbol.name()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto symbol_location = result.value().address; diff --git a/Userland/Libraries/LibELF/Image.cpp b/Userland/Libraries/LibELF/Image.cpp index 07233f5e0d..d40cea14e3 100644 --- a/Userland/Libraries/LibELF/Image.cpp +++ b/Userland/Libraries/LibELF/Image.cpp @@ -74,7 +74,7 @@ static const char* object_file_type_to_string(Elf32_Half type) StringView Image::section_index_to_string(unsigned index) const { - ASSERT(m_valid); + VERIFY(m_valid); if (index == SHN_UNDEF) return "Undefined"; if (index >= SHN_LORESERVE) @@ -84,7 +84,7 @@ StringView Image::section_index_to_string(unsigned index) const unsigned Image::symbol_count() const { - ASSERT(m_valid); + VERIFY(m_valid); if (!section_count()) return 0; return section(m_symbol_table_section_index).entry_count(); @@ -146,13 +146,13 @@ void Image::dump() const unsigned Image::section_count() const { - ASSERT(m_valid); + VERIFY(m_valid); return header().e_shnum; } unsigned Image::program_header_count() const { - ASSERT(m_valid); + VERIFY(m_valid); return header().e_phnum; } @@ -191,7 +191,7 @@ bool Image::parse() StringView Image::table_string(unsigned table_index, unsigned offset) const { - ASSERT(m_valid); + VERIFY(m_valid); auto& sh = section_header(table_index); if (sh.sh_type != SHT_STRTAB) return nullptr; @@ -208,67 +208,67 @@ StringView Image::table_string(unsigned table_index, unsigned offset) const StringView Image::section_header_table_string(unsigned offset) const { - ASSERT(m_valid); + VERIFY(m_valid); return table_string(header().e_shstrndx, offset); } StringView Image::table_string(unsigned offset) const { - ASSERT(m_valid); + VERIFY(m_valid); return table_string(m_string_table_section_index, offset); } const char* Image::raw_data(unsigned offset) const { - ASSERT(offset < m_size); // Callers must check indices into raw_data()'s result are also in bounds. + VERIFY(offset < m_size); // Callers must check indices into raw_data()'s result are also in bounds. return reinterpret_cast<const char*>(m_buffer) + offset; } const Elf32_Ehdr& Image::header() const { - ASSERT(m_size >= sizeof(Elf32_Ehdr)); + VERIFY(m_size >= sizeof(Elf32_Ehdr)); return *reinterpret_cast<const Elf32_Ehdr*>(raw_data(0)); } const Elf32_Phdr& Image::program_header_internal(unsigned index) const { - ASSERT(m_valid); - ASSERT(index < header().e_phnum); + VERIFY(m_valid); + VERIFY(index < header().e_phnum); return *reinterpret_cast<const Elf32_Phdr*>(raw_data(header().e_phoff + (index * sizeof(Elf32_Phdr)))); } const Elf32_Shdr& Image::section_header(unsigned index) const { - ASSERT(m_valid); - ASSERT(index < header().e_shnum); + VERIFY(m_valid); + VERIFY(index < header().e_shnum); return *reinterpret_cast<const Elf32_Shdr*>(raw_data(header().e_shoff + (index * header().e_shentsize))); } Image::Symbol Image::symbol(unsigned index) const { - ASSERT(m_valid); - ASSERT(index < symbol_count()); + VERIFY(m_valid); + VERIFY(index < symbol_count()); auto* raw_syms = reinterpret_cast<const Elf32_Sym*>(raw_data(section(m_symbol_table_section_index).offset())); return Symbol(*this, index, raw_syms[index]); } Image::Section Image::section(unsigned index) const { - ASSERT(m_valid); - ASSERT(index < section_count()); + VERIFY(m_valid); + VERIFY(index < section_count()); return Section(*this, index); } Image::ProgramHeader Image::program_header(unsigned index) const { - ASSERT(m_valid); - ASSERT(index < program_header_count()); + VERIFY(m_valid); + VERIFY(index < program_header_count()); return ProgramHeader(*this, index); } Image::Relocation Image::RelocationSection::relocation(unsigned index) const { - ASSERT(index < relocation_count()); + VERIFY(index < relocation_count()); auto* rels = reinterpret_cast<const Elf32_Rel*>(m_image.raw_data(offset())); return Relocation(m_image, rels[index]); } @@ -291,7 +291,7 @@ Image::RelocationSection Image::Section::relocations() const Image::Section Image::lookup_section(const String& name) const { - ASSERT(m_valid); + VERIFY(m_valid); for (unsigned i = 0; i < section_count(); ++i) { auto section = this->section(i); if (section.name() == name) diff --git a/Userland/Libraries/LibELF/Validation.cpp b/Userland/Libraries/LibELF/Validation.cpp index b849e836b8..403353cdde 100644 --- a/Userland/Libraries/LibELF/Validation.cpp +++ b/Userland/Libraries/LibELF/Validation.cpp @@ -219,7 +219,7 @@ bool validate_program_headers(const Elf32_Ehdr& elf_header, size_t file_size, co if (file_size < buffer_size) { dbgln("We somehow read more from a file than was in the file in the first place!"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } size_t num_program_headers = elf_header.e_phnum; diff --git a/Userland/Libraries/LibGUI/AbstractSlider.cpp b/Userland/Libraries/LibGUI/AbstractSlider.cpp index 99400b44d2..f6601ee38d 100644 --- a/Userland/Libraries/LibGUI/AbstractSlider.cpp +++ b/Userland/Libraries/LibGUI/AbstractSlider.cpp @@ -65,7 +65,7 @@ void AbstractSlider::set_page_step(int page_step) void AbstractSlider::set_range(int min, int max) { - ASSERT(min <= max); + VERIFY(min <= max); if (m_min == min && m_max == max) return; m_min = min; diff --git a/Userland/Libraries/LibGUI/AbstractView.cpp b/Userland/Libraries/LibGUI/AbstractView.cpp index d735291e59..8ac69da289 100644 --- a/Userland/Libraries/LibGUI/AbstractView.cpp +++ b/Userland/Libraries/LibGUI/AbstractView.cpp @@ -140,8 +140,8 @@ void AbstractView::update_edit_widget_position() void AbstractView::begin_editing(const ModelIndex& index) { - ASSERT(is_editable()); - ASSERT(model()); + VERIFY(is_editable()); + VERIFY(model()); if (m_edit_index == index) return; if (!model()->is_editable(index)) @@ -152,7 +152,7 @@ void AbstractView::begin_editing(const ModelIndex& index) } m_edit_index = index; - ASSERT(aid_create_editing_delegate); + VERIFY(aid_create_editing_delegate); m_editing_delegate = aid_create_editing_delegate(index); m_editing_delegate->bind(*model(), index); m_editing_delegate->set_value(index.data()); @@ -164,12 +164,12 @@ void AbstractView::begin_editing(const ModelIndex& index) m_edit_widget->set_focus(true); m_editing_delegate->will_begin_editing(); m_editing_delegate->on_commit = [this] { - ASSERT(model()); + VERIFY(model()); model()->set_data(m_edit_index, m_editing_delegate->value()); stop_editing(); }; m_editing_delegate->on_rollback = [this] { - ASSERT(model()); + VERIFY(model()); stop_editing(); }; } @@ -298,7 +298,7 @@ void AbstractView::mousemove_event(MouseEvent& event) if (distance_travelled_squared <= drag_distance_threshold) return ScrollableWidget::mousemove_event(event); - ASSERT(!data_type.is_null()); + VERIFY(!data_type.is_null()); if (m_is_dragging) return; @@ -323,7 +323,7 @@ void AbstractView::mousemove_event(MouseEvent& event) dbgln("Drag was cancelled!"); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } diff --git a/Userland/Libraries/LibGUI/Action.h b/Userland/Libraries/LibGUI/Action.h index efafc3c9ee..4ed68896f7 100644 --- a/Userland/Libraries/LibGUI/Action.h +++ b/Userland/Libraries/LibGUI/Action.h @@ -105,7 +105,7 @@ public: bool is_checked() const { - ASSERT(is_checkable()); + VERIFY(is_checkable()); return m_checked; } void set_checked(bool); diff --git a/Userland/Libraries/LibGUI/Application.cpp b/Userland/Libraries/LibGUI/Application.cpp index 818fe37cd6..73e4caa964 100644 --- a/Userland/Libraries/LibGUI/Application.cpp +++ b/Userland/Libraries/LibGUI/Application.cpp @@ -82,7 +82,7 @@ Application* Application::the() Application::Application(int argc, char** argv) { - ASSERT(!*s_the); + VERIFY(!*s_the); *s_the = *this; m_event_loop = make<Core::EventLoop>(); WindowServerConnection::the(); @@ -212,7 +212,7 @@ Gfx::Palette Application::palette() const void Application::tooltip_show_timer_did_fire() { - ASSERT(m_tooltip_window); + VERIFY(m_tooltip_window); Gfx::IntRect desktop_rect = Desktop::the().rect(); const int margin = 30; diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp index d136c17413..007e136a19 100644 --- a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp +++ b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp @@ -196,7 +196,7 @@ void AutocompleteBox::apply_suggestion() auto suggestion = suggestion_index.data().to_string(); size_t partial_length = suggestion_index.data((GUI::ModelRole)AutocompleteSuggestionModel::InternalRole::PartialInputLength).to_i64(); - ASSERT(suggestion.length() >= partial_length); + VERIFY(suggestion.length() >= partial_length); auto completion = suggestion.substring_view(partial_length, suggestion.length() - partial_length); m_editor->insert_at_cursor_or_replace_selection(completion); } diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.h b/Userland/Libraries/LibGUI/AutocompleteProvider.h index 6987f3b0ca..6dd51864ee 100644 --- a/Userland/Libraries/LibGUI/AutocompleteProvider.h +++ b/Userland/Libraries/LibGUI/AutocompleteProvider.h @@ -59,7 +59,7 @@ public: void attach(TextEditor& editor) { - ASSERT(!m_editor); + VERIFY(!m_editor); m_editor = editor; } void detach() { m_editor.clear(); } diff --git a/Userland/Libraries/LibGUI/BreadcrumbBar.cpp b/Userland/Libraries/LibGUI/BreadcrumbBar.cpp index b95e756c86..15fce14f53 100644 --- a/Userland/Libraries/LibGUI/BreadcrumbBar.cpp +++ b/Userland/Libraries/LibGUI/BreadcrumbBar.cpp @@ -136,7 +136,7 @@ void BreadcrumbBar::set_selected_segment(Optional<size_t> index) } auto& segment = m_segments[index.value()]; - ASSERT(segment.button); + VERIFY(segment.button); segment.button->set_checked(true); } diff --git a/Userland/Libraries/LibGUI/ColumnsView.cpp b/Userland/Libraries/LibGUI/ColumnsView.cpp index 9a18c4a5f3..c2d2747dcc 100644 --- a/Userland/Libraries/LibGUI/ColumnsView.cpp +++ b/Userland/Libraries/LibGUI/ColumnsView.cpp @@ -69,7 +69,7 @@ void ColumnsView::select_all() return; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }); for (Column& column : columns_for_selection) { @@ -102,12 +102,12 @@ void ColumnsView::paint_event(PaintEvent& event) auto& column = m_columns[i]; auto* next_column = i + 1 == m_columns.size() ? nullptr : &m_columns[i + 1]; - ASSERT(column.width > 0); + VERIFY(column.width > 0); int row_count = model()->row_count(column.parent_index); for (int row = 0; row < row_count; row++) { ModelIndex index = model()->index(row, m_model_column, column.parent_index); - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); bool is_selected_row = selection().contains(index); @@ -180,7 +180,7 @@ void ColumnsView::paint_event(PaintEvent& event) void ColumnsView::push_column(const ModelIndex& parent_index) { - ASSERT(model()); + VERIFY(model()); // Drop columns at the end. ModelIndex grandparent = model()->parent_index(parent_index); @@ -216,7 +216,7 @@ void ColumnsView::update_column_sizes() column.width = 10; for (int row = 0; row < row_count; row++) { ModelIndex index = model()->index(row, m_model_column, column.parent_index); - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); auto text = index.data().to_string(); int row_width = icon_spacing() + icon_size() + icon_spacing() + font().width(text) + icon_spacing() + s_arrow_bitmap_width + icon_spacing(); if (row_width > column.width) diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp index 510074df8c..565ca3de1b 100644 --- a/Userland/Libraries/LibGUI/ComboBox.cpp +++ b/Userland/Libraries/LibGUI/ComboBox.cpp @@ -118,7 +118,7 @@ ComboBox::ComboBox() m_list_view->set_frame_thickness(1); m_list_view->set_frame_shadow(Gfx::FrameShadow::Plain); m_list_view->on_selection = [this](auto& index) { - ASSERT(model()); + VERIFY(model()); m_list_view->set_activates_on_selection(true); if (m_updating_model) selection_updated(index); diff --git a/Userland/Libraries/LibGUI/Dialog.cpp b/Userland/Libraries/LibGUI/Dialog.cpp index e1988da503..9922812333 100644 --- a/Userland/Libraries/LibGUI/Dialog.cpp +++ b/Userland/Libraries/LibGUI/Dialog.cpp @@ -43,7 +43,7 @@ Dialog::~Dialog() int Dialog::exec() { - ASSERT(!m_event_loop); + VERIFY(!m_event_loop); m_event_loop = make<Core::EventLoop>(); if (parent() && is<Window>(parent())) { auto& parent_window = *static_cast<Window*>(parent()); diff --git a/Userland/Libraries/LibGUI/DisplayLink.cpp b/Userland/Libraries/LibGUI/DisplayLink.cpp index a2bf46e921..b9663405d1 100644 --- a/Userland/Libraries/LibGUI/DisplayLink.cpp +++ b/Userland/Libraries/LibGUI/DisplayLink.cpp @@ -73,7 +73,7 @@ i32 DisplayLink::register_callback(Function<void(i32)> callback) bool DisplayLink::unregister_callback(i32 callback_id) { - ASSERT(callbacks().contains(callback_id)); + VERIFY(callbacks().contains(callback_id)); callbacks().remove(callback_id); if (callbacks().is_empty()) diff --git a/Userland/Libraries/LibGUI/DragOperation.cpp b/Userland/Libraries/LibGUI/DragOperation.cpp index a1afb25cdc..e6a3215303 100644 --- a/Userland/Libraries/LibGUI/DragOperation.cpp +++ b/Userland/Libraries/LibGUI/DragOperation.cpp @@ -46,9 +46,9 @@ DragOperation::~DragOperation() DragOperation::Outcome DragOperation::exec() { - ASSERT(!s_current_drag_operation); - ASSERT(!m_event_loop); - ASSERT(m_mime_data); + VERIFY(!s_current_drag_operation); + VERIFY(!m_event_loop); + VERIFY(m_mime_data); Gfx::ShareableBitmap drag_bitmap; if (m_mime_data->has_format("image/x-raw-bitmap")) { @@ -79,14 +79,14 @@ DragOperation::Outcome DragOperation::exec() void DragOperation::done(Outcome outcome) { - ASSERT(m_outcome == Outcome::None); + VERIFY(m_outcome == Outcome::None); m_outcome = outcome; m_event_loop->quit(0); } void DragOperation::notify_accepted(Badge<WindowServerConnection>) { - ASSERT(s_current_drag_operation); + VERIFY(s_current_drag_operation); s_current_drag_operation->done(Outcome::Accepted); } diff --git a/Userland/Libraries/LibGUI/EditingEngine.cpp b/Userland/Libraries/LibGUI/EditingEngine.cpp index 3e16b1c3b1..45c75b4f12 100644 --- a/Userland/Libraries/LibGUI/EditingEngine.cpp +++ b/Userland/Libraries/LibGUI/EditingEngine.cpp @@ -36,13 +36,13 @@ EditingEngine::~EditingEngine() void EditingEngine::attach(TextEditor& editor) { - ASSERT(!m_editor); + VERIFY(!m_editor); m_editor = editor; } void EditingEngine::detach() { - ASSERT(m_editor); + VERIFY(m_editor); m_editor = nullptr; } @@ -450,7 +450,7 @@ TextPosition EditingEngine::find_beginning_of_next_word() has_seen_whitespace = true; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void EditingEngine::move_to_beginning_of_next_word() @@ -516,7 +516,7 @@ TextPosition EditingEngine::find_end_of_next_word() is_first_iteration = false; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void EditingEngine::move_to_end_of_next_word() @@ -584,7 +584,7 @@ TextPosition EditingEngine::find_end_of_previous_word() has_seen_whitespace = true; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void EditingEngine::move_to_end_of_previous_word() @@ -648,7 +648,7 @@ TextPosition EditingEngine::find_beginning_of_previous_word() is_first_iteration = false; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void EditingEngine::move_to_beginning_of_previous_word() @@ -689,7 +689,7 @@ void EditingEngine::move_selected_lines_down() get_selection_line_boundaries(first_line, last_line); auto& lines = m_editor->document().lines(); - ASSERT(lines.size() != 0); + VERIFY(lines.size() != 0); if (last_line >= lines.size() - 1) return; diff --git a/Userland/Libraries/LibGUI/FileIconProvider.cpp b/Userland/Libraries/LibGUI/FileIconProvider.cpp index 9d2ec26ba0..ed585e9dc2 100644 --- a/Userland/Libraries/LibGUI/FileIconProvider.cpp +++ b/Userland/Libraries/LibGUI/FileIconProvider.cpp @@ -240,7 +240,7 @@ Icon FileIconProvider::icon_for_path(const String& path, mode_t mode) for (auto size : target_icon.sizes()) { auto& emblem = size < 32 ? *s_symlink_emblem_small : *s_symlink_emblem; auto original_bitmap = target_icon.bitmap_for_size(size); - ASSERT(original_bitmap); + VERIFY(original_bitmap); auto generated_bitmap = original_bitmap->clone(); if (!generated_bitmap) { dbgln("Failed to clone {}x{} icon for symlink variant", size, size); diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index 3f9c5dae0c..88672e9e36 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -99,7 +99,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& file_ auto& widget = set_main_widget<GUI::Widget>(); if (!widget.load_from_gml(file_picker_dialog_gml)) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); auto& toolbar = *widget.find_descendant_of_type_named<GUI::ToolBar>("toolbar"); toolbar.set_has_frame(false); diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp index 4c8d7b08af..b504ae09e2 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.cpp +++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp @@ -53,7 +53,7 @@ ModelIndex FileSystemModel::Node::index(int column) const if (&parent->children[row] == this) return m_model.create_index(row, column, const_cast<Node*>(this)); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool FileSystemModel::Node::fetch_data(const String& full_path, bool is_root) @@ -340,7 +340,7 @@ const FileSystemModel::Node& FileSystemModel::node(const ModelIndex& index) cons { if (!index.is_valid()) return *m_root; - ASSERT(index.internal_data()); + VERIFY(index.internal_data()); return *(Node*)index.internal_data(); } @@ -361,7 +361,7 @@ ModelIndex FileSystemModel::parent_index(const ModelIndex& index) const return {}; auto& node = this->node(index); if (!node.parent) { - ASSERT(&node == m_root); + VERIFY(&node == m_root); return {}; } return node.parent->index(index.column()); @@ -369,7 +369,7 @@ ModelIndex FileSystemModel::parent_index(const ModelIndex& index) const Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const { - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); if (role == ModelRole::TextAlignment) { switch (index.column()) { @@ -386,7 +386,7 @@ Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const case Column::SymlinkTarget: return Gfx::TextAlignment::CenterLeft; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -394,7 +394,7 @@ Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const if (role == ModelRole::Custom) { // For GUI::FileSystemModel, custom role means the full path. - ASSERT(index.column() == Column::Name); + VERIFY(index.column() == Column::Name); return node.full_path(); } @@ -429,7 +429,7 @@ Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const case Column::SymlinkTarget: return node.symlink_target; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (role == ModelRole::Display) { @@ -581,7 +581,7 @@ String FileSystemModel::column_name(int column) const case Column::SymlinkTarget: return "Symlink target"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool FileSystemModel::accepts_drag(const ModelIndex& index, const Vector<String>& mime_types) const @@ -611,7 +611,7 @@ bool FileSystemModel::is_editable(const ModelIndex& index) const void FileSystemModel::set_data(const ModelIndex& index, const Variant& data) { - ASSERT(is_editable(index)); + VERIFY(is_editable(index)); Node& node = const_cast<Node&>(this->node(index)); auto dirname = LexicalPath(node.full_path()).dirname(); auto new_full_path = String::formatted("{}/{}", dirname, data.to_string()); diff --git a/Userland/Libraries/LibGUI/FontPicker.cpp b/Userland/Libraries/LibGUI/FontPicker.cpp index de73560cc6..d4e14bbf86 100644 --- a/Userland/Libraries/LibGUI/FontPicker.cpp +++ b/Userland/Libraries/LibGUI/FontPicker.cpp @@ -96,7 +96,7 @@ FontPicker::FontPicker(Window* parent_window, const Gfx::Font* current_font, boo auto& widget = set_main_widget<GUI::Widget>(); if (!widget.load_from_gml(font_picker_dialog_gml)) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); m_family_list_view = *widget.find_descendant_of_type_named<ListView>("family_list_view"); m_family_list_view->set_model(ItemListModel<String>::create(m_families)); diff --git a/Userland/Libraries/LibGUI/GMLFormatter.cpp b/Userland/Libraries/LibGUI/GMLFormatter.cpp index 09c263bcc9..813247af48 100644 --- a/Userland/Libraries/LibGUI/GMLFormatter.cpp +++ b/Userland/Libraries/LibGUI/GMLFormatter.cpp @@ -113,7 +113,7 @@ String format_gml(const StringView& string) auto ast = parse_gml(string); if (ast.is_null()) return {}; - ASSERT(ast.is_object()); + VERIFY(ast.is_object()); return format_gml_object(ast.as_object()); } diff --git a/Userland/Libraries/LibGUI/GMLLexer.cpp b/Userland/Libraries/LibGUI/GMLLexer.cpp index ede1272356..05985b7426 100644 --- a/Userland/Libraries/LibGUI/GMLLexer.cpp +++ b/Userland/Libraries/LibGUI/GMLLexer.cpp @@ -44,7 +44,7 @@ char GMLLexer::peek(size_t offset) const char GMLLexer::consume() { - ASSERT(m_index < m_input.length()); + VERIFY(m_index < m_input.length()); char ch = m_input[m_index++]; m_previous_position = m_position; if (ch == '\n') { diff --git a/Userland/Libraries/LibGUI/GMLLexer.h b/Userland/Libraries/LibGUI/GMLLexer.h index 0803747dd9..20bd137a39 100644 --- a/Userland/Libraries/LibGUI/GMLLexer.h +++ b/Userland/Libraries/LibGUI/GMLLexer.h @@ -62,7 +62,7 @@ struct GMLToken { FOR_EACH_TOKEN_TYPE #undef __TOKEN } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Type m_type { Type::Unknown }; diff --git a/Userland/Libraries/LibGUI/HeaderView.cpp b/Userland/Libraries/LibGUI/HeaderView.cpp index 0b394b63d2..c60dbc9e55 100644 --- a/Userland/Libraries/LibGUI/HeaderView.cpp +++ b/Userland/Libraries/LibGUI/HeaderView.cpp @@ -153,7 +153,7 @@ void HeaderView::mousemove_event(MouseEvent& event) int new_size = m_section_resize_original_width + delta.primary_offset_for_orientation(m_orientation); if (new_size <= minimum_column_size) new_size = minimum_column_size; - ASSERT(m_resizing_section >= 0 && m_resizing_section < model()->column_count()); + VERIFY(m_resizing_section >= 0 && m_resizing_section < model()->column_count()); set_section_size(m_resizing_section, new_size); return; } @@ -317,7 +317,7 @@ Menu& HeaderView::ensure_context_menu() // FIXME: This menu needs to be rebuilt if the model is swapped out, // or if the column count/names change. if (!m_context_menu) { - ASSERT(model()); + VERIFY(model()); m_context_menu = Menu::construct(); if (m_orientation == Gfx::Orientation::Vertical) { diff --git a/Userland/Libraries/LibGUI/INILexer.cpp b/Userland/Libraries/LibGUI/INILexer.cpp index 6410a58c03..4b34800c01 100644 --- a/Userland/Libraries/LibGUI/INILexer.cpp +++ b/Userland/Libraries/LibGUI/INILexer.cpp @@ -44,7 +44,7 @@ char IniLexer::peek(size_t offset) const char IniLexer::consume() { - ASSERT(m_index < m_input.length()); + VERIFY(m_index < m_input.length()); char ch = m_input[m_index++]; m_previous_position = m_position; if (ch == '\n') { diff --git a/Userland/Libraries/LibGUI/INILexer.h b/Userland/Libraries/LibGUI/INILexer.h index c4f4ba46d8..69c71c662b 100644 --- a/Userland/Libraries/LibGUI/INILexer.h +++ b/Userland/Libraries/LibGUI/INILexer.h @@ -62,7 +62,7 @@ struct IniToken { FOR_EACH_TOKEN_TYPE #undef __TOKEN } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Type m_type { Type::Unknown }; diff --git a/Userland/Libraries/LibGUI/Icon.cpp b/Userland/Libraries/LibGUI/Icon.cpp index 650b440842..c927a5368d 100644 --- a/Userland/Libraries/LibGUI/Icon.cpp +++ b/Userland/Libraries/LibGUI/Icon.cpp @@ -49,7 +49,7 @@ Icon::Icon(RefPtr<Gfx::Bitmap>&& bitmap) : Icon() { if (bitmap) { - ASSERT(bitmap->width() == bitmap->height()); + VERIFY(bitmap->width() == bitmap->height()); int size = bitmap->width(); set_bitmap_for_size(size, move(bitmap)); } @@ -59,7 +59,7 @@ Icon::Icon(RefPtr<Gfx::Bitmap>&& bitmap1, RefPtr<Gfx::Bitmap>&& bitmap2) : Icon(move(bitmap1)) { if (bitmap2) { - ASSERT(bitmap2->width() == bitmap2->height()); + VERIFY(bitmap2->width() == bitmap2->height()); int size = bitmap2->width(); set_bitmap_for_size(size, move(bitmap2)); } diff --git a/Userland/Libraries/LibGUI/IconView.cpp b/Userland/Libraries/LibGUI/IconView.cpp index d3ac1e84b7..d5108d3a26 100644 --- a/Userland/Libraries/LibGUI/IconView.cpp +++ b/Userland/Libraries/LibGUI/IconView.cpp @@ -85,7 +85,7 @@ void IconView::reinit_item_cache() const for (size_t i = new_item_count; i < m_item_data_cache.size(); i++) { auto& item_data = m_item_data_cache[i]; if (item_data.selected) { - ASSERT(m_selected_count_cache > 0); + VERIFY(m_selected_count_cache > 0); m_selected_count_cache--; } } @@ -212,7 +212,7 @@ Gfx::IntRect IconView::item_rect(int item_index) const ModelIndex IconView::index_at_event_position(const Gfx::IntPoint& position) const { - ASSERT(model()); + VERIFY(model()); auto adjusted_position = to_content_position(position); if (auto item_data = item_data_from_content_position(adjusted_position)) { if (item_data->is_containing(adjusted_position)) @@ -603,7 +603,7 @@ void IconView::do_clear_selection() m_selected_count_cache--; } m_first_selected_hint = 0; - ASSERT(m_selected_count_cache == 0); + VERIFY(m_selected_count_cache == 0); } void IconView::clear_selection() @@ -661,7 +661,7 @@ void IconView::remove_selection(ItemData& item_data) TemporaryChange change(m_changing_selection, true); item_data.selected = false; - ASSERT(m_selected_count_cache > 0); + VERIFY(m_selected_count_cache > 0); m_selected_count_cache--; int item_index = &item_data - &m_item_data_cache[0]; if (m_first_selected_hint == item_index) { @@ -770,7 +770,7 @@ void IconView::set_flow_direction(FlowDirection flow_direction) template<typename Function> inline IterationDecision IconView::for_each_item_intersecting_rect(const Gfx::IntRect& rect, Function f) const { - ASSERT(model()); + VERIFY(model()); if (rect.is_empty()) return IterationDecision::Continue; int begin_row, begin_column; diff --git a/Userland/Libraries/LibGUI/IconView.h b/Userland/Libraries/LibGUI/IconView.h index c26d34b766..71cf41b8ed 100644 --- a/Userland/Libraries/LibGUI/IconView.h +++ b/Userland/Libraries/LibGUI/IconView.h @@ -100,13 +100,13 @@ private: bool is_intersecting(const Gfx::IntRect& rect) const { - ASSERT(valid); + VERIFY(valid); return icon_rect.intersects(rect) || text_rect.intersects(rect); } bool is_containing(const Gfx::IntPoint& point) const { - ASSERT(valid); + VERIFY(valid); return icon_rect.contains(point) || text_rect.contains(point); } }; @@ -135,7 +135,7 @@ private: void reinit_item_cache() const; int model_index_to_item_index(const ModelIndex& model_index) const { - ASSERT(model_index.row() < item_count()); + VERIFY(model_index.row() < item_count()); return model_index.row(); } diff --git a/Userland/Libraries/LibGUI/ImageWidget.cpp b/Userland/Libraries/LibGUI/ImageWidget.cpp index a77ca3d1b7..019994224e 100644 --- a/Userland/Libraries/LibGUI/ImageWidget.cpp +++ b/Userland/Libraries/LibGUI/ImageWidget.cpp @@ -99,7 +99,7 @@ void ImageWidget::load_from_file(const StringView& path) auto& mapped_file = *file_or_error.value(); m_image_decoder = Gfx::ImageDecoder::create((const u8*)mapped_file.data(), mapped_file.size()); auto bitmap = m_image_decoder->bitmap(); - ASSERT(bitmap); + VERIFY(bitmap); set_bitmap(bitmap); diff --git a/Userland/Libraries/LibGUI/JsonArrayModel.cpp b/Userland/Libraries/LibGUI/JsonArrayModel.cpp index 83846ff37a..b31007d36d 100644 --- a/Userland/Libraries/LibGUI/JsonArrayModel.cpp +++ b/Userland/Libraries/LibGUI/JsonArrayModel.cpp @@ -43,8 +43,8 @@ void JsonArrayModel::update() auto json = JsonValue::from_string(file->read_all()); - ASSERT(json.has_value()); - ASSERT(json.value().is_array()); + VERIFY(json.has_value()); + VERIFY(json.value().is_array()); m_array = json.value().as_array(); did_update(); @@ -65,7 +65,7 @@ bool JsonArrayModel::store() bool JsonArrayModel::add(const Vector<JsonValue>&& values) { - ASSERT(values.size() == m_fields.size()); + VERIFY(values.size() == m_fields.size()); JsonObject obj; for (size_t i = 0; i < m_fields.size(); ++i) { auto& field_spec = m_fields[i]; diff --git a/Userland/Libraries/LibGUI/Layout.cpp b/Userland/Libraries/LibGUI/Layout.cpp index 250b1c5ca4..e534a1d5a9 100644 --- a/Userland/Libraries/LibGUI/Layout.cpp +++ b/Userland/Libraries/LibGUI/Layout.cpp @@ -66,7 +66,7 @@ Layout::Layout() } else if (entry.type == Entry::Type::Spacer) { entry_object.set("type", "Spacer"); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } entries_array.append(move(entry_object)); } @@ -87,7 +87,7 @@ void Layout::notify_adopted(Badge<Widget>, Widget& widget) void Layout::notify_disowned(Badge<Widget>, Widget& widget) { - ASSERT(m_owner == &widget); + VERIFY(m_owner == &widget); m_owner.clear(); } diff --git a/Userland/Libraries/LibGUI/LazyWidget.cpp b/Userland/Libraries/LibGUI/LazyWidget.cpp index 3e1a9c4951..1472b5879e 100644 --- a/Userland/Libraries/LibGUI/LazyWidget.cpp +++ b/Userland/Libraries/LibGUI/LazyWidget.cpp @@ -42,7 +42,7 @@ void LazyWidget::show_event(ShowEvent&) return; m_has_been_shown = true; - ASSERT(on_first_show); + VERIFY(on_first_show); on_first_show(*this); } diff --git a/Userland/Libraries/LibGUI/ListView.cpp b/Userland/Libraries/LibGUI/ListView.cpp index 4b304f6751..a1cd030f96 100644 --- a/Userland/Libraries/LibGUI/ListView.cpp +++ b/Userland/Libraries/LibGUI/ListView.cpp @@ -96,7 +96,7 @@ Gfx::IntRect ListView::content_rect(const ModelIndex& index) const ModelIndex ListView::index_at_event_position(const Gfx::IntPoint& point) const { - ASSERT(model()); + VERIFY(model()); auto adjusted_position = this->adjusted_position(point); for (int row = 0, row_count = model()->row_count(); row < row_count; ++row) { diff --git a/Userland/Libraries/LibGUI/Menu.cpp b/Userland/Libraries/LibGUI/Menu.cpp index 28844f055f..805fc22165 100644 --- a/Userland/Libraries/LibGUI/Menu.cpp +++ b/Userland/Libraries/LibGUI/Menu.cpp @@ -113,7 +113,7 @@ int Menu::realize_menu(RefPtr<Action> default_action) #if MENU_DEBUG dbgln("GUI::Menu::realize_menu(): New menu ID: {}", m_menu_id); #endif - ASSERT(m_menu_id > 0); + VERIFY(m_menu_id > 0); for (size_t i = 0; i < m_items.size(); ++i) { auto& item = m_items[i]; item.set_menu_id({}, m_menu_id); diff --git a/Userland/Libraries/LibGUI/MenuBar.cpp b/Userland/Libraries/LibGUI/MenuBar.cpp index ea8c9649b5..1900aa046c 100644 --- a/Userland/Libraries/LibGUI/MenuBar.cpp +++ b/Userland/Libraries/LibGUI/MenuBar.cpp @@ -63,12 +63,12 @@ void MenuBar::unrealize_menubar() void MenuBar::notify_added_to_application(Badge<Application>) { - ASSERT(m_menubar_id == -1); + VERIFY(m_menubar_id == -1); m_menubar_id = realize_menubar(); - ASSERT(m_menubar_id != -1); + VERIFY(m_menubar_id != -1); for (auto& menu : m_menus) { int menu_id = menu.realize_menu(); - ASSERT(menu_id != -1); + VERIFY(menu_id != -1); WindowServerConnection::the().send_sync<Messages::WindowServer::AddMenuToMenubar>(m_menubar_id, menu_id); } WindowServerConnection::the().send_sync<Messages::WindowServer::SetApplicationMenubar>(m_menubar_id); diff --git a/Userland/Libraries/LibGUI/MenuItem.cpp b/Userland/Libraries/LibGUI/MenuItem.cpp index 8c6e5a92ec..af9522fb7e 100644 --- a/Userland/Libraries/LibGUI/MenuItem.cpp +++ b/Userland/Libraries/LibGUI/MenuItem.cpp @@ -72,7 +72,7 @@ void MenuItem::set_enabled(bool enabled) void MenuItem::set_checked(bool checked) { - ASSERT(is_checkable()); + VERIFY(is_checkable()); if (m_checked == checked) return; m_checked = checked; @@ -81,7 +81,7 @@ void MenuItem::set_checked(bool checked) void MenuItem::set_default(bool is_default) { - ASSERT(is_checkable()); + VERIFY(is_checkable()); if (m_default == is_default) return; m_default = is_default; diff --git a/Userland/Libraries/LibGUI/ModelIndex.cpp b/Userland/Libraries/LibGUI/ModelIndex.cpp index ea6a97c28f..038974d1d4 100644 --- a/Userland/Libraries/LibGUI/ModelIndex.cpp +++ b/Userland/Libraries/LibGUI/ModelIndex.cpp @@ -35,7 +35,7 @@ Variant ModelIndex::data(ModelRole role) const if (!is_valid()) return {}; - ASSERT(model()); + VERIFY(model()); return model()->data(*this, role); } diff --git a/Userland/Libraries/LibGUI/ModelSelection.cpp b/Userland/Libraries/LibGUI/ModelSelection.cpp index 2a22336855..27686f22ce 100644 --- a/Userland/Libraries/LibGUI/ModelSelection.cpp +++ b/Userland/Libraries/LibGUI/ModelSelection.cpp @@ -47,7 +47,7 @@ void ModelSelection::remove_matching(Function<bool(const ModelIndex&)> filter) void ModelSelection::set(const ModelIndex& index) { - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); if (m_indexes.size() == 1 && m_indexes.contains(index)) return; m_indexes.clear(); @@ -57,7 +57,7 @@ void ModelSelection::set(const ModelIndex& index) void ModelSelection::add(const ModelIndex& index) { - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); if (m_indexes.contains(index)) return; m_indexes.set(index); @@ -78,7 +78,7 @@ void ModelSelection::add_all(const Vector<ModelIndex>& indices) void ModelSelection::toggle(const ModelIndex& index) { - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); if (m_indexes.contains(index)) m_indexes.remove(index); else @@ -88,7 +88,7 @@ void ModelSelection::toggle(const ModelIndex& index) bool ModelSelection::remove(const ModelIndex& index) { - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); if (!m_indexes.contains(index)) return false; m_indexes.remove(index); diff --git a/Userland/Libraries/LibGUI/MultiView.cpp b/Userland/Libraries/LibGUI/MultiView.cpp index 0c50700b6d..1fcff6446f 100644 --- a/Userland/Libraries/LibGUI/MultiView.cpp +++ b/Userland/Libraries/LibGUI/MultiView.cpp @@ -94,7 +94,7 @@ void MultiView::set_view_mode(ViewMode mode) m_view_as_icons_action->set_checked(true); return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void MultiView::set_model(RefPtr<Model> model) diff --git a/Userland/Libraries/LibGUI/MultiView.h b/Userland/Libraries/LibGUI/MultiView.h index e835bca6eb..2c2406e86e 100644 --- a/Userland/Libraries/LibGUI/MultiView.h +++ b/Userland/Libraries/LibGUI/MultiView.h @@ -73,7 +73,7 @@ public: case ViewMode::Icon: return *m_icon_view; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibGUI/OpacitySlider.cpp b/Userland/Libraries/LibGUI/OpacitySlider.cpp index d32002f479..c92f59da10 100644 --- a/Userland/Libraries/LibGUI/OpacitySlider.cpp +++ b/Userland/Libraries/LibGUI/OpacitySlider.cpp @@ -37,7 +37,7 @@ OpacitySlider::OpacitySlider(Gfx::Orientation orientation) : AbstractSlider(orientation) { // FIXME: Implement vertical mode. - ASSERT(orientation == Gfx::Orientation::Horizontal); + VERIFY(orientation == Gfx::Orientation::Horizontal); set_min(0); set_max(100); diff --git a/Userland/Libraries/LibGUI/ProgressBar.cpp b/Userland/Libraries/LibGUI/ProgressBar.cpp index 0e6cd4acbe..e2732a738c 100644 --- a/Userland/Libraries/LibGUI/ProgressBar.cpp +++ b/Userland/Libraries/LibGUI/ProgressBar.cpp @@ -59,7 +59,7 @@ void ProgressBar::set_value(int value) void ProgressBar::set_range(int min, int max) { - ASSERT(min < max); + VERIFY(min < max); m_min = min; m_max = max; m_value = clamp(m_value, m_min, m_max); diff --git a/Userland/Libraries/LibGUI/RunningProcessesModel.cpp b/Userland/Libraries/LibGUI/RunningProcessesModel.cpp index 985586c10f..b416873435 100644 --- a/Userland/Libraries/LibGUI/RunningProcessesModel.cpp +++ b/Userland/Libraries/LibGUI/RunningProcessesModel.cpp @@ -85,7 +85,7 @@ String RunningProcessesModel::column_name(int column_index) const case Column::Name: return "Name"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } GUI::Variant RunningProcessesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const @@ -109,7 +109,7 @@ GUI::Variant RunningProcessesModel::data(const GUI::ModelIndex& index, GUI::Mode case Column::Name: return process.name; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return {}; } diff --git a/Userland/Libraries/LibGUI/ScrollBar.cpp b/Userland/Libraries/LibGUI/ScrollBar.cpp index ad8bf27e48..26b6816b4d 100644 --- a/Userland/Libraries/LibGUI/ScrollBar.cpp +++ b/Userland/Libraries/LibGUI/ScrollBar.cpp @@ -279,7 +279,7 @@ void ScrollBar::mousedown_event(MouseEvent& event) if (event.shift()) { scroll_to_position(event.position()); m_pressed_component = component_at_position(event.position()); - ASSERT(m_pressed_component == Component::Scrubber); + VERIFY(m_pressed_component == Component::Scrubber); } if (m_pressed_component == Component::Scrubber) { m_scrub_start_value = value(); @@ -287,9 +287,9 @@ void ScrollBar::mousedown_event(MouseEvent& event) update(); return; } - ASSERT(!event.shift()); + VERIFY(!event.shift()); - ASSERT(m_pressed_component == Component::Gutter); + VERIFY(m_pressed_component == Component::Gutter); set_automatic_scrolling_active(true, Component::Gutter); update(); } diff --git a/Userland/Libraries/LibGUI/SortingProxyModel.cpp b/Userland/Libraries/LibGUI/SortingProxyModel.cpp index a0618ae410..a3602de29e 100644 --- a/Userland/Libraries/LibGUI/SortingProxyModel.cpp +++ b/Userland/Libraries/LibGUI/SortingProxyModel.cpp @@ -83,12 +83,12 @@ ModelIndex SortingProxyModel::map_to_source(const ModelIndex& proxy_index) const if (!proxy_index.is_valid()) return {}; - ASSERT(proxy_index.model() == this); - ASSERT(proxy_index.internal_data()); + VERIFY(proxy_index.model() == this); + VERIFY(proxy_index.internal_data()); auto& index_mapping = *static_cast<Mapping*>(proxy_index.internal_data()); auto it = m_mappings.find(index_mapping.source_parent); - ASSERT(it != m_mappings.end()); + VERIFY(it != m_mappings.end()); auto& mapping = *it->value; if (static_cast<size_t>(proxy_index.row()) >= mapping.source_rows.size() || proxy_index.column() >= column_count()) @@ -103,7 +103,7 @@ ModelIndex SortingProxyModel::map_to_proxy(const ModelIndex& source_index) const if (!source_index.is_valid()) return {}; - ASSERT(source_index.model() == m_source); + VERIFY(source_index.model() == m_source); auto source_parent = source_index.parent(); auto it = const_cast<SortingProxyModel*>(this)->build_mapping(source_parent); @@ -158,7 +158,7 @@ ModelIndex SortingProxyModel::index(int row, int column, const ModelIndex& paren const_cast<SortingProxyModel*>(this)->build_mapping(source_parent); auto it = m_mappings.find(source_parent); - ASSERT(it != m_mappings.end()); + VERIFY(it != m_mappings.end()); auto& mapping = *it->value; if (row >= static_cast<int>(mapping.source_rows.size()) || column >= column_count()) return {}; @@ -170,12 +170,12 @@ ModelIndex SortingProxyModel::parent_index(const ModelIndex& proxy_index) const if (!proxy_index.is_valid()) return {}; - ASSERT(proxy_index.model() == this); - ASSERT(proxy_index.internal_data()); + VERIFY(proxy_index.model() == this); + VERIFY(proxy_index.internal_data()); auto& index_mapping = *static_cast<Mapping*>(proxy_index.internal_data()); auto it = m_mappings.find(index_mapping.source_parent); - ASSERT(it != m_mappings.end()); + VERIFY(it != m_mappings.end()); return map_to_proxy(it->value->source_parent); } diff --git a/Userland/Libraries/LibGUI/SpinBox.cpp b/Userland/Libraries/LibGUI/SpinBox.cpp index 943497c918..5673907ff1 100644 --- a/Userland/Libraries/LibGUI/SpinBox.cpp +++ b/Userland/Libraries/LibGUI/SpinBox.cpp @@ -83,7 +83,7 @@ void SpinBox::set_value(int value) void SpinBox::set_range(int min, int max) { - ASSERT(min <= max); + VERIFY(min <= max); if (m_min == min && m_max == max) return; diff --git a/Userland/Libraries/LibGUI/TabWidget.cpp b/Userland/Libraries/LibGUI/TabWidget.cpp index 5e46f267d0..a5d2f000b3 100644 --- a/Userland/Libraries/LibGUI/TabWidget.cpp +++ b/Userland/Libraries/LibGUI/TabWidget.cpp @@ -176,7 +176,7 @@ Gfx::IntRect TabWidget::bar_rect() const case TabPosition::Bottom: return { 0, height() - bar_height(), width(), bar_height() }; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Gfx::IntRect TabWidget::container_rect() const @@ -187,7 +187,7 @@ Gfx::IntRect TabWidget::container_rect() const case TabPosition::Bottom: return { 0, 0, width(), height() - bar_height() }; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void TabWidget::paint_event(PaintEvent& event) diff --git a/Userland/Libraries/LibGUI/TextDocument.cpp b/Userland/Libraries/LibGUI/TextDocument.cpp index a523b18157..132a0c79e8 100644 --- a/Userland/Libraries/LibGUI/TextDocument.cpp +++ b/Userland/Libraries/LibGUI/TextDocument.cpp @@ -210,7 +210,7 @@ void TextDocumentLine::remove(TextDocument& document, size_t index) void TextDocumentLine::remove_range(TextDocument& document, size_t start, size_t length) { - ASSERT(length <= m_text.size()); + VERIFY(length <= m_text.size()); Vector<u32> new_data; new_data.ensure_capacity(m_text.size() - length); @@ -332,7 +332,7 @@ String TextDocument::text_in_range(const TextRange& a_range) const u32 TextDocument::code_point_at(const TextPosition& position) const { - ASSERT(position.line() < line_count()); + VERIFY(position.line() < line_count()); auto& line = this->line(position.line()); if (position.column() == line.length()) return '\n'; @@ -814,7 +814,7 @@ void TextDocument::remove(const TextRange& unnormalized_range) } } else { // Delete across a newline, merging lines. - ASSERT(range.start().line() == range.end().line() - 1); + VERIFY(range.start().line() == range.end().line() - 1); auto& first_line = line(range.start().line()); auto& second_line = line(range.end().line()); Vector<u32> code_points; diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 106cc37edf..799a0e2194 100644 --- a/Userland/Libraries/LibGUI/TextEditor.cpp +++ b/Userland/Libraries/LibGUI/TextEditor.cpp @@ -199,11 +199,11 @@ TextPosition TextEditor::text_position_at_content_position(const Gfx::IntPoint& break; case Gfx::TextAlignment::CenterRight: // FIXME: Support right-aligned line wrapping, I guess. - ASSERT(!is_wrapping_enabled()); + VERIFY(!is_wrapping_enabled()); column_index = (position.x() - content_x_for_position({ line_index, 0 }) + fixed_glyph_width() / 2) / fixed_glyph_width(); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } column_index = max((size_t)0, min(column_index, line(line_index).length())); @@ -688,7 +688,7 @@ void TextEditor::keydown_event(KeyEvent& event) } } } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (m_editing_engine->on_key(event)) @@ -873,10 +873,10 @@ int TextEditor::content_x_for_position(const TextPosition& position) const return m_horizontal_content_padding + ((is_single_line() && icon()) ? (icon_size() + icon_padding()) : 0) + x_offset; case Gfx::TextAlignment::CenterRight: // FIXME - ASSERT(!is_wrapping_enabled()); + VERIFY(!is_wrapping_enabled()); return content_width() - m_horizontal_content_padding - (line.length() * fixed_glyph_width()) + (position.column() * fixed_glyph_width()); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -884,8 +884,8 @@ Gfx::IntRect TextEditor::content_rect_for_position(const TextPosition& position) { if (!position.is_valid()) return {}; - ASSERT(!lines().is_empty()); - ASSERT(position.column() <= (current_line().length() + 1)); + VERIFY(!lines().is_empty()); + VERIFY(position.column() <= (current_line().length() + 1)); int x = content_x_for_position(position); @@ -993,7 +993,7 @@ void TextEditor::set_cursor(size_t line, size_t column) void TextEditor::set_cursor(const TextPosition& a_position) { - ASSERT(!lines().is_empty()); + VERIFY(!lines().is_empty()); TextPosition position = a_position; @@ -1146,7 +1146,7 @@ void TextEditor::delete_text_range(TextRange range) void TextEditor::insert_at_cursor_or_replace_selection(const StringView& text) { ReflowDeferrer defer(*this); - ASSERT(is_editable()); + VERIFY(is_editable()); if (has_selection()) delete_selection(); execute<InsertTextCommand>(text, m_cursor); @@ -1188,7 +1188,7 @@ void TextEditor::defer_reflow() void TextEditor::undefer_reflow() { - ASSERT(m_reflow_deferred); + VERIFY(m_reflow_deferred); if (!--m_reflow_deferred) { if (m_reflow_requested) { recompute_all_visual_lines(); @@ -1268,7 +1268,7 @@ void TextEditor::set_mode(const Mode mode) set_accepts_emoji_input(false); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (!is_displayonly()) @@ -1637,7 +1637,7 @@ void TextEditor::set_editing_engine(OwnPtr<EditingEngine> editing_engine) m_editing_engine->detach(); m_editing_engine = move(editing_engine); - ASSERT(m_editing_engine); + VERIFY(m_editing_engine); m_editing_engine->attach(*this); m_cursor_state = true; @@ -1653,7 +1653,7 @@ int TextEditor::line_height() const int TextEditor::fixed_glyph_width() const { - ASSERT(font().is_fixed_width()); + VERIFY(font().is_fixed_width()); return font().glyph_width(' '); } @@ -1679,7 +1679,7 @@ void TextEditor::set_should_autocomplete_automatically(bool value) return; if (value) { - ASSERT(m_autocomplete_provider); + VERIFY(m_autocomplete_provider); m_autocomplete_timer = Core::Timer::create_single_shot(m_automatic_autocomplete_delay_ms, [this] { try_show_autocomplete(); }); return; } diff --git a/Userland/Libraries/LibGUI/TreeView.cpp b/Userland/Libraries/LibGUI/TreeView.cpp index 81c2cc07df..ab1192853c 100644 --- a/Userland/Libraries/LibGUI/TreeView.cpp +++ b/Userland/Libraries/LibGUI/TreeView.cpp @@ -43,7 +43,7 @@ struct TreeView::MetadataForIndex { TreeView::MetadataForIndex& TreeView::ensure_metadata_for_index(const ModelIndex& index) const { - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); auto it = m_view_metadata.find(index.internal_data()); if (it != m_view_metadata.end()) return *it->value; @@ -165,7 +165,7 @@ void TreeView::collapse_tree(const ModelIndex& root) void TreeView::toggle_index(const ModelIndex& index) { - ASSERT(model()->row_count(index)); + VERIFY(model()->row_count(index)); auto& metadata = ensure_metadata_for_index(index); metadata.open = !metadata.open; if (on_toggle) @@ -178,7 +178,7 @@ void TreeView::toggle_index(const ModelIndex& index) template<typename Callback> void TreeView::traverse_in_paint_order(Callback callback) const { - ASSERT(model()); + VERIFY(model()); auto& model = *this->model(); int indent_level = 1; int y_offset = 0; diff --git a/Userland/Libraries/LibGUI/Variant.cpp b/Userland/Libraries/LibGUI/Variant.cpp index 5d3ddac2b2..44a52d46d4 100644 --- a/Userland/Libraries/LibGUI/Variant.cpp +++ b/Userland/Libraries/LibGUI/Variant.cpp @@ -65,7 +65,7 @@ const char* to_string(Variant::Type type) case Variant::Type::TextAlignment: return "TextAlignment"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Variant::Variant() @@ -195,7 +195,7 @@ Variant::Variant(const JsonValue& value) return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Variant::Variant(const Gfx::Bitmap& value) @@ -276,7 +276,7 @@ void Variant::move_from(Variant&& other) void Variant::copy_from(const Variant& other) { - ASSERT(!is_valid()); + VERIFY(!is_valid()); m_type = other.m_type; switch (m_type) { case Type::Bool: @@ -366,7 +366,7 @@ bool Variant::operator==(const Variant& other) const case Type::Invalid: return true; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool Variant::operator<(const Variant& other) const @@ -400,11 +400,11 @@ bool Variant::operator<(const Variant& other) const case Type::Font: case Type::TextAlignment: // FIXME: Figure out how to compare these. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case Type::Invalid: break; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } String Variant::to_string() const @@ -449,14 +449,14 @@ String Variant::to_string() const case Gfx::TextAlignment::TopRight: return "Gfx::TextAlignment::TopRight"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return ""; } case Type::Invalid: return "[null]"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibGUI/Variant.h b/Userland/Libraries/LibGUI/Variant.h index a04f7b2e17..90f747f8e5 100644 --- a/Userland/Libraries/LibGUI/Variant.h +++ b/Userland/Libraries/LibGUI/Variant.h @@ -100,7 +100,7 @@ public: bool as_bool() const { - ASSERT(type() == Type::Bool); + VERIFY(type() == Type::Bool); return m_value.as_bool; } @@ -127,19 +127,19 @@ public: int as_i32() const { - ASSERT(type() == Type::Int32); + VERIFY(type() == Type::Int32); return m_value.as_i32; } int as_i64() const { - ASSERT(type() == Type::Int64); + VERIFY(type() == Type::Int64); return m_value.as_i64; } unsigned as_uint() const { - ASSERT(type() == Type::UnsignedInt); + VERIFY(type() == Type::UnsignedInt); return m_value.as_uint; } @@ -155,7 +155,7 @@ public: if (is_float()) return (int)as_float(); if (is_uint()) { - ASSERT(as_uint() <= INT32_MAX); + VERIFY(as_uint() <= INT32_MAX); return (int)as_uint(); } if (is_string()) @@ -175,7 +175,7 @@ public: float as_float() const { - ASSERT(type() == Type::Float); + VERIFY(type() == Type::Float); return m_value.as_float; } @@ -196,31 +196,31 @@ public: String as_string() const { - ASSERT(type() == Type::String); + VERIFY(type() == Type::String); return m_value.as_string; } const Gfx::Bitmap& as_bitmap() const { - ASSERT(type() == Type::Bitmap); + VERIFY(type() == Type::Bitmap); return *m_value.as_bitmap; } GUI::Icon as_icon() const { - ASSERT(type() == Type::Icon); + VERIFY(type() == Type::Icon); return GUI::Icon(*m_value.as_icon); } Color as_color() const { - ASSERT(type() == Type::Color); + VERIFY(type() == Type::Color); return Color::from_rgba(m_value.as_color); } const Gfx::Font& as_font() const { - ASSERT(type() == Type::Font); + VERIFY(type() == Type::Font); return *m_value.as_font; } diff --git a/Userland/Libraries/LibGUI/VimEditingEngine.cpp b/Userland/Libraries/LibGUI/VimEditingEngine.cpp index 60a6a2b21b..52826ab01d 100644 --- a/Userland/Libraries/LibGUI/VimEditingEngine.cpp +++ b/Userland/Libraries/LibGUI/VimEditingEngine.cpp @@ -48,7 +48,7 @@ bool VimEditingEngine::on_key(const KeyEvent& event) case (VimMode::Normal): return on_key_in_normal_mode(event); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return false; diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp index 85b521924e..807bc1cbad 100644 --- a/Userland/Libraries/LibGUI/Widget.cpp +++ b/Userland/Libraries/LibGUI/Widget.cpp @@ -305,7 +305,7 @@ void Widget::handle_keydown_event(KeyEvent& event) void Widget::handle_paint_event(PaintEvent& event) { - ASSERT(is_visible()); + VERIFY(is_visible()); if (fill_with_background_color()) { Painter painter(*this); painter.fill_rect(event.rect(), palette().color(background_role())); diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index a6be58c01b..f4b23a06d5 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -228,7 +228,7 @@ String Window::title() const Gfx::IntRect Window::rect_in_menubar() const { - ASSERT(m_window_type == WindowType::MenuApplet); + VERIFY(m_window_type == WindowType::MenuApplet); return WindowServerConnection::the().send_sync<Messages::WindowServer::GetWindowRectInMenubar>(m_window_id)->rect(); } @@ -330,7 +330,7 @@ void Window::handle_drop_event(DropEvent& event) return; auto result = m_main_widget->hit_test(event.position()); auto local_event = make<DropEvent>(result.local_position, event.text(), event.mime_data()); - ASSERT(result.widget); + VERIFY(result.widget); result.widget->dispatch_event(*local_event, this); Application::the()->set_drag_hovered_widget({}, nullptr); @@ -358,7 +358,7 @@ void Window::handle_mouse_event(MouseEvent& event) return; auto result = m_main_widget->hit_test(event.position()); auto local_event = make<MouseEvent>((Event::Type)event.type(), result.local_position, event.buttons(), event.button(), event.modifiers(), event.wheel_delta()); - ASSERT(result.widget); + VERIFY(result.widget); set_hovered_widget(result.widget); if (event.buttons() != 0 && !m_automatic_cursor_tracking_widget) m_automatic_cursor_tracking_widget = *result.widget; @@ -374,7 +374,7 @@ void Window::handle_multi_paint_event(MultiPaintEvent& event) if (!m_main_widget) return; auto rects = event.rects(); - ASSERT(!rects.is_empty()); + VERIFY(!rects.is_empty()); if (m_back_store && m_back_store->size() != event.window_size()) { // Eagerly discard the backing store if we learn from this paint event that it needs to be bigger. // Otherwise we would have to wait for a resize event to tell us. This way we don't waste the @@ -384,12 +384,12 @@ void Window::handle_multi_paint_event(MultiPaintEvent& event) bool created_new_backing_store = !m_back_store; if (!m_back_store) { m_back_store = create_backing_store(event.window_size()); - ASSERT(m_back_store); + VERIFY(m_back_store); } else if (m_double_buffering_enabled) { bool still_has_pixels = m_back_store->bitmap().set_nonvolatile(); if (!still_has_pixels) { m_back_store = create_backing_store(event.window_size()); - ASSERT(m_back_store); + VERIFY(m_back_store); created_new_backing_store = true; } } @@ -497,7 +497,7 @@ void Window::handle_drag_move_event(DragEvent& event) if (!m_main_widget) return; auto result = m_main_widget->hit_test(event.position()); - ASSERT(result.widget); + VERIFY(result.widget); Application::the()->set_drag_hovered_widget({}, result.widget, result.local_position, event.mime_types()); @@ -688,7 +688,7 @@ void Window::set_has_alpha_channel(bool value) void Window::set_double_buffering_enabled(bool value) { - ASSERT(!is_visible()); + VERIFY(!is_visible()); m_double_buffering_enabled = value; } @@ -742,7 +742,7 @@ void Window::flip(const Vector<Gfx::IntRect, 32>& dirty_rects) if (!m_back_store || m_back_store->size() != m_front_store->size()) { m_back_store = create_backing_store(m_front_store->size()); - ASSERT(m_back_store); + VERIFY(m_back_store); memcpy(m_back_store->bitmap().scanline(0), m_front_store->bitmap().scanline(0), m_front_store->bitmap().size_in_bytes()); m_back_store->bitmap().set_volatile(); return; @@ -760,7 +760,7 @@ OwnPtr<WindowBackingStore> Window::create_backing_store(const Gfx::IntSize& size { auto format = m_has_alpha_channel ? Gfx::BitmapFormat::RGBA32 : Gfx::BitmapFormat::RGB32; - ASSERT(!size.is_empty()); + VERIFY(!size.is_empty()); size_t pitch = Gfx::Bitmap::minimum_pitch(size.width(), format); size_t size_in_bytes = size.height() * pitch; @@ -779,7 +779,7 @@ OwnPtr<WindowBackingStore> Window::create_backing_store(const Gfx::IntSize& size void Window::set_modal(bool modal) { - ASSERT(!is_visible()); + VERIFY(!is_visible()); m_modal = modal; } @@ -795,7 +795,7 @@ void Window::set_icon(const Gfx::Bitmap* icon) Gfx::IntSize icon_size = icon ? icon->size() : Gfx::IntSize(16, 16); m_icon = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, icon_size); - ASSERT(m_icon); + VERIFY(m_icon); if (icon) { Painter painter(*m_icon); painter.blit({ 0, 0 }, *icon, icon->rect()); @@ -910,7 +910,7 @@ void Window::refresh_system_theme() void Window::for_each_window(Badge<WindowServerConnection>, Function<void(Window&)> callback) { for (auto& e : *reified_windows) { - ASSERT(e.value); + VERIFY(e.value); callback(*e.value); } } @@ -1003,7 +1003,7 @@ void Window::did_remove_widget(Badge<Widget>, Widget& widget) void Window::set_progress(int progress) { - ASSERT(m_window_id); + VERIFY(m_window_id); WindowServerConnection::the().post_message(Messages::WindowServer::SetWindowProgress(m_window_id, progress)); } @@ -1040,7 +1040,7 @@ void Window::did_disable_focused_widget(Badge<Widget>) bool Window::is_active() const { - ASSERT(Application::the()); + VERIFY(Application::the()); return this == Application::the()->active_window(); } diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.cpp b/Userland/Libraries/LibGUI/WindowServerConnection.cpp index 79169345e0..2d33b91dd1 100644 --- a/Userland/Libraries/LibGUI/WindowServerConnection.cpp +++ b/Userland/Libraries/LibGUI/WindowServerConnection.cpp @@ -213,7 +213,7 @@ static MouseButton to_gmousebutton(u32 button) case 16: return MouseButton::Forward; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } diff --git a/Userland/Libraries/LibGemini/GeminiJob.cpp b/Userland/Libraries/LibGemini/GeminiJob.cpp index be63d00fe1..4e43854fae 100644 --- a/Userland/Libraries/LibGemini/GeminiJob.cpp +++ b/Userland/Libraries/LibGemini/GeminiJob.cpp @@ -36,7 +36,7 @@ namespace Gemini { void GeminiJob::start() { - ASSERT(!m_socket); + VERIFY(!m_socket); m_socket = TLS::TLSv12::construct(this); m_socket->set_root_certificates(m_override_ca_certificates ? *m_override_ca_certificates : DefaultRootCACertificates::the().certificates()); m_socket->on_tls_connected = [this] { @@ -98,7 +98,7 @@ void GeminiJob::set_certificate(String certificate, String private_key) if (!m_socket->add_client_key(certificate.bytes(), private_key.bytes())) { dbgln("LibGemini: Failed to set a client certificate"); // FIXME: Do something about this failure - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibGemini/Job.cpp b/Userland/Libraries/LibGemini/Job.cpp index 5175dd100d..f8fd7cbf52 100644 --- a/Userland/Libraries/LibGemini/Job.cpp +++ b/Userland/Libraries/LibGemini/Job.cpp @@ -53,7 +53,7 @@ void Job::flush_received_buffers() m_received_buffers.take_first(); continue; } - ASSERT(written < payload.size()); + VERIFY(written < payload.size()); payload = payload.slice(written, payload.size() - written); return; } @@ -124,7 +124,7 @@ void Job::on_socket_connected() return; } - ASSERT(m_state == State::InBody || m_state == State::Finished); + VERIFY(m_state == State::InBody || m_state == State::Finished); read_while_data_available([&] { auto read_size = 64 * KiB; diff --git a/Userland/Libraries/LibGemini/Line.cpp b/Userland/Libraries/LibGemini/Line.cpp index d3197176d5..7496f704b4 100644 --- a/Userland/Libraries/LibGemini/Line.cpp +++ b/Userland/Libraries/LibGemini/Line.cpp @@ -81,7 +81,7 @@ String Control::render_to_html() const return "</ul>"; default: dbgln("Unknown control kind _{}_", (int)m_kind); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return ""; } } diff --git a/Userland/Libraries/LibGfx/BMPLoader.cpp b/Userland/Libraries/LibGfx/BMPLoader.cpp index 3d8203ad91..65e7da62f4 100644 --- a/Userland/Libraries/LibGfx/BMPLoader.cpp +++ b/Userland/Libraries/LibGfx/BMPLoader.cpp @@ -180,7 +180,7 @@ struct BMPLoadingContext { return 124; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }; @@ -215,7 +215,7 @@ public: u8 read_u8() { - ASSERT(m_size_remaining >= 1); + VERIFY(m_size_remaining >= 1); m_size_remaining--; return *(m_data_ptr++); } @@ -242,7 +242,7 @@ public: void drop_bytes(u8 num_bytes) { - ASSERT(m_size_remaining >= num_bytes); + VERIFY(m_size_remaining >= num_bytes); m_size_remaining -= num_bytes; m_data_ptr += num_bytes; } @@ -355,7 +355,7 @@ static void populate_dib_mask_info_if_needed(BMPLoadingContext& context) if (!mask_shifts.is_empty() && !mask_sizes.is_empty()) return; - ASSERT(mask_shifts.is_empty() && mask_sizes.is_empty()); + VERIFY(mask_shifts.is_empty() && mask_sizes.is_empty()); mask_shifts.ensure_capacity(masks.size()); mask_sizes.ensure_capacity(masks.size()); @@ -896,7 +896,7 @@ static bool decode_bmp_color_table(BMPLoadingContext& context) auto bytes_per_color = context.dib_type == DIBType::Core ? 3 : 4; u32 max_colors = 1 << context.dib.core.bpp; - ASSERT(context.data_offset >= bmp_header_size + context.dib_size()); + VERIFY(context.data_offset >= bmp_header_size + context.dib_size()); auto size_of_color_table = context.data_offset - bmp_header_size - context.dib_size(); if (context.dib_type <= DIBType::OSV2) { @@ -1161,7 +1161,7 @@ static bool uncompress_bmp_rle_data(BMPLoadingContext& context, ByteBuffer& buff } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static bool decode_bmp_pixel_data(BMPLoadingContext& context) @@ -1302,7 +1302,7 @@ static bool decode_bmp_pixel_data(BMPLoadingContext& context) case 3: return 1; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }(); if (streamer.remaining() < bytes_to_drop) return false; @@ -1377,7 +1377,7 @@ RefPtr<Gfx::Bitmap> BMPImageDecoderPlugin::bitmap() if (m_context->state < BMPLoadingContext::State::PixelDataDecoded && !decode_bmp_pixel_data(*m_context)) return nullptr; - ASSERT(m_context->bitmap); + VERIFY(m_context->bitmap); return m_context->bitmap; } diff --git a/Userland/Libraries/LibGfx/BMPWriter.cpp b/Userland/Libraries/LibGfx/BMPWriter.cpp index 6911f99164..ecf2808d60 100644 --- a/Userland/Libraries/LibGfx/BMPWriter.cpp +++ b/Userland/Libraries/LibGfx/BMPWriter.cpp @@ -95,7 +95,7 @@ static ByteBuffer compress_pixel_data(const ByteBuffer& pixel_data, BMPWriter::C return pixel_data; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } ByteBuffer BMPWriter::dump(const RefPtr<Bitmap> bitmap) diff --git a/Userland/Libraries/LibGfx/Bitmap.cpp b/Userland/Libraries/LibGfx/Bitmap.cpp index 2b7c207c7b..2046fdcf74 100644 --- a/Userland/Libraries/LibGfx/Bitmap.cpp +++ b/Userland/Libraries/LibGfx/Bitmap.cpp @@ -69,7 +69,7 @@ size_t Bitmap::minimum_pitch(size_t physical_width, BitmapFormat format) element_size = 4; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return physical_width * element_size; @@ -127,10 +127,10 @@ Bitmap::Bitmap(BitmapFormat format, const IntSize& size, int scale_factor, Purge , m_format(format) , m_purgeable(purgeable == Purgeable::Yes) { - ASSERT(!m_size.is_empty()); - ASSERT(!size_would_overflow(format, size, scale_factor)); - ASSERT(m_data); - ASSERT(backing_store.size_in_bytes == size_in_bytes()); + VERIFY(!m_size.is_empty()); + VERIFY(!size_would_overflow(format, size, scale_factor)); + VERIFY(m_data); + VERIFY(backing_store.size_in_bytes == size_in_bytes()); allocate_palette_from_format(format, {}); m_needs_munmap = true; } @@ -160,8 +160,8 @@ RefPtr<Bitmap> Bitmap::load_from_file(const StringView& path, int scale_factor) ENUMERATE_IMAGE_FORMATS #undef __ENUMERATE_IMAGE_FORMAT if (bmp) { - ASSERT(bmp->width() % scale_factor == 0); - ASSERT(bmp->height() % scale_factor == 0); + VERIFY(bmp->width() % scale_factor == 0); + VERIFY(bmp->height() % scale_factor == 0); bmp->m_size.set_width(bmp->width() / scale_factor); bmp->m_size.set_height(bmp->height() / scale_factor); bmp->m_scale = scale_factor; @@ -185,8 +185,8 @@ Bitmap::Bitmap(BitmapFormat format, const IntSize& size, int scale_factor, size_ , m_pitch(pitch) , m_format(format) { - ASSERT(pitch >= minimum_pitch(size.width() * scale_factor, format)); - ASSERT(!size_would_overflow(format, size, scale_factor)); + VERIFY(pitch >= minimum_pitch(size.width() * scale_factor, format)); + VERIFY(!size_would_overflow(format, size, scale_factor)); // FIXME: assert that `data` is actually long enough! allocate_palette_from_format(format, {}); @@ -220,7 +220,7 @@ RefPtr<Bitmap> Bitmap::create_with_anon_fd(BitmapFormat format, int anon_fd, con ScopeGuard close_guard = [&] { if (should_close_anon_fd == ShouldCloseAnonymousFile::Yes) { int rc = close(anon_fd); - ASSERT(rc == 0); + VERIFY(rc == 0); anon_fd = -1; } }; @@ -321,7 +321,7 @@ ByteBuffer Bitmap::serialize_to_byte_buffer() const } auto size = size_in_bytes(); - ASSERT(stream.remaining() == size); + VERIFY(stream.remaining() == size); if (stream.write({ scanline(0), size }) != size) return {}; @@ -338,8 +338,8 @@ Bitmap::Bitmap(BitmapFormat format, int anon_fd, const IntSize& size, int scale_ , m_purgeable(true) , m_anon_fd(anon_fd) { - ASSERT(!is_indexed() || !palette.is_empty()); - ASSERT(!size_would_overflow(format, size, scale_factor)); + VERIFY(!is_indexed() || !palette.is_empty()); + VERIFY(!size_would_overflow(format, size, scale_factor)); if (is_indexed(m_format)) allocate_palette_from_format(m_format, palette); @@ -358,7 +358,7 @@ RefPtr<Gfx::Bitmap> Bitmap::clone() const return nullptr; } - ASSERT(size_in_bytes() == new_bitmap->size_in_bytes()); + VERIFY(size_in_bytes() == new_bitmap->size_in_bytes()); memcpy(new_bitmap->scanline(0), scanline(0), size_in_bytes()); return new_bitmap; @@ -428,11 +428,11 @@ Bitmap::~Bitmap() { if (m_needs_munmap) { int rc = munmap(m_data, size_in_bytes()); - ASSERT(rc == 0); + VERIFY(rc == 0); } if (m_anon_fd != -1) { int rc = close(m_anon_fd); - ASSERT(rc == 0); + VERIFY(rc == 0); } m_data = nullptr; delete[] m_palette; @@ -440,7 +440,7 @@ Bitmap::~Bitmap() void Bitmap::set_mmap_name([[maybe_unused]] const StringView& name) { - ASSERT(m_needs_munmap); + VERIFY(m_needs_munmap); #ifdef __serenity__ ::set_mmap_name(m_data, size_in_bytes(), name.to_string().characters()); #endif @@ -448,7 +448,7 @@ void Bitmap::set_mmap_name([[maybe_unused]] const StringView& name) void Bitmap::fill(Color color) { - ASSERT(!is_indexed(m_format)); + VERIFY(!is_indexed(m_format)); for (int y = 0; y < physical_height(); ++y) { auto* scanline = this->scanline(y); fast_u32_fill(scanline, color.value(), physical_width()); @@ -457,14 +457,14 @@ void Bitmap::fill(Color color) void Bitmap::set_volatile() { - ASSERT(m_purgeable); + VERIFY(m_purgeable); if (m_volatile) return; #ifdef __serenity__ int rc = madvise(m_data, size_in_bytes(), MADV_SET_VOLATILE); if (rc < 0) { perror("madvise(MADV_SET_VOLATILE)"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } #endif m_volatile = true; @@ -472,14 +472,14 @@ void Bitmap::set_volatile() [[nodiscard]] bool Bitmap::set_nonvolatile() { - ASSERT(m_purgeable); + VERIFY(m_purgeable); if (!m_volatile) return true; #ifdef __serenity__ int rc = madvise(m_data, size_in_bytes(), MADV_SET_NONVOLATILE); if (rc < 0) { perror("madvise(MADV_SET_NONVOLATILE)"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } #else int rc = 0; @@ -528,7 +528,7 @@ void Bitmap::allocate_palette_from_format(BitmapFormat format, const Vector<RGBA return; m_palette = new RGBA32[size]; if (!source_palette.is_empty()) { - ASSERT(source_palette.size() == size); + VERIFY(source_palette.size() == size); memcpy(m_palette, source_palette.data(), size * sizeof(RGBA32)); } } diff --git a/Userland/Libraries/LibGfx/Bitmap.h b/Userland/Libraries/LibGfx/Bitmap.h index 0dfbe82bcc..bcfb89fa96 100644 --- a/Userland/Libraries/LibGfx/Bitmap.h +++ b/Userland/Libraries/LibGfx/Bitmap.h @@ -90,7 +90,7 @@ static StorageFormat determine_storage_format(BitmapFormat format) case BitmapFormat::Indexed8: return StorageFormat::Indexed8; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -198,7 +198,7 @@ public: case BitmapFormat::RGBA32: return 32; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case BitmapFormat::Invalid: return 0; } @@ -274,13 +274,13 @@ private: inline u8* Bitmap::scanline_u8(int y) { - ASSERT(y >= 0 && y < physical_height()); + VERIFY(y >= 0 && y < physical_height()); return reinterpret_cast<u8*>(m_data) + (y * m_pitch); } inline const u8* Bitmap::scanline_u8(int y) const { - ASSERT(y >= 0 && y < physical_height()); + VERIFY(y >= 0 && y < physical_height()); return reinterpret_cast<const u8*>(m_data) + (y * m_pitch); } @@ -297,21 +297,21 @@ inline const RGBA32* Bitmap::scanline(int y) const template<> inline Color Bitmap::get_pixel<StorageFormat::RGB32>(int x, int y) const { - ASSERT(x >= 0 && x < physical_width()); + VERIFY(x >= 0 && x < physical_width()); return Color::from_rgb(scanline(y)[x]); } template<> inline Color Bitmap::get_pixel<StorageFormat::RGBA32>(int x, int y) const { - ASSERT(x >= 0 && x < physical_width()); + VERIFY(x >= 0 && x < physical_width()); return Color::from_rgba(scanline(y)[x]); } template<> inline Color Bitmap::get_pixel<StorageFormat::Indexed8>(int x, int y) const { - ASSERT(x >= 0 && x < physical_width()); + VERIFY(x >= 0 && x < physical_width()); return Color::from_rgb(m_palette[scanline_u8(y)[x]]); } @@ -325,20 +325,20 @@ inline Color Bitmap::get_pixel(int x, int y) const case StorageFormat::Indexed8: return get_pixel<StorageFormat::Indexed8>(x, y); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } template<> inline void Bitmap::set_pixel<StorageFormat::RGB32>(int x, int y, Color color) { - ASSERT(x >= 0 && x < physical_width()); + VERIFY(x >= 0 && x < physical_width()); scanline(y)[x] = color.value(); } template<> inline void Bitmap::set_pixel<StorageFormat::RGBA32>(int x, int y, Color color) { - ASSERT(x >= 0 && x < physical_width()); + VERIFY(x >= 0 && x < physical_width()); scanline(y)[x] = color.value(); // drop alpha } inline void Bitmap::set_pixel(int x, int y, Color color) @@ -351,9 +351,9 @@ inline void Bitmap::set_pixel(int x, int y, Color color) set_pixel<StorageFormat::RGBA32>(x, y, color); break; case StorageFormat::Indexed8: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibGfx/BitmapFont.cpp b/Userland/Libraries/LibGfx/BitmapFont.cpp index 492f921053..09e080ec8e 100644 --- a/Userland/Libraries/LibGfx/BitmapFont.cpp +++ b/Userland/Libraries/LibGfx/BitmapFont.cpp @@ -147,7 +147,7 @@ RefPtr<BitmapFont> BitmapFont::load_from_memory(const u8* data) else if (header.type == 1) type = FontTypes::LatinExtendedA; else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); size_t count = glyph_count_by_type(type); size_t bytes_per_glyph = sizeof(unsigned) * header.glyph_height; @@ -168,7 +168,7 @@ size_t BitmapFont::glyph_count_by_type(FontTypes type) return 384; dbgln("Unknown font type: {}", (int)type); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } RefPtr<BitmapFont> BitmapFont::load_from_file(const StringView& path) diff --git a/Userland/Libraries/LibGfx/BitmapFont.h b/Userland/Libraries/LibGfx/BitmapFont.h index b43514fe0a..88ada2a2b7 100644 --- a/Userland/Libraries/LibGfx/BitmapFont.h +++ b/Userland/Libraries/LibGfx/BitmapFont.h @@ -98,7 +98,7 @@ public: void set_glyph_width(size_t ch, u8 width) { - ASSERT(m_glyph_widths); + VERIFY(m_glyph_widths); m_glyph_widths[ch] = width; } diff --git a/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp b/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp index 6227ecfc39..0f6f1ae684 100644 --- a/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp +++ b/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp @@ -167,7 +167,7 @@ ClassicWindowTheme::FrameColors ClassicWindowTheme::compute_frame_colors(WindowS case WindowState::Inactive: return { palette.inactive_window_title(), palette.inactive_window_border1(), palette.inactive_window_border2(), palette.inactive_window_title_stripes(), palette.inactive_window_title_shadow() }; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibGfx/Color.cpp b/Userland/Libraries/LibGfx/Color.cpp index 5e4af7a12b..20265dc43f 100644 --- a/Userland/Libraries/LibGfx/Color.cpp +++ b/Userland/Libraries/LibGfx/Color.cpp @@ -50,8 +50,8 @@ String Color::to_string_without_alpha() const static Optional<Color> parse_rgb_color(const StringView& string) { - ASSERT(string.starts_with("rgb(")); - ASSERT(string.ends_with(")")); + VERIFY(string.starts_with("rgb(")); + VERIFY(string.ends_with(")")); auto substring = string.substring_view(4, string.length() - 5); auto parts = substring.split_view(','); @@ -71,8 +71,8 @@ static Optional<Color> parse_rgb_color(const StringView& string) static Optional<Color> parse_rgba_color(const StringView& string) { - ASSERT(string.starts_with("rgba(")); - ASSERT(string.ends_with(")")); + VERIFY(string.starts_with("rgba(")); + VERIFY(string.ends_with(")")); auto substring = string.substring_view(5, string.length() - 6); auto parts = substring.split_view(','); diff --git a/Userland/Libraries/LibGfx/Color.h b/Userland/Libraries/LibGfx/Color.h index c4a28ba323..8070a712e2 100644 --- a/Userland/Libraries/LibGfx/Color.h +++ b/Userland/Libraries/LibGfx/Color.h @@ -239,9 +239,9 @@ public: hsv.value = max; - ASSERT(hsv.hue >= 0.0 && hsv.hue < 360.0); - ASSERT(hsv.saturation >= 0.0 && hsv.saturation <= 1.0); - ASSERT(hsv.value >= 0.0 && hsv.value <= 1.0); + VERIFY(hsv.hue >= 0.0 && hsv.hue < 360.0); + VERIFY(hsv.saturation >= 0.0 && hsv.saturation <= 1.0); + VERIFY(hsv.value >= 0.0 && hsv.value <= 1.0); return hsv; } @@ -253,9 +253,9 @@ public: static Color from_hsv(const HSV& hsv) { - ASSERT(hsv.hue >= 0.0 && hsv.hue < 360.0); - ASSERT(hsv.saturation >= 0.0 && hsv.saturation <= 1.0); - ASSERT(hsv.value >= 0.0 && hsv.value <= 1.0); + VERIFY(hsv.hue >= 0.0 && hsv.hue < 360.0); + VERIFY(hsv.saturation >= 0.0 && hsv.saturation <= 1.0); + VERIFY(hsv.value >= 0.0 && hsv.value <= 1.0); double hue = hsv.hue; double saturation = hsv.saturation; @@ -397,7 +397,7 @@ inline constexpr Color::Color(NamedColor named) rgb = { 212, 208, 200 }; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } diff --git a/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h b/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h index 416f84321a..93f325a28e 100644 --- a/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h +++ b/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h @@ -85,7 +85,7 @@ public: virtual void apply(Bitmap& target_bitmap, const IntRect& target_rect, const Bitmap& source_bitmap, const IntRect& source_rect, const Filter::Parameters& parameters) override { - ASSERT(parameters.is_generic_convolution_filter()); + VERIFY(parameters.is_generic_convolution_filter()); auto& gcf_params = static_cast<const GenericConvolutionFilter::Parameters&>(parameters); ApplyCache apply_cache; @@ -98,10 +98,10 @@ public: // contained by the source area. source_rect should be describing // the pixels that can be accessed to apply this filter, while // target_rect should describe the area where to apply the filter on. - ASSERT(source_rect.contains(target_rect)); - ASSERT(source.size().contains(target.size())); - ASSERT(target.rect().contains(target_rect)); - ASSERT(source.rect().contains(source_rect)); + VERIFY(source_rect.contains(target_rect)); + VERIFY(source.size().contains(target.size())); + VERIFY(target.rect().contains(target_rect)); + VERIFY(source.rect().contains(source_rect)); // If source is different from target, it should still be describing // essentially the same bitmap. But it allows us to modify target diff --git a/Userland/Libraries/LibGfx/FontDatabase.cpp b/Userland/Libraries/LibGfx/FontDatabase.cpp index c06fd0ebba..6aaaff246a 100644 --- a/Userland/Libraries/LibGfx/FontDatabase.cpp +++ b/Userland/Libraries/LibGfx/FontDatabase.cpp @@ -50,7 +50,7 @@ Font& FontDatabase::default_font() static Font* font; if (!font) { font = FontDatabase::the().get_by_name("Katica 10 400"); - ASSERT(font); + VERIFY(font); } return *font; } @@ -60,7 +60,7 @@ Font& FontDatabase::default_fixed_width_font() static Font* font; if (!font) { font = FontDatabase::the().get_by_name("Csilla 10 400"); - ASSERT(font); + VERIFY(font); } return *font; } @@ -70,7 +70,7 @@ Font& FontDatabase::default_bold_fixed_width_font() static Font* font; if (!font) { font = FontDatabase::the().get_by_name("Csilla 10 700"); - ASSERT(font); + VERIFY(font); } return *font; } @@ -80,7 +80,7 @@ Font& FontDatabase::default_bold_font() static Font* font; if (!font) { font = FontDatabase::the().get_by_name("Katica 10 700"); - ASSERT(font); + VERIFY(font); } return *font; } diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp index 750587e207..3bec3d1ce9 100644 --- a/Userland/Libraries/LibGfx/GIFLoader.cpp +++ b/Userland/Libraries/LibGfx/GIFLoader.cpp @@ -232,14 +232,14 @@ public: Vector<u8>& get_output() { - ASSERT(m_current_code <= m_code_table.size()); + VERIFY(m_current_code <= m_code_table.size()); if (m_current_code < m_code_table.size()) { Vector<u8> new_entry = m_output; m_output = m_code_table.at(m_current_code); new_entry.append(m_output[0]); extend_code_table(new_entry); } else if (m_current_code == m_code_table.size()) { - ASSERT(!m_output.is_empty()); + VERIFY(!m_output.is_empty()); m_output.append(m_output[0]); extend_code_table(m_output); } @@ -285,7 +285,7 @@ private: static void copy_frame_buffer(Bitmap& dest, const Bitmap& src) { - ASSERT(dest.size_in_bytes() == src.size_in_bytes()); + VERIFY(dest.size_in_bytes() == src.size_in_bytes()); memcpy(dest.scanline(0), src.scanline(0), dest.size_in_bytes()); } @@ -294,7 +294,7 @@ static void clear_rect(Bitmap& bitmap, const IntRect& rect, Color color) if (rect.is_empty()) return; - ASSERT(bitmap.rect().contains(rect)); + VERIFY(bitmap.rect().contains(rect)); RGBA32* dst = bitmap.scanline(rect.top()) + rect.left(); const size_t dst_skip = bitmap.pitch() / sizeof(RGBA32); diff --git a/Userland/Libraries/LibGfx/ICOLoader.cpp b/Userland/Libraries/LibGfx/ICOLoader.cpp index e0326f1580..51a2107e4b 100644 --- a/Userland/Libraries/LibGfx/ICOLoader.cpp +++ b/Userland/Libraries/LibGfx/ICOLoader.cpp @@ -388,7 +388,7 @@ RefPtr<Gfx::Bitmap> ICOImageDecoderPlugin::bitmap() m_context->state = ICOLoadingContext::State::BitmapDecoded; } - ASSERT(m_context->images[m_context->largest_index].bitmap); + VERIFY(m_context->images[m_context->largest_index].bitmap); return m_context->images[m_context->largest_index].bitmap; } diff --git a/Userland/Libraries/LibGfx/JPGLoader.cpp b/Userland/Libraries/LibGfx/JPGLoader.cpp index 4b4b4be311..0ec40055db 100644 --- a/Userland/Libraries/LibGfx/JPGLoader.cpp +++ b/Userland/Libraries/LibGfx/JPGLoader.cpp @@ -661,7 +661,7 @@ static bool read_huffman_table(InputMemoryStream& stream, JPGLoadingContext& con auto& huffman_table = table.type == 0 ? context.dc_tables : context.ac_tables; huffman_table.set(table.destination_id, table); - ASSERT(huffman_table.size() <= 2); + VERIFY(huffman_table.size() <= 2); bytes_to_read -= 1 + 16 + total_codes; } @@ -1167,7 +1167,7 @@ static bool parse_header(InputMemoryStream& stream, JPGLoadingContext& context) } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static bool scan_huffman_stream(InputMemoryStream& stream, JPGLoadingContext& context) @@ -1213,7 +1213,7 @@ static bool scan_huffman_stream(InputMemoryStream& stream, JPGLoadingContext& co } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static bool decode_jpg(JPGLoadingContext& context) diff --git a/Userland/Libraries/LibGfx/Matrix.h b/Userland/Libraries/LibGfx/Matrix.h index aa9cf5e64f..2913457d91 100644 --- a/Userland/Libraries/LibGfx/Matrix.h +++ b/Userland/Libraries/LibGfx/Matrix.h @@ -39,7 +39,7 @@ public: Matrix() = default; Matrix(std::initializer_list<T> elements) { - ASSERT(elements.size() == N * N); + VERIFY(elements.size() == N * N); size_t i = 0; for (auto& element : elements) { m_elements[i / N][i % N] = element; diff --git a/Userland/Libraries/LibGfx/PBMLoader.cpp b/Userland/Libraries/LibGfx/PBMLoader.cpp index 4040b09c97..dda7c44da2 100644 --- a/Userland/Libraries/LibGfx/PBMLoader.cpp +++ b/Userland/Libraries/LibGfx/PBMLoader.cpp @@ -166,7 +166,7 @@ RefPtr<Gfx::Bitmap> PBMImageDecoderPlugin::bitmap() return nullptr; } - ASSERT(m_context->bitmap); + VERIFY(m_context->bitmap); return m_context->bitmap; } diff --git a/Userland/Libraries/LibGfx/PGMLoader.cpp b/Userland/Libraries/LibGfx/PGMLoader.cpp index 122a698a7b..5cd2b7bed3 100644 --- a/Userland/Libraries/LibGfx/PGMLoader.cpp +++ b/Userland/Libraries/LibGfx/PGMLoader.cpp @@ -169,7 +169,7 @@ RefPtr<Gfx::Bitmap> PGMImageDecoderPlugin::bitmap() return nullptr; } - ASSERT(m_context->bitmap); + VERIFY(m_context->bitmap); return m_context->bitmap; } diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp index 1f1ae6d066..fbb4a4d8b9 100644 --- a/Userland/Libraries/LibGfx/PNGLoader.cpp +++ b/Userland/Libraries/LibGfx/PNGLoader.cpp @@ -387,7 +387,7 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context) } } } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } break; case 4: @@ -396,7 +396,7 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context) } else if (context.bit_depth == 16) { unpack_grayscale_with_alpha<u16>(context); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } break; case 2: @@ -405,7 +405,7 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context) } else if (context.bit_depth == 16) { unpack_triplets_without_alpha<u16>(context); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } break; case 6: @@ -425,7 +425,7 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context) } } } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } break; case 3: @@ -468,11 +468,11 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context) } } } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } @@ -658,7 +658,7 @@ static int adam7_height(PNGLoadingContext& context, int pass) case 7: return context.height / 2; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -680,7 +680,7 @@ static int adam7_width(PNGLoadingContext& context, int pass) case 7: return context.width; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -809,7 +809,7 @@ static bool decode_png_bitmap(PNGLoadingContext& context) return false; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } munmap(context.decompression_buffer, context.decompression_buffer_size); @@ -1026,7 +1026,7 @@ RefPtr<Gfx::Bitmap> PNGImageDecoderPlugin::bitmap() return nullptr; } - ASSERT(m_context->bitmap); + VERIFY(m_context->bitmap); return m_context->bitmap; } diff --git a/Userland/Libraries/LibGfx/PPMLoader.cpp b/Userland/Libraries/LibGfx/PPMLoader.cpp index 80d99d8966..8f88a9ff8b 100644 --- a/Userland/Libraries/LibGfx/PPMLoader.cpp +++ b/Userland/Libraries/LibGfx/PPMLoader.cpp @@ -171,7 +171,7 @@ RefPtr<Gfx::Bitmap> PPMImageDecoderPlugin::bitmap() return nullptr; } - ASSERT(m_context->bitmap); + VERIFY(m_context->bitmap); return m_context->bitmap; } diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp index ed075d8381..445f4eda35 100644 --- a/Userland/Libraries/LibGfx/Painter.cpp +++ b/Userland/Libraries/LibGfx/Painter.cpp @@ -73,9 +73,9 @@ Painter::Painter(Gfx::Bitmap& bitmap) : m_target(bitmap) { int scale = bitmap.scale(); - ASSERT(bitmap.format() == Gfx::BitmapFormat::RGB32 || bitmap.format() == Gfx::BitmapFormat::RGBA32); - ASSERT(bitmap.physical_width() % scale == 0); - ASSERT(bitmap.physical_height() % scale == 0); + VERIFY(bitmap.format() == Gfx::BitmapFormat::RGB32 || bitmap.format() == Gfx::BitmapFormat::RGBA32); + VERIFY(bitmap.physical_width() % scale == 0); + VERIFY(bitmap.physical_height() % scale == 0); m_state_stack.append(State()); state().font = &FontDatabase::default_font(); state().clip_rect = { { 0, 0 }, bitmap.size() }; @@ -89,7 +89,7 @@ Painter::~Painter() void Painter::fill_rect_with_draw_op(const IntRect& a_rect, Color color) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. auto rect = a_rect.translated(translation()).intersected(clip_rect()); if (rect.is_empty()) @@ -111,7 +111,7 @@ void Painter::clear_rect(const IntRect& a_rect, Color color) if (rect.is_empty()) return; - ASSERT(m_target->rect().contains(rect)); + VERIFY(m_target->rect().contains(rect)); rect *= scale(); RGBA32* dst = m_target->scanline(rect.top()) + rect.left(); @@ -154,14 +154,14 @@ void Painter::fill_rect(const IntRect& a_rect, Color color) auto rect = a_rect.translated(translation()).intersected(clip_rect()); if (rect.is_empty()) return; - ASSERT(m_target->rect().contains(rect)); + VERIFY(m_target->rect().contains(rect)); fill_physical_rect(rect * scale(), color); } void Painter::fill_rect_with_dither_pattern(const IntRect& a_rect, Color color_a, Color color_b) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. auto rect = a_rect.translated(translation()).intersected(clip_rect()); if (rect.is_empty()) @@ -185,7 +185,7 @@ void Painter::fill_rect_with_dither_pattern(const IntRect& a_rect, Color color_a void Painter::fill_rect_with_checkerboard(const IntRect& a_rect, const IntSize& cell_size, Color color_dark, Color color_light) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. auto rect = a_rect.translated(translation()).intersected(clip_rect()); if (rect.is_empty()) @@ -264,13 +264,13 @@ void Painter::fill_rect_with_gradient(const IntRect& a_rect, Color gradient_star void Painter::fill_ellipse(const IntRect& a_rect, Color color) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. auto rect = a_rect.translated(translation()).intersected(clip_rect()); if (rect.is_empty()) return; - ASSERT(m_target->rect().contains(rect)); + VERIFY(m_target->rect().contains(rect)); RGBA32* dst = m_target->scanline(rect.top()) + rect.left() + rect.width() / 2; const size_t dst_skip = m_target->pitch() / sizeof(RGBA32); @@ -285,7 +285,7 @@ void Painter::fill_ellipse(const IntRect& a_rect, Color color) void Painter::draw_ellipse_intersecting(const IntRect& rect, Color color, int thickness) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. constexpr int number_samples = 100; // FIXME: dynamically work out the number of samples based upon the rect size double increment = M_PI / number_samples; @@ -324,7 +324,7 @@ static void for_each_pixel_around_rect_clockwise(const RectType& rect, Callback void Painter::draw_focus_rect(const IntRect& rect, Color color) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. if (rect.is_empty()) return; @@ -389,7 +389,7 @@ void Painter::draw_rect(const IntRect& a_rect, Color color, bool rough) void Painter::draw_bitmap(const IntPoint& p, const CharacterBitmap& bitmap, Color color) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. auto rect = IntRect(p, bitmap.size()).translated(translation()); auto clipped_rect = rect.intersected(clip_rect()); @@ -454,7 +454,7 @@ void Painter::draw_bitmap(const IntPoint& p, const GlyphBitmap& bitmap, Color co void Painter::draw_triangle(const IntPoint& a, const IntPoint& b, const IntPoint& c, Color color) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. RGBA32 rgba = color.value(); @@ -524,7 +524,7 @@ void Painter::draw_triangle(const IntPoint& a, const IntPoint& b, const IntPoint void Painter::blit_with_opacity(const IntPoint& position, const Gfx::Bitmap& source, const IntRect& a_src_rect, float opacity, bool apply_alpha) { - ASSERT(scale() >= source.scale() && "painter doesn't support downsampling scale factors"); + VERIFY(scale() >= source.scale() && "painter doesn't support downsampling scale factors"); if (opacity >= 1.0f && !(source.has_alpha_channel() && apply_alpha)) return blit(position, source, a_src_rect); @@ -581,7 +581,7 @@ void Painter::blit_with_opacity(const IntPoint& position, const Gfx::Bitmap& sou void Painter::blit_filtered(const IntPoint& position, const Gfx::Bitmap& source, const IntRect& src_rect, Function<Color(Color)> filter) { - ASSERT((source.scale() == 1 || source.scale() == scale()) && "blit_filtered only supports integer upsampling"); + VERIFY((source.scale() == 1 || source.scale() == scale()) && "blit_filtered only supports integer upsampling"); IntRect safe_src_rect = src_rect.intersected(source.rect()); auto dst_rect = IntRect(position, safe_src_rect.size()).translated(translation()); @@ -660,7 +660,7 @@ void Painter::blit_dimmed(const IntPoint& position, const Gfx::Bitmap& source, c void Painter::draw_tiled_bitmap(const IntRect& a_dst_rect, const Gfx::Bitmap& source) { - ASSERT((source.scale() == 1 || source.scale() == scale()) && "draw_tiled_bitmap only supports integer upsampling"); + VERIFY((source.scale() == 1 || source.scale() == scale()) && "draw_tiled_bitmap only supports integer upsampling"); auto dst_rect = a_dst_rect.translated(translation()); auto clipped_rect = dst_rect.intersected(clip_rect()); @@ -701,7 +701,7 @@ void Painter::draw_tiled_bitmap(const IntRect& a_dst_rect, const Gfx::Bitmap& so return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Painter::blit_offset(const IntPoint& a_position, const Gfx::Bitmap& source, const IntRect& a_src_rect, const IntPoint& offset) @@ -721,7 +721,7 @@ void Painter::blit_offset(const IntPoint& a_position, const Gfx::Bitmap& source, void Painter::blit(const IntPoint& position, const Gfx::Bitmap& source, const IntRect& a_src_rect, float opacity, bool apply_alpha) { - ASSERT(scale() >= source.scale() && "painter doesn't support downsampling scale factors"); + VERIFY(scale() >= source.scale() && "painter doesn't support downsampling scale factors"); if (opacity < 1.0f || (source.has_alpha_channel() && apply_alpha)) return blit_with_opacity(position, source, a_src_rect, opacity, apply_alpha); @@ -772,7 +772,7 @@ void Painter::blit(const IntPoint& position, const Gfx::Bitmap& source, const In return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } template<bool has_alpha_channel, typename GetPixel> @@ -1024,7 +1024,7 @@ void draw_text_line(const IntRect& a_rect, const TextType& text, const Font& fon break; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (is_vertically_centered_text_alignment(alignment)) { @@ -1117,7 +1117,7 @@ void do_draw_text(const IntRect& rect, const TextType& text, const Font& font, T bounding_rect.set_location({ (rect.right() + 1) - bounding_rect.width(), (rect.bottom() + 1) - bounding_rect.height() }); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } for (size_t i = 0; i < lines.size(); ++i) { @@ -1155,7 +1155,7 @@ void Painter::draw_text(const IntRect& rect, const Utf32View& text, const Font& void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, const IntRect& rect, const StringView& raw_text, const Font& font, TextAlignment alignment, TextElision elision) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. Utf8View text { raw_text }; do_draw_text(rect, text, font, alignment, elision, [&](const IntRect& r, u32 code_point) { @@ -1165,7 +1165,7 @@ void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, cons void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, const IntRect& rect, const Utf8View& text, const Font& font, TextAlignment alignment, TextElision elision) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. do_draw_text(rect, text, font, alignment, elision, [&](const IntRect& r, u32 code_point) { draw_one_glyph(r, code_point); @@ -1174,7 +1174,7 @@ void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, cons void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, const IntRect& rect, const Utf32View& text, const Font& font, TextAlignment alignment, TextElision elision) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. do_draw_text(rect, text, font, alignment, elision, [&](const IntRect& r, u32 code_point) { draw_one_glyph(r, code_point); @@ -1183,7 +1183,7 @@ void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, cons void Painter::set_pixel(const IntPoint& p, Color color) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. auto point = p; point.move_by(state().translation); @@ -1245,7 +1245,7 @@ void Painter::draw_physical_pixel(const IntPoint& physical_position, Color color // This always draws a single physical pixel, independent of scale(). // This should only be called by routines that already handle scale // (including scaling thickness). - ASSERT(draw_op() == DrawOp::Copy); + VERIFY(draw_op() == DrawOp::Copy); if (thickness == 1) { // Implies scale() == 1. auto& pixel = m_target->scanline(physical_position.y())[physical_position.x()]; @@ -1327,7 +1327,7 @@ void Painter::draw_line(const IntPoint& p1, const IntPoint& p2, Color color, int } // FIXME: Implement dotted/dashed diagonal lines. - ASSERT(style == LineStyle::Solid); + VERIFY(style == LineStyle::Solid); const double adx = abs(point2.x() - point1.x()); const double ady = abs(point2.y() - point1.y()); @@ -1462,7 +1462,7 @@ static bool can_approximate_elliptical_arc(const FloatPoint& p1, const FloatPoin void Painter::draw_quadratic_bezier_curve(const IntPoint& control_point, const IntPoint& p1, const IntPoint& p2, Color color, int thickness, LineStyle style) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. for_each_line_segment_on_bezier_curve(FloatPoint(control_point), FloatPoint(p1), FloatPoint(p2), [&](const FloatPoint& fp1, const FloatPoint& fp2) { draw_line(IntPoint(fp1.x(), fp1.y()), IntPoint(fp2.x(), fp2.y()), color, thickness, style); @@ -1487,7 +1487,7 @@ void Painter::for_each_line_segment_on_elliptical_arc(const FloatPoint& p1, cons void Painter::draw_elliptical_arc(const IntPoint& p1, const IntPoint& p2, const IntPoint& center, const FloatPoint& radii, float x_axis_rotation, float theta_1, float theta_delta, Color color, int thickness, LineStyle style) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. for_each_line_segment_on_elliptical_arc(FloatPoint(p1), FloatPoint(p2), FloatPoint(center), radii, x_axis_rotation, theta_1, theta_delta, [&](const FloatPoint& fp1, const FloatPoint& fp2) { draw_line(IntPoint(fp1.x(), fp1.y()), IntPoint(fp2.x(), fp2.y()), color, thickness, style); @@ -1518,14 +1518,14 @@ PainterStateSaver::~PainterStateSaver() void Painter::stroke_path(const Path& path, Color color, int thickness) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. FloatPoint cursor; for (auto& segment : path.segments()) { switch (segment.type()) { case Segment::Type::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; case Segment::Type::MoveTo: cursor = segment.point(); @@ -1573,7 +1573,7 @@ void Painter::stroke_path(const Path& path, Color color, int thickness) void Painter::fill_path(Path& path, Color color, WindingRule winding_rule) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. const auto& segments = path.split_lines(); @@ -1604,7 +1604,7 @@ void Painter::fill_path(Path& path, Color color, WindingRule winding_rule) if (winding_rule == WindingRule::EvenOdd) return winding_number % 2 == 0; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }; auto increment_winding = [winding_rule](int& winding_number, const IntPoint& from, const IntPoint& to) { @@ -1621,7 +1621,7 @@ void Painter::fill_path(Path& path, Color color, WindingRule winding_rule) return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }; while (scanline >= last_y) { diff --git a/Userland/Libraries/LibGfx/Painter.h b/Userland/Libraries/LibGfx/Painter.h index 36db4ddac6..62b5c3de3b 100644 --- a/Userland/Libraries/LibGfx/Painter.h +++ b/Userland/Libraries/LibGfx/Painter.h @@ -125,7 +125,7 @@ public: void save() { m_state_stack.append(m_state_stack.last()); } void restore() { - ASSERT(m_state_stack.size() > 1); + VERIFY(m_state_stack.size() > 1); m_state_stack.take_last(); } diff --git a/Userland/Libraries/LibGfx/Palette.cpp b/Userland/Libraries/LibGfx/Palette.cpp index 2068e1a50f..93ba1e28cf 100644 --- a/Userland/Libraries/LibGfx/Palette.cpp +++ b/Userland/Libraries/LibGfx/Palette.cpp @@ -51,13 +51,13 @@ Palette::~Palette() int PaletteImpl::metric(MetricRole role) const { - ASSERT((int)role < (int)MetricRole::__Count); + VERIFY((int)role < (int)MetricRole::__Count); return theme().metric[(int)role]; } String PaletteImpl::path(PathRole role) const { - ASSERT((int)role < (int)PathRole::__Count); + VERIFY((int)role < (int)PathRole::__Count); return theme().path[(int)role]; } diff --git a/Userland/Libraries/LibGfx/Palette.h b/Userland/Libraries/LibGfx/Palette.h index 34ce928ba8..9d1c65bdbd 100644 --- a/Userland/Libraries/LibGfx/Palette.h +++ b/Userland/Libraries/LibGfx/Palette.h @@ -46,7 +46,7 @@ public: Color color(ColorRole role) const { - ASSERT((int)role < (int)ColorRole::__Count); + VERIFY((int)role < (int)ColorRole::__Count); return Color::from_rgba(theme().color[(int)role]); } diff --git a/Userland/Libraries/LibGfx/Path.cpp b/Userland/Libraries/LibGfx/Path.cpp index 5fe2bb2f63..95812cf532 100644 --- a/Userland/Libraries/LibGfx/Path.cpp +++ b/Userland/Libraries/LibGfx/Path.cpp @@ -70,7 +70,7 @@ void Path::close_all_subpaths() // This is a move from a subpath to another // connect the two ends of this subpath before // moving on to the next one - ASSERT(start_of_subpath.has_value()); + VERIFY(start_of_subpath.has_value()); append_segment<MoveSegment>(cursor.value()); append_segment<LineSegment>(start_of_subpath.value()); @@ -89,7 +89,7 @@ void Path::close_all_subpaths() cursor = segment.point(); break; case Segment::Type::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } @@ -216,7 +216,7 @@ void Path::segmentize_path() break; } case Segment::Type::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } first = false; diff --git a/Userland/Libraries/LibGfx/Path.h b/Userland/Libraries/LibGfx/Path.h index 7a8dfe9567..81ebf2ccfb 100644 --- a/Userland/Libraries/LibGfx/Path.h +++ b/Userland/Libraries/LibGfx/Path.h @@ -177,7 +177,7 @@ public: { if (!m_split_lines.has_value()) { segmentize_path(); - ASSERT(m_split_lines.has_value()); + VERIFY(m_split_lines.has_value()); } return m_split_lines.value(); } @@ -186,7 +186,7 @@ public: { if (!m_bounding_box.has_value()) { segmentize_path(); - ASSERT(m_bounding_box.has_value()); + VERIFY(m_bounding_box.has_value()); } return m_bounding_box.value(); } diff --git a/Userland/Libraries/LibGfx/SystemTheme.cpp b/Userland/Libraries/LibGfx/SystemTheme.cpp index 6e2961a3f7..7a5f61c10d 100644 --- a/Userland/Libraries/LibGfx/SystemTheme.cpp +++ b/Userland/Libraries/LibGfx/SystemTheme.cpp @@ -36,13 +36,13 @@ static Core::AnonymousBuffer theme_buffer; const SystemTheme& current_system_theme() { - ASSERT(theme_page); + VERIFY(theme_page); return *theme_page; } Core::AnonymousBuffer& current_system_theme_buffer() { - ASSERT(theme_buffer.is_valid()); + VERIFY(theme_buffer.is_valid()); return theme_buffer; } diff --git a/Userland/Libraries/LibGfx/SystemTheme.h b/Userland/Libraries/LibGfx/SystemTheme.h index ad7c423b92..e0e97556ed 100644 --- a/Userland/Libraries/LibGfx/SystemTheme.h +++ b/Userland/Libraries/LibGfx/SystemTheme.h @@ -129,7 +129,7 @@ inline const char* to_string(ColorRole role) ENUMERATE_COLOR_ROLES(__ENUMERATE_COLOR_ROLE) #undef __ENUMERATE_COLOR_ROLE default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibGfx/Typeface.cpp b/Userland/Libraries/LibGfx/Typeface.cpp index 76e7fcfbed..3995e0ddb9 100644 --- a/Userland/Libraries/LibGfx/Typeface.cpp +++ b/Userland/Libraries/LibGfx/Typeface.cpp @@ -30,7 +30,7 @@ namespace Gfx { unsigned Typeface::weight() const { - ASSERT(m_ttf_font || m_bitmap_fonts.size() > 0); + VERIFY(m_ttf_font || m_bitmap_fonts.size() > 0); if (is_fixed_size()) return m_bitmap_fonts[0]->weight(); @@ -40,7 +40,7 @@ unsigned Typeface::weight() const bool Typeface::is_fixed_width() const { - ASSERT(m_ttf_font || m_bitmap_fonts.size() > 0); + VERIFY(m_ttf_font || m_bitmap_fonts.size() > 0); if (is_fixed_size()) return m_bitmap_fonts[0]->is_fixed_width(); diff --git a/Userland/Libraries/LibHTTP/HttpJob.cpp b/Userland/Libraries/LibHTTP/HttpJob.cpp index 68c751598e..c2b73aa12a 100644 --- a/Userland/Libraries/LibHTTP/HttpJob.cpp +++ b/Userland/Libraries/LibHTTP/HttpJob.cpp @@ -35,7 +35,7 @@ namespace HTTP { void HttpJob::start() { - ASSERT(!m_socket); + VERIFY(!m_socket); m_socket = Core::TCPSocket::construct(this); m_socket->on_connected = [this] { #if CHTTPJOB_DEBUG diff --git a/Userland/Libraries/LibHTTP/HttpRequest.cpp b/Userland/Libraries/LibHTTP/HttpRequest.cpp index 8ea42a4e84..6d6a9ccce7 100644 --- a/Userland/Libraries/LibHTTP/HttpRequest.cpp +++ b/Userland/Libraries/LibHTTP/HttpRequest.cpp @@ -48,7 +48,7 @@ String HttpRequest::method_name() const case Method::POST: return "POST"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -100,7 +100,7 @@ Optional<HttpRequest> HttpRequest::from_raw_request(ReadonlyBytes raw_request) }; auto consume = [&]() -> u8 { - ASSERT(index < raw_request.size()); + VERIFY(index < raw_request.size()); return raw_request[index++]; }; diff --git a/Userland/Libraries/LibHTTP/HttpsJob.cpp b/Userland/Libraries/LibHTTP/HttpsJob.cpp index 9dd77f8c83..3f89c4b971 100644 --- a/Userland/Libraries/LibHTTP/HttpsJob.cpp +++ b/Userland/Libraries/LibHTTP/HttpsJob.cpp @@ -37,7 +37,7 @@ namespace HTTP { void HttpsJob::start() { - ASSERT(!m_socket); + VERIFY(!m_socket); m_socket = TLS::TLSv12::construct(this); m_socket->set_root_certificates(m_override_ca_certificates ? *m_override_ca_certificates : DefaultRootCACertificates::the().certificates()); m_socket->on_tls_connected = [this] { @@ -91,7 +91,7 @@ void HttpsJob::set_certificate(String certificate, String private_key) if (!m_socket->add_client_key(certificate.bytes(), private_key.bytes())) { dbgln("LibHTTP: Failed to set a client certificate"); // FIXME: Do something about this failure - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibHTTP/Job.cpp b/Userland/Libraries/LibHTTP/Job.cpp index ce3b7419fd..7da8eee947 100644 --- a/Userland/Libraries/LibHTTP/Job.cpp +++ b/Userland/Libraries/LibHTTP/Job.cpp @@ -88,7 +88,7 @@ void Job::flush_received_buffers() --i; continue; } - ASSERT(written < payload.size()); + VERIFY(written < payload.size()); payload = payload.slice(written, payload.size() - written); break; } @@ -121,8 +121,8 @@ void Job::on_socket_connected() // and then get eof() == true. [[maybe_unused]] auto payload = receive(64); // These assertions are only correct if "Connection: close". - ASSERT(payload.is_empty()); - ASSERT(eof()); + VERIFY(payload.is_empty()); + VERIFY(eof()); return; } @@ -204,8 +204,8 @@ void Job::on_socket_connected() dbgln_if(JOB_DEBUG, "Job: [{}] = '{}'", name, value); return; } - ASSERT(m_state == State::InBody); - ASSERT(can_read()); + VERIFY(m_state == State::InBody); + VERIFY(can_read()); read_while_data_available([&] { auto read_size = 64 * KiB; diff --git a/Userland/Libraries/LibIPC/ClientConnection.h b/Userland/Libraries/LibIPC/ClientConnection.h index bca77f3b58..50f8bf0bba 100644 --- a/Userland/Libraries/LibIPC/ClientConnection.h +++ b/Userland/Libraries/LibIPC/ClientConnection.h @@ -43,7 +43,7 @@ public: : IPC::Connection<ServerEndpoint, ClientEndpoint>(endpoint, move(socket)) , m_client_id(client_id) { - ASSERT(this->socket().is_connected()); + VERIFY(this->socket().is_connected()); this->socket().on_ready_to_read = [this] { this->drain_messages_from_peer(); }; } diff --git a/Userland/Libraries/LibIPC/Connection.h b/Userland/Libraries/LibIPC/Connection.h index c6b281aa18..66bcab9a42 100644 --- a/Userland/Libraries/LibIPC/Connection.h +++ b/Userland/Libraries/LibIPC/Connection.h @@ -122,7 +122,7 @@ public: { post_message(RequestType(forward<Args>(args)...)); auto response = wait_for_specific_endpoint_message<typename RequestType::ResponseType, PeerEndpoint>(); - ASSERT(response); + VERIFY(response); return response; } @@ -171,8 +171,8 @@ protected: if (rc < 0) { perror("select"); } - ASSERT(rc > 0); - ASSERT(FD_ISSET(m_socket->fd(), &rfds)); + VERIFY(rc > 0); + VERIFY(FD_ISSET(m_socket->fd(), &rfds)); if (!drain_messages_from_peer()) break; } diff --git a/Userland/Libraries/LibIPC/Decoder.cpp b/Userland/Libraries/LibIPC/Decoder.cpp index 0eef0a005a..67ed0b91fc 100644 --- a/Userland/Libraries/LibIPC/Decoder.cpp +++ b/Userland/Libraries/LibIPC/Decoder.cpp @@ -152,7 +152,7 @@ bool Decoder::decode(Dictionary& dictionary) if (m_stream.handle_any_error()) return false; if (size >= (size_t)NumericLimits<i32>::max()) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } for (size_t i = 0; i < size; ++i) { diff --git a/Userland/Libraries/LibIPC/Decoder.h b/Userland/Libraries/LibIPC/Decoder.h index a8752f7890..d21781602b 100644 --- a/Userland/Libraries/LibIPC/Decoder.h +++ b/Userland/Libraries/LibIPC/Decoder.h @@ -39,7 +39,7 @@ template<typename T> inline bool decode(Decoder&, T&) { static_assert(DependentFalse<T>, "Base IPC::decoder() instantiated"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } class Decoder { diff --git a/Userland/Libraries/LibIPC/Encoder.h b/Userland/Libraries/LibIPC/Encoder.h index da8416f5a5..97b02df312 100644 --- a/Userland/Libraries/LibIPC/Encoder.h +++ b/Userland/Libraries/LibIPC/Encoder.h @@ -35,7 +35,7 @@ template<typename T> bool encode(Encoder&, T&) { static_assert(DependentFalse<T>, "Base IPC::encode() was instantiated"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } class Encoder { diff --git a/Userland/Libraries/LibIPC/ServerConnection.h b/Userland/Libraries/LibIPC/ServerConnection.h index 6f655d4c5b..493f0a0af9 100644 --- a/Userland/Libraries/LibIPC/ServerConnection.h +++ b/Userland/Libraries/LibIPC/ServerConnection.h @@ -41,10 +41,10 @@ public: if (!this->socket().connect(Core::SocketAddress::local(address))) { perror("connect"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(this->socket().is_connected()); + VERIFY(this->socket().is_connected()); } virtual void handshake() = 0; diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index 7ff07f32af..6d11821451 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -145,7 +145,7 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete if (is<SuperExpression>(*m_callee)) { // If we are calling super, |this| has not been initialized yet, and would not be meaningful to provide. auto new_target = vm.get_new_target(); - ASSERT(new_target.is_function()); + VERIFY(new_target.is_function()); return { js_undefined(), new_target }; } @@ -182,7 +182,7 @@ Value CallExpression::execute(Interpreter& interpreter, GlobalObject& global_obj if (vm.exception()) return {}; - ASSERT(!callee.is_empty()); + VERIFY(!callee.is_empty()); if (!callee.is_function() || (is<NewExpression>(*this) && (is<NativeFunction>(callee.as_object()) && !static_cast<NativeFunction&>(callee.as_object()).has_constructor()))) { @@ -301,7 +301,7 @@ Value WithStatement::execute(Interpreter& interpreter, GlobalObject& global_obje if (interpreter.exception()) return {}; - ASSERT(object); + VERIFY(object); auto* with_scope = interpreter.heap().allocate<WithScope>(global_object, *object, interpreter.vm().call_frame().scope); TemporaryChange<ScopeObject*> scope_change(interpreter.vm().call_frame().scope, with_scope); @@ -456,7 +456,7 @@ static FlyString variable_from_for_declaration(Interpreter& interpreter, GlobalO FlyString variable_name; if (is<VariableDeclaration>(node)) { auto& variable_declaration = static_cast<const VariableDeclaration&>(node); - ASSERT(!variable_declaration.declarations().is_empty()); + VERIFY(!variable_declaration.declarations().is_empty()); if (variable_declaration.declaration_kind() != DeclarationKind::Var) { wrapper = create_ast_node<BlockStatement>(node.source_range()); interpreter.enter_scope(*wrapper, ScopeType::Block, global_object); @@ -466,7 +466,7 @@ static FlyString variable_from_for_declaration(Interpreter& interpreter, GlobalO } else if (is<Identifier>(node)) { variable_name = static_cast<const Identifier&>(node).string(); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return variable_name; } @@ -478,7 +478,7 @@ Value ForInStatement::execute(Interpreter& interpreter, GlobalObject& global_obj if (!is<VariableDeclaration>(*m_lhs) && !is<Identifier>(*m_lhs)) { // FIXME: Implement "for (foo.bar in baz)", "for (foo[0] in bar)" - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } RefPtr<BlockStatement> wrapper; auto variable_name = variable_from_for_declaration(interpreter, global_object, m_lhs, wrapper); @@ -525,7 +525,7 @@ Value ForOfStatement::execute(Interpreter& interpreter, GlobalObject& global_obj if (!is<VariableDeclaration>(*m_lhs) && !is<Identifier>(*m_lhs)) { // FIXME: Implement "for (foo.bar of baz)", "for (foo[0] of bar)" - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } RefPtr<BlockStatement> wrapper; auto variable_name = variable_from_for_declaration(interpreter, global_object, m_lhs, wrapper); @@ -621,7 +621,7 @@ Value BinaryExpression::execute(Interpreter& interpreter, GlobalObject& global_o return instance_of(global_object, lhs_result, rhs_result); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value LogicalExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const @@ -660,7 +660,7 @@ Value LogicalExpression::execute(Interpreter& interpreter, GlobalObject& global_ return lhs_result; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Reference Expression::to_reference(Interpreter&, GlobalObject&) const @@ -697,7 +697,7 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob if (reference.is_unresolvable()) return Value(true); // FIXME: Support deleting locals - ASSERT(!reference.is_local_variable()); + VERIFY(!reference.is_local_variable()); if (reference.is_global_variable()) return global_object.delete_property(reference.name()); auto* base_object = reference.base().to_object(global_object); @@ -737,7 +737,7 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob case UnaryOp::Typeof: switch (lhs_result.type()) { case Value::Type::Empty: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; case Value::Type::Undefined: return js_string(vm, "undefined"); @@ -760,15 +760,15 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob case Value::Type::BigInt: return js_string(vm, "bigint"); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } case UnaryOp::Void: return js_undefined(); case UnaryOp::Delete: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value SuperExpression::execute(Interpreter& interpreter, GlobalObject&) const @@ -777,7 +777,7 @@ Value SuperExpression::execute(Interpreter& interpreter, GlobalObject&) const ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } }; // The semantics for SuperExpressions are handled in CallExpression::compute_this_and_callee() - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value ClassMethod::execute(Interpreter& interpreter, GlobalObject& global_object) const @@ -800,7 +800,7 @@ Value ClassExpression::execute(Interpreter& interpreter, GlobalObject& global_ob update_function_name(class_constructor_value, m_name); - ASSERT(class_constructor_value.is_function() && is<ScriptFunction>(class_constructor_value.as_function())); + VERIFY(class_constructor_value.is_function() && is<ScriptFunction>(class_constructor_value.as_function())); ScriptFunction* class_constructor = static_cast<ScriptFunction*>(&class_constructor_value.as_function()); class_constructor->set_is_class_constructor(); Value super_constructor = js_undefined(); @@ -870,7 +870,7 @@ Value ClassExpression::execute(Interpreter& interpreter, GlobalObject& global_ob case ClassMethod::Kind::Setter: return String::formatted("set {}", get_function_name(global_object, key)); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }(); update_function_name(method_value, accessor_name); @@ -1492,7 +1492,7 @@ Value UpdateExpression::execute(Interpreter& interpreter, GlobalObject& global_o new_value = js_bigint(interpreter.heap(), old_value.as_bigint().big_integer().minus(Crypto::SignedBigInteger { 1 })); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } reference.put(global_object, new_value); @@ -1610,7 +1610,7 @@ Value VariableDeclarator::execute(Interpreter& interpreter, GlobalObject&) const ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } }; // NOTE: VariableDeclarator execution is handled by VariableDeclaration. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void VariableDeclaration::dump(int indent) const @@ -1671,7 +1671,7 @@ Value ObjectProperty::execute(Interpreter& interpreter, GlobalObject&) const ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } }; // NOTE: ObjectProperty execution is handled by ObjectExpression. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const @@ -1733,7 +1733,7 @@ Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_o update_function_name(value, name); if (property.type() == ObjectProperty::Type::Getter || property.type() == ObjectProperty::Type::Setter) { - ASSERT(value.is_function()); + VERIFY(value.is_function()); object->define_accessor(PropertyName::from_value(global_object, key), value.as_function(), property.type() == ObjectProperty::Type::Getter, Attribute::Configurable | Attribute::Enumerable); if (interpreter.exception()) return {}; @@ -1757,13 +1757,13 @@ void MemberExpression::dump(int indent) const PropertyName MemberExpression::computed_property_name(Interpreter& interpreter, GlobalObject& global_object) const { if (!is_computed()) { - ASSERT(is<Identifier>(*m_property)); + VERIFY(is<Identifier>(*m_property)); return static_cast<const Identifier&>(*m_property).string(); } auto value = m_property->execute(interpreter, global_object); if (interpreter.exception()) return {}; - ASSERT(!value.is_empty()); + VERIFY(!value.is_empty()); return PropertyName::from_value(global_object, value); } @@ -1774,7 +1774,7 @@ String MemberExpression::to_string_approximation() const object_string = static_cast<const Identifier&>(*m_object).string(); if (is_computed()) return String::formatted("{}[<computed>]", object_string); - ASSERT(is<Identifier>(*m_property)); + VERIFY(is<Identifier>(*m_property)); return String::formatted("{}.{}", object_string, static_cast<const Identifier&>(*m_property).string()); } @@ -1803,7 +1803,7 @@ void MetaProperty::dump(int indent) const else if (m_type == MetaProperty::Type::ImportMeta) name = "import.meta"; else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); print_indent(indent); outln("{} {}", class_name(), name); } @@ -1817,7 +1817,7 @@ Value MetaProperty::execute(Interpreter& interpreter, GlobalObject&) const return interpreter.vm().get_new_target().value_or(js_undefined()); if (m_type == MetaProperty::Type::ImportMeta) TODO(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value StringLiteral::execute(Interpreter& interpreter, GlobalObject&) const @@ -2073,7 +2073,7 @@ Value CatchClause::execute(Interpreter& interpreter, GlobalObject&) const ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } }; // NOTE: CatchClause execution is handled by TryStatement. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } @@ -2137,7 +2137,7 @@ Value SwitchCase::execute(Interpreter& interpreter, GlobalObject&) const ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } }; // NOTE: SwitchCase execution is handled by SwitchStatement. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } diff --git a/Userland/Libraries/LibJS/AST.h b/Userland/Libraries/LibJS/AST.h index f24035a5f7..b22c99dc4c 100644 --- a/Userland/Libraries/LibJS/AST.h +++ b/Userland/Libraries/LibJS/AST.h @@ -971,7 +971,7 @@ public: const Expression& key() const { return m_key; } const Expression& value() const { - ASSERT(m_value); + VERIFY(m_value); return *m_value; } diff --git a/Userland/Libraries/LibJS/Heap/Allocator.cpp b/Userland/Libraries/LibJS/Heap/Allocator.cpp index 03190382c4..fcbeeeaaa8 100644 --- a/Userland/Libraries/LibJS/Heap/Allocator.cpp +++ b/Userland/Libraries/LibJS/Heap/Allocator.cpp @@ -48,7 +48,7 @@ Cell* Allocator::allocate_cell(Heap& heap) auto& block = *m_usable_blocks.last(); auto* cell = block.allocate(); - ASSERT(cell); + VERIFY(cell); if (block.is_full()) m_full_blocks.append(*m_usable_blocks.last()); return cell; @@ -62,7 +62,7 @@ void Allocator::block_did_become_empty(Badge<Heap>, HeapBlock& block) void Allocator::block_did_become_usable(Badge<Heap>, HeapBlock& block) { - ASSERT(!block.is_full()); + VERIFY(!block.is_full()); m_usable_blocks.append(block); } diff --git a/Userland/Libraries/LibJS/Heap/Heap.cpp b/Userland/Libraries/LibJS/Heap/Heap.cpp index 7f4daae2e3..dd093c2b0b 100644 --- a/Userland/Libraries/LibJS/Heap/Heap.cpp +++ b/Userland/Libraries/LibJS/Heap/Heap.cpp @@ -64,7 +64,7 @@ ALWAYS_INLINE Allocator& Heap::allocator_for_size(size_t cell_size) if (allocator->cell_size() >= cell_size) return *allocator; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Cell* Heap::allocate_cell(size_t size) @@ -84,7 +84,7 @@ Cell* Heap::allocate_cell(size_t size) void Heap::collect_garbage(CollectionType collection_type, bool print_report) { - ASSERT(!m_collecting_garbage); + VERIFY(!m_collecting_garbage); TemporaryChange change(m_collecting_garbage, true); Core::ElapsedTimer collection_measurement_timer; @@ -288,25 +288,25 @@ void Heap::sweep_dead_cells(bool print_report, const Core::ElapsedTimer& measure void Heap::did_create_handle(Badge<HandleImpl>, HandleImpl& impl) { - ASSERT(!m_handles.contains(&impl)); + VERIFY(!m_handles.contains(&impl)); m_handles.set(&impl); } void Heap::did_destroy_handle(Badge<HandleImpl>, HandleImpl& impl) { - ASSERT(m_handles.contains(&impl)); + VERIFY(m_handles.contains(&impl)); m_handles.remove(&impl); } void Heap::did_create_marked_value_list(Badge<MarkedValueList>, MarkedValueList& list) { - ASSERT(!m_marked_value_lists.contains(&list)); + VERIFY(!m_marked_value_lists.contains(&list)); m_marked_value_lists.set(&list); } void Heap::did_destroy_marked_value_list(Badge<MarkedValueList>, MarkedValueList& list) { - ASSERT(m_marked_value_lists.contains(&list)); + VERIFY(m_marked_value_lists.contains(&list)); m_marked_value_lists.remove(&list); } @@ -317,7 +317,7 @@ void Heap::defer_gc(Badge<DeferGC>) void Heap::undefer_gc(Badge<DeferGC>) { - ASSERT(m_gc_deferrals > 0); + VERIFY(m_gc_deferrals > 0); --m_gc_deferrals; if (!m_gc_deferrals) { diff --git a/Userland/Libraries/LibJS/Heap/HeapBlock.cpp b/Userland/Libraries/LibJS/Heap/HeapBlock.cpp index 0341eeb243..c250211421 100644 --- a/Userland/Libraries/LibJS/Heap/HeapBlock.cpp +++ b/Userland/Libraries/LibJS/Heap/HeapBlock.cpp @@ -42,7 +42,7 @@ NonnullOwnPtr<HeapBlock> HeapBlock::create_with_cell_size(Heap& heap, size_t cel #else auto* block = (HeapBlock*)aligned_alloc(block_size, block_size); #endif - ASSERT(block != MAP_FAILED); + VERIFY(block != MAP_FAILED); new (block) HeapBlock(heap, cell_size); return NonnullOwnPtr<HeapBlock>(NonnullOwnPtr<HeapBlock>::Adopt, *block); } @@ -51,7 +51,7 @@ void HeapBlock::operator delete(void* ptr) { #ifdef __serenity__ int rc = munmap(ptr, block_size); - ASSERT(rc == 0); + VERIFY(rc == 0); #else free(ptr); #endif @@ -61,7 +61,7 @@ HeapBlock::HeapBlock(Heap& heap, size_t cell_size) : m_heap(heap) , m_cell_size(cell_size) { - ASSERT(cell_size >= sizeof(FreelistEntry)); + VERIFY(cell_size >= sizeof(FreelistEntry)); FreelistEntry* next = nullptr; for (ssize_t i = cell_count() - 1; i >= 0; i--) { @@ -75,10 +75,10 @@ HeapBlock::HeapBlock(Heap& heap, size_t cell_size) void HeapBlock::deallocate(Cell* cell) { - ASSERT(is_valid_cell_pointer(cell)); - ASSERT(!m_freelist || is_valid_cell_pointer(m_freelist)); - ASSERT(cell->is_live()); - ASSERT(!cell->is_marked()); + VERIFY(is_valid_cell_pointer(cell)); + VERIFY(!m_freelist || is_valid_cell_pointer(m_freelist)); + VERIFY(cell->is_live()); + VERIFY(!cell->is_marked()); cell->~Cell(); auto* freelist_entry = new (cell) FreelistEntry(); freelist_entry->set_live(false); diff --git a/Userland/Libraries/LibJS/Heap/HeapBlock.h b/Userland/Libraries/LibJS/Heap/HeapBlock.h index 6cc3e5acb1..459ae5f80a 100644 --- a/Userland/Libraries/LibJS/Heap/HeapBlock.h +++ b/Userland/Libraries/LibJS/Heap/HeapBlock.h @@ -51,7 +51,7 @@ public: { if (!m_freelist) return nullptr; - ASSERT(is_valid_cell_pointer(m_freelist)); + VERIFY(is_valid_cell_pointer(m_freelist)); return exchange(m_freelist, m_freelist->next); } diff --git a/Userland/Libraries/LibJS/Interpreter.cpp b/Userland/Libraries/LibJS/Interpreter.cpp index 69ec6e18b8..5b14b8101c 100644 --- a/Userland/Libraries/LibJS/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Interpreter.cpp @@ -57,7 +57,7 @@ Interpreter::~Interpreter() Value Interpreter::run(GlobalObject& global_object, const Program& program) { auto& vm = this->vm(); - ASSERT(!vm.exception()); + VERIFY(!vm.exception()); VM::InterpreterExecutionScope scope(*this); @@ -66,10 +66,10 @@ Value Interpreter::run(GlobalObject& global_object, const Program& program) static FlyString global_execution_context_name = "(global execution context)"; global_call_frame.function_name = global_execution_context_name; global_call_frame.scope = &global_object; - ASSERT(!vm.exception()); + VERIFY(!vm.exception()); global_call_frame.is_strict_mode = program.is_strict_mode(); vm.push_call_frame(global_call_frame, global_object); - ASSERT(!vm.exception()); + VERIFY(!vm.exception()); auto result = program.execute(*this, global_object); vm.pop_call_frame(); return result; @@ -185,7 +185,7 @@ Value Interpreter::execute_statement(GlobalObject& global_object, const Statemen LexicalEnvironment* Interpreter::current_environment() { - ASSERT(is<LexicalEnvironment>(vm().call_frame().scope)); + VERIFY(is<LexicalEnvironment>(vm().call_frame().scope)); return static_cast<LexicalEnvironment*>(vm().call_frame().scope); } diff --git a/Userland/Libraries/LibJS/MarkupGenerator.cpp b/Userland/Libraries/LibJS/MarkupGenerator.cpp index afdd347098..6766b1b858 100644 --- a/Userland/Libraries/LibJS/MarkupGenerator.cpp +++ b/Userland/Libraries/LibJS/MarkupGenerator.cpp @@ -185,7 +185,7 @@ String MarkupGenerator::style_from_style_type(StyleType type) case StyleType::Identifier: return "color: -libweb-palette-syntax-identifier;"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -216,7 +216,7 @@ MarkupGenerator::StyleType MarkupGenerator::style_type_for_token(Token token) return StyleType::Identifier; default: dbgln("Unknown style type for token {}", token.name()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibJS/Parser.cpp b/Userland/Libraries/LibJS/Parser.cpp index ac8fbeb2e9..0eb7352a17 100644 --- a/Userland/Libraries/LibJS/Parser.cpp +++ b/Userland/Libraries/LibJS/Parser.cpp @@ -94,7 +94,7 @@ public: int p = m_token_precedence[static_cast<size_t>(token)]; if (p == 0) { warnln("Internal Error: No precedence for operator {}", Token::name(token)); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return -1; } @@ -827,7 +827,7 @@ NonnullRefPtr<ObjectExpression> Parser::parse_object_expression() } if (match(TokenType::ParenOpen)) { - ASSERT(property_name); + VERIFY(property_name); u8 parse_options = FunctionNodeParseOptions::AllowSuperPropertyLookup; if (property_type == ObjectProperty::Type::Getter) parse_options |= FunctionNodeParseOptions::IsGetterFunction; @@ -905,7 +905,7 @@ NonnullRefPtr<StringLiteral> Parser::parse_string_literal(Token token, bool in_t } else if (status == Token::StringValueStatus::UnicodeEscapeOverflow) { message = "Unicode code_point must not be greater than 0x10ffff in escape sequence"; } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (!message.is_empty()) @@ -1158,7 +1158,7 @@ NonnullRefPtr<Expression> Parser::parse_secondary_expression(NonnullRefPtr<Expre NonnullRefPtr<AssignmentExpression> Parser::parse_assignment_expression(AssignmentOp assignment_op, NonnullRefPtr<Expression> lhs, int min_precedence, Associativity associativity) { auto rule_start = push_start(); - ASSERT(match(TokenType::Equals) + VERIFY(match(TokenType::Equals) || match(TokenType::PlusEquals) || match(TokenType::MinusEquals) || match(TokenType::AsteriskEquals) @@ -1315,7 +1315,7 @@ template<typename FunctionNodeType> NonnullRefPtr<FunctionNodeType> Parser::parse_function_node(u8 parse_options) { auto rule_start = push_start(); - ASSERT(!(parse_options & FunctionNodeParseOptions::IsGetterFunction && parse_options & FunctionNodeParseOptions::IsSetterFunction)); + VERIFY(!(parse_options & FunctionNodeParseOptions::IsGetterFunction && parse_options & FunctionNodeParseOptions::IsSetterFunction)); TemporaryChange super_property_access_rollback(m_parser_state.m_allow_super_property_lookup, !!(parse_options & FunctionNodeParseOptions::AllowSuperPropertyLookup)); TemporaryChange super_constructor_call_rollback(m_parser_state.m_allow_super_constructor_call, !!(parse_options & FunctionNodeParseOptions::AllowSuperConstructorCall)); @@ -1427,7 +1427,7 @@ NonnullRefPtr<VariableDeclaration> Parser::parse_variable_declaration(bool for_l declaration_kind = DeclarationKind::Const; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } consume(); @@ -2037,7 +2037,7 @@ void Parser::save_state() void Parser::load_state() { - ASSERT(!m_saved_state.is_empty()); + VERIFY(!m_saved_state.is_empty()); m_parser_state = m_saved_state.take_last(); } diff --git a/Userland/Libraries/LibJS/Parser.h b/Userland/Libraries/LibJS/Parser.h index 6d6c4a57a6..628c90803b 100644 --- a/Userland/Libraries/LibJS/Parser.h +++ b/Userland/Libraries/LibJS/Parser.h @@ -187,8 +187,8 @@ private: ~RulePosition() { auto last = m_parser.m_rule_starts.take_last(); - ASSERT(last.line == m_position.line); - ASSERT(last.column == m_position.column); + VERIFY(last.line == m_position.line); + VERIFY(last.column == m_position.column); } const Position& position() const { return m_position; } diff --git a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp index c3cbd179b0..62c6c8cde0 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp @@ -63,7 +63,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayIteratorPrototype::next) auto target_array = iterator.array(); if (target_array.is_undefined()) return create_iterator_result_object(global_object, js_undefined(), true); - ASSERT(target_array.is_object()); + VERIFY(target_array.is_object()); auto& array = target_array.as_object(); auto index = iterator.index(); diff --git a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp index 440cc8a05e..311ea3707b 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp @@ -670,9 +670,9 @@ static void array_merge_sort(VM& vm, GlobalObject& global_object, Function* comp // Because they are called with primitive strings, these abstract_relation calls // should never result in a VM exception. auto x_lt_y_relation = abstract_relation(global_object, true, x_string_value, y_string_value); - ASSERT(x_lt_y_relation != TriState::Unknown); + VERIFY(x_lt_y_relation != TriState::Unknown); auto y_lt_x_relation = abstract_relation(global_object, true, y_string_value, x_string_value); - ASSERT(y_lt_x_relation != TriState::Unknown); + VERIFY(y_lt_x_relation != TriState::Unknown); if (x_lt_y_relation == TriState::True) { comparison_result = -1; diff --git a/Userland/Libraries/LibJS/Runtime/BigInt.cpp b/Userland/Libraries/LibJS/Runtime/BigInt.cpp index 59a0951ff7..37d5c51c1e 100644 --- a/Userland/Libraries/LibJS/Runtime/BigInt.cpp +++ b/Userland/Libraries/LibJS/Runtime/BigInt.cpp @@ -33,7 +33,7 @@ namespace JS { BigInt::BigInt(Crypto::SignedBigInteger big_integer) : m_big_integer(move(big_integer)) { - ASSERT(!m_big_integer.is_invalid()); + VERIFY(!m_big_integer.is_invalid()); } BigInt::~BigInt() diff --git a/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp b/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp index 5bd828a4d9..d38101c8a8 100644 --- a/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp @@ -108,7 +108,7 @@ static Value parse_simplified_iso8601(const String& iso_8601) } // We parsed a valid date simplified ISO 8601 string. Values not present in the string are -1. - ASSERT(year != -1); // A valid date string always has at least a year. + VERIFY(year != -1); // A valid date string always has at least a year. struct tm tm = {}; tm.tm_year = year - 1900; tm.tm_mon = month == -1 ? 0 : month - 1; diff --git a/Userland/Libraries/LibJS/Runtime/Exception.cpp b/Userland/Libraries/LibJS/Runtime/Exception.cpp index 08c6f6bde9..b7769581a3 100644 --- a/Userland/Libraries/LibJS/Runtime/Exception.cpp +++ b/Userland/Libraries/LibJS/Runtime/Exception.cpp @@ -45,7 +45,7 @@ Exception::Exception(Value value) auto& node_stack = vm().node_stack(); for (ssize_t i = node_stack.size() - 1; i >= 0; --i) { auto* node = node_stack[i]; - ASSERT(node); + VERIFY(node); m_source_ranges.append(node->source_range()); } } diff --git a/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp b/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp index 577d7b9175..6ed90ff166 100644 --- a/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp +++ b/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp @@ -50,8 +50,8 @@ Optional<ValueAndAttributes> SimpleIndexedPropertyStorage::get(u32 index) const void SimpleIndexedPropertyStorage::put(u32 index, Value value, PropertyAttributes attributes) { - ASSERT(attributes == default_attributes); - ASSERT(index < SPARSE_ARRAY_THRESHOLD); + VERIFY(attributes == default_attributes); + VERIFY(index < SPARSE_ARRAY_THRESHOLD); if (index >= m_array_size) { m_array_size = index + 1; @@ -69,10 +69,10 @@ void SimpleIndexedPropertyStorage::remove(u32 index) void SimpleIndexedPropertyStorage::insert(u32 index, Value value, PropertyAttributes attributes) { - ASSERT(attributes == default_attributes); - ASSERT(index < SPARSE_ARRAY_THRESHOLD); + VERIFY(attributes == default_attributes); + VERIFY(index < SPARSE_ARRAY_THRESHOLD); m_array_size++; - ASSERT(m_array_size <= SPARSE_ARRAY_THRESHOLD); + VERIFY(m_array_size <= SPARSE_ARRAY_THRESHOLD); m_packed_elements.insert(index, value); } @@ -92,7 +92,7 @@ ValueAndAttributes SimpleIndexedPropertyStorage::take_last() void SimpleIndexedPropertyStorage::set_array_like_size(size_t new_size) { - ASSERT(new_size <= SPARSE_ARRAY_THRESHOLD); + VERIFY(new_size <= SPARSE_ARRAY_THRESHOLD); m_array_size = new_size; m_packed_elements.resize(new_size); } @@ -177,7 +177,7 @@ void GenericIndexedPropertyStorage::insert(u32 index, Value value, PropertyAttri ValueAndAttributes GenericIndexedPropertyStorage::take_first() { - ASSERT(m_array_size > 0); + VERIFY(m_array_size > 0); m_array_size--; if (!m_sparse_elements.is_empty()) { @@ -192,7 +192,7 @@ ValueAndAttributes GenericIndexedPropertyStorage::take_first() ValueAndAttributes GenericIndexedPropertyStorage::take_last() { - ASSERT(m_array_size > 0); + VERIFY(m_array_size > 0); m_array_size--; if (m_array_size <= SPARSE_ARRAY_THRESHOLD) { @@ -202,7 +202,7 @@ ValueAndAttributes GenericIndexedPropertyStorage::take_last() } else { auto result = m_sparse_elements.get(m_array_size); m_sparse_elements.remove(m_array_size); - ASSERT(result.has_value()); + VERIFY(result.has_value()); return result.value(); } } @@ -282,7 +282,7 @@ Optional<ValueAndAttributes> IndexedProperties::get(Object* this_object, u32 ind return {}; auto& value = result.value(); if (value.value.is_accessor()) { - ASSERT(this_object); + VERIFY(this_object); auto& accessor = value.value.as_accessor(); return ValueAndAttributes { accessor.call_getter(this_object), value.attributes }; } @@ -300,7 +300,7 @@ void IndexedProperties::put(Object* this_object, u32 index, Value value, Propert auto value_here = m_storage->get(index); if (value_here.has_value() && value_here.value().value.is_accessor()) { - ASSERT(this_object); + VERIFY(this_object); value_here.value().value.as_accessor().call_setter(this_object, value); } else { m_storage->put(index, value, attributes); diff --git a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp index ee6a8ed057..6dd9259203 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp @@ -33,7 +33,7 @@ namespace JS { Object* get_iterator(GlobalObject& global_object, Value value, String hint, Value method) { auto& vm = global_object.vm(); - ASSERT(hint == "sync" || hint == "async"); + VERIFY(hint == "sync" || hint == "async"); if (method.is_empty()) { if (hint == "async") TODO(); @@ -128,7 +128,7 @@ void get_iterator_values(GlobalObject& global_object, Value value, AK::Function< auto result = callback(next_value); if (result == IterationDecision::Break) return; - ASSERT(result == IterationDecision::Continue); + VERIFY(result == IterationDecision::Continue); } } diff --git a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp index b4959dc733..c1bcfe0c0e 100644 --- a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp @@ -433,7 +433,7 @@ Value JSONObject::parse_json_value(GlobalObject& global_object, const JsonValue& return js_string(global_object.heap(), value.to_string()); if (value.is_bool()) return Value(static_cast<bool>(value.as_bool())); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Object* JSONObject::parse_json_object(GlobalObject& global_object, const JsonObject& json_object) diff --git a/Userland/Libraries/LibJS/Runtime/LexicalEnvironment.cpp b/Userland/Libraries/LibJS/Runtime/LexicalEnvironment.cpp index 94d1c97e2d..72549ea8bb 100644 --- a/Userland/Libraries/LibJS/Runtime/LexicalEnvironment.cpp +++ b/Userland/Libraries/LibJS/Runtime/LexicalEnvironment.cpp @@ -89,7 +89,7 @@ bool LexicalEnvironment::has_super_binding() const Value LexicalEnvironment::get_super_base() { - ASSERT(has_super_binding()); + VERIFY(has_super_binding()); if (m_home_object.is_object()) return m_home_object.as_object().prototype(); return {}; @@ -107,12 +107,12 @@ bool LexicalEnvironment::has_this_binding() const case EnvironmentRecordType::Module: return true; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value LexicalEnvironment::get_this_binding(GlobalObject& global_object) const { - ASSERT(has_this_binding()); + VERIFY(has_this_binding()); if (this_binding_status() == ThisBindingStatus::Uninitialized) { vm().throw_exception<ReferenceError>(global_object, ErrorType::ThisHasNotBeenInitialized); return {}; @@ -122,7 +122,7 @@ Value LexicalEnvironment::get_this_binding(GlobalObject& global_object) const void LexicalEnvironment::bind_this_value(GlobalObject& global_object, Value this_value) { - ASSERT(has_this_binding()); + VERIFY(has_this_binding()); if (m_this_binding_status == ThisBindingStatus::Initialized) { vm().throw_exception<ReferenceError>(global_object, ErrorType::ThisIsAlreadyInitialized); return; diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index 8aec832a2f..a6d76f6903 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -160,8 +160,8 @@ bool Object::prevent_extensions() Value Object::get_own_property(const PropertyName& property_name, Value receiver) const { - ASSERT(property_name.is_valid()); - ASSERT(!receiver.is_empty()); + VERIFY(property_name.is_valid()); + VERIFY(!receiver.is_empty()); Value value_here; @@ -177,7 +177,7 @@ Value Object::get_own_property(const PropertyName& property_name, Value receiver value_here = m_storage[metadata.value().offset].value_or(js_undefined()); } - ASSERT(!value_here.is_empty()); + VERIFY(!value_here.is_empty()); if (value_here.is_accessor()) return value_here.as_accessor().call_getter(receiver); if (value_here.is_native_property()) @@ -263,7 +263,7 @@ Value Object::get_own_properties(const Object& this_object, PropertyKind kind, b Optional<PropertyDescriptor> Object::get_own_property_descriptor(const PropertyName& property_name) const { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); Value value; PropertyAttributes attributes; @@ -304,7 +304,7 @@ Optional<PropertyDescriptor> Object::get_own_property_descriptor(const PropertyN Value Object::get_own_property_descriptor_object(const PropertyName& property_name) const { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); auto& vm = this->vm(); auto descriptor_opt = get_own_property_descriptor(property_name); @@ -433,7 +433,7 @@ bool Object::define_property_without_transition(const PropertyName& property_nam bool Object::define_property(const PropertyName& property_name, Value value, PropertyAttributes attributes, bool throw_exceptions) { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); if (property_name.is_number()) return put_own_property_by_index(*this, property_name.as_number(), value, attributes, PutOwnPropertyMode::DefineProperty, throw_exceptions); @@ -448,7 +448,7 @@ bool Object::define_property(const PropertyName& property_name, Value value, Pro bool Object::define_accessor(const PropertyName& property_name, Function& getter_or_setter, bool is_getter, PropertyAttributes attributes, bool throw_exceptions) { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); Accessor* accessor { nullptr }; auto property_metadata = shape().lookup(property_name.to_string_or_symbol()); @@ -475,7 +475,7 @@ bool Object::define_accessor(const PropertyName& property_name, Function& getter bool Object::put_own_property(Object& this_object, const StringOrSymbol& property_name, Value value, PropertyAttributes attributes, PutOwnPropertyMode mode, bool throw_exceptions) { - ASSERT(!(mode == PutOwnPropertyMode::Put && value.is_accessor())); + VERIFY(!(mode == PutOwnPropertyMode::Put && value.is_accessor())); if (value.is_accessor()) { auto& accessor = value.as_accessor(); @@ -523,7 +523,7 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert m_storage.resize(m_shape->property_count()); } metadata = shape().lookup(property_name); - ASSERT(metadata.has_value()); + VERIFY(metadata.has_value()); } if (!new_property && mode == PutOwnPropertyMode::DefineProperty && !metadata.value().attributes.is_configurable() && attributes != metadata.value().attributes) { @@ -569,7 +569,7 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert bool Object::put_own_property_by_index(Object& this_object, u32 property_index, Value value, PropertyAttributes attributes, PutOwnPropertyMode mode, bool throw_exceptions) { - ASSERT(!(mode == PutOwnPropertyMode::Put && value.is_accessor())); + VERIFY(!(mode == PutOwnPropertyMode::Put && value.is_accessor())); auto existing_property = m_indexed_properties.get(nullptr, property_index, false); auto new_property = !existing_property.has_value(); @@ -623,7 +623,7 @@ bool Object::put_own_property_by_index(Object& this_object, u32 property_index, Value Object::delete_property(const PropertyName& property_name) { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); if (property_name.is_number()) return Value(m_indexed_properties.remove(property_name.as_number())); @@ -684,7 +684,7 @@ Value Object::get_by_index(u32 property_index) const Value Object::get(const PropertyName& property_name, Value receiver) const { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); if (property_name.is_number()) return get_by_index(property_name.as_number()); @@ -714,7 +714,7 @@ Value Object::get(const PropertyName& property_name, Value receiver) const bool Object::put_by_index(u32 property_index, Value value) { - ASSERT(!value.is_empty()); + VERIFY(!value.is_empty()); // If there's a setter in the prototype chain, we go to the setter. // Otherwise, it goes in the own property storage. @@ -743,12 +743,12 @@ bool Object::put_by_index(u32 property_index, Value value) bool Object::put(const PropertyName& property_name, Value value, Value receiver) { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); if (property_name.is_number()) return put_by_index(property_name.as_number(), value); - ASSERT(!value.is_empty()); + VERIFY(!value.is_empty()); if (property_name.is_string()) { auto& property_string = property_name.as_string(); @@ -837,7 +837,7 @@ bool Object::has_property(const PropertyName& property_name) const bool Object::has_own_property(const PropertyName& property_name) const { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); auto has_indexed_property = [&](u32 index) -> bool { if (is<StringObject>(*this)) @@ -859,7 +859,7 @@ bool Object::has_own_property(const PropertyName& property_name) const Value Object::ordinary_to_primitive(Value::PreferredType preferred_type) const { - ASSERT(preferred_type == Value::PreferredType::String || preferred_type == Value::PreferredType::Number); + VERIFY(preferred_type == Value::PreferredType::String || preferred_type == Value::PreferredType::Number); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/PropertyName.h b/Userland/Libraries/LibJS/Runtime/PropertyName.h index bbd6a0c640..cad939cd81 100644 --- a/Userland/Libraries/LibJS/Runtime/PropertyName.h +++ b/Userland/Libraries/LibJS/Runtime/PropertyName.h @@ -60,7 +60,7 @@ public: : m_type(Type::Number) , m_number(index) { - ASSERT(index >= 0); + VERIFY(index >= 0); } PropertyName(const char* chars) @@ -73,21 +73,21 @@ public: : m_type(Type::String) , m_string(FlyString(string)) { - ASSERT(!string.is_null()); + VERIFY(!string.is_null()); } PropertyName(const FlyString& string) : m_type(Type::String) , m_string(string) { - ASSERT(!string.is_null()); + VERIFY(!string.is_null()); } PropertyName(Symbol* symbol) : m_type(Type::Symbol) , m_symbol(symbol) { - ASSERT(symbol); + VERIFY(symbol); } PropertyName(const StringOrSymbol& string_or_symbol) @@ -108,26 +108,26 @@ public: i32 as_number() const { - ASSERT(is_number()); + VERIFY(is_number()); return m_number; } const FlyString& as_string() const { - ASSERT(is_string()); + VERIFY(is_string()); return m_string; } const Symbol* as_symbol() const { - ASSERT(is_symbol()); + VERIFY(is_symbol()); return m_symbol; } String to_string() const { - ASSERT(is_valid()); - ASSERT(!is_symbol()); + VERIFY(is_valid()); + VERIFY(!is_symbol()); if (is_string()) return as_string(); return String::number(as_number()); @@ -135,8 +135,8 @@ public: StringOrSymbol to_string_or_symbol() const { - ASSERT(is_valid()); - ASSERT(!is_number()); + VERIFY(is_valid()); + VERIFY(!is_number()); if (is_string()) return StringOrSymbol(as_string()); return StringOrSymbol(as_symbol()); diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp index 6386022b1e..4bf111978b 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp @@ -546,13 +546,13 @@ Value ProxyObject::construct(Function& new_target) const FlyString& ProxyObject::name() const { - ASSERT(is_function()); + VERIFY(is_function()); return static_cast<Function&>(m_target).name(); } LexicalEnvironment* ProxyObject::create_environment() { - ASSERT(is_function()); + VERIFY(is_function()); return static_cast<Function&>(m_target).create_environment(); } diff --git a/Userland/Libraries/LibJS/Runtime/Shape.cpp b/Userland/Libraries/LibJS/Runtime/Shape.cpp index 1f74b14471..056837ef64 100644 --- a/Userland/Libraries/LibJS/Runtime/Shape.cpp +++ b/Userland/Libraries/LibJS/Runtime/Shape.cpp @@ -32,7 +32,7 @@ namespace JS { Shape* Shape::create_unique_clone() const { - ASSERT(m_global_object); + VERIFY(m_global_object); auto* new_shape = heap().allocate_without_global_object<Shape>(*m_global_object); new_shape->m_unique = true; new_shape->m_prototype = m_prototype; @@ -179,7 +179,7 @@ void Shape::ensure_property_table() const m_property_table->set(shape->m_property_name, { next_offset++, shape->m_attributes }); } else if (shape->m_transition_type == TransitionType::Configure) { auto it = m_property_table->find(shape->m_property_name); - ASSERT(it != m_property_table->end()); + VERIFY(it != m_property_table->end()); it->value.attributes = shape->m_attributes; } } @@ -187,31 +187,31 @@ void Shape::ensure_property_table() const void Shape::add_property_to_unique_shape(const StringOrSymbol& property_name, PropertyAttributes attributes) { - ASSERT(is_unique()); - ASSERT(m_property_table); - ASSERT(!m_property_table->contains(property_name)); + VERIFY(is_unique()); + VERIFY(m_property_table); + VERIFY(!m_property_table->contains(property_name)); m_property_table->set(property_name, { m_property_table->size(), attributes }); ++m_property_count; } void Shape::reconfigure_property_in_unique_shape(const StringOrSymbol& property_name, PropertyAttributes attributes) { - ASSERT(is_unique()); - ASSERT(m_property_table); + VERIFY(is_unique()); + VERIFY(m_property_table); auto it = m_property_table->find(property_name); - ASSERT(it != m_property_table->end()); + VERIFY(it != m_property_table->end()); it->value.attributes = attributes; m_property_table->set(property_name, it->value); } void Shape::remove_property_from_unique_shape(const StringOrSymbol& property_name, size_t offset) { - ASSERT(is_unique()); - ASSERT(m_property_table); + VERIFY(is_unique()); + VERIFY(m_property_table); if (m_property_table->remove(property_name)) --m_property_count; for (auto& it : *m_property_table) { - ASSERT(it.value.offset != offset); + VERIFY(it.value.offset != offset); if (it.value.offset > offset) --it.value.offset; } diff --git a/Userland/Libraries/LibJS/Runtime/StringOrSymbol.h b/Userland/Libraries/LibJS/Runtime/StringOrSymbol.h index 38311b61b2..3ac5d3baea 100644 --- a/Userland/Libraries/LibJS/Runtime/StringOrSymbol.h +++ b/Userland/Libraries/LibJS/Runtime/StringOrSymbol.h @@ -57,14 +57,14 @@ public: StringOrSymbol(const String& string) : m_ptr(string.impl()) { - ASSERT(!string.is_null()); + VERIFY(!string.is_null()); as_string_impl().ref(); } StringOrSymbol(const FlyString& string) : m_ptr(string.impl()) { - ASSERT(!string.is_null()); + VERIFY(!string.is_null()); as_string_impl().ref(); } @@ -98,13 +98,13 @@ public: ALWAYS_INLINE String as_string() const { - ASSERT(is_string()); + VERIFY(is_string()); return as_string_impl(); } ALWAYS_INLINE const Symbol* as_symbol() const { - ASSERT(is_symbol()); + VERIFY(is_symbol()); return reinterpret_cast<const Symbol*>(bits() & ~1ul); } @@ -114,7 +114,7 @@ public: return as_string(); if (is_symbol()) return as_symbol()->to_string(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value to_value(VM& vm) const @@ -178,7 +178,7 @@ private: ALWAYS_INLINE const StringImpl& as_string_impl() const { - ASSERT(is_string()); + VERIFY(is_string()); return *reinterpret_cast<const StringImpl*>(m_ptr); } diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.h b/Userland/Libraries/LibJS/Runtime/TypedArray.h index a0f6709a76..0b580be39d 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArray.h +++ b/Userland/Libraries/LibJS/Runtime/TypedArray.h @@ -131,10 +131,10 @@ protected: TypedArray(u32 array_length, Object& prototype) : TypedArrayBase(prototype) { - ASSERT(!Checked<u32>::multiplication_would_overflow(array_length, sizeof(T))); + VERIFY(!Checked<u32>::multiplication_would_overflow(array_length, sizeof(T))); m_viewed_array_buffer = ArrayBuffer::create(global_object(), array_length * sizeof(T)); if (array_length) - ASSERT(!data().is_null()); + VERIFY(!data().is_null()); m_array_length = array_length; m_byte_length = m_viewed_array_buffer->byte_length(); } diff --git a/Userland/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp b/Userland/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp index ee7c8c14ff..6f923d67ce 100644 --- a/Userland/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp +++ b/Userland/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp @@ -47,7 +47,7 @@ Uint8ClampedArray::Uint8ClampedArray(u32 length, Object& prototype) Uint8ClampedArray::~Uint8ClampedArray() { - ASSERT(m_data); + VERIFY(m_data); free(m_data); m_data = nullptr; } diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index 73842974c7..ea88e9fc01 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -64,7 +64,7 @@ VM::~VM() Interpreter& VM::interpreter() { - ASSERT(!m_interpreters.is_empty()); + VERIFY(!m_interpreters.is_empty()); return *m_interpreters.last(); } @@ -82,9 +82,9 @@ void VM::push_interpreter(Interpreter& interpreter) void VM::pop_interpreter(Interpreter& interpreter) { - ASSERT(!m_interpreters.is_empty()); + VERIFY(!m_interpreters.is_empty()); auto* popped_interpreter = m_interpreters.take_last(); - ASSERT(popped_interpreter == &interpreter); + VERIFY(popped_interpreter == &interpreter); } VM::InterpreterExecutionScope::InterpreterExecutionScope(Interpreter& interpreter) @@ -256,7 +256,7 @@ Value VM::construct(Function& function, Function& new_target, Optional<MarkedVal // If we are constructing an instance of a derived class, // set the prototype on objects created by constructors that return an object (i.e. NativeFunction subclasses). if (function.constructor_kind() == Function::ConstructorKind::Base && new_target.constructor_kind() == Function::ConstructorKind::Derived && result.is_object()) { - ASSERT(is<LexicalEnvironment>(current_scope())); + VERIFY(is<LexicalEnvironment>(current_scope())); static_cast<LexicalEnvironment*>(current_scope())->replace_this_binding(result); auto prototype = new_target.get(names.prototype); if (exception()) @@ -319,18 +319,18 @@ const ScopeObject* VM::find_this_scope() const if (scope->has_this_binding()) return scope; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value VM::get_new_target() const { - ASSERT(is<LexicalEnvironment>(find_this_scope())); + VERIFY(is<LexicalEnvironment>(find_this_scope())); return static_cast<const LexicalEnvironment*>(find_this_scope())->new_target(); } Value VM::call_internal(Function& function, Value this_value, Optional<MarkedValueList> arguments) { - ASSERT(!exception()); + VERIFY(!exception()); CallFrame call_frame; call_frame.is_strict_mode = function.is_strict_mode(); @@ -342,7 +342,7 @@ Value VM::call_internal(Function& function, Value this_value, Optional<MarkedVal auto* environment = function.create_environment(); call_frame.scope = environment; - ASSERT(environment->this_binding_status() == LexicalEnvironment::ThisBindingStatus::Uninitialized); + VERIFY(environment->this_binding_status() == LexicalEnvironment::ThisBindingStatus::Uninitialized); environment->bind_this_value(function.global_object(), call_frame.this_value); if (exception()) return {}; diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index 320ea53405..571703ec93 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -109,13 +109,13 @@ public: PrimitiveString& empty_string() { return *m_empty_string; } PrimitiveString& single_ascii_character_string(u8 character) { - ASSERT(character < 0x80); + VERIFY(character < 0x80); return *m_single_ascii_character_strings[character]; } void push_call_frame(CallFrame& call_frame, GlobalObject& global_object) { - ASSERT(!exception()); + VERIFY(!exception()); // Ensure we got some stack space left, so the next function call doesn't kill us. // This value is merely a guess and might need tweaking at a later point. if (m_stack_info.size_free() < 16 * KiB) diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index 148d1834fc..8362c832df 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -213,7 +213,7 @@ bool Value::is_array() const Array& Value::as_array() { - ASSERT(is_array()); + VERIFY(is_array()); return static_cast<Array&>(*m_value.as_object); } @@ -224,7 +224,7 @@ bool Value::is_function() const Function& Value::as_function() { - ASSERT(is_function()); + VERIFY(is_function()); return static_cast<Function&>(as_object()); } @@ -268,7 +268,7 @@ String Value::to_string_without_side_effects() const case Type::NativeProperty: return "<native-property>"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -307,7 +307,7 @@ String Value::to_string(GlobalObject& global_object, bool legacy_null_to_empty_s return primitive_value.to_string(global_object); } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -332,7 +332,7 @@ bool Value::to_boolean() const case Type::Object: return true; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -368,7 +368,7 @@ Object* Value::to_object(GlobalObject& global_object) const return &const_cast<Object&>(as_object()); default: dbgln("Dying because I can't to_object() on {}", *this); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -420,7 +420,7 @@ Value Value::to_number(GlobalObject& global_object) const return primitive.to_number(global_object); } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -458,7 +458,7 @@ BigInt* Value::to_bigint(GlobalObject& global_object) const vm.throw_exception<TypeError>(global_object, ErrorType::Convert, "symbol", "BigInt"); return {}; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -470,13 +470,13 @@ i32 Value::as_i32() const u32 Value::as_u32() const { - ASSERT(as_double() >= 0); + VERIFY(as_double() >= 0); return min((double)as_i32(), MAX_U32); } size_t Value::as_size_t() const { - ASSERT(as_double() >= 0); + VERIFY(as_double() >= 0); return min((double)as_i32(), MAX_ARRAY_LIKE_INDEX); } @@ -552,7 +552,7 @@ size_t Value::to_index(GlobalObject& global_object) const return INVALID; } auto index = Value(integer_index).to_length(global_object); - ASSERT(!vm.exception()); + VERIFY(!vm.exception()); if (integer_index != index) { vm.throw_exception<RangeError>(global_object, ErrorType::InvalidIndex); return INVALID; @@ -1028,8 +1028,8 @@ bool same_value_zero(Value lhs, Value rhs) bool same_value_non_numeric(Value lhs, Value rhs) { - ASSERT(!lhs.is_number() && !lhs.is_bigint()); - ASSERT(lhs.type() == rhs.type()); + VERIFY(!lhs.is_number() && !lhs.is_bigint()); + VERIFY(lhs.type() == rhs.type()); switch (lhs.type()) { case Value::Type::Undefined: @@ -1044,7 +1044,7 @@ bool same_value_non_numeric(Value lhs, Value rhs) case Value::Type::Object: return &lhs.as_object() == &rhs.as_object(); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -1160,7 +1160,7 @@ TriState abstract_relation(GlobalObject& global_object, bool left_first, Value l } } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (x_primitive.is_bigint() && y_primitive.is_string()) { @@ -1213,7 +1213,7 @@ TriState abstract_relation(GlobalObject& global_object, bool left_first, Value l return TriState::False; } - ASSERT((x_numeric.is_number() && y_numeric.is_bigint()) || (x_numeric.is_bigint() && y_numeric.is_number())); + VERIFY((x_numeric.is_number() && y_numeric.is_bigint()) || (x_numeric.is_bigint() && y_numeric.is_number())); bool x_lower_than_y; if (x_numeric.is_number()) { diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h index a24db80057..781d996c5d 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -169,73 +169,73 @@ public: double as_double() const { - ASSERT(type() == Type::Number); + VERIFY(type() == Type::Number); return m_value.as_double; } bool as_bool() const { - ASSERT(type() == Type::Boolean); + VERIFY(type() == Type::Boolean); return m_value.as_bool; } Object& as_object() { - ASSERT(type() == Type::Object); + VERIFY(type() == Type::Object); return *m_value.as_object; } const Object& as_object() const { - ASSERT(type() == Type::Object); + VERIFY(type() == Type::Object); return *m_value.as_object; } PrimitiveString& as_string() { - ASSERT(is_string()); + VERIFY(is_string()); return *m_value.as_string; } const PrimitiveString& as_string() const { - ASSERT(is_string()); + VERIFY(is_string()); return *m_value.as_string; } Symbol& as_symbol() { - ASSERT(is_symbol()); + VERIFY(is_symbol()); return *m_value.as_symbol; } const Symbol& as_symbol() const { - ASSERT(is_symbol()); + VERIFY(is_symbol()); return *m_value.as_symbol; } Cell* as_cell() { - ASSERT(is_cell()); + VERIFY(is_cell()); return m_value.as_cell; } Accessor& as_accessor() { - ASSERT(is_accessor()); + VERIFY(is_accessor()); return *m_value.as_accessor; } BigInt& as_bigint() { - ASSERT(is_bigint()); + VERIFY(is_bigint()); return *m_value.as_bigint; } NativeProperty& as_native_property() { - ASSERT(is_native_property()); + VERIFY(is_native_property()); return *m_value.as_native_property; } diff --git a/Userland/Libraries/LibJS/Token.cpp b/Userland/Libraries/LibJS/Token.cpp index 638d4b7931..1a502b3476 100644 --- a/Userland/Libraries/LibJS/Token.cpp +++ b/Userland/Libraries/LibJS/Token.cpp @@ -42,7 +42,7 @@ const char* Token::name(TokenType type) ENUMERATE_JS_TOKENS #undef __ENUMERATE_JS_TOKEN default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "<Unknown>"; } } @@ -61,7 +61,7 @@ TokenCategory Token::category(TokenType type) ENUMERATE_JS_TOKENS #undef __ENUMERATE_JS_TOKEN default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -72,7 +72,7 @@ TokenCategory Token::category() const double Token::double_value() const { - ASSERT(type() == TokenType::NumericLiteral); + VERIFY(type() == TokenType::NumericLiteral); String value_string(m_value); if (value_string[0] == '0' && value_string.length() >= 2) { if (value_string[1] == 'x' || value_string[1] == 'X') { @@ -95,7 +95,7 @@ double Token::double_value() const static u32 hex2int(char x) { - ASSERT(isxdigit(x)); + VERIFY(isxdigit(x)); if (x >= '0' && x <= '9') return x - '0'; return 10u + (tolower(x) - 'a'); @@ -103,7 +103,7 @@ static u32 hex2int(char x) String Token::string_value(StringValueStatus& status) const { - ASSERT(type() == TokenType::StringLiteral || type() == TokenType::TemplateLiteralString); + VERIFY(type() == TokenType::StringLiteral || type() == TokenType::TemplateLiteralString); auto is_template = type() == TokenType::TemplateLiteralString; GenericLexer lexer(is_template ? m_value : m_value.substring_view(1, m_value.length() - 2)); @@ -122,7 +122,7 @@ String Token::string_value(StringValueStatus& status) const } lexer.ignore(); - ASSERT(!lexer.is_eof()); + VERIFY(!lexer.is_eof()); // Line continuation if (lexer.next_is('\n') || lexer.next_is('\r')) { @@ -146,7 +146,7 @@ String Token::string_value(StringValueStatus& status) const if (!isxdigit(lexer.peek()) || !isxdigit(lexer.peek(1))) return encoding_failure(StringValueStatus::MalformedHexEscape); auto code_point = hex2int(lexer.consume()) * 16 + hex2int(lexer.consume()); - ASSERT(code_point <= 255); + VERIFY(code_point <= 255); builder.append_code_point(code_point); continue; } @@ -202,7 +202,7 @@ String Token::string_value(StringValueStatus& status) const if (!octal_str.is_null()) { status = StringValueStatus::LegacyOctalEscapeSequence; auto code_point = strtoul(octal_str.characters(), nullptr, 8); - ASSERT(code_point <= 255); + VERIFY(code_point <= 255); builder.append_code_point(code_point); continue; } @@ -215,7 +215,7 @@ String Token::string_value(StringValueStatus& status) const bool Token::bool_value() const { - ASSERT(type() == TokenType::BoolLiteral); + VERIFY(type() == TokenType::BoolLiteral); return m_value == "true"; } diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp index acab00433d..4bb27d0ea2 100644 --- a/Userland/Libraries/LibLine/Editor.cpp +++ b/Userland/Libraries/LibLine/Editor.cpp @@ -1352,7 +1352,7 @@ void Editor::reposition_cursor(bool to_end) auto line = cursor_line() - 1; auto column = offset_in_line(); - ASSERT(column + m_origin_column <= m_num_columns); + VERIFY(column + m_origin_column <= m_num_columns); VT::move_absolute(line + m_origin_row, column + m_origin_column); if (line + m_origin_row > m_num_lines) { diff --git a/Userland/Libraries/LibLine/Editor.h b/Userland/Libraries/LibLine/Editor.h index 6523d403be..083d3ceb91 100644 --- a/Userland/Libraries/LibLine/Editor.h +++ b/Userland/Libraries/LibLine/Editor.h @@ -331,7 +331,7 @@ private: void restore() { - ASSERT(m_initialized); + VERIFY(m_initialized); tcsetattr(0, TCSANOW, &m_default_termios); m_initialized = false; for (auto id : m_signal_handlers) diff --git a/Userland/Libraries/LibLine/InternalFunctions.cpp b/Userland/Libraries/LibLine/InternalFunctions.cpp index e4e3be3be8..fa8d95da5c 100644 --- a/Userland/Libraries/LibLine/InternalFunctions.cpp +++ b/Userland/Libraries/LibLine/InternalFunctions.cpp @@ -227,7 +227,7 @@ void Editor::enter_search() { if (m_is_searching) { // How did we get here? - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { m_is_searching = true; m_search_offset = 0; @@ -494,7 +494,7 @@ void Editor::case_change_word(Editor::CaseChangeOp change_op) if (change_op == CaseChangeOp::Uppercase || (change_op == CaseChangeOp::Capital && m_cursor == start)) { m_buffer[m_cursor] = toupper(m_buffer[m_cursor]); } else { - ASSERT(change_op == CaseChangeOp::Lowercase || (change_op == CaseChangeOp::Capital && m_cursor > start)); + VERIFY(change_op == CaseChangeOp::Lowercase || (change_op == CaseChangeOp::Capital && m_cursor > start)); m_buffer[m_cursor] = tolower(m_buffer[m_cursor]); } ++m_cursor; diff --git a/Userland/Libraries/LibLine/KeyCallbackMachine.cpp b/Userland/Libraries/LibLine/KeyCallbackMachine.cpp index 742976abad..d7036ebad5 100644 --- a/Userland/Libraries/LibLine/KeyCallbackMachine.cpp +++ b/Userland/Libraries/LibLine/KeyCallbackMachine.cpp @@ -44,7 +44,7 @@ void KeyCallbackMachine::key_pressed(Editor& editor, Key key) dbgln("Key<{}, {}> pressed, seq_length={}, {} things in the matching vector", key.key, key.modifiers, m_sequence_length, m_current_matching_keys.size()); #endif if (m_sequence_length == 0) { - ASSERT(m_current_matching_keys.is_empty()); + VERIFY(m_current_matching_keys.is_empty()); for (auto& it : m_key_callbacks) { if (it.key.first() == key) diff --git a/Userland/Libraries/LibLine/SuggestionManager.cpp b/Userland/Libraries/LibLine/SuggestionManager.cpp index f7c0667e49..8978ac8a6b 100644 --- a/Userland/Libraries/LibLine/SuggestionManager.cpp +++ b/Userland/Libraries/LibLine/SuggestionManager.cpp @@ -53,7 +53,7 @@ void SuggestionManager::set_suggestions(Vector<CompletionSuggestion>&& suggestio // make sure we were not given invalid suggestions for (auto& suggestion : m_suggestions) - ASSERT(suggestion.is_valid); + VERIFY(suggestion.is_valid); size_t common_suggestion_prefix { 0 }; if (m_suggestions.size() == 1) { diff --git a/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp b/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp index 7e341854ee..03b5243416 100644 --- a/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp +++ b/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp @@ -183,7 +183,7 @@ bool XtermSuggestionDisplay::cleanup() size_t XtermSuggestionDisplay::fit_to_page_boundary(size_t selection_index) { - ASSERT(m_pages.size() > 0); + VERIFY(m_pages.size() > 0); size_t index = 0; auto* match = binary_search( diff --git a/Userland/Libraries/LibM/math.cpp b/Userland/Libraries/LibM/math.cpp index 9df74829b1..a17666af81 100644 --- a/Userland/Libraries/LibM/math.cpp +++ b/Userland/Libraries/LibM/math.cpp @@ -552,19 +552,19 @@ long double log2l(long double x) NOEXCEPT double frexp(double, int*) NOEXCEPT { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return 0; } float frexpf(float, int*) NOEXCEPT { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return 0; } long double frexpl(long double, int*) NOEXCEPT { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return 0; } diff --git a/Userland/Libraries/LibMarkdown/Heading.h b/Userland/Libraries/LibMarkdown/Heading.h index 5628f68679..5bb6e7c4b5 100644 --- a/Userland/Libraries/LibMarkdown/Heading.h +++ b/Userland/Libraries/LibMarkdown/Heading.h @@ -40,7 +40,7 @@ public: : m_text(move(text)) , m_level(level) { - ASSERT(m_level > 0); + VERIFY(m_level > 0); } virtual ~Heading() override { } diff --git a/Userland/Libraries/LibMarkdown/List.cpp b/Userland/Libraries/LibMarkdown/List.cpp index d9484cb098..d80503efb1 100644 --- a/Userland/Libraries/LibMarkdown/List.cpp +++ b/Userland/Libraries/LibMarkdown/List.cpp @@ -116,7 +116,7 @@ OwnPtr<List> List::parse(Vector<StringView>::ConstIterator& lines) break; } - ASSERT(!(appears_unordered && appears_ordered)); + VERIFY(!(appears_unordered && appears_ordered)); if (appears_unordered || appears_ordered) { if (first) @@ -142,7 +142,7 @@ OwnPtr<List> List::parse(Vector<StringView>::ConstIterator& lines) first = false; if (!item_builder.is_empty()) item_builder.append(' '); - ASSERT(offset <= line.length()); + VERIFY(offset <= line.length()); item_builder.append(line.substring_view(offset, line.length() - offset)); ++lines; offset = 0; diff --git a/Userland/Libraries/LibMarkdown/Table.cpp b/Userland/Libraries/LibMarkdown/Table.cpp index 065a0a48d9..b70c1f572c 100644 --- a/Userland/Libraries/LibMarkdown/Table.cpp +++ b/Userland/Libraries/LibMarkdown/Table.cpp @@ -67,7 +67,7 @@ String Table::render_for_terminal(size_t view_width) const for (size_t i = 0; i < m_row_count; ++i) { bool first = true; for (auto& col : m_columns) { - ASSERT(i < col.rows.size()); + VERIFY(i < col.rows.size()); auto& cell = col.rows[i]; if (!first) @@ -101,7 +101,7 @@ String Table::render_to_html() const for (size_t i = 0; i < m_row_count; ++i) { builder.append("<tr>"); for (auto& column : m_columns) { - ASSERT(i < column.rows.size()); + VERIFY(i < column.rows.size()); builder.append("<td>"); builder.append(column.rows[i].render_to_html()); builder.append("</td>"); diff --git a/Userland/Libraries/LibMarkdown/Text.cpp b/Userland/Libraries/LibMarkdown/Text.cpp index 1fd83daed9..31631e9678 100644 --- a/Userland/Libraries/LibMarkdown/Text.cpp +++ b/Userland/Libraries/LibMarkdown/Text.cpp @@ -196,7 +196,7 @@ Optional<Text> Text::parse(const StringView& str) Vector<Span> spans; auto append_span_if_needed = [&](size_t offset) { - ASSERT(current_span_start <= offset); + VERIFY(current_span_start <= offset); if (current_span_start != offset) { Span span { unescape(str.substring_view(current_span_start, offset - current_span_start)), @@ -280,7 +280,7 @@ Optional<Text> Text::parse(const StringView& str) break; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // We've processed the character as a special, so the next offset will diff --git a/Userland/Libraries/LibPCIDB/Database.cpp b/Userland/Libraries/LibPCIDB/Database.cpp index bb73c308ea..b8a106d9ea 100644 --- a/Userland/Libraries/LibPCIDB/Database.cpp +++ b/Userland/Libraries/LibPCIDB/Database.cpp @@ -113,14 +113,14 @@ static u8 parse_hex_digit(char digit) { if (digit >= '0' && digit <= '9') return digit - '0'; - ASSERT(digit >= 'a' && digit <= 'f'); + VERIFY(digit >= 'a' && digit <= 'f'); return 10 + (digit - 'a'); } template<typename T> static T parse_hex(StringView str, size_t count) { - ASSERT(str.length() >= count); + VERIFY(str.length() >= count); T res = 0; for (size_t i = 0; i < count; i++) diff --git a/Userland/Libraries/LibProtocol/Download.cpp b/Userland/Libraries/LibProtocol/Download.cpp index 130a237174..6f5b35015e 100644 --- a/Userland/Libraries/LibProtocol/Download.cpp +++ b/Userland/Libraries/LibProtocol/Download.cpp @@ -42,7 +42,7 @@ bool Download::stop() void Download::stream_into(OutputStream& stream) { - ASSERT(!m_internal_stream_data); + VERIFY(!m_internal_stream_data); auto notifier = Core::Notifier::construct(fd(), Core::Notifier::Read); @@ -85,9 +85,9 @@ void Download::set_should_buffer_all_input(bool value) return; } - ASSERT(!m_internal_stream_data); - ASSERT(!m_internal_buffered_data); - ASSERT(on_buffered_download_finish); // Not having this set makes no sense. + VERIFY(!m_internal_stream_data); + VERIFY(!m_internal_buffered_data); + VERIFY(on_buffered_download_finish); // Not having this set makes no sense. m_internal_buffered_data = make<InternalBufferedData>(fd()); m_should_buffer_all_input = true; diff --git a/Userland/Libraries/LibPthread/pthread.cpp b/Userland/Libraries/LibPthread/pthread.cpp index 4b28cde0e4..fa0f9e2ff0 100644 --- a/Userland/Libraries/LibPthread/pthread.cpp +++ b/Userland/Libraries/LibPthread/pthread.cpp @@ -92,7 +92,7 @@ static int create_thread(pthread_t* thread, void* (*entry)(void*), void* argumen push_on_stack(argument); push_on_stack((void*)entry); - ASSERT((uintptr_t)stack % 16 == 0); + VERIFY((uintptr_t)stack % 16 == 0); // Push a fake return address push_on_stack(nullptr); @@ -107,7 +107,7 @@ static int create_thread(pthread_t* thread, void* (*entry)(void*), void* argumen { KeyDestroyer::destroy_for_current_thread(); syscall(SC_exit_thread, code); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int pthread_self() @@ -485,7 +485,7 @@ static int cond_wait(pthread_cond_t* cond, pthread_mutex_t* mutex, const struct int pthread_cond_wait(pthread_cond_t* cond, pthread_mutex_t* mutex) { int rc = cond_wait(cond, mutex, nullptr); - ASSERT(rc == 0); + VERIFY(rc == 0); return 0; } @@ -516,7 +516,7 @@ int pthread_cond_signal(pthread_cond_t* cond) u32 value = cond->previous + 1; cond->value = value; int rc = futex(&cond->value, FUTEX_WAKE, 1, nullptr, nullptr, 0); - ASSERT(rc >= 0); + VERIFY(rc >= 0); return 0; } @@ -525,7 +525,7 @@ int pthread_cond_broadcast(pthread_cond_t* cond) u32 value = cond->previous + 1; cond->value = value; int rc = futex(&cond->value, FUTEX_WAKE, INT32_MAX, nullptr, nullptr, 0); - ASSERT(rc >= 0); + VERIFY(rc >= 0); return 0; } @@ -874,15 +874,15 @@ int pthread_rwlockattr_destroy(pthread_rwlockattr_t*) } int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t* __restrict, int* __restrict) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int pthread_rwlockattr_init(pthread_rwlockattr_t*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int pthread_rwlockattr_setpshared(pthread_rwlockattr_t*, int) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void)) diff --git a/Userland/Libraries/LibPthread/pthread_once.cpp b/Userland/Libraries/LibPthread/pthread_once.cpp index 88acb88f67..6fdf1b5b8e 100644 --- a/Userland/Libraries/LibPthread/pthread_once.cpp +++ b/Userland/Libraries/LibPthread/pthread_once.cpp @@ -59,7 +59,7 @@ int pthread_once(pthread_once_t* self, void (*callback)(void)) switch (state2) { case State::INITIAL: case State::DONE: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case State::PERFORMING_NO_WAITERS: // The fast path: there's no contention, so we don't have to wake // anyone. @@ -77,7 +77,7 @@ int pthread_once(pthread_once_t* self, void (*callback)(void)) while (true) { switch (state2) { case State::INITIAL: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case State::DONE: // Awesome, nothing to do then. return 0; diff --git a/Userland/Libraries/LibRegex/RegexByteCode.cpp b/Userland/Libraries/LibRegex/RegexByteCode.cpp index b996c4b7ca..0987192af7 100644 --- a/Userland/Libraries/LibRegex/RegexByteCode.cpp +++ b/Userland/Libraries/LibRegex/RegexByteCode.cpp @@ -42,7 +42,7 @@ const char* OpCode::name(OpCodeId opcode_id) ENUMERATE_OPCODES #undef __ENUMERATE_OPCODE default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "<Unknown>"; } } @@ -61,7 +61,7 @@ const char* execution_result_name(ExecutionResult result) ENUMERATE_EXECUTION_RESULTS #undef __ENUMERATE_EXECUTION_RESULT default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "<Unknown>"; } } @@ -75,7 +75,7 @@ const char* boundary_check_type_name(BoundaryCheckType ty) ENUMERATE_BOUNDARY_CHECK_TYPES #undef __ENUMERATE_BOUNDARY_CHECK_TYPE default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "<Unknown>"; } } @@ -89,7 +89,7 @@ const char* character_compare_type_name(CharacterCompareType ch_compare_type) ENUMERATE_CHARACTER_COMPARE_TYPES #undef __ENUMERATE_CHARACTER_COMPARE_TYPE default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "<Unknown>"; } } @@ -103,7 +103,7 @@ static const char* character_class_name(CharClass ch_class) ENUMERATE_CHARACTER_CLASSES #undef __ENUMERATE_CHARACTER_CLASS default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "<Unknown>"; } } @@ -222,7 +222,7 @@ ALWAYS_INLINE ExecutionResult OpCode_GoBack::execute(const MatchInput&, MatchSta ALWAYS_INLINE ExecutionResult OpCode_FailForks::execute(const MatchInput& input, MatchState&, MatchOutput&) const { - ASSERT(count() > 0); + VERIFY(count() > 0); input.fail_counter += count() - 1; return ExecutionResult::Failed_ExecuteLowPrioForks; @@ -291,7 +291,7 @@ ALWAYS_INLINE ExecutionResult OpCode_CheckBoundary::execute(const MatchInput& in return ExecutionResult::Failed_ExecuteLowPrioForks; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } ALWAYS_INLINE ExecutionResult OpCode_CheckEnd::execute(const MatchInput& input, MatchState& state, MatchOutput&) const @@ -335,7 +335,7 @@ ALWAYS_INLINE ExecutionResult OpCode_SaveRightCaptureGroup::execute(const MatchI if (start_position < match.column) return ExecutionResult::Continue; - ASSERT(start_position + length <= input.view.length()); + VERIFY(start_position + length <= input.view.length()); auto view = input.view.substring_view(start_position, length); @@ -371,11 +371,11 @@ ALWAYS_INLINE ExecutionResult OpCode_SaveRightNamedCaptureGroup::execute(const M auto& map = output.named_capture_group_matches.at(input.match_index); if constexpr (REGEX_DEBUG) { - ASSERT(start_position + length <= input.view.length()); + VERIFY(start_position + length <= input.view.length()); dbgln("Save named capture group with name={} and content='{}'", capture_group_name, input.view.substring_view(start_position, length)); } - ASSERT(start_position + length <= input.view.length()); + VERIFY(start_position + length <= input.view.length()); auto view = input.view.substring_view(start_position, length); if (input.regex_options & AllFlags::StringCopyMatches) { map.set(capture_group_name, { view.to_string(), input.line, start_position, input.global_offset + start_position }); // create a copy of the original string @@ -420,7 +420,7 @@ ALWAYS_INLINE ExecutionResult OpCode_Compare::execute(const MatchInput& input, M else if (compare_type == CharacterCompareType::TemporaryInverse) { // If "TemporaryInverse" is given, negate the current inversion state only for the next opcode. // it follows that this cannot be the last compare element. - ASSERT(i != arguments_count() - 1); + VERIFY(i != arguments_count() - 1); temporary_inverse = true; reset_temp_inverse = false; @@ -439,11 +439,11 @@ ALWAYS_INLINE ExecutionResult OpCode_Compare::execute(const MatchInput& input, M if (input.view.length() - state.string_position < 1) return ExecutionResult::Failed_ExecuteLowPrioForks; - ASSERT(!current_inversion_state()); + VERIFY(!current_inversion_state()); ++state.string_position; } else if (compare_type == CharacterCompareType::String) { - ASSERT(!current_inversion_state()); + VERIFY(!current_inversion_state()); const auto& length = m_bytecode->at(offset++); StringBuilder str_builder; @@ -511,7 +511,7 @@ ALWAYS_INLINE ExecutionResult OpCode_Compare::execute(const MatchInput& input, M } else { fprintf(stderr, "Undefined comparison: %i\n", (int)compare_type); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } diff --git a/Userland/Libraries/LibRegex/RegexByteCode.h b/Userland/Libraries/LibRegex/RegexByteCode.h index f9a69c6d73..1909e36a91 100644 --- a/Userland/Libraries/LibRegex/RegexByteCode.h +++ b/Userland/Libraries/LibRegex/RegexByteCode.h @@ -161,10 +161,10 @@ public: ByteCode arguments; for (auto& value : pairs) { - ASSERT(value.type != CharacterCompareType::RangeExpressionDummy); - ASSERT(value.type != CharacterCompareType::Undefined); - ASSERT(value.type != CharacterCompareType::String); - ASSERT(value.type != CharacterCompareType::NamedReference); + VERIFY(value.type != CharacterCompareType::RangeExpressionDummy); + VERIFY(value.type != CharacterCompareType::Undefined); + VERIFY(value.type != CharacterCompareType::String); + VERIFY(value.type != CharacterCompareType::NamedReference); arguments.append((ByteCodeValueType)value.type); if (value.type != CharacterCompareType::Inverse && value.type != CharacterCompareType::AnyChar && value.type != CharacterCompareType::TemporaryInverse) @@ -327,7 +327,7 @@ public: } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void insert_bytecode_alternation(ByteCode&& left, ByteCode&& right) @@ -503,7 +503,7 @@ public: ALWAYS_INLINE ByteCodeValueType argument(size_t offset) const { - ASSERT(state().instruction_position + offset <= m_bytecode->size()); + VERIFY(state().instruction_position + offset <= m_bytecode->size()); return m_bytecode->at(state().instruction_position + 1 + offset); } @@ -526,7 +526,7 @@ public: ALWAYS_INLINE const MatchState& state() const { - ASSERT(m_state.has_value()); + VERIFY(m_state.has_value()); return *m_state.value(); } @@ -809,28 +809,28 @@ ALWAYS_INLINE bool is<OpCode_Compare>(const OpCode& opcode) template<typename T> ALWAYS_INLINE const T& to(const OpCode& opcode) { - ASSERT(is<T>(opcode)); + VERIFY(is<T>(opcode)); return static_cast<const T&>(opcode); } template<typename T> ALWAYS_INLINE T* to(OpCode* opcode) { - ASSERT(is<T>(opcode)); + VERIFY(is<T>(opcode)); return static_cast<T*>(opcode); } template<typename T> ALWAYS_INLINE const T* to(const OpCode* opcode) { - ASSERT(is<T>(opcode)); + VERIFY(is<T>(opcode)); return static_cast<const T*>(opcode); } template<typename T> ALWAYS_INLINE T& to(OpCode& opcode) { - ASSERT(is<T>(opcode)); + VERIFY(is<T>(opcode)); return static_cast<T&>(opcode); } diff --git a/Userland/Libraries/LibRegex/RegexLexer.cpp b/Userland/Libraries/LibRegex/RegexLexer.cpp index e61708a4c4..c7bd1194c5 100644 --- a/Userland/Libraries/LibRegex/RegexLexer.cpp +++ b/Userland/Libraries/LibRegex/RegexLexer.cpp @@ -41,7 +41,7 @@ const char* Token::name(const TokenType type) ENUMERATE_REGEX_TOKENS #undef __ENUMERATE_REGEX_TOKEN default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "<Unknown>"; } } @@ -68,7 +68,7 @@ void Lexer::back(size_t offset) if (offset == m_position + 1) offset = m_position; // 'position == 0' occurs twice. - ASSERT(offset <= m_position); + VERIFY(offset <= m_position); if (!offset) return; m_position -= offset; @@ -122,7 +122,7 @@ Token Lexer::next() }; auto commit_token = [&](auto type) -> Token& { - ASSERT(token_start_position + m_previous_position - token_start_position + 1 <= m_source.length()); + VERIFY(token_start_position + m_previous_position - token_start_position + 1 <= m_source.length()); auto substring = m_source.substring_view(token_start_position, m_previous_position - token_start_position + 1); m_current_token = Token(type, token_start_position, substring); return m_current_token; diff --git a/Userland/Libraries/LibRegex/RegexMatch.h b/Userland/Libraries/LibRegex/RegexMatch.h index d688dcab0f..73b332ac3e 100644 --- a/Userland/Libraries/LibRegex/RegexMatch.h +++ b/Userland/Libraries/LibRegex/RegexMatch.h @@ -64,13 +64,13 @@ public: const StringView& u8view() const { - ASSERT(m_u8view.has_value()); + VERIFY(m_u8view.has_value()); return m_u8view.value(); }; const Utf32View& u32view() const { - ASSERT(m_u32view.has_value()); + VERIFY(m_u32view.has_value()); return m_u32view.value(); }; diff --git a/Userland/Libraries/LibRegex/RegexMatcher.cpp b/Userland/Libraries/LibRegex/RegexMatcher.cpp index 7d6f6d8e92..970db6bf1c 100644 --- a/Userland/Libraries/LibRegex/RegexMatcher.cpp +++ b/Userland/Libraries/LibRegex/RegexMatcher.cpp @@ -104,7 +104,7 @@ RegexResult Matcher<Parser>::match(const Vector<RegexStringView> views, Optional output.operations = 0; if (input.regex_options.has_flag_set(AllFlags::Internal_Stateful)) - ASSERT(views.size() == 1); + VERIFY(views.size() == 1); if (c_match_preallocation_count) { output.matches.ensure_capacity(c_match_preallocation_count); @@ -130,7 +130,7 @@ RegexResult Matcher<Parser>::match(const Vector<RegexStringView> views, Optional if (output.matches.size() == input.match_index) output.matches.empend(); - ASSERT(start_position + state.string_position - start_position <= input.view.length()); + VERIFY(start_position + state.string_position - start_position <= input.view.length()); if (input.regex_options.has_flag_set(AllFlags::StringCopyMatches)) { output.matches.at(input.match_index) = { input.view.substring_view(start_position, state.string_position - start_position).to_string(), input.line, start_position, input.global_offset + start_position }; } else { // let the view point to the original string ... @@ -360,7 +360,7 @@ Optional<bool> Matcher<Parser>::execute(const MatchInput& input, MatchState& sta } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } template<class Parser> diff --git a/Userland/Libraries/LibRegex/RegexParser.cpp b/Userland/Libraries/LibRegex/RegexParser.cpp index 6ed5e2e217..eacc306975 100644 --- a/Userland/Libraries/LibRegex/RegexParser.cpp +++ b/Userland/Libraries/LibRegex/RegexParser.cpp @@ -313,7 +313,7 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_bracket_expression(ByteCode& stack // FIXME: Parse collating element, this is needed when we have locale support // This could have impact on length parameter, I guess. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); consume(TokenType::Period, Error::InvalidCollationElement); consume(TokenType::RightBracket, Error::MismatchingBracket); @@ -322,7 +322,7 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_bracket_expression(ByteCode& stack consume(); // FIXME: Parse collating element, this is needed when we have locale support // This could have impact on length parameter, I guess. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); consume(TokenType::EqualSign, Error::InvalidCollationElement); consume(TokenType::RightBracket, Error::MismatchingBracket); @@ -529,16 +529,16 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_sub_expression(ByteCode& stack, si } else if (match(TokenType::EqualSign)) { // positive lookahead consume(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else if (consume("!")) { // negative lookahead - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else if (consume("<")) { if (match(TokenType::EqualSign)) { // positive lookbehind consume(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (consume("!")) // negative lookbehind - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { return set_error(Error::InvalidRepetitionMarker); } @@ -926,7 +926,7 @@ bool ECMA262Parser::parse_quantifier(ByteCode& stack, size_t& match_length_minim match_length_minimum *= repeat_min.value(); break; case Repetition::None: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return true; @@ -1370,8 +1370,8 @@ bool ECMA262Parser::parse_nonempty_class_ranges(Vector<CompareTypeAndValuePair>& return false; } - ASSERT(!first_atom.value().is_negated); - ASSERT(!second_atom.value().is_negated); + VERIFY(!first_atom.value().is_negated); + VERIFY(!second_atom.value().is_negated); ranges.empend(CompareTypeAndValuePair { CharacterCompareType::CharRange, CharRange { first_atom.value().code_point, second_atom.value().code_point } }); continue; @@ -1386,7 +1386,7 @@ bool ECMA262Parser::parse_nonempty_class_ranges(Vector<CompareTypeAndValuePair>& ranges.empend(CompareTypeAndValuePair { CharacterCompareType::TemporaryInverse, 0 }); ranges.empend(CompareTypeAndValuePair { CharacterCompareType::CharClass, (ByteCodeValueType)first_atom.value().character_class }); } else { - ASSERT(!atom.is_negated); + VERIFY(!atom.is_negated); ranges.empend(CompareTypeAndValuePair { CharacterCompareType::Char, first_atom.value().code_point }); } } diff --git a/Userland/Libraries/LibRegex/Tests/Benchmark.cpp b/Userland/Libraries/LibRegex/Tests/Benchmark.cpp index 0a25ee1847..a17794a7e3 100644 --- a/Userland/Libraries/LibRegex/Tests/Benchmark.cpp +++ b/Userland/Libraries/LibRegex/Tests/Benchmark.cpp @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <AK/TestSuite.h> // import first, to prevent warning of ASSERT* redefinition +#include <AK/TestSuite.h> // import first, to prevent warning of VERIFY* redefinition #include <LibRegex/Regex.h> #include <stdio.h> diff --git a/Userland/Libraries/LibRegex/Tests/Regex.cpp b/Userland/Libraries/LibRegex/Tests/Regex.cpp index ffd585e8d3..93bab8d705 100644 --- a/Userland/Libraries/LibRegex/Tests/Regex.cpp +++ b/Userland/Libraries/LibRegex/Tests/Regex.cpp @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <AK/TestSuite.h> // import first, to prevent warning of ASSERT* redefinition +#include <AK/TestSuite.h> // import first, to prevent warning of VERIFY* redefinition #include <AK/StringBuilder.h> #include <LibRegex/Regex.h> diff --git a/Userland/Libraries/LibSyntax/Highlighter.cpp b/Userland/Libraries/LibSyntax/Highlighter.cpp index c1463e6537..0fe7706a0f 100644 --- a/Userland/Libraries/LibSyntax/Highlighter.cpp +++ b/Userland/Libraries/LibSyntax/Highlighter.cpp @@ -127,7 +127,7 @@ void Highlighter::highlight_matching_token_pair() void Highlighter::attach(HighlighterClient& client) { - ASSERT(!m_client); + VERIFY(!m_client); m_client = &client; } diff --git a/Userland/Libraries/LibTLS/ClientHandshake.cpp b/Userland/Libraries/LibTLS/ClientHandshake.cpp index 39f2193a8e..6051291880 100644 --- a/Userland/Libraries/LibTLS/ClientHandshake.cpp +++ b/Userland/Libraries/LibTLS/ClientHandshake.cpp @@ -348,7 +348,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) case ClientHello: // FIXME: We only support client mode right now if (m_context.is_server) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } payload_res = (i8)Error::UnexpectedMessage; break; @@ -364,7 +364,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) #endif if (m_context.is_server) { dbgln("unsupported: server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { payload_res = handle_hello(buffer.slice(1, payload_size), write_packets); } @@ -386,7 +386,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) if (m_context.connection_status == ConnectionStatus::Negotiating) { if (m_context.is_server) { dbgln("unsupported: server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } payload_res = handle_certificate(buffer.slice(1, payload_size)); if (m_context.certificates.size()) { @@ -420,7 +420,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) #endif if (m_context.is_server) { dbgln("unsupported: server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { payload_res = handle_server_key_exchange(buffer.slice(1, payload_size)); } @@ -435,7 +435,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) if (m_context.is_server) { dbgln("invalid request"); dbgln("unsupported: server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { // we do not support "certificate request" dbgln("certificate request"); @@ -456,7 +456,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) #endif if (m_context.is_server) { dbgln("unsupported: server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { payload_res = handle_server_hello_done(buffer.slice(1, payload_size)); if (payload_res > 0) @@ -491,7 +491,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) #endif if (m_context.is_server) { dbgln("unsupported: server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { payload_res = (i8)Error::UnexpectedMessage; } @@ -581,7 +581,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) break; default: dbgln("Unknown TLS::Error with value {}", payload_res); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } if (payload_res < 0) @@ -628,7 +628,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) case WritePacketStage::ServerHandshake: // server handshake dbgln("UNSUPPORTED: Server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; case WritePacketStage::Finished: // finished diff --git a/Userland/Libraries/LibTLS/Exchange.cpp b/Userland/Libraries/LibTLS/Exchange.cpp index 9f3ea55eb9..26f71e2697 100644 --- a/Userland/Libraries/LibTLS/Exchange.cpp +++ b/Userland/Libraries/LibTLS/Exchange.cpp @@ -189,7 +189,7 @@ ByteBuffer TLSv12::build_certificate() if (m_context.is_server) { dbgln("Unsupported: Server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { local_certificates = &m_context.client_certificates; } diff --git a/Userland/Libraries/LibTLS/Handshake.cpp b/Userland/Libraries/LibTLS/Handshake.cpp index 1fa0f01fca..88395b4e27 100644 --- a/Userland/Libraries/LibTLS/Handshake.cpp +++ b/Userland/Libraries/LibTLS/Handshake.cpp @@ -110,7 +110,7 @@ ByteBuffer TLSv12::build_hello() if (alpn_length) { // TODO - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // set the "length" field of the packet diff --git a/Userland/Libraries/LibTLS/Record.cpp b/Userland/Libraries/LibTLS/Record.cpp index 4bdf6f0e9b..f9822dc377 100644 --- a/Userland/Libraries/LibTLS/Record.cpp +++ b/Userland/Libraries/LibTLS/Record.cpp @@ -117,7 +117,7 @@ void TLSv12::update_packet(ByteBuffer& packet) aad_stream.write({ &seq_no, sizeof(seq_no) }); aad_stream.write(packet.bytes().slice(0, 3)); // content-type + version aad_stream.write({ &len, sizeof(len) }); // length - ASSERT(aad_stream.is_end()); + VERIFY(aad_stream.is_end()); // AEAD IV (12) // IV (4) @@ -141,7 +141,7 @@ void TLSv12::update_packet(ByteBuffer& packet) aad_bytes, ct.bytes().slice(header_size + 8 + length, 16)); - ASSERT(header_size + 8 + length + 16 == ct.size()); + VERIFY(header_size + 8 + length + 16 == ct.size()); } else { // We need enough space for a header, iv_length bytes of IV and whatever the packet contains @@ -161,7 +161,7 @@ void TLSv12::update_packet(ByteBuffer& packet) memset(buffer.offset_pointer(buffer_position), padding - 1, padding); buffer_position += padding; - ASSERT(buffer_position == buffer.size()); + VERIFY(buffer_position == buffer.size()); auto iv = ByteBuffer::create_uninitialized(iv_size); AK::fill_with_random(iv.data(), iv.size()); @@ -169,8 +169,8 @@ void TLSv12::update_packet(ByteBuffer& packet) // write it into the ciphertext portion of the message ct.overwrite(header_size, iv.data(), iv.size()); - ASSERT(header_size + iv_size + length == ct.size()); - ASSERT(length % block_size == 0); + VERIFY(header_size + iv_size + length == ct.size()); + VERIFY(length % block_size == 0); // get a block to encrypt into auto view = ct.bytes().slice(header_size + iv_size, length); @@ -269,7 +269,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) } if (is_aead()) { - ASSERT(m_aes_remote.gcm); + VERIFY(m_aes_remote.gcm); if (length < 24) { dbgln("Invalid packet length"); @@ -297,7 +297,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) aad_stream.write({ &seq_no, sizeof(seq_no) }); // Sequence number aad_stream.write(buffer.slice(0, header_size - 2)); // content-type + version aad_stream.write({ &len, sizeof(u16) }); - ASSERT(aad_stream.is_end()); + VERIFY(aad_stream.is_end()); auto nonce = payload.slice(0, iv_length()); payload = payload.slice(iv_length()); @@ -333,7 +333,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) plain = decrypted; } else { - ASSERT(m_aes_remote.cbc); + VERIFY(m_aes_remote.cbc); auto iv_size = iv_length(); decrypted = m_aes_remote.cbc->create_aligned_buffer(length - iv_size); diff --git a/Userland/Libraries/LibTLS/Socket.cpp b/Userland/Libraries/LibTLS/Socket.cpp index 3022b5e17d..3e8b712eaa 100644 --- a/Userland/Libraries/LibTLS/Socket.cpp +++ b/Userland/Libraries/LibTLS/Socket.cpp @@ -61,7 +61,7 @@ String TLSv12::read_line(size_t max_size) auto* start = m_context.application_buffer.data(); auto* newline = (u8*)memchr(m_context.application_buffer.data(), '\n', m_context.application_buffer.size()); - ASSERT(newline); + VERIFY(newline); size_t offset = newline - start; @@ -106,7 +106,7 @@ bool TLSv12::common_connect(const struct sockaddr* saddr, socklen_t length) if (Core::Socket::is_connected()) { if (is_established()) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { Core::Socket::close(); // reuse? } diff --git a/Userland/Libraries/LibTLS/TLSPacketBuilder.h b/Userland/Libraries/LibTLS/TLSPacketBuilder.h index 2994ed27ab..98c3fcf2d9 100644 --- a/Userland/Libraries/LibTLS/TLSPacketBuilder.h +++ b/Userland/Libraries/LibTLS/TLSPacketBuilder.h @@ -107,7 +107,7 @@ public: } inline void set(size_t offset, u8 value) { - ASSERT(offset < m_current_length); + VERIFY(offset < m_current_length); m_packet_data[offset] = value; } size_t length() const { return m_current_length; } diff --git a/Userland/Libraries/LibTTF/Cmap.cpp b/Userland/Libraries/LibTTF/Cmap.cpp index ce651e5385..5a4993fbaf 100644 --- a/Userland/Libraries/LibTTF/Cmap.cpp +++ b/Userland/Libraries/LibTTF/Cmap.cpp @@ -45,7 +45,7 @@ Cmap::Subtable::Platform Cmap::Subtable::platform_id() const case 4: return Platform::Custom; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -71,7 +71,7 @@ Cmap::Subtable::Format Cmap::Subtable::format() const case 14: return Format::UnicodeVariationSequences; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -89,7 +89,7 @@ Optional<Cmap::Subtable> Cmap::subtable(u32 index) const u16 platform_id = be_u16(m_slice.offset_pointer(record_offset)); u16 encoding_id = be_u16(m_slice.offset_pointer(record_offset + (u32)Offsets::EncodingRecord_EncodingID)); u32 subtable_offset = be_u32(m_slice.offset_pointer(record_offset + (u32)Offsets::EncodingRecord_Offset)); - ASSERT(subtable_offset < m_slice.size()); + VERIFY(subtable_offset < m_slice.size()); auto subtable_slice = ReadonlyBytes(m_slice.offset_pointer(subtable_offset), m_slice.size() - subtable_offset); return Subtable(subtable_slice, platform_id, encoding_id); } @@ -128,7 +128,7 @@ u32 Cmap::Subtable::glyph_id_for_codepoint_table_4(u32 codepoint) const return (codepoint + delta) & 0xffff; } u32 glyph_offset = (u32)Table4Offsets::GlyphOffsetConstBase + segcount_x2 * 3 + offset + range + (codepoint - start_codepoint) * 2; - ASSERT(glyph_offset + 2 <= m_slice.size()); + VERIFY(glyph_offset + 2 <= m_slice.size()); return (be_u16(m_slice.offset_pointer(glyph_offset)) + delta) & 0xffff; } return 0; @@ -137,7 +137,7 @@ u32 Cmap::Subtable::glyph_id_for_codepoint_table_4(u32 codepoint) const u32 Cmap::Subtable::glyph_id_for_codepoint_table_12(u32 codepoint) const { u32 num_groups = be_u32(m_slice.offset_pointer((u32)Table12Offsets::NumGroups)); - ASSERT(m_slice.size() >= (u32)Table12Sizes::Header + (u32)Table12Sizes::Record * num_groups); + VERIFY(m_slice.size() >= (u32)Table12Sizes::Header + (u32)Table12Sizes::Record * num_groups); for (u32 offset = 0; offset < num_groups * (u32)Table12Sizes::Record; offset += (u32)Table12Sizes::Record) { u32 start_codepoint = be_u32(m_slice.offset_pointer((u32)Table12Offsets::Record_StartCode + offset)); if (codepoint < start_codepoint) { diff --git a/Userland/Libraries/LibTTF/Font.cpp b/Userland/Libraries/LibTTF/Font.cpp index be649dc171..03c6c92cdd 100644 --- a/Userland/Libraries/LibTTF/Font.cpp +++ b/Userland/Libraries/LibTTF/Font.cpp @@ -117,7 +117,7 @@ IndexToLocFormat Head::index_to_loc_format() const case 1: return IndexToLocFormat::Offset32; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -207,7 +207,7 @@ String Name::string_for_id(NameId id) const GlyphHorizontalMetrics Hmtx::get_glyph_horizontal_metrics(u32 glyph_id) const { - ASSERT(glyph_id < m_num_glyphs); + VERIFY(glyph_id < m_num_glyphs); if (glyph_id < m_number_of_h_metrics) { auto offset = glyph_id * (u32)Sizes::LongHorMetric; u16 advance_width = be_u16(m_slice.offset_pointer(offset)); diff --git a/Userland/Libraries/LibTTF/Glyf.cpp b/Userland/Libraries/LibTTF/Glyf.cpp index 7ad25cd4e1..bf3c01177e 100644 --- a/Userland/Libraries/LibTTF/Glyf.cpp +++ b/Userland/Libraries/LibTTF/Glyf.cpp @@ -273,8 +273,8 @@ void Rasterizer::draw_line(Gfx::FloatPoint p0, Gfx::FloatPoint p1) return; } - ASSERT(p0.x() >= 0.0 && p0.y() >= 0.0 && p0.x() <= m_size.width() && p0.y() <= m_size.height()); - ASSERT(p1.x() >= 0.0 && p1.y() >= 0.0 && p1.x() <= m_size.width() && p1.y() <= m_size.height()); + VERIFY(p0.x() >= 0.0 && p0.y() >= 0.0 && p0.x() <= m_size.width() && p0.y() <= m_size.height()); + VERIFY(p1.x() >= 0.0 && p1.y() >= 0.0 && p1.x() <= m_size.width() && p1.y() <= m_size.height()); // If we're on the same Y, there's no need to draw if (p0.y() == p1.y()) { @@ -356,14 +356,14 @@ Optional<Loca> Loca::from_slice(const ReadonlyBytes& slice, u32 num_glyphs, Inde u32 Loca::get_glyph_offset(u32 glyph_id) const { - ASSERT(glyph_id < m_num_glyphs); + VERIFY(glyph_id < m_num_glyphs); switch (m_index_to_loc_format) { case IndexToLocFormat::Offset16: return ((u32)be_u16(m_slice.offset_pointer(glyph_id * 2))) * 2; case IndexToLocFormat::Offset32: return be_u32(m_slice.offset_pointer(glyph_id * 4)); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -428,7 +428,7 @@ void Glyf::Glyph::raster_inner(Rasterizer& rasterizer, Gfx::AffineTransform& aff contour_size = current_contour_end - last_contour_end; last_contour_end = current_contour_end; auto opt_item = point_iterator.next(); - ASSERT(opt_item.has_value()); + VERIFY(opt_item.has_value()); contour_start = opt_item.value().point; path.move_to(contour_start.value()); contour_size--; @@ -506,7 +506,7 @@ RefPtr<Gfx::Bitmap> Glyf::Glyph::raster_simple(float x_scale, float y_scale) con Glyf::Glyph Glyf::glyph(u32 offset) const { - ASSERT(m_slice.size() >= offset + (u32)Sizes::GlyphHeader); + VERIFY(m_slice.size() >= offset + (u32)Sizes::GlyphHeader); i16 num_contours = be_i16(m_slice.offset_pointer(offset)); i16 xmin = be_i16(m_slice.offset_pointer(offset + (u32)Offsets::XMin)); i16 ymin = be_i16(m_slice.offset_pointer(offset + (u32)Offsets::YMin)); diff --git a/Userland/Libraries/LibTTF/Glyf.h b/Userland/Libraries/LibTTF/Glyf.h index c7beb43644..2568001afd 100644 --- a/Userland/Libraries/LibTTF/Glyf.h +++ b/Userland/Libraries/LibTTF/Glyf.h @@ -91,7 +91,7 @@ public: case Type::Composite: return raster_composite(x_scale, y_scale, glyph_callback); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int ascender() const { return m_ymax; } int descender() const { return m_ymin; } diff --git a/Userland/Libraries/LibTar/Tar.h b/Userland/Libraries/LibTar/Tar.h index 70f1764344..3ca46b3ca2 100644 --- a/Userland/Libraries/LibTar/Tar.h +++ b/Userland/Libraries/LibTar/Tar.h @@ -97,7 +97,7 @@ size_t Header::get_tar_field(const char (&field)[N]) if (field[i] == 0) break; - ASSERT(field[i] >= '0' && field[i] <= '7'); + VERIFY(field[i] >= '0' && field[i] <= '7'); value *= 8; value += field[i] - '0'; } diff --git a/Userland/Libraries/LibTar/TarStream.cpp b/Userland/Libraries/LibTar/TarStream.cpp index 533a01e932..30654dc607 100644 --- a/Userland/Libraries/LibTar/TarStream.cpp +++ b/Userland/Libraries/LibTar/TarStream.cpp @@ -37,7 +37,7 @@ TarFileStream::TarFileStream(TarStream& tar_stream) size_t TarFileStream::read(Bytes bytes) { // verify that the stream has not advanced - ASSERT(m_tar_stream.m_generation == m_generation); + VERIFY(m_tar_stream.m_generation == m_generation); if (has_any_error()) return 0; @@ -52,7 +52,7 @@ size_t TarFileStream::read(Bytes bytes) bool TarFileStream::unreliable_eof() const { // verify that the stream has not advanced - ASSERT(m_tar_stream.m_generation == m_generation); + VERIFY(m_tar_stream.m_generation == m_generation); return m_tar_stream.m_stream.unreliable_eof() || m_tar_stream.m_file_offset >= m_tar_stream.header().size(); @@ -61,7 +61,7 @@ bool TarFileStream::unreliable_eof() const bool TarFileStream::read_or_error(Bytes bytes) { // verify that the stream has not advanced - ASSERT(m_tar_stream.m_generation == m_generation); + VERIFY(m_tar_stream.m_generation == m_generation); if (read(bytes) < bytes.size()) { set_fatal_error(); @@ -74,7 +74,7 @@ bool TarFileStream::read_or_error(Bytes bytes) bool TarFileStream::discard_or_error(size_t count) { // verify that the stream has not advanced - ASSERT(m_tar_stream.m_generation == m_generation); + VERIFY(m_tar_stream.m_generation == m_generation); if (count > m_tar_stream.header().size() - m_tar_stream.m_file_offset) { return false; @@ -90,7 +90,7 @@ TarStream::TarStream(InputStream& stream) m_finished = true; return; } - ASSERT(m_stream.discard_or_error(block_size - sizeof(Header))); + VERIFY(m_stream.discard_or_error(block_size - sizeof(Header))); } static constexpr unsigned long block_ceiling(unsigned long offset) @@ -104,7 +104,7 @@ void TarStream::advance() return; m_generation++; - ASSERT(m_stream.discard_or_error(block_ceiling(m_header.size()) - m_file_offset)); + VERIFY(m_stream.discard_or_error(block_ceiling(m_header.size()) - m_file_offset)); m_file_offset = 0; if (!m_stream.read_or_error(Bytes(&m_header, sizeof(m_header)))) { @@ -116,7 +116,7 @@ void TarStream::advance() return; } - ASSERT(m_stream.discard_or_error(block_size - sizeof(Header))); + VERIFY(m_stream.discard_or_error(block_size - sizeof(Header))); } bool TarStream::valid() const @@ -126,7 +126,7 @@ bool TarStream::valid() const TarFileStream TarStream::file_contents() { - ASSERT(!m_finished); + VERIFY(!m_finished); return TarFileStream(*this); } diff --git a/Userland/Libraries/LibThread/BackgroundAction.cpp b/Userland/Libraries/LibThread/BackgroundAction.cpp index a2880dfb3f..6bf7d561ba 100644 --- a/Userland/Libraries/LibThread/BackgroundAction.cpp +++ b/Userland/Libraries/LibThread/BackgroundAction.cpp @@ -48,7 +48,7 @@ static int background_thread_func() sleep(1); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static void init() diff --git a/Userland/Libraries/LibThread/Lock.h b/Userland/Libraries/LibThread/Lock.h index 7ab63162c7..5d92c7c304 100644 --- a/Userland/Libraries/LibThread/Lock.h +++ b/Userland/Libraries/LibThread/Lock.h @@ -82,8 +82,8 @@ ALWAYS_INLINE void Lock::lock() inline void Lock::unlock() { - ASSERT(m_holder == gettid()); - ASSERT(m_level); + VERIFY(m_holder == gettid()); + VERIFY(m_level); if (m_level == 1) m_holder.store(0, AK::memory_order_release); else diff --git a/Userland/Libraries/LibThread/Thread.cpp b/Userland/Libraries/LibThread/Thread.cpp index 7d8fea4af4..4179604647 100644 --- a/Userland/Libraries/LibThread/Thread.cpp +++ b/Userland/Libraries/LibThread/Thread.cpp @@ -59,10 +59,10 @@ void LibThread::Thread::start() }, static_cast<void*>(this)); - ASSERT(rc == 0); + VERIFY(rc == 0); if (!m_thread_name.is_empty()) { rc = pthread_setname_np(m_tid, m_thread_name.characters()); - ASSERT(rc == 0); + VERIFY(rc == 0); } dbgln("Started thread \"{}\", tid = {}", m_thread_name, m_tid); } diff --git a/Userland/Libraries/LibVT/Line.cpp b/Userland/Libraries/LibVT/Line.cpp index 56f776e9cb..6818220e62 100644 --- a/Userland/Libraries/LibVT/Line.cpp +++ b/Userland/Libraries/LibVT/Line.cpp @@ -114,7 +114,7 @@ bool Line::has_only_one_background_color() const void Line::convert_to_utf32() { - ASSERT(!m_utf32); + VERIFY(!m_utf32); auto* new_code_points = new u32[m_length]; for (size_t i = 0; i < m_length; ++i) { new_code_points[i] = m_code_points.as_u8[i]; diff --git a/Userland/Libraries/LibVT/Terminal.cpp b/Userland/Libraries/LibVT/Terminal.cpp index 6a25ccccfb..6d61c1853f 100644 --- a/Userland/Libraries/LibVT/Terminal.cpp +++ b/Userland/Libraries/LibVT/Terminal.cpp @@ -744,8 +744,8 @@ void Terminal::set_cursor(unsigned a_row, unsigned a_column) unsigned column = min(a_column, m_columns - 1u); if (row == m_cursor_row && column == m_cursor_column) return; - ASSERT(row < rows()); - ASSERT(column < columns()); + VERIFY(row < rows()); + VERIFY(column < columns()); invalidate_cursor(); m_cursor_row = row; m_cursor_column = column; @@ -755,8 +755,8 @@ void Terminal::set_cursor(unsigned a_row, unsigned a_column) void Terminal::put_character_at(unsigned row, unsigned column, u32 code_point) { - ASSERT(row < rows()); - ASSERT(column < columns()); + VERIFY(row < rows()); + VERIFY(column < columns()); auto& line = m_lines[row]; line.set_code_point(column, code_point); line.attributes()[column] = m_current_attribute; diff --git a/Userland/Libraries/LibVT/Terminal.h b/Userland/Libraries/LibVT/Terminal.h index a1e383d109..50090f7dfa 100644 --- a/Userland/Libraries/LibVT/Terminal.h +++ b/Userland/Libraries/LibVT/Terminal.h @@ -244,7 +244,7 @@ private: return; if (m_history.size() < max_history_size()) { - ASSERT(m_history_start == 0); + VERIFY(m_history_start == 0); m_history.append(move(line)); return; } diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index b315d4185b..ba17011f98 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -590,7 +590,7 @@ VT::Position TerminalWidget::buffer_position_at(const Gfx::IntPoint& position) c u32 TerminalWidget::code_point_at(const VT::Position& position) const { - ASSERT(position.row() >= 0 && static_cast<size_t>(position.row()) < m_terminal.line_count()); + VERIFY(position.row() >= 0 && static_cast<size_t>(position.row()) < m_terminal.line_count()); auto& line = m_terminal.line(position.row()); if (position.column() == line.length()) return '\n'; @@ -599,7 +599,7 @@ u32 TerminalWidget::code_point_at(const VT::Position& position) const VT::Position TerminalWidget::next_position_after(const VT::Position& position, bool should_wrap) const { - ASSERT(position.row() >= 0 && static_cast<size_t>(position.row()) < m_terminal.line_count()); + VERIFY(position.row() >= 0 && static_cast<size_t>(position.row()) < m_terminal.line_count()); auto& line = m_terminal.line(position.row()); if (position.column() == line.length()) { if (static_cast<size_t>(position.row()) == m_terminal.line_count() - 1) { @@ -614,7 +614,7 @@ VT::Position TerminalWidget::next_position_after(const VT::Position& position, b VT::Position TerminalWidget::previous_position_before(const VT::Position& position, bool should_wrap) const { - ASSERT(position.row() >= 0 && static_cast<size_t>(position.row()) < m_terminal.line_count()); + VERIFY(position.row() >= 0 && static_cast<size_t>(position.row()) < m_terminal.line_count()); if (position.column() == 0) { if (position.row() == 0) { if (should_wrap) { @@ -747,7 +747,7 @@ void TerminalWidget::paste() int nwritten = write(m_ptm_fd, text.data(), text.size()); if (nwritten < 0) { perror("write"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp index 2abd1f54f2..1a7bfb2719 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp @@ -110,7 +110,7 @@ static DOM::Window* impl_from(JS::VM& vm, JS::GlobalObject& global_object) { auto* this_object = vm.this_value(global_object).to_object(global_object); if (!this_object) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return nullptr; } if (StringView("WindowObject") != this_object->class_name()) { @@ -317,7 +317,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::atob) // decode_base64() returns a byte string. LibJS uses UTF-8 for strings. Use Latin1Decoder to convert bytes 128-255 to UTF-8. auto decoder = TextCodec::decoder_for("windows-1252"); - ASSERT(decoder); + VERIFY(decoder); return JS::js_string(vm, decoder->to_utf8(decoded)); } diff --git a/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp b/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp index b257a378a6..13d3f662fd 100644 --- a/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp +++ b/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp @@ -36,7 +36,7 @@ Wrappable::~Wrappable() void Wrappable::set_wrapper(Wrapper& wrapper) { - ASSERT(!m_wrapper); + VERIFY(!m_wrapper); m_wrapper = wrapper.make_weak_ptr(); } diff --git a/Userland/Libraries/LibWeb/CSS/Length.cpp b/Userland/Libraries/LibWeb/CSS/Length.cpp index 08b2ca500f..a2a55c81ba 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.cpp +++ b/Userland/Libraries/LibWeb/CSS/Length.cpp @@ -55,7 +55,7 @@ float Length::relative_length_to_px(const Layout::Node& layout_node) const return max(viewport.width(), viewport.height()) * (m_value / 100); } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -97,7 +97,7 @@ const char* Length::unit_name() const case Type::Vmin: return "vmin"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibWeb/CSS/Length.h b/Userland/Libraries/LibWeb/CSS/Length.h index bce76a059c..78ee24f5de 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.h +++ b/Userland/Libraries/LibWeb/CSS/Length.h @@ -143,7 +143,7 @@ public: case Type::Undefined: case Type::Percentage: default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp index ad5ab28745..87fcde8d6e 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp @@ -33,11 +33,11 @@ #include <stdlib.h> #include <string.h> -#define PARSE_ASSERT(x) \ +#define PARSE_VERIFY(x) \ if (!(x)) { \ dbgln("CSS PARSER ASSERTION FAILED: {}", #x); \ dbgln("At character# {} in CSS: _{}_", index, css); \ - ASSERT_NOT_REACHED(); \ + VERIFY_NOT_REACHED(); \ } #define PARSE_ERROR() \ @@ -344,7 +344,7 @@ public: char consume_one() { - PARSE_ASSERT(index < css.length()); + PARSE_VERIFY(index < css.length()); return css[index++]; }; @@ -424,7 +424,7 @@ public: if (type != CSS::Selector::SimpleSelector::Type::Universal) { while (is_valid_selector_char(peek())) buffer.append(consume_one()); - PARSE_ASSERT(!buffer.is_null()); + PARSE_VERIFY(!buffer.is_null()); } auto value = String::copy(buffer); @@ -593,7 +593,7 @@ public: break; simple_selectors.append(component.value()); // If this assert triggers, we're most likely up to no good. - PARSE_ASSERT(simple_selectors.size() < 100); + PARSE_VERIFY(simple_selectors.size() < 100); } if (simple_selectors.is_empty()) @@ -682,7 +682,7 @@ public: continue; } if (ch == ')') { - PARSE_ASSERT(paren_nesting_level > 0); + PARSE_VERIFY(paren_nesting_level > 0); --paren_nesting_level; buffer.append(consume_one()); continue; diff --git a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp index 5f553e2be0..a1db87f78f 100644 --- a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp +++ b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp @@ -119,7 +119,7 @@ static bool matches(const CSS::Selector::SimpleSelector& component, const DOM::E case CSS::Selector::SimpleSelector::Type::TagName: return component.value == element.local_name(); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -134,7 +134,7 @@ static bool matches(const CSS::Selector& selector, int component_list_index, con case CSS::Selector::ComplexSelector::Relation::None: return true; case CSS::Selector::ComplexSelector::Relation::Descendant: - ASSERT(component_list_index != 0); + VERIFY(component_list_index != 0); for (auto* ancestor = element.parent(); ancestor; ancestor = ancestor->parent()) { if (!is<DOM::Element>(*ancestor)) continue; @@ -143,29 +143,29 @@ static bool matches(const CSS::Selector& selector, int component_list_index, con } return false; case CSS::Selector::ComplexSelector::Relation::ImmediateChild: - ASSERT(component_list_index != 0); + VERIFY(component_list_index != 0); if (!element.parent() || !is<DOM::Element>(*element.parent())) return false; return matches(selector, component_list_index - 1, downcast<DOM::Element>(*element.parent())); case CSS::Selector::ComplexSelector::Relation::AdjacentSibling: - ASSERT(component_list_index != 0); + VERIFY(component_list_index != 0); if (auto* sibling = element.previous_element_sibling()) return matches(selector, component_list_index - 1, *sibling); return false; case CSS::Selector::ComplexSelector::Relation::GeneralSibling: - ASSERT(component_list_index != 0); + VERIFY(component_list_index != 0); for (auto* sibling = element.previous_element_sibling(); sibling; sibling = sibling->previous_element_sibling()) { if (matches(selector, component_list_index - 1, *sibling)) return true; } return false; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool matches(const CSS::Selector& selector, const DOM::Element& element) { - ASSERT(!selector.complex_selectors().is_empty()); + VERIFY(!selector.complex_selectors().is_empty()); return matches(selector, selector.complex_selectors().size() - 1, element); } diff --git a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp b/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp index da6f2a6fd9..2ced865baa 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp @@ -188,7 +188,7 @@ static bool contains(Edge a, Edge b) static inline void set_property_border_width(StyleProperties& style, const StyleValue& value, Edge edge) { - ASSERT(value.is_length()); + VERIFY(value.is_length()); if (contains(Edge::Top, edge)) style.set_property(CSS::PropertyID::BorderTopWidth, value); if (contains(Edge::Right, edge)) @@ -201,7 +201,7 @@ static inline void set_property_border_width(StyleProperties& style, const Style static inline void set_property_border_color(StyleProperties& style, const StyleValue& value, Edge edge) { - ASSERT(value.is_color()); + VERIFY(value.is_color()); if (contains(Edge::Top, edge)) style.set_property(CSS::PropertyID::BorderTopColor, value); if (contains(Edge::Right, edge)) @@ -214,7 +214,7 @@ static inline void set_property_border_color(StyleProperties& style, const Style static inline void set_property_border_style(StyleProperties& style, const StyleValue& value, Edge edge) { - ASSERT(value.is_string()); + VERIFY(value.is_string()); if (contains(Edge::Top, edge)) style.set_property(CSS::PropertyID::BorderTopStyle, value); if (contains(Edge::Right, edge)) diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp index c6d6b503bf..65905b54d5 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp @@ -54,7 +54,7 @@ Color IdentifierStyleValue::to_color(const DOM::Document& document) const if (id() == CSS::ValueID::LibwebLink) return document.link_color(); - ASSERT(document.page()); + VERIFY(document.page()); auto palette = document.page()->palette(); switch (id()) { case CSS::ValueID::LibwebPaletteDesktopBackground: diff --git a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp.cpp b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp.cpp index 2b7b2218c7..1fde66eee3 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp.cpp @@ -58,8 +58,8 @@ int main(int argc, char** argv) return 1; auto json = JsonValue::from_string(file->read_all()); - ASSERT(json.has_value()); - ASSERT(json.value().is_object()); + VERIFY(json.has_value()); + VERIFY(json.value().is_object()); StringBuilder builder; SourceGenerator generator { builder }; @@ -75,7 +75,7 @@ PropertyID property_id_from_string(const StringView& string) )~~~"); json.value().as_object().for_each_member([&](auto& name, auto& value) { - ASSERT(value.is_object()); + VERIFY(value.is_object()); auto member_generator = generator.fork(); member_generator.set("name", name); @@ -95,7 +95,7 @@ const char* string_from_property_id(PropertyID property_id) { )~~~"); json.value().as_object().for_each_member([&](auto& name, auto& value) { - ASSERT(value.is_object()); + VERIFY(value.is_object()); auto member_generator = generator.fork(); member_generator.set("name", name); diff --git a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h.cpp b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h.cpp index e2f235db62..6391df70f4 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h.cpp @@ -58,8 +58,8 @@ int main(int argc, char** argv) return 1; auto json = JsonValue::from_string(file->read_all()); - ASSERT(json.has_value()); - ASSERT(json.value().is_object()); + VERIFY(json.has_value()); + VERIFY(json.value().is_object()); StringBuilder builder; SourceGenerator generator { builder }; @@ -76,7 +76,7 @@ enum class PropertyID { )~~~"); json.value().as_object().for_each_member([&](auto& name, auto& value) { - ASSERT(value.is_object()); + VERIFY(value.is_object()); auto member_generator = generator.fork(); member_generator.set("name:titlecase", title_casify(name)); diff --git a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_cpp.cpp b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_cpp.cpp index 4991a4040a..0fb443bcc6 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_cpp.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_cpp.cpp @@ -58,8 +58,8 @@ int main(int argc, char** argv) return 1; auto json = JsonValue::from_string(file->read_all()); - ASSERT(json.has_value()); - ASSERT(json.value().is_array()); + VERIFY(json.has_value()); + VERIFY(json.value().is_array()); StringBuilder builder; SourceGenerator generator { builder }; diff --git a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_h.cpp b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_h.cpp index 7c85ade83f..03b474908c 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_h.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_h.cpp @@ -58,8 +58,8 @@ int main(int argc, char** argv) return 1; auto json = JsonValue::from_string(file->read_all()); - ASSERT(json.has_value()); - ASSERT(json.value().is_array()); + VERIFY(json.has_value()); + VERIFY(json.value().is_array()); StringBuilder builder; SourceGenerator generator { builder }; diff --git a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp index 5b257c1b0d..7a7449ed0b 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp @@ -585,7 +585,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter )~~~"); } else { dbgln("Unimplemented JS-to-C++ conversion: {}", parameter.type.name); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }; diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index d4f2170f1b..242b2924b8 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -89,8 +89,8 @@ Document::~Document() void Document::removed_last_ref() { - ASSERT(!ref_count()); - ASSERT(!m_deletion_has_begun); + VERIFY(!ref_count()); + VERIFY(!m_deletion_has_begun); if (m_referencing_node_count) { // The document has reached ref_count==0 but still has nodes keeping it alive. @@ -121,8 +121,8 @@ void Document::removed_last_ref() }); for (auto& node : descendants) { - ASSERT(&node.document() == this); - ASSERT(!node.is_document()); + VERIFY(&node.document() == this); + VERIFY(!node.is_document()); if (node.parent()) node.parent()->remove_child(node); } @@ -299,7 +299,7 @@ void Document::attach_to_frame(Badge<Frame>, Frame& frame) void Document::detach_from_frame(Badge<Frame>, Frame& frame) { - ASSERT(&frame == m_frame); + VERIFY(&frame == m_frame); tear_down_layout_tree(); m_frame = nullptr; } diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index e789df05a3..30c4c17b32 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -259,14 +259,14 @@ private: void increment_referencing_node_count() { - ASSERT(!m_deletion_has_begun); + VERIFY(!m_deletion_has_begun); ++m_referencing_node_count; } void decrement_referencing_node_count() { - ASSERT(!m_deletion_has_begun); - ASSERT(m_referencing_node_count); + VERIFY(!m_deletion_has_begun); + VERIFY(m_referencing_node_count); --m_referencing_node_count; if (!m_referencing_node_count && !ref_count()) { m_deletion_has_begun = true; diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 10e2bda733..24b063d5cd 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -131,7 +131,7 @@ RefPtr<Layout::Node> Element::create_layout_node() switch (display) { case CSS::Display::None: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; case CSS::Display::Block: return adopt(*new Layout::BlockBox(document(), this, move(style))); @@ -164,7 +164,7 @@ RefPtr<Layout::Node> Element::create_layout_node() // FIXME: This is just an incorrect placeholder until we improve table layout support. return adopt(*new Layout::BlockBox(document(), this, move(style))); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Element::parse_attribute(const FlyString& name, const String& value) @@ -214,7 +214,7 @@ static StyleDifference compute_style_difference(const CSS::StyleProperties& old_ void Element::recompute_style() { set_needs_style_update(false); - ASSERT(parent()); + VERIFY(parent()); auto old_specified_css_values = m_specified_css_values; auto new_specified_css_values = document().style_resolver().resolve_style(*this); m_specified_css_values = new_specified_css_values; diff --git a/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp b/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp index e45b42c23e..1ec7f8b96b 100644 --- a/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp @@ -136,7 +136,7 @@ void EventDispatcher::invoke(Event::PathEntry& struct_, Event& event, Event::Pha return entry.index <= struct_.index && !entry.shadow_adjusted_target.is_null(); }); - ASSERT(last_valid_shadow_adjusted_target.has_value()); + VERIFY(last_valid_shadow_adjusted_target.has_value()); event.set_target(last_valid_shadow_adjusted_target.value().shadow_adjusted_target); event.set_related_target(struct_.related_target); @@ -249,7 +249,7 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr< return !entry.shadow_adjusted_target.is_null(); }); - ASSERT(clear_targets_struct.has_value()); + VERIFY(clear_targets_struct.has_value()); if (is<Node>(clear_targets_struct.value().shadow_adjusted_target.ptr())) { auto& shadow_adjusted_target_node = downcast<Node>(*clear_targets_struct.value().shadow_adjusted_target); diff --git a/Userland/Libraries/LibWeb/DOM/EventListener.cpp b/Userland/Libraries/LibWeb/DOM/EventListener.cpp index eb64bfa503..ad9f0cd3e7 100644 --- a/Userland/Libraries/LibWeb/DOM/EventListener.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventListener.cpp @@ -31,7 +31,7 @@ namespace Web::DOM { JS::Function& EventListener::function() { - ASSERT(m_function.cell()); + VERIFY(m_function.cell()); return *m_function.cell(); } diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index 26204538bc..d66c33e138 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -54,7 +54,7 @@ Node::Node(Document& document, NodeType type) Node::~Node() { - ASSERT(m_deletion_has_begun); + VERIFY(m_deletion_has_begun); if (layout_node() && layout_node()->parent()) layout_node()->parent()->remove_child(*layout_node()); diff --git a/Userland/Libraries/LibWeb/DOM/Window.cpp b/Userland/Libraries/LibWeb/DOM/Window.cpp index b6fae82ebf..0b7f66afc4 100644 --- a/Userland/Libraries/LibWeb/DOM/Window.cpp +++ b/Userland/Libraries/LibWeb/DOM/Window.cpp @@ -95,7 +95,7 @@ i32 Window::set_timeout(JS::Function& callback, i32 interval) void Window::timer_did_fire(Badge<Timer>, Timer& timer) { // We should not be here if there's no JS wrapper for the Window object. - ASSERT(wrapper()); + VERIFY(wrapper()); auto& vm = wrapper()->vm(); // NOTE: This protector pointer keeps the timer alive until the end of this function no matter what. diff --git a/Userland/Libraries/LibWeb/DOMTreeModel.cpp b/Userland/Libraries/LibWeb/DOMTreeModel.cpp index 76c0e39769..ad732548d5 100644 --- a/Userland/Libraries/LibWeb/DOMTreeModel.cpp +++ b/Userland/Libraries/LibWeb/DOMTreeModel.cpp @@ -79,7 +79,7 @@ GUI::ModelIndex DOMTreeModel::parent_index(const GUI::ModelIndex& index) const ++grandparent_child_index; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } diff --git a/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp b/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp index 46585e80d9..c41be830a8 100644 --- a/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp +++ b/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp @@ -70,7 +70,7 @@ void GlobalEventHandlers::set_event_handler_attribute(const FlyString& name, HTM return; } auto* function = JS::ScriptFunction::create(self.script_execution_context()->interpreter().global_object(), name, program->body(), program->parameters(), program->function_length(), nullptr, false, false); - ASSERT(function); + VERIFY(function); listener = adopt(*new DOM::EventListener(JS::make_handle(static_cast<JS::Function*>(function)))); } if (listener) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp index d2f071314d..4b6462417e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp @@ -53,7 +53,7 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co if (color.has_value()) style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value())); } else if (name.equals_ignoring_case("background")) { - ASSERT(m_background_style_value); + VERIFY(m_background_style_value); style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value); } }); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp index 9144211b07..259f88083d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp @@ -65,7 +65,7 @@ RefPtr<Layout::Node> HTMLCanvasElement::create_layout_node() CanvasRenderingContext2D* HTMLCanvasElement::get_context(String type) { - ASSERT(type == "2d"); + VERIFY(type == "2d"); if (!m_context) m_context = CanvasRenderingContext2D::create(*this); return m_context; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index 36fff8b52c..73113dd242 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -73,7 +73,7 @@ bool HTMLElement::is_editable() const case ContentEditableState::Inherit: return parent() && parent()->is_editable(); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -87,7 +87,7 @@ String HTMLElement::content_editable() const case ContentEditableState::Inherit: return "inherit"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index d4fe2cb37f..06b942e076 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -44,7 +44,7 @@ namespace Web::HTML { HTMLIFrameElement::HTMLIFrameElement(DOM::Document& document, QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - ASSERT(document.frame()); + VERIFY(document.frame()); m_content_frame = Frame::create_subframe(*this, document.frame()->main_frame()); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index d2005bb4b0..8fcf9edaff 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -56,7 +56,7 @@ void HTMLLinkElement::resource_did_fail() void HTMLLinkElement::resource_did_load() { - ASSERT(resource()); + VERIFY(resource()); if (!resource()->has_encoded_data()) return; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp index 9eeaa8b9ec..e3a64bcbb9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp @@ -93,7 +93,7 @@ void HTMLScriptElement::execute_script() document().set_current_script({}, old_current_script); } else { - ASSERT(!document().current_script()); + VERIFY(!document().current_script()); TODO(); } diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp index 8320416d20..fd7a1655a3 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp @@ -267,7 +267,7 @@ void HTMLDocumentParser::process_using_the_rules_for(InsertionMode mode, HTMLTok handle_after_after_frameset(token); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -429,7 +429,7 @@ HTMLDocumentParser::AdjustedInsertionLocation HTMLDocumentParser::find_appropria return { downcast<HTMLTemplateElement>(last_template.element)->content(), nullptr }; } if (!last_table.element) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); // Guaranteed not to be a template element (it will be the html element), // so no need to check the parent is a template. return { m_stack_of_open_elements.elements().first(), nullptr }; @@ -903,7 +903,7 @@ void HTMLDocumentParser::reconstruct_the_active_formatting_elements() ssize_t index = m_list_of_active_formatting_elements.entries().size() - 1; RefPtr<DOM::Element> entry = m_list_of_active_formatting_elements.entries().at(index).element; - ASSERT(entry); + VERIFY(entry); Rewind: if (index == 0) { @@ -912,7 +912,7 @@ Rewind: --index; entry = m_list_of_active_formatting_elements.entries().at(index).element; - ASSERT(entry); + VERIFY(entry); if (!m_stack_of_open_elements.contains(*entry)) goto Rewind; @@ -920,7 +920,7 @@ Rewind: Advance: ++index; entry = m_list_of_active_formatting_elements.entries().at(index).element; - ASSERT(entry); + VERIFY(entry); Create: // FIXME: Hold on to the real token! @@ -1140,7 +1140,7 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token) if (m_stack_of_open_elements.elements().size() == 1 || m_stack_of_open_elements.elements().at(1).local_name() != HTML::TagNames::body || m_stack_of_open_elements.contains(HTML::TagNames::template_)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } m_frameset_ok = false; @@ -1158,7 +1158,7 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token) if (m_stack_of_open_elements.elements().size() == 1 || m_stack_of_open_elements.elements().at(1).local_name() != HTML::TagNames::body) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } @@ -1863,7 +1863,7 @@ void HTMLDocumentParser::increment_script_nesting_level() void HTMLDocumentParser::decrement_script_nesting_level() { - ASSERT(m_script_nesting_level); + VERIFY(m_script_nesting_level); --m_script_nesting_level; } @@ -1917,7 +1917,7 @@ void HTMLDocumentParser::handle_text(HTMLToken& token) if (the_script->failed_to_load()) return; - ASSERT(the_script->is_ready_to_be_parser_executed()); + VERIFY(the_script->is_ready_to_be_parser_executed()); if (m_aborted) return; @@ -1926,13 +1926,13 @@ void HTMLDocumentParser::handle_text(HTMLToken& token) // FIXME: Handle tokenizer insertion point stuff here too. - ASSERT(script_nesting_level() == 0); + VERIFY(script_nesting_level() == 0); increment_script_nesting_level(); the_script->execute_script(); decrement_script_nesting_level(); - ASSERT(script_nesting_level() == 0); + VERIFY(script_nesting_level() == 0); m_parser_pause_flag = false; // FIXME: Handle tokenizer insertion point stuff here too. @@ -1955,7 +1955,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_context() m_stack_of_open_elements.pop(); if (current_node().local_name() == HTML::TagNames::html) - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); } void HTMLDocumentParser::clear_the_stack_back_to_a_table_row_context() @@ -1964,7 +1964,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_row_context() m_stack_of_open_elements.pop(); if (current_node().local_name() == HTML::TagNames::html) - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); } void HTMLDocumentParser::clear_the_stack_back_to_a_table_body_context() @@ -1973,7 +1973,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_body_context() m_stack_of_open_elements.pop(); if (current_node().local_name() == HTML::TagNames::html) - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); } void HTMLDocumentParser::handle_in_row(HTMLToken& token) @@ -2068,7 +2068,7 @@ void HTMLDocumentParser::handle_in_cell(HTMLToken& token) } if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr)) { if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::td) && !m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::th)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); PARSE_ERROR(); return; } @@ -2109,7 +2109,7 @@ void HTMLDocumentParser::handle_in_table_text(HTMLToken& token) } for (auto& pending_token : m_pending_table_character_tokens) { - ASSERT(pending_token.is_character()); + VERIFY(pending_token.is_character()); if (!pending_token.is_parser_whitespace()) { // If any of the tokens in the pending table character tokens list // are character tokens that are not ASCII whitespace, then this is a parse error: @@ -2401,7 +2401,7 @@ void HTMLDocumentParser::handle_in_select(HTMLToken& token) if (token.is_end_tag() && token.tag_name() == HTML::TagNames::select) { if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); PARSE_ERROR(); return; } @@ -2414,7 +2414,7 @@ void HTMLDocumentParser::handle_in_select(HTMLToken& token) PARSE_ERROR(); if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } @@ -2427,7 +2427,7 @@ void HTMLDocumentParser::handle_in_select(HTMLToken& token) PARSE_ERROR(); if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } @@ -2459,7 +2459,7 @@ void HTMLDocumentParser::handle_in_caption(HTMLToken& token) { if (token.is_end_tag() && token.tag_name() == HTML::TagNames::caption) { if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::caption)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); PARSE_ERROR(); return; } @@ -2479,7 +2479,7 @@ void HTMLDocumentParser::handle_in_caption(HTMLToken& token) if ((token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr)) || (token.is_end_tag() && token.tag_name() == HTML::TagNames::table)) { if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::caption)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); PARSE_ERROR(); return; } @@ -2634,7 +2634,7 @@ void HTMLDocumentParser::handle_in_template(HTMLToken& token) if (token.is_end_of_file()) { if (!m_stack_of_open_elements.contains(HTML::TagNames::template_)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); stop_parsing(); return; } @@ -2849,7 +2849,7 @@ void HTMLDocumentParser::process_using_the_rules_for_foreign_content(HTMLToken& PARSE_ERROR(); for (ssize_t i = m_stack_of_open_elements.elements().size() - 1; i >= 0; --i) { if (node == m_stack_of_open_elements.first()) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } // FIXME: See the above FIXME @@ -2870,7 +2870,7 @@ void HTMLDocumentParser::process_using_the_rules_for_foreign_content(HTMLToken& } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void HTMLDocumentParser::reset_the_insertion_mode_appropriately() @@ -2935,14 +2935,14 @@ void HTMLDocumentParser::reset_the_insertion_mode_appropriately() } if (node->local_name() == HTML::TagNames::frameset) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); m_insertion_mode = InsertionMode::InFrameset; return; } if (node->local_name() == HTML::TagNames::html) { if (!m_head_element) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); m_insertion_mode = InsertionMode::BeforeHead; return; } @@ -2952,7 +2952,7 @@ void HTMLDocumentParser::reset_the_insertion_mode_appropriately() } } - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); m_insertion_mode = InsertionMode::InBody; } @@ -2965,7 +2965,7 @@ const char* HTMLDocumentParser::insertion_mode_name() const ENUMERATE_INSERTION_MODES #undef __ENUMERATE_INSERTION_MODE } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } DOM::Document& HTMLDocumentParser::document() diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp index 53a2357be5..38652bdb4e 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp @@ -55,7 +55,7 @@ String HTMLToken::to_string() const builder.append("EndOfFile"); break; case HTMLToken::Type::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (type() == HTMLToken::Type::StartTag || type() == HTMLToken::Type::EndTag) { diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h index c2246229c6..fcfad6e34b 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h @@ -75,9 +75,9 @@ public: u32 code_point() const { - ASSERT(is_character()); + VERIFY(is_character()); Utf8View view(m_comment_or_character.data.string_view()); - ASSERT(view.length() == 1); + VERIFY(view.length() == 1); return *view.begin(); } @@ -100,19 +100,19 @@ public: String tag_name() const { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); return m_tag.tag_name.to_string(); } bool is_self_closing() const { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); return m_tag.self_closing; } bool has_acknowledged_self_closing_flag() const { - ASSERT(is_self_closing()); + VERIFY(is_self_closing()); return m_tag.self_closing_acknowledged; } @@ -124,7 +124,7 @@ public: StringView attribute(const FlyString& attribute_name) { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); for (auto& attribute : m_tag.attributes) { if (attribute_name == attribute.local_name_builder.string_view()) return attribute.value_builder.string_view(); @@ -139,7 +139,7 @@ public: void adjust_tag_name(const FlyString& old_name, const FlyString& new_name) { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); if (old_name == m_tag.tag_name.string_view()) { m_tag.tag_name.clear(); m_tag.tag_name.append(new_name); @@ -148,7 +148,7 @@ public: void adjust_attribute_name(const FlyString& old_name, const FlyString& new_name) { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); for (auto& attribute : m_tag.attributes) { if (old_name == attribute.local_name_builder.string_view()) { attribute.local_name_builder.clear(); @@ -159,7 +159,7 @@ public: void adjust_foreign_attribute(const FlyString& old_name, const FlyString& prefix, const FlyString& local_name, const FlyString& namespace_) { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); for (auto& attribute : m_tag.attributes) { if (old_name == attribute.local_name_builder.string_view()) { attribute.prefix_builder.clear(); @@ -176,7 +176,7 @@ public: void drop_attributes() { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); m_tag.attributes.clear(); } diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp index 6aa94b1163..2b35432a19 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp @@ -189,7 +189,7 @@ namespace Web::HTML { { #define END_STATE \ - ASSERT_NOT_REACHED(); \ + VERIFY_NOT_REACHED(); \ break; \ } \ } \ @@ -2610,7 +2610,7 @@ void HTMLTokenizer::create_new_token(HTMLToken::Type type) HTMLTokenizer::HTMLTokenizer(const StringView& input, const String& encoding) { auto* decoder = TextCodec::decoder_for(encoding); - ASSERT(decoder); + VERIFY(decoder); m_decoded_input = decoder->to_utf8(input); m_utf8_view = Utf8View(m_decoded_input); m_utf8_iterator = m_utf8_view.begin(); @@ -2640,7 +2640,7 @@ void HTMLTokenizer::will_emit(HTMLToken& token) bool HTMLTokenizer::current_end_tag_token_is_appropriate() const { - ASSERT(m_current_token.is_end_tag()); + VERIFY(m_current_token.is_end_tag()); if (!m_last_emitted_start_tag.is_start_tag()) return false; return m_current_token.tag_name() == m_last_emitted_start_tag.tag_name(); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h index 787bc12b46..e0c84271c4 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h @@ -152,7 +152,7 @@ private: ENUMERATE_TOKENIZER_STATES #undef __ENUMERATE_TOKENIZER_STATE }; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void will_emit(HTMLToken&); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp index 2406711bff..502e8e0c6b 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp @@ -45,7 +45,7 @@ bool StackOfOpenElements::has_in_scope_impl(const FlyString& tag_name, const Vec if (list.contains_slow(node.local_name())) return false; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool StackOfOpenElements::has_in_scope(const FlyString& tag_name) const @@ -62,7 +62,7 @@ bool StackOfOpenElements::has_in_scope_impl(const DOM::Element& target_node, con if (list.contains_slow(node.local_name())) return false; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool StackOfOpenElements::has_in_scope(const DOM::Element& target_node) const diff --git a/Userland/Libraries/LibWeb/InProcessWebView.cpp b/Userland/Libraries/LibWeb/InProcessWebView.cpp index b74cc8828c..7f664b3920 100644 --- a/Userland/Libraries/LibWeb/InProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/InProcessWebView.cpp @@ -96,8 +96,8 @@ void InProcessWebView::select_all() last_layout_node = layout_node; } - ASSERT(first_layout_node); - ASSERT(last_layout_node); + VERIFY(first_layout_node); + VERIFY(last_layout_node); int last_layout_node_index_in_node = 0; if (is<Layout::TextNode>(*last_layout_node)) @@ -114,7 +114,7 @@ String InProcessWebView::selected_text() const void InProcessWebView::page_did_layout() { - ASSERT(layout_root()); + VERIFY(layout_root()); set_content_size(layout_root()->size().to_type<int>()); } diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index bb7def7bb5..2f1c1e96b4 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -359,7 +359,7 @@ void BlockFormattingContext::layout_block_level_children(Box& box, LayoutMode la void BlockFormattingContext::place_block_level_replaced_element_in_normal_flow(Box& child_box, Box& containing_block) { - ASSERT(!containing_block.is_absolutely_positioned()); + VERIFY(!containing_block.is_absolutely_positioned()); auto& replaced_element_box_model = child_box.box_model(); replaced_element_box_model.margin.top = child_box.computed_values().margin().top.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); @@ -472,7 +472,7 @@ void BlockFormattingContext::layout_initial_containing_block(LayoutMode layout_m layout_block_level_children(context_box(), layout_mode); - ASSERT(!icb.children_are_inline()); + VERIFY(!icb.children_are_inline()); // FIXME: The ICB should have the height of the viewport. // Instead of auto-sizing the ICB, we should spill into overflow. @@ -501,7 +501,7 @@ static Gfx::FloatRect rect_in_coordinate_space(const Box& box, const Box& contex void BlockFormattingContext::layout_floating_child(Box& box, Box& containing_block) { - ASSERT(box.is_floating()); + VERIFY(box.is_floating()); compute_width(box); layout_inside(box, LayoutMode::Default); diff --git a/Userland/Libraries/LibWeb/Layout/Box.cpp b/Userland/Libraries/LibWeb/Layout/Box.cpp index 190340f13c..0cea9f0b3f 100644 --- a/Userland/Libraries/LibWeb/Layout/Box.cpp +++ b/Userland/Libraries/LibWeb/Layout/Box.cpp @@ -156,11 +156,11 @@ StackingContext* Box::enclosing_stacking_context() auto& ancestor_box = downcast<Box>(*ancestor); if (!ancestor_box.establishes_stacking_context()) continue; - ASSERT(ancestor_box.stacking_context()); + VERIFY(ancestor_box.stacking_context()); return ancestor_box.stacking_context(); } // We should always reach the Layout::InitialContainingBlockBox stacking context. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool Box::establishes_stacking_context() const @@ -196,7 +196,7 @@ LineBox& Box::add_line_box() float Box::width_of_logical_containing_block() const { auto* containing_block = this->containing_block(); - ASSERT(containing_block); + VERIFY(containing_block); return containing_block->width(); } diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index 11d0c6b7b0..b96fa7d039 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -99,7 +99,7 @@ void FormattingContext::layout_inside(Box& box, LayoutMode layout_mode) context.run(box, layout_mode); } else { // FIXME: This needs refactoring! - ASSERT(is_block_formatting_context()); + VERIFY(is_block_formatting_context()); run(box, layout_mode); } } diff --git a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp index f3210ad941..d0c8b432c6 100644 --- a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp @@ -45,7 +45,7 @@ FrameBox::~FrameBox() void FrameBox::prepare_for_replaced_layout() { - ASSERT(dom_node().content_frame()); + VERIFY(dom_node().content_frame()); set_has_intrinsic_width(true); set_has_intrinsic_height(true); @@ -90,7 +90,7 @@ void FrameBox::did_set_rect() { ReplacedBox::did_set_rect(); - ASSERT(dom_node().content_frame()); + VERIFY(dom_node().content_frame()); dom_node().content_frame()->set_size(size().to_type<int>()); } diff --git a/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp b/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp index 587c9198c8..fa74a76dda 100644 --- a/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp @@ -51,11 +51,11 @@ void InitialContainingBlockBox::build_stacking_context_tree() if (&box == this) return IterationDecision::Continue; if (!box.establishes_stacking_context()) { - ASSERT(!box.stacking_context()); + VERIFY(!box.stacking_context()); return IterationDecision::Continue; } auto* parent_context = box.enclosing_stacking_context(); - ASSERT(parent_context); + VERIFY(parent_context); box.set_stacking_context(make<StackingContext>(box, parent_context)); return IterationDecision::Continue; }); diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp index 50430ce843..0e57f6a184 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp @@ -90,10 +90,10 @@ float InlineFormattingContext::available_width_at_line(size_t line_index) const void InlineFormattingContext::run(Box&, LayoutMode layout_mode) { - ASSERT(containing_block().children_are_inline()); + VERIFY(containing_block().children_are_inline()); containing_block().line_boxes().clear(); containing_block().for_each_child([&](auto& child) { - ASSERT(child.is_inline()); + VERIFY(child.is_inline()); if (is<Box>(child) && child.is_absolutely_positioned()) { layout_absolutely_positioned_element(downcast<Box>(child)); return; diff --git a/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp b/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp index c1f6aa1db9..c7c1d3995b 100644 --- a/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp +++ b/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp @@ -55,7 +55,7 @@ LayoutRange LayoutRange::normalized() const NonnullRefPtr<DOM::Range> LayoutRange::to_dom_range() const { - ASSERT(is_valid()); + VERIFY(is_valid()); auto start = m_start.to_dom_position(); auto end = m_end.to_dom_position(); diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index e62a688513..5c708f42eb 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -114,25 +114,25 @@ HitTestResult Node::hit_test(const Gfx::IntPoint& position, HitTestType type) co const Frame& Node::frame() const { - ASSERT(document().frame()); + VERIFY(document().frame()); return *document().frame(); } Frame& Node::frame() { - ASSERT(document().frame()); + VERIFY(document().frame()); return *document().frame(); } const InitialContainingBlockBox& Node::root() const { - ASSERT(document().layout_node()); + VERIFY(document().layout_node()); return *document().layout_node(); } InitialContainingBlockBox& Node::root() { - ASSERT(document().layout_node()); + VERIFY(document().layout_node()); return *document().layout_node(); } @@ -159,7 +159,7 @@ Gfx::FloatPoint Node::box_type_agnostic_position() const { if (is<Box>(*this)) return downcast<Box>(*this).absolute_position(); - ASSERT(is_inline()); + VERIFY(is_inline()); Gfx::FloatPoint position; if (auto* block = containing_block()) { block->for_each_fragment([&](auto& fragment) { diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp index 23fa3eaf6e..79c5e58784 100644 --- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -115,7 +115,7 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node) if (!m_parent_stack[i]->is_inline() || m_parent_stack[i]->is_inline_block()) return *m_parent_stack[i]; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }(); auto& insertion_point = insertion_parent_for_block_node(nearest_non_inline_ancestor, *layout_node); insertion_point.append_child(*layout_node); @@ -260,7 +260,7 @@ static void for_each_sequence_of_consecutive_children_matching(NodeWithStyle& pa template<typename WrapperBoxType> static void wrap_in_anonymous(NonnullRefPtrVector<Node>& sequence, Node* nearest_sibling) { - ASSERT(!sequence.is_empty()); + VERIFY(!sequence.is_empty()); auto& parent = *sequence.first().parent(); auto computed_values = parent.computed_values().clone_inherited_values(); static_cast<CSS::MutableComputedValues&>(computed_values).set_display(WrapperBoxType::static_display()); diff --git a/Userland/Libraries/LibWeb/LayoutTreeModel.cpp b/Userland/Libraries/LibWeb/LayoutTreeModel.cpp index 440b2fce52..b2caa2d6ca 100644 --- a/Userland/Libraries/LibWeb/LayoutTreeModel.cpp +++ b/Userland/Libraries/LibWeb/LayoutTreeModel.cpp @@ -78,7 +78,7 @@ GUI::ModelIndex LayoutTreeModel::parent_index(const GUI::ModelIndex& index) cons ++grandparent_child_index; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp index 6dcbaa5434..956fa31295 100644 --- a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp @@ -227,7 +227,7 @@ void FrameLoader::load_error_page(const URL& failed_url, const String& error) ResourceLoader::the().load( error_page_url, [this, failed_url, error](auto data, auto&) { - ASSERT(!data.is_null()); + VERIFY(!data.is_null()); #pragma GCC diagnostic ignored "-Wformat-nonliteral" auto html = String::format( String::copy(data).characters(), @@ -235,12 +235,12 @@ void FrameLoader::load_error_page(const URL& failed_url, const String& error) escape_html_entities(error).characters()); #pragma GCC diagnostic pop auto document = HTML::parse_html_document(html, failed_url, "utf-8"); - ASSERT(document); + VERIFY(document); frame().set_document(document); }, [](auto error) { dbgln("Failed to load error page: {}", error); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }); } @@ -279,7 +279,7 @@ void FrameLoader::resource_did_load() if (auto* host_element = frame().host_element()) { // FIXME: Perhaps in the future we'll have a better common base class for <frame> and <iframe> - ASSERT(is<HTML::HTMLIFrameElement>(*host_element)); + VERIFY(is<HTML::HTMLIFrameElement>(*host_element)); downcast<HTML::HTMLIFrameElement>(*host_element).content_frame_did_load({}); } diff --git a/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp b/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp index 30bfa5ab81..4d049c8d5f 100644 --- a/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp @@ -60,7 +60,7 @@ void ImageLoader::set_visible_in_viewport(bool visible_in_viewport) const void ImageLoader::resource_did_load() { - ASSERT(resource()); + VERIFY(resource()); if (!resource()->mime_type().starts_with("image/")) { m_loading_state = LoadingState::Failed; diff --git a/Userland/Libraries/LibWeb/Loader/Resource.cpp b/Userland/Libraries/LibWeb/Loader/Resource.cpp index 03f17b34d1..048d500aec 100644 --- a/Userland/Libraries/LibWeb/Loader/Resource.cpp +++ b/Userland/Libraries/LibWeb/Loader/Resource.cpp @@ -87,7 +87,7 @@ static String mime_type_from_content_type(const String& content_type) void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, const HashMap<String, String, CaseInsensitiveStringTraits>& headers) { - ASSERT(!m_loaded); + VERIFY(!m_loaded); m_encoded_data = ByteBuffer::copy(data); m_response_headers = headers; m_loaded = true; @@ -128,13 +128,13 @@ void Resource::did_fail(Badge<ResourceLoader>, const String& error) void Resource::register_client(Badge<ResourceClient>, ResourceClient& client) { - ASSERT(!m_clients.contains(&client)); + VERIFY(!m_clients.contains(&client)); m_clients.set(&client); } void Resource::unregister_client(Badge<ResourceClient>, ResourceClient& client) { - ASSERT(m_clients.contains(&client)); + VERIFY(m_clients.contains(&client)); m_clients.remove(&client); } @@ -144,7 +144,7 @@ void ResourceClient::set_resource(Resource* resource) m_resource->unregister_client({}, *this); m_resource = resource; if (m_resource) { - ASSERT(resource->type() == client_type()); + VERIFY(resource->type() == client_type()); m_resource->register_client({}, *this); diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp index 29e3467ceb..df60760b4b 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -55,7 +55,7 @@ OutOfProcessWebView::~OutOfProcessWebView() void OutOfProcessWebView::handle_web_content_process_crash() { create_client(); - ASSERT(m_client_state.client); + VERIFY(m_client_state.client); // Don't keep a stale backup bitmap around. m_backup_bitmap = nullptr; @@ -337,7 +337,7 @@ void OutOfProcessWebView::request_repaint() WebContentClient& OutOfProcessWebView::client() { - ASSERT(m_client_state.client); + VERIFY(m_client_state.client); return *m_client_state.client; } diff --git a/Userland/Libraries/LibWeb/Page/Frame.cpp b/Userland/Libraries/LibWeb/Page/Frame.cpp index 2dab2252c3..4c90e16fa1 100644 --- a/Userland/Libraries/LibWeb/Page/Frame.cpp +++ b/Userland/Libraries/LibWeb/Page/Frame.cpp @@ -277,7 +277,7 @@ String Frame::selected_text() const } // End node - ASSERT(layout_node == selection.end().layout_node); + VERIFY(layout_node == selection.end().layout_node); if (is<Layout::TextNode>(*layout_node)) { auto& text = downcast<Layout::TextNode>(*layout_node).text_for_rendering(); builder.append(text.substring(0, selection.end().index_in_node)); @@ -289,13 +289,13 @@ String Frame::selected_text() const void Frame::register_viewport_client(ViewportClient& client) { auto result = m_viewport_clients.set(&client); - ASSERT(result == AK::HashSetResult::InsertedNewEntry); + VERIFY(result == AK::HashSetResult::InsertedNewEntry); } void Frame::unregister_viewport_client(ViewportClient& client) { bool was_removed = m_viewport_clients.remove(&client); - ASSERT(was_removed); + VERIFY(was_removed); } } diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index 7524f4fff9..fc9dbc8d02 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -37,7 +37,7 @@ StackingContext::StackingContext(Box& box, StackingContext* parent) : m_box(box) , m_parent(parent) { - ASSERT(m_parent != this); + VERIFY(m_parent != this); if (m_parent) { m_parent->m_children.append(this); diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp index f812d42dfc..07773c0f72 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp @@ -38,7 +38,7 @@ namespace Web::SVG { static void print_instruction(const PathInstruction& instruction) { - ASSERT(PATH_DEBUG); + VERIFY(PATH_DEBUG); auto& data = instruction.data; @@ -115,7 +115,7 @@ Vector<PathInstruction> PathDataParser::parse() while (!done()) parse_drawto(); if (!m_instructions.is_empty() && m_instructions[0].type != PathInstructionType::Move) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return m_instructions; } @@ -348,7 +348,7 @@ void PathDataParser::parse_whitespace(bool must_match_once) matched = true; } - ASSERT(!must_match_once || matched); + VERIFY(!must_match_once || matched); } void PathDataParser::parse_comma_whitespace() @@ -379,7 +379,7 @@ float PathDataParser::parse_fractional_constant() while (!done() && isdigit(ch())) builder.append(consume()); } else { - ASSERT(builder.length() > 0); + VERIFY(builder.length() > 0); } if (floating_point) @@ -398,7 +398,7 @@ float PathDataParser::parse_number() float PathDataParser::parse_flag() { if (!match('0') && !match('1')) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return consume() - '0'; } @@ -475,7 +475,7 @@ Gfx::Path& SVGPathElement::get_path() if (absolute) { path.move_to(point); } else { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); path.move_to(point + path.segments().last().point()); } break; @@ -488,13 +488,13 @@ Gfx::Path& SVGPathElement::get_path() if (absolute) { path.line_to(point); } else { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); path.line_to(point + path.segments().last().point()); } break; } case PathInstructionType::HorizontalLine: { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); auto last_point = path.segments().last().point(); if (absolute) { path.line_to(Gfx::FloatPoint { data[0], last_point.y() }); @@ -504,7 +504,7 @@ Gfx::Path& SVGPathElement::get_path() break; } case PathInstructionType::VerticalLine: { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); auto last_point = path.segments().last().point(); if (absolute) { path.line_to(Gfx::FloatPoint { last_point.x(), data[0] }); @@ -610,7 +610,7 @@ Gfx::Path& SVGPathElement::get_path() path.quadratic_bezier_curve_to(through, point); m_previous_control_point = through; } else { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); auto last_point = path.segments().last().point(); auto control_point = through + last_point; path.quadratic_bezier_curve_to(control_point, point + last_point); @@ -621,7 +621,7 @@ Gfx::Path& SVGPathElement::get_path() case PathInstructionType::SmoothQuadraticBezierCurve: { clear_last_control_point = false; - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); auto last_point = path.segments().last().point(); if (m_previous_control_point.is_null()) { @@ -650,7 +650,7 @@ Gfx::Path& SVGPathElement::get_path() // with these path instructions, let's just skip them continue; case PathInstructionType::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (clear_last_control_point) { diff --git a/Userland/Libraries/LibWeb/StylePropertiesModel.cpp b/Userland/Libraries/LibWeb/StylePropertiesModel.cpp index 123337db8e..fde0a4898a 100644 --- a/Userland/Libraries/LibWeb/StylePropertiesModel.cpp +++ b/Userland/Libraries/LibWeb/StylePropertiesModel.cpp @@ -58,7 +58,7 @@ String StylePropertiesModel::column_name(int column_index) const case Column::PropertyValue: return "Value"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } GUI::Variant StylePropertiesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const diff --git a/Userland/Libraries/LibWeb/TreeNode.h b/Userland/Libraries/LibWeb/TreeNode.h index 1673a52dc5..c304230e7b 100644 --- a/Userland/Libraries/LibWeb/TreeNode.h +++ b/Userland/Libraries/LibWeb/TreeNode.h @@ -39,15 +39,15 @@ class TreeNode : public Weakable<T> { public: void ref() { - ASSERT(!m_in_removed_last_ref); - ASSERT(m_ref_count); + VERIFY(!m_in_removed_last_ref); + VERIFY(m_ref_count); ++m_ref_count; } void unref() { - ASSERT(!m_in_removed_last_ref); - ASSERT(m_ref_count); + VERIFY(!m_in_removed_last_ref); + VERIFY(m_ref_count); if (!--m_ref_count) { if constexpr (IsBaseOf<DOM::Node, T>::value) { m_in_removed_last_ref = true; @@ -324,7 +324,7 @@ inline void TreeNode<T>::remove_all_children() template<typename T> inline NonnullRefPtr<T> TreeNode<T>::remove_child(NonnullRefPtr<T> node) { - ASSERT(node->m_parent == this); + VERIFY(node->m_parent == this); if (m_first_child == node) m_first_child = node->m_next_sibling; @@ -354,7 +354,7 @@ inline NonnullRefPtr<T> TreeNode<T>::remove_child(NonnullRefPtr<T> node) template<typename T> inline void TreeNode<T>::append_child(NonnullRefPtr<T> node, bool notify) { - ASSERT(!node->m_parent); + VERIFY(!node->m_parent); if (!static_cast<T*>(this)->is_child_allowed(*node)) return; @@ -380,8 +380,8 @@ inline void TreeNode<T>::insert_before(NonnullRefPtr<T> node, RefPtr<T> child, b if (!child) return append_child(move(node), notify); - ASSERT(!node->m_parent); - ASSERT(child->parent() == this); + VERIFY(!node->m_parent); + VERIFY(child->parent() == this); if (!static_cast<T*>(this)->is_child_allowed(*node)) return; @@ -412,7 +412,7 @@ inline void TreeNode<T>::insert_before(NonnullRefPtr<T> node, RefPtr<T> child, b template<typename T> inline void TreeNode<T>::prepend_child(NonnullRefPtr<T> node) { - ASSERT(!node->m_parent); + VERIFY(!node->m_parent); if (!static_cast<T*>(this)->is_child_allowed(*node)) return; diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWeb/WebContentClient.cpp index 56a25cf7f6..ed947be896 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.cpp +++ b/Userland/Libraries/LibWeb/WebContentClient.cpp @@ -39,7 +39,7 @@ WebContentClient::WebContentClient(OutOfProcessWebView& view) void WebContentClient::die() { - ASSERT(on_web_content_process_crash); + VERIFY(on_web_content_process_crash); on_web_content_process_crash(); } diff --git a/Userland/Libraries/LibX86/Instruction.cpp b/Userland/Libraries/LibX86/Instruction.cpp index c8713e723a..eb24a7db3a 100644 --- a/Userland/Libraries/LibX86/Instruction.cpp +++ b/Userland/Libraries/LibX86/Instruction.cpp @@ -195,7 +195,7 @@ static void build(InstructionDescriptor* table, u8 op, const char* mnemonic, Ins static void build_slash(InstructionDescriptor* table, u8 op, u8 slash, const char* mnemonic, InstructionFormat format, InstructionHandler handler, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { InstructionDescriptor& d = table[op]; - ASSERT(d.handler == nullptr); + VERIFY(d.handler == nullptr); d.format = MultibyteWithSlash; d.has_rm = true; if (!d.slashes) @@ -206,11 +206,11 @@ static void build_slash(InstructionDescriptor* table, u8 op, u8 slash, const cha static void build_slash_rm(InstructionDescriptor* table, u8 op, u8 slash, u8 rm, const char* mnemonic, InstructionFormat format, InstructionHandler handler) { - ASSERT((rm & 0xc0) == 0xc0); - ASSERT(((rm >> 3) & 7) == slash); + VERIFY((rm & 0xc0) == 0xc0); + VERIFY(((rm >> 3) & 7) == slash); InstructionDescriptor& d0 = table[op]; - ASSERT(d0.format == MultibyteWithSlash); + VERIFY(d0.format == MultibyteWithSlash); InstructionDescriptor& d = d0.slashes[slash]; if (!d.slashes) { @@ -937,19 +937,19 @@ String MemoryOrRegisterReference::to_string_o32(const Instruction& insn) const String MemoryOrRegisterReference::to_string_fpu_reg() const { - ASSERT(is_register()); + VERIFY(is_register()); return register_name(reg_fpu()); } String MemoryOrRegisterReference::to_string_fpu_mem(const Instruction& insn) const { - ASSERT(!is_register()); + VERIFY(!is_register()); return String::format("[%s]", to_string(insn).characters()); } String MemoryOrRegisterReference::to_string_fpu_ax16() const { - ASSERT(is_register()); + VERIFY(is_register()); return register_name(reg16()); } @@ -976,7 +976,7 @@ String MemoryOrRegisterReference::to_string_fpu64(const Instruction& insn) const String MemoryOrRegisterReference::to_string_fpu80(const Instruction& insn) const { - ASSERT(!is_register()); + VERIFY(!is_register()); return String::format("tbyte ptr [%s]", to_string(insn).characters()); } String MemoryOrRegisterReference::to_string_mm(const Instruction& insn) const @@ -1824,7 +1824,7 @@ void Instruction::to_string_internal(StringBuilder& builder, u32 origin, const S String Instruction::mnemonic() const { if (!m_descriptor) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return m_descriptor->mnemonic; } diff --git a/Userland/Libraries/LibX86/Instruction.h b/Userland/Libraries/LibX86/Instruction.h index 64505856ff..0473841724 100644 --- a/Userland/Libraries/LibX86/Instruction.h +++ b/Userland/Libraries/LibX86/Instruction.h @@ -641,7 +641,7 @@ ALWAYS_INLINE u32 MemoryOrRegisterReference::evaluate_sib(const CPU& cpu, Segmen base += cpu.ebp().value(); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } break; @@ -689,7 +689,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::write32(CPU& cpu, const Instructio template<typename CPU, typename T> ALWAYS_INLINE void MemoryOrRegisterReference::write64(CPU& cpu, const Instruction& insn, T value) { - ASSERT(!is_register()); + VERIFY(!is_register()); auto address = resolve(cpu, insn); cpu.write_memory64(address, value); } @@ -727,7 +727,7 @@ ALWAYS_INLINE typename CPU::ValueWithShadowType32 MemoryOrRegisterReference::rea template<typename CPU> ALWAYS_INLINE typename CPU::ValueWithShadowType64 MemoryOrRegisterReference::read64(CPU& cpu, const Instruction& insn) { - ASSERT(!is_register()); + VERIFY(!is_register()); auto address = resolve(cpu, insn); return cpu.read_memory64(address); } @@ -864,7 +864,7 @@ ALWAYS_INLINE Instruction::Instruction(InstructionStreamType& stream, bool o32, m_imm2 = stream.read32(); break; default: - ASSERT(imm2_bytes == 0); + VERIFY(imm2_bytes == 0); break; } @@ -879,7 +879,7 @@ ALWAYS_INLINE Instruction::Instruction(InstructionStreamType& stream, bool o32, m_imm1 = stream.read32(); break; default: - ASSERT(imm1_bytes == 0); + VERIFY(imm1_bytes == 0); break; } @@ -910,7 +910,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::decode(InstructionStreamType& stre m_displacement32 = stream.read32(); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } else { @@ -925,7 +925,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::decode(InstructionStreamType& stre m_displacement16 = stream.read16(); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } @@ -939,7 +939,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::decode16(InstructionStreamType&) if ((m_rm & 0x07) == 6) m_displacement_bytes = 2; else - ASSERT(m_displacement_bytes == 0); + VERIFY(m_displacement_bytes == 0); break; case 0x40: m_displacement_bytes = 1; @@ -987,7 +987,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::decode32(InstructionStreamType& st m_displacement_bytes = 4; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } diff --git a/Userland/MenuApplets/Audio/main.cpp b/Userland/MenuApplets/Audio/main.cpp index 0e7e8236c4..4bdcaa7d86 100644 --- a/Userland/MenuApplets/Audio/main.cpp +++ b/Userland/MenuApplets/Audio/main.cpp @@ -186,7 +186,7 @@ private: if (m_audio_volume >= pair.volume_threshold) return *pair.bitmap; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void reposition_slider_window() { m_slider_window->set_rect(window()->rect_in_menubar().x() - 20, 19, 50, 100); } diff --git a/Userland/MenuApplets/ClipboardHistory/ClipboardHistoryModel.cpp b/Userland/MenuApplets/ClipboardHistory/ClipboardHistoryModel.cpp index 9662c64448..2afbeca41a 100644 --- a/Userland/MenuApplets/ClipboardHistory/ClipboardHistoryModel.cpp +++ b/Userland/MenuApplets/ClipboardHistory/ClipboardHistoryModel.cpp @@ -47,7 +47,7 @@ String ClipboardHistoryModel::column_name(int column) const case Column::Size: return "Size"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -101,7 +101,7 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode case Column::Size: return AK::human_readable_size(data_and_type.data.size()); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/MenuApplets/ResourceGraph/main.cpp b/Userland/MenuApplets/ResourceGraph/main.cpp index a7e91ba233..fbb271d164 100644 --- a/Userland/MenuApplets/ResourceGraph/main.cpp +++ b/Userland/MenuApplets/ResourceGraph/main.cpp @@ -95,7 +95,7 @@ private: break; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } set_tooltip(m_tooltip); update(); @@ -175,7 +175,7 @@ private: auto file_contents = m_proc_mem->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); auto& obj = json.value().as_object(); unsigned kmalloc_allocated = obj.get("kmalloc_allocated").to_u32(); unsigned kmalloc_available = obj.get("kmalloc_available").to_u32(); diff --git a/Userland/Services/AudioServer/Mixer.cpp b/Userland/Services/AudioServer/Mixer.cpp index 66a33ed23d..70f791ba8a 100644 --- a/Userland/Services/AudioServer/Mixer.cpp +++ b/Userland/Services/AudioServer/Mixer.cpp @@ -125,8 +125,8 @@ void Mixer::mix() stream << out_sample; } - ASSERT(stream.is_end()); - ASSERT(!stream.has_any_error()); + VERIFY(stream.is_end()); + VERIFY(!stream.has_any_error()); m_device->write(stream.data(), stream.size()); } } diff --git a/Userland/Services/AudioServer/main.cpp b/Userland/Services/AudioServer/main.cpp index ee7c8ca8fd..ff71b5b6e1 100644 --- a/Userland/Services/AudioServer/main.cpp +++ b/Userland/Services/AudioServer/main.cpp @@ -40,7 +40,7 @@ int main(int, char**) auto server = Core::LocalServer::construct(); bool ok = server->take_over_from_system_server(); - ASSERT(ok); + VERIFY(ok); server->on_ready_to_accept = [&] { auto client_socket = server->accept(); if (!client_socket) { diff --git a/Userland/Services/ChessEngine/ChessEngine.cpp b/Userland/Services/ChessEngine/ChessEngine.cpp index e45965d771..0e9ebc6159 100644 --- a/Userland/Services/ChessEngine/ChessEngine.cpp +++ b/Userland/Services/ChessEngine/ChessEngine.cpp @@ -41,10 +41,10 @@ void ChessEngine::handle_uci() void ChessEngine::handle_position(const PositionCommand& command) { // FIXME: Implement fen board position. - ASSERT(!command.fen().has_value()); + VERIFY(!command.fen().has_value()); m_board = Chess::Board(); for (auto& move : command.moves()) { - ASSERT(m_board.apply_move(move)); + VERIFY(m_board.apply_move(move)); } } @@ -52,7 +52,7 @@ void ChessEngine::handle_go(const GoCommand& command) { // FIXME: A better algorithm than naive mcts. // FIXME: Add different ways to terminate search. - ASSERT(command.movetime.has_value()); + VERIFY(command.movetime.has_value()); srand(arc4random()); diff --git a/Userland/Services/ChessEngine/MCTSTree.cpp b/Userland/Services/ChessEngine/MCTSTree.cpp index dc195089fe..a0004e8017 100644 --- a/Userland/Services/ChessEngine/MCTSTree.cpp +++ b/Userland/Services/ChessEngine/MCTSTree.cpp @@ -51,13 +51,13 @@ MCTSTree& MCTSTree::select_leaf() node = &child; } } - ASSERT(node); + VERIFY(node); return node->select_leaf(); } MCTSTree& MCTSTree::expand() { - ASSERT(!expanded() || m_children.size() == 0); + VERIFY(!expanded() || m_children.size() == 0); if (!m_moves_generated) { m_board.generate_moves([&](Chess::Move move) { @@ -78,12 +78,12 @@ MCTSTree& MCTSTree::expand() return child; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int MCTSTree::simulate_game() const { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); Chess::Board clone = m_board; while (!clone.game_finished()) { clone.apply_move(clone.random_move()); @@ -135,7 +135,7 @@ Chess::Move MCTSTree::best_move() const Chess::Move best_move = { { 0, 0 }, { 0, 0 } }; double best_score = -double(INFINITY); - ASSERT(m_children.size()); + VERIFY(m_children.size()); for (auto& node : m_children) { double node_score = node.expected_value() * score_multiplier; if (node_score >= best_score) { diff --git a/Userland/Services/Clipboard/main.cpp b/Userland/Services/Clipboard/main.cpp index 94efa7a67e..aad3af04b4 100644 --- a/Userland/Services/Clipboard/main.cpp +++ b/Userland/Services/Clipboard/main.cpp @@ -48,7 +48,7 @@ int main(int, char**) auto server = Core::LocalServer::construct(); bool ok = server->take_over_from_system_server(); - ASSERT(ok); + VERIFY(ok); if (pledge("stdio recvfd sendfd accept", nullptr) < 0) { perror("pledge"); diff --git a/Userland/Services/CrashDaemon/main.cpp b/Userland/Services/CrashDaemon/main.cpp index b651675864..6b27e3d41b 100644 --- a/Userland/Services/CrashDaemon/main.cpp +++ b/Userland/Services/CrashDaemon/main.cpp @@ -40,7 +40,7 @@ static void wait_until_coredump_is_ready(const String& coredump_path) struct stat statbuf; if (stat(coredump_path.characters(), &statbuf) < 0) { perror("stat"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (statbuf.st_mode & 0400) // Check if readable break; @@ -92,7 +92,7 @@ int main() Core::BlockingFileWatcher watcher { "/tmp/coredump" }; while (true) { auto event = watcher.wait_for_event(); - ASSERT(event.has_value()); + VERIFY(event.has_value()); if (event.value().type != Core::FileWatcherEvent::Type::ChildAdded) continue; auto coredump_path = event.value().child_path; diff --git a/Userland/Services/DHCPClient/DHCPv4.h b/Userland/Services/DHCPClient/DHCPv4.h index c5738c6cf7..23ffb446a6 100644 --- a/Userland/Services/DHCPClient/DHCPv4.h +++ b/Userland/Services/DHCPClient/DHCPv4.h @@ -269,9 +269,9 @@ public: void add_option(DHCPOption option, u8 length, const void* data) { - ASSERT(m_can_add); + VERIFY(m_can_add); // we need enough space to fit the option value, its length, and its data - ASSERT(next_option_offset + length + 2 < DHCPV4_OPTION_FIELD_MAX_LENGTH); + VERIFY(next_option_offset + length + 2 < DHCPV4_OPTION_FIELD_MAX_LENGTH); auto* options = peek().options(); options[next_option_offset++] = (u8)option; diff --git a/Userland/Services/DHCPClient/DHCPv4Client.cpp b/Userland/Services/DHCPClient/DHCPv4Client.cpp index 74ddb40ee4..8bf421ab81 100644 --- a/Userland/Services/DHCPClient/DHCPv4Client.cpp +++ b/Userland/Services/DHCPClient/DHCPv4Client.cpp @@ -126,7 +126,7 @@ DHCPv4Client::DHCPv4Client(Vector<InterfaceDescriptor> ifnames) if (!m_server->bind({}, 68)) { dbgln("The server we just created somehow came already bound, refusing to continue"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } for (auto& iface : m_ifnames) @@ -233,7 +233,7 @@ void DHCPv4Client::process_incoming(const DHCPv4Packet& packet) case DHCPMessageType::DHCPDecline: default: dbgln("I dunno what to do with this {}", (u8)value); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } diff --git a/Userland/Services/DHCPClient/main.cpp b/Userland/Services/DHCPClient/main.cpp index 9e77dfb816..722cee2b2d 100644 --- a/Userland/Services/DHCPClient/main.cpp +++ b/Userland/Services/DHCPClient/main.cpp @@ -45,7 +45,7 @@ static u8 mac_part(const Vector<String>& parts, size_t index) static MACAddress mac_from_string(const String& str) { auto chunks = str.split(':'); - ASSERT(chunks.size() == 6); // should we...worry about this? + VERIFY(chunks.size() == 6); // should we...worry about this? return { mac_part(chunks, 0), mac_part(chunks, 1), mac_part(chunks, 2), mac_part(chunks, 3), mac_part(chunks, 4), mac_part(chunks, 5) diff --git a/Userland/Services/LaunchServer/Launcher.cpp b/Userland/Services/LaunchServer/Launcher.cpp index ad6d025035..5b359179ce 100644 --- a/Userland/Services/LaunchServer/Launcher.cpp +++ b/Userland/Services/LaunchServer/Launcher.cpp @@ -85,13 +85,13 @@ String Handler::to_details_str() const Launcher::Launcher() { - ASSERT(s_the == nullptr); + VERIFY(s_the == nullptr); s_the = this; } Launcher& Launcher::the() { - ASSERT(s_the); + VERIFY(s_the); return *s_the; } diff --git a/Userland/Services/LaunchServer/main.cpp b/Userland/Services/LaunchServer/main.cpp index 2535d1e8bb..d7e3b768c7 100644 --- a/Userland/Services/LaunchServer/main.cpp +++ b/Userland/Services/LaunchServer/main.cpp @@ -48,7 +48,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv) } bool ok = server->take_over_from_system_server(); - ASSERT(ok); + VERIFY(ok); server->on_ready_to_accept = [&] { auto client_socket = server->accept(); if (!client_socket) { diff --git a/Userland/Services/LookupServer/DNSPacket.cpp b/Userland/Services/LookupServer/DNSPacket.cpp index 0d30ac6761..5ff8685742 100644 --- a/Userland/Services/LookupServer/DNSPacket.cpp +++ b/Userland/Services/LookupServer/DNSPacket.cpp @@ -41,14 +41,14 @@ void DNSPacket::add_question(const DNSQuestion& question) { m_questions.empend(question); - ASSERT(m_questions.size() <= UINT16_MAX); + VERIFY(m_questions.size() <= UINT16_MAX); } void DNSPacket::add_answer(const DNSAnswer& answer) { m_answers.empend(answer); - ASSERT(m_answers.size() <= UINT16_MAX); + VERIFY(m_answers.size() <= UINT16_MAX); } ByteBuffer DNSPacket::to_byte_buffer() const diff --git a/Userland/Services/LookupServer/DNSPacket.h b/Userland/Services/LookupServer/DNSPacket.h index bfda9cd5e9..a636e2fa08 100644 --- a/Userland/Services/LookupServer/DNSPacket.h +++ b/Userland/Services/LookupServer/DNSPacket.h @@ -69,13 +69,13 @@ public: u16 question_count() const { - ASSERT(m_questions.size() <= UINT16_MAX); + VERIFY(m_questions.size() <= UINT16_MAX); return m_questions.size(); } u16 answer_count() const { - ASSERT(m_answers.size() <= UINT16_MAX); + VERIFY(m_answers.size() <= UINT16_MAX); return m_answers.size(); } diff --git a/Userland/Services/LookupServer/LookupServer.cpp b/Userland/Services/LookupServer/LookupServer.cpp index 2185c4fea1..c1523d713c 100644 --- a/Userland/Services/LookupServer/LookupServer.cpp +++ b/Userland/Services/LookupServer/LookupServer.cpp @@ -47,13 +47,13 @@ static LookupServer* s_the; LookupServer& LookupServer::the() { - ASSERT(s_the); + VERIFY(s_the); return *s_the; } LookupServer::LookupServer() { - ASSERT(s_the == nullptr); + VERIFY(s_the == nullptr); s_the = this; auto config = Core::ConfigFile::get_for_system("LookupServer"); @@ -79,7 +79,7 @@ LookupServer::LookupServer() IPC::new_client_connection<ClientConnection>(socket.release_nonnull(), client_id); }; bool ok = m_local_server->take_over_from_system_server(); - ASSERT(ok); + VERIFY(ok); } void LookupServer::load_etc_hosts() diff --git a/Userland/Services/NotificationServer/main.cpp b/Userland/Services/NotificationServer/main.cpp index 3d00b380c3..9bf0e11ab1 100644 --- a/Userland/Services/NotificationServer/main.cpp +++ b/Userland/Services/NotificationServer/main.cpp @@ -44,7 +44,7 @@ int main(int argc, char** argv) auto server = Core::LocalServer::construct(); bool ok = server->take_over_from_system_server(); - ASSERT(ok); + VERIFY(ok); server->on_ready_to_accept = [&] { auto client_socket = server->accept(); if (!client_socket) { diff --git a/Userland/Services/ProtocolServer/ClientConnection.cpp b/Userland/Services/ProtocolServer/ClientConnection.cpp index 555c441def..151fbcab27 100644 --- a/Userland/Services/ProtocolServer/ClientConnection.cpp +++ b/Userland/Services/ProtocolServer/ClientConnection.cpp @@ -103,7 +103,7 @@ void ClientConnection::did_receive_headers(Badge<Download>, Download& download) void ClientConnection::did_finish_download(Badge<Download>, Download& download, bool success) { - ASSERT(download.total_size().has_value()); + VERIFY(download.total_size().has_value()); post_message(Messages::ProtocolClient::DownloadFinished(download.id(), success, download.total_size().value())); diff --git a/Userland/Services/ProtocolServer/Protocol.cpp b/Userland/Services/ProtocolServer/Protocol.cpp index ee8248dfef..de4a4e8a49 100644 --- a/Userland/Services/ProtocolServer/Protocol.cpp +++ b/Userland/Services/ProtocolServer/Protocol.cpp @@ -49,7 +49,7 @@ Protocol::Protocol(const String& name) Protocol::~Protocol() { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Result<Protocol::Pipe, String> Protocol::get_pipe_for_download() diff --git a/Userland/Services/ProtocolServer/main.cpp b/Userland/Services/ProtocolServer/main.cpp index 5969a23c9e..6fdb429674 100644 --- a/Userland/Services/ProtocolServer/main.cpp +++ b/Userland/Services/ProtocolServer/main.cpp @@ -63,7 +63,7 @@ int main(int, char**) [[maybe_unused]] auto https = new ProtocolServer::HttpsProtocol; auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server(); - ASSERT(socket); + VERIFY(socket); IPC::new_client_connection<ProtocolServer::ClientConnection>(socket.release_nonnull(), 1); return event_loop.exec(); } diff --git a/Userland/Services/SymbolServer/ClientConnection.cpp b/Userland/Services/SymbolServer/ClientConnection.cpp index 849b87d6da..efa3f1a3e4 100644 --- a/Userland/Services/SymbolServer/ClientConnection.cpp +++ b/Userland/Services/SymbolServer/ClientConnection.cpp @@ -82,7 +82,7 @@ OwnPtr<Messages::SymbolServer::SymbolicateResponse> ClientConnection::handle(con } auto it = s_cache.find(path); - ASSERT(it != s_cache.end()); + VERIFY(it != s_cache.end()); auto& cached_elf = it->value; if (!cached_elf) diff --git a/Userland/Services/SymbolServer/main.cpp b/Userland/Services/SymbolServer/main.cpp index f975f3b37b..da74cc2270 100644 --- a/Userland/Services/SymbolServer/main.cpp +++ b/Userland/Services/SymbolServer/main.cpp @@ -63,7 +63,7 @@ int main(int, char**) } bool ok = server->take_over_from_system_server(); - ASSERT(ok); + VERIFY(ok); server->on_ready_to_accept = [&] { auto client_socket = server->accept(); if (!client_socket) { diff --git a/Userland/Services/SystemMenu/main.cpp b/Userland/Services/SystemMenu/main.cpp index d5897d3c60..b65fb6bdab 100644 --- a/Userland/Services/SystemMenu/main.cpp +++ b/Userland/Services/SystemMenu/main.cpp @@ -190,7 +190,7 @@ NonnullRefPtr<GUI::Menu> build_system_menu() auto& theme = g_themes[theme_identifier]; dbgln("Theme switched to {} at path {}", theme.name, theme.path); auto response = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetSystemTheme>(theme.path, theme.name); - ASSERT(response->success()); + VERIFY(response->success()); }); if (theme.name == current_theme_name) action->set_checked(true); diff --git a/Userland/Services/SystemServer/Service.cpp b/Userland/Services/SystemServer/Service.cpp index bd21306404..2529dcdd90 100644 --- a/Userland/Services/SystemServer/Service.cpp +++ b/Userland/Services/SystemServer/Service.cpp @@ -53,11 +53,11 @@ Service* Service::find_by_pid(pid_t pid) void Service::setup_socket() { - ASSERT(!m_socket_path.is_null()); - ASSERT(m_socket_fd == -1); + VERIFY(!m_socket_path.is_null()); + VERIFY(m_socket_fd == -1); auto ok = Core::File::ensure_parent_directories(m_socket_path); - ASSERT(ok); + VERIFY(ok); // Note: we use SOCK_CLOEXEC here to make sure we don't leak every socket to // all the clients. We'll make the one we do need to pass down !CLOEXEC later @@ -65,47 +65,47 @@ void Service::setup_socket() m_socket_fd = socket(AF_LOCAL, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0); if (m_socket_fd < 0) { perror("socket"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (m_account.has_value()) { auto& account = m_account.value(); if (fchown(m_socket_fd, account.uid(), account.gid()) < 0) { perror("fchown"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } if (fchmod(m_socket_fd, m_socket_permissions) < 0) { perror("fchmod"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto socket_address = Core::SocketAddress::local(m_socket_path); auto un_optional = socket_address.to_sockaddr_un(); if (!un_optional.has_value()) { dbgln("Socket name {} is too long. BUG! This should have failed earlier!", m_socket_path); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto un = un_optional.value(); int rc = bind(m_socket_fd, (const sockaddr*)&un, sizeof(un)); if (rc < 0) { perror("bind"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } rc = listen(m_socket_fd, 16); if (rc < 0) { perror("listen"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } void Service::setup_notifier() { - ASSERT(m_lazy); - ASSERT(m_socket_fd >= 0); - ASSERT(!m_socket_notifier); + VERIFY(m_lazy); + VERIFY(m_socket_fd >= 0); + VERIFY(!m_socket_notifier); m_socket_notifier = Core::Notifier::construct(m_socket_fd, Core::Notifier::Event::Read, this); m_socket_notifier->on_ready_to_read = [this] { @@ -134,7 +134,7 @@ void Service::handle_socket_connection() void Service::activate() { - ASSERT(m_pid < 0); + VERIFY(m_pid < 0); if (m_lazy) setup_notifier(); @@ -158,7 +158,7 @@ void Service::spawn(int socket_fd) if (!m_working_directory.is_null()) { if (chdir(m_working_directory.characters()) < 0) { perror("chdir"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -167,16 +167,16 @@ void Service::spawn(int socket_fd) int rc = sched_setparam(0, &p); if (rc < 0) { perror("sched_setparam"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (!m_stdio_file_path.is_null()) { close(STDIN_FILENO); int fd = open(m_stdio_file_path.characters(), O_RDWR, 0); - ASSERT(fd <= 0); + VERIFY(fd <= 0); if (fd < 0) { perror("open"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } dup2(STDIN_FILENO, STDOUT_FILENO); dup2(STDIN_FILENO, STDERR_FILENO); @@ -193,14 +193,14 @@ void Service::spawn(int socket_fd) close(STDERR_FILENO); int fd = open("/dev/null", O_RDWR); - ASSERT(fd == STDIN_FILENO); + VERIFY(fd == STDIN_FILENO); dup2(STDIN_FILENO, STDOUT_FILENO); dup2(STDIN_FILENO, STDERR_FILENO); } if (socket_fd >= 0) { - ASSERT(!m_socket_path.is_null()); - ASSERT(socket_fd > 3); + VERIFY(!m_socket_path.is_null()); + VERIFY(socket_fd > 3); dup2(socket_fd, 3); // The new descriptor is !CLOEXEC here. setenv("SOCKET_TAKEOVER", "1", true); @@ -226,7 +226,7 @@ void Service::spawn(int socket_fd) rc = execv(argv[0], argv); perror("exec"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else if (!m_multi_instance) { // We are the parent. m_pid = pid; @@ -236,8 +236,8 @@ void Service::spawn(int socket_fd) void Service::did_exit(int exit_code) { - ASSERT(m_pid > 0); - ASSERT(!m_multi_instance); + VERIFY(m_pid > 0); + VERIFY(!m_multi_instance); dbgln("Service {} has exited with exit code {}", name(), exit_code); @@ -271,7 +271,7 @@ void Service::did_exit(int exit_code) Service::Service(const Core::ConfigFile& config, const StringView& name) : Core::Object(nullptr) { - ASSERT(config.has_group(name)); + VERIFY(config.has_group(name)); set_name(name); m_executable_path = config.read_entry(name, "Executable", String::formatted("/bin/{}", this->name())); @@ -286,7 +286,7 @@ Service::Service(const Core::ConfigFile& config, const StringView& name) else if (prio == "high") m_priority = 50; else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); m_keep_alive = config.read_bool_entry(name, "KeepAlive"); m_lazy = config.read_bool_entry(name, "Lazy"); @@ -309,13 +309,13 @@ Service::Service(const Core::ConfigFile& config, const StringView& name) m_socket_path = config.read_entry(name, "Socket"); // Lazy requires Socket. - ASSERT(!m_lazy || !m_socket_path.is_null()); + VERIFY(!m_lazy || !m_socket_path.is_null()); // AcceptSocketConnections always requires Socket, Lazy, and MultiInstance. - ASSERT(!m_accept_socket_connections || (!m_socket_path.is_null() && m_lazy && m_multi_instance)); + VERIFY(!m_accept_socket_connections || (!m_socket_path.is_null() && m_lazy && m_multi_instance)); // MultiInstance doesn't work with KeepAlive. - ASSERT(!m_multi_instance || !m_keep_alive); + VERIFY(!m_multi_instance || !m_keep_alive); // Socket path (plus NUL) must fit into the structs sent to the Kernel. - ASSERT(m_socket_path.length() < UNIX_PATH_MAX); + VERIFY(m_socket_path.length() < UNIX_PATH_MAX); if (!m_socket_path.is_null() && is_enabled()) { auto socket_permissions_string = config.read_entry(name, "SocketPermissions", "0600"); diff --git a/Userland/Services/SystemServer/main.cpp b/Userland/Services/SystemServer/main.cpp index f20728b506..8773dc3b45 100644 --- a/Userland/Services/SystemServer/main.cpp +++ b/Userland/Services/SystemServer/main.cpp @@ -88,7 +88,7 @@ static void chown_wrapper(const char* path, uid_t uid, gid_t gid) { int rc = chown(path, uid, gid); if (rc < 0 && errno != ENOENT) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -98,22 +98,22 @@ static void prepare_devfs() int rc = mount(-1, "/dev", "dev", 0); if (rc != 0) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } rc = mkdir("/dev/pts", 0755); if (rc != 0) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } rc = mount(-1, "/dev/pts", "devpts", 0); if (rc != 0) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } rc = symlink("/dev/random", "/dev/urandom"); if (rc < 0) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // FIXME: Find a better way to chown without hardcoding the gid! @@ -140,15 +140,15 @@ static void prepare_devfs() rc = symlink("/proc/self/fd/0", "/dev/stdin"); if (rc < 0) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } rc = symlink("/proc/self/fd/1", "/dev/stdout"); if (rc < 0) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } rc = symlink("/proc/self/fd/2", "/dev/stderr"); if (rc < 0) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -159,11 +159,11 @@ static void mount_all_filesystems() if (pid < 0) { perror("fork"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else if (pid == 0) { execl("/bin/mount", "mount", "-a", nullptr); perror("exec"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { wait(nullptr); } @@ -176,7 +176,7 @@ static void create_tmp_rpc_directory() auto rc = mkdir("/tmp/rpc", 01777); if (rc < 0) { perror("mkdir(/tmp/rpc)"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } umask(old_umask); } @@ -188,7 +188,7 @@ static void create_tmp_coredump_directory() auto rc = mkdir("/tmp/coredump", 0755); if (rc < 0) { perror("mkdir(/tmp/coredump)"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } umask(old_umask); } diff --git a/Userland/Services/Taskbar/TaskbarButton.cpp b/Userland/Services/Taskbar/TaskbarButton.cpp index 69103ca5e0..d40a61c49c 100644 --- a/Userland/Services/Taskbar/TaskbarButton.cpp +++ b/Userland/Services/Taskbar/TaskbarButton.cpp @@ -105,7 +105,7 @@ static void paint_custom_progress_bar(GUI::Painter& painter, const Gfx::IntRect& void TaskbarButton::paint_event(GUI::PaintEvent& event) { - ASSERT(icon()); + VERIFY(icon()); auto& icon = *this->icon(); auto& font = is_checked() ? Gfx::FontDatabase::default_bold_font() : this->font(); auto& window = WindowList::the().ensure_window(m_identifier); diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp index 1b0e344c7f..e1de201504 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.cpp +++ b/Userland/Services/Taskbar/TaskbarWindow.cpp @@ -130,7 +130,7 @@ void TaskbarWindow::create_quick_launch_bar() } execl(app_executable.characters(), app_executable.characters(), nullptr); perror("execl"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { if (disown(pid) < 0) perror("disown"); @@ -291,7 +291,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event) } else if (window_owner) { // check the window owner's button if the modal's window button // would have been checked - ASSERT(window.is_modal()); + VERIFY(window.is_modal()); update_window_button(*window_owner, window.is_active()); } break; diff --git a/Userland/Services/TelnetServer/Client.cpp b/Userland/Services/TelnetServer/Client.cpp index 5e1accf9d1..f063b7ee45 100644 --- a/Userland/Services/TelnetServer/Client.cpp +++ b/Userland/Services/TelnetServer/Client.cpp @@ -176,7 +176,7 @@ void Client::send_commands(Vector<Command> commands) for (auto& command : commands) stream << (u8)IAC << command.command << command.subcommand; - ASSERT(stream.is_end()); + VERIFY(stream.is_end()); m_socket->write(buffer.data(), buffer.size()); } diff --git a/Userland/Services/TelnetServer/main.cpp b/Userland/Services/TelnetServer/main.cpp index dc5ddf1a04..3adda4b83a 100644 --- a/Userland/Services/TelnetServer/main.cpp +++ b/Userland/Services/TelnetServer/main.cpp @@ -99,7 +99,7 @@ static void run_command(int ptm_fd, String command) perror("execve"); exit(1); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp index f355a8ef2b..b28f98323a 100644 --- a/Userland/Services/WebContent/PageHost.cpp +++ b/Userland/Services/WebContent/PageHost.cpp @@ -116,7 +116,7 @@ void PageHost::page_did_change_selection() void PageHost::page_did_layout() { auto* layout_root = this->layout_root(); - ASSERT(layout_root); + VERIFY(layout_root); auto content_size = enclosing_int_rect(layout_root->absolute_rect()).size(); m_client.post_message(Messages::WebContentClient::DidLayout(content_size)); } diff --git a/Userland/Services/WebContent/main.cpp b/Userland/Services/WebContent/main.cpp index e6f335e640..bad662ccd8 100644 --- a/Userland/Services/WebContent/main.cpp +++ b/Userland/Services/WebContent/main.cpp @@ -54,7 +54,7 @@ int main(int, char**) } auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server(); - ASSERT(socket); + VERIFY(socket); IPC::new_client_connection<WebContent::ClientConnection>(socket.release_nonnull(), 1); return event_loop.exec(); } diff --git a/Userland/Services/WebServer/Client.cpp b/Userland/Services/WebServer/Client.cpp index 9364eada4f..985a27eec0 100644 --- a/Userland/Services/WebServer/Client.cpp +++ b/Userland/Services/WebServer/Client.cpp @@ -174,7 +174,7 @@ static String folder_image_data() static String cache; if (cache.is_empty()) { auto file_or_error = MappedFile::map("/res/icons/16x16/filetype-folder.png"); - ASSERT(!file_or_error.is_error()); + VERIFY(!file_or_error.is_error()); cache = encode_base64(file_or_error.value()->bytes()); } return cache; @@ -185,7 +185,7 @@ static String file_image_data() static String cache; if (cache.is_empty()) { auto file_or_error = MappedFile::map("/res/icons/16x16/filetype-unknown.png"); - ASSERT(!file_or_error.is_error()); + VERIFY(!file_or_error.is_error()); cache = encode_base64(file_or_error.value()->bytes()); } return cache; diff --git a/Userland/Services/WebServer/main.cpp b/Userland/Services/WebServer/main.cpp index 8c326c84a8..f74c0bca8f 100644 --- a/Userland/Services/WebServer/main.cpp +++ b/Userland/Services/WebServer/main.cpp @@ -68,7 +68,7 @@ int main(int argc, char** argv) server->on_ready_to_accept = [&] { auto client_socket = server->accept(); - ASSERT(client_socket); + VERIFY(client_socket); auto client = WebServer::Client::construct(client_socket.release_nonnull(), real_root_path, server); client->start(); }; diff --git a/Userland/Services/WindowServer/AppletManager.cpp b/Userland/Services/WindowServer/AppletManager.cpp index 509d5de3d0..4b7c6d5962 100644 --- a/Userland/Services/WindowServer/AppletManager.cpp +++ b/Userland/Services/WindowServer/AppletManager.cpp @@ -49,7 +49,7 @@ AppletManager::~AppletManager() AppletManager& AppletManager::the() { - ASSERT(s_the); + VERIFY(s_the); return *s_the; } diff --git a/Userland/Services/WindowServer/ClientConnection.cpp b/Userland/Services/WindowServer/ClientConnection.cpp index 7347eb8a78..9536e1346c 100644 --- a/Userland/Services/WindowServer/ClientConnection.cpp +++ b/Userland/Services/WindowServer/ClientConnection.cpp @@ -537,14 +537,14 @@ void ClientConnection::destroy_window(Window& window, Vector<i32>& destroyed_win for (auto& child_window : window.child_windows()) { if (!child_window) continue; - ASSERT(child_window->window_id() != window.window_id()); + VERIFY(child_window->window_id() != window.window_id()); destroy_window(*child_window, destroyed_window_ids); } for (auto& accessory_window : window.accessory_windows()) { if (!accessory_window) continue; - ASSERT(accessory_window->window_id() != window.window_id()); + VERIFY(accessory_window->window_id() != window.window_id()); destroy_window(*accessory_window, destroyed_window_ids); } diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp index c1a15d32e3..c7125ccaf4 100644 --- a/Userland/Services/WindowServer/Compositor.cpp +++ b/Userland/Services/WindowServer/Compositor.cpp @@ -221,15 +221,15 @@ void Compositor::compose() auto prepare_rect = [&](const Gfx::IntRect& rect) { dbgln_if(COMPOSE_DEBUG, " -> flush opaque: {}", rect); - ASSERT(!flush_rects.intersects(rect)); - ASSERT(!flush_transparent_rects.intersects(rect)); + VERIFY(!flush_rects.intersects(rect)); + VERIFY(!flush_transparent_rects.intersects(rect)); flush_rects.add(rect); check_restore_cursor_back(rect); }; auto prepare_transparency_rect = [&](const Gfx::IntRect& rect) { dbgln_if(COMPOSE_DEBUG, " -> flush transparent: {}", rect); - ASSERT(!flush_rects.intersects(rect)); + VERIFY(!flush_rects.intersects(rect)); for (auto& r : flush_transparent_rects.rects()) { if (r == rect) return; @@ -261,7 +261,7 @@ void Compositor::compose() auto src_rect = Gfx::FloatRect { rect.x() * hscale, rect.y() * vscale, rect.width() * hscale, rect.height() * vscale }; painter.draw_scaled_bitmap(rect, *m_wallpaper, src_rect); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } }; @@ -434,7 +434,7 @@ void Compositor::compose() } // Check that there are no overlapping transparent and opaque flush rectangles - ASSERT(![&]() { + VERIFY(![&]() { for (auto& rect_transparent : flush_transparent_rects.rects()) { for (auto& rect_opaque : flush_rects.rects()) { if (rect_opaque.intersects(rect_transparent)) { @@ -649,7 +649,7 @@ bool Compositor::set_wallpaper(const String& path, Function<void(bool)>&& callba void Compositor::flip_buffers() { - ASSERT(m_screen_can_set_buffer); + VERIFY(m_screen_can_set_buffer); swap(m_front_bitmap, m_back_bitmap); swap(m_front_painter, m_back_painter); Screen::the().set_buffer(m_buffers_are_flipped ? 0 : 1); @@ -838,7 +838,7 @@ void Compositor::increment_display_link_count(Badge<ClientConnection>) void Compositor::decrement_display_link_count(Badge<ClientConnection>) { - ASSERT(m_display_link_count); + VERIFY(m_display_link_count); --m_display_link_count; if (!m_display_link_count) m_display_link_notify_timer->stop(); @@ -1024,7 +1024,7 @@ void Compositor::recompute_occlusions() if (!transparency_rects.is_empty()) have_transparent = true; - ASSERT(!visible_opaque.intersects(transparency_rects)); + VERIFY(!visible_opaque.intersects(transparency_rects)); // Determine visible area for the window below if (w.is_opaque()) { @@ -1089,9 +1089,9 @@ void Compositor::recompute_occlusions() dbgln(" transparent: {}", r); } - ASSERT(!w.opaque_rects().intersects(m_opaque_wallpaper_rects)); - ASSERT(!w.transparency_rects().intersects(m_opaque_wallpaper_rects)); - ASSERT(!w.transparency_wallpaper_rects().intersects(m_opaque_wallpaper_rects)); + VERIFY(!w.opaque_rects().intersects(m_opaque_wallpaper_rects)); + VERIFY(!w.transparency_rects().intersects(m_opaque_wallpaper_rects)); + VERIFY(!w.transparency_wallpaper_rects().intersects(m_opaque_wallpaper_rects)); return IterationDecision::Continue; }); } diff --git a/Userland/Services/WindowServer/Cursor.cpp b/Userland/Services/WindowServer/Cursor.cpp index f5044dc71f..d25130dcc6 100644 --- a/Userland/Services/WindowServer/Cursor.cpp +++ b/Userland/Services/WindowServer/Cursor.cpp @@ -125,7 +125,7 @@ Cursor::Cursor(NonnullRefPtr<Gfx::Bitmap>&& bitmap, const CursorParams& cursor_p , m_rect(m_bitmap->rect()) { if (m_params.frames() > 1) { - ASSERT(m_rect.width() % m_params.frames() == 0); + VERIFY(m_rect.width() % m_params.frames() == 0); m_rect.set_width(m_rect.width() / m_params.frames()); } } @@ -182,7 +182,7 @@ RefPtr<Cursor> Cursor::create(Gfx::StandardCursor standard_cursor) case Gfx::StandardCursor::Wait: return WindowManager::the().wait_cursor(); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Services/WindowServer/EventLoop.cpp b/Userland/Services/WindowServer/EventLoop.cpp index abee0afc62..30611aa97f 100644 --- a/Userland/Services/WindowServer/EventLoop.cpp +++ b/Userland/Services/WindowServer/EventLoop.cpp @@ -52,7 +52,7 @@ EventLoop::EventLoop() m_mouse_fd = open("/dev/mouse", O_RDONLY | O_NONBLOCK | O_CLOEXEC); bool ok = m_server->take_over_from_system_server(); - ASSERT(ok); + VERIFY(ok); m_server->on_ready_to_accept = [this] { auto client_socket = m_server->accept(); @@ -145,7 +145,7 @@ void EventLoop::drain_keyboard() ssize_t nread = read(m_keyboard_fd, (u8*)&event, sizeof(::KeyEvent)); if (nread == 0) break; - ASSERT(nread == sizeof(::KeyEvent)); + VERIFY(nread == sizeof(::KeyEvent)); screen.on_receive_keyboard_data(event); } } diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index 7efe89454c..3cee99bc05 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -172,7 +172,7 @@ int Menu::visible_item_count() const { if (!is_scrollable()) return m_items.size(); - ASSERT(m_menu_window); + VERIFY(m_menu_window); // Make space for up/down arrow indicators return m_menu_window->height() / item_height() - 2; } @@ -182,8 +182,8 @@ void Menu::draw() auto palette = WindowManager::the().palette(); m_theme_index_at_last_paint = MenuManager::the().theme_index(); - ASSERT(menu_window()); - ASSERT(menu_window()->backing_store()); + VERIFY(menu_window()); + VERIFY(menu_window()->backing_store()); Gfx::Painter painter(*menu_window()->backing_store()); Gfx::IntRect rect { {}, menu_window()->size() }; @@ -297,7 +297,7 @@ MenuItem* Menu::hovered_item() const void Menu::update_for_new_hovered_item(bool make_input) { if (hovered_item() && hovered_item()->is_submenu()) { - ASSERT(menu_window()); + VERIFY(menu_window()); MenuManager::the().close_everyone_not_in_lineage(*hovered_item()->submenu()); hovered_item()->submenu()->do_popup(hovered_item()->rect().top_right().translated(menu_window()->rect().location()), make_input); } else { @@ -309,8 +309,8 @@ void Menu::update_for_new_hovered_item(bool make_input) void Menu::open_hovered_item() { - ASSERT(menu_window()); - ASSERT(menu_window()->is_visible()); + VERIFY(menu_window()); + VERIFY(menu_window()->is_visible()); if (!hovered_item()) return; if (hovered_item()->is_enabled()) @@ -320,17 +320,17 @@ void Menu::open_hovered_item() void Menu::descend_into_submenu_at_hovered_item() { - ASSERT(hovered_item()); + VERIFY(hovered_item()); auto submenu = hovered_item()->submenu(); - ASSERT(submenu); + VERIFY(submenu); MenuManager::the().open_menu(*submenu, false, false); submenu->set_hovered_item(0); - ASSERT(submenu->hovered_item()->type() != MenuItem::Separator); + VERIFY(submenu->hovered_item()->type() != MenuItem::Separator); } void Menu::handle_mouse_move_event(const MouseEvent& mouse_event) { - ASSERT(menu_window()); + VERIFY(menu_window()); MenuManager::the().set_current_menu(this); if (hovered_item() && hovered_item()->is_submenu()) { @@ -368,7 +368,7 @@ void Menu::event(Core::Event& event) } if (event.type() == Event::MouseWheel && is_scrollable()) { - ASSERT(menu_window()); + VERIFY(menu_window()); auto& mouse_event = static_cast<const MouseEvent&>(event); m_scroll_offset += mouse_event.wheel_delta(); m_scroll_offset = clamp(m_scroll_offset, 0, m_max_scroll_offset); @@ -388,8 +388,8 @@ void Menu::event(Core::Event& event) if (!(key == Key_Up || key == Key_Down || key == Key_Left || key == Key_Right || key == Key_Return)) return; - ASSERT(menu_window()); - ASSERT(menu_window()->is_visible()); + VERIFY(menu_window()); + VERIFY(menu_window()->is_visible()); // Default to the first enabled, non-separator item on key press if one has not been selected yet if (!hovered_item()) { @@ -406,7 +406,7 @@ void Menu::event(Core::Event& event) } if (key == Key_Up) { - ASSERT(m_items.at(0).type() != MenuItem::Separator); + VERIFY(m_items.at(0).type() != MenuItem::Separator); if (is_scrollable() && m_hovered_item_index == 0) return; @@ -421,7 +421,7 @@ void Menu::event(Core::Event& event) return; } while (hovered_item()->type() == MenuItem::Separator || !hovered_item()->is_enabled()); - ASSERT(m_hovered_item_index >= 0 && m_hovered_item_index <= static_cast<int>(m_items.size()) - 1); + VERIFY(m_hovered_item_index >= 0 && m_hovered_item_index <= static_cast<int>(m_items.size()) - 1); if (is_scrollable() && m_hovered_item_index < m_scroll_offset) --m_scroll_offset; @@ -431,7 +431,7 @@ void Menu::event(Core::Event& event) } if (key == Key_Down) { - ASSERT(m_items.at(0).type() != MenuItem::Separator); + VERIFY(m_items.at(0).type() != MenuItem::Separator); if (is_scrollable() && m_hovered_item_index == static_cast<int>(m_items.size()) - 1) return; @@ -446,7 +446,7 @@ void Menu::event(Core::Event& event) return; } while (hovered_item()->type() == MenuItem::Separator || !hovered_item()->is_enabled()); - ASSERT(m_hovered_item_index >= 0 && m_hovered_item_index <= static_cast<int>(m_items.size()) - 1); + VERIFY(m_hovered_item_index >= 0 && m_hovered_item_index <= static_cast<int>(m_items.size()) - 1); if (is_scrollable() && m_hovered_item_index >= (m_scroll_offset + visible_item_count())) ++m_scroll_offset; diff --git a/Userland/Services/WindowServer/MenuItem.cpp b/Userland/Services/WindowServer/MenuItem.cpp index 324724a893..ee0baafbfe 100644 --- a/Userland/Services/WindowServer/MenuItem.cpp +++ b/Userland/Services/WindowServer/MenuItem.cpp @@ -81,15 +81,15 @@ void MenuItem::set_default(bool is_default) Menu* MenuItem::submenu() { - ASSERT(is_submenu()); - ASSERT(m_menu.client()); + VERIFY(is_submenu()); + VERIFY(m_menu.client()); return m_menu.client()->find_menu_by_id(m_submenu_id); } const Menu* MenuItem::submenu() const { - ASSERT(is_submenu()); - ASSERT(m_menu.client()); + VERIFY(is_submenu()); + VERIFY(m_menu.client()); return m_menu.client()->find_menu_by_id(m_submenu_id); } diff --git a/Userland/Services/WindowServer/MenuManager.cpp b/Userland/Services/WindowServer/MenuManager.cpp index a28dfd5288..214e055fcc 100644 --- a/Userland/Services/WindowServer/MenuManager.cpp +++ b/Userland/Services/WindowServer/MenuManager.cpp @@ -44,7 +44,7 @@ static constexpr int s_search_timeout = 3000; MenuManager& MenuManager::the() { - ASSERT(s_the); + VERIFY(s_the); return *s_the; } @@ -162,7 +162,7 @@ void MenuManager::event(Core::Event& event) if (key_event.key() == Key_Left) { auto it = m_open_menu_stack.find_if([&](const auto& other) { return m_current_menu == other.ptr(); }); - ASSERT(!it.is_end()); + VERIFY(!it.is_end()); // Going "back" a menu should be the previous menu in the stack if (it.index() > 0) @@ -229,13 +229,13 @@ void MenuManager::handle_mouse_event(MouseEvent& mouse_event) if (has_open_menu()) { auto* topmost_menu = m_open_menu_stack.last().ptr(); - ASSERT(topmost_menu); + VERIFY(topmost_menu); auto* window = topmost_menu->menu_window(); if (!window) { dbgln("MenuManager::handle_mouse_event: No menu window"); return; } - ASSERT(window->is_visible()); + VERIFY(window->is_visible()); bool event_is_inside_current_menu = window->rect().contains(mouse_event.position()); if (event_is_inside_current_menu) { @@ -326,7 +326,7 @@ void MenuManager::close_all_menus_from_client(Badge<ClientConnection>, ClientCon void MenuManager::close_everyone() { for (auto& menu : m_open_menu_stack) { - ASSERT(menu); + VERIFY(menu); if (menu->menu_window()) menu->menu_window()->set_visible(false); menu->clear_hovered_item(); @@ -440,7 +440,7 @@ void MenuManager::set_current_menu(Menu* menu) return; } - ASSERT(is_open(*menu)); + VERIFY(is_open(*menu)); if (menu == m_current_menu) { return; } diff --git a/Userland/Services/WindowServer/Screen.cpp b/Userland/Services/WindowServer/Screen.cpp index 8fed3a44cc..dc909fc181 100644 --- a/Userland/Services/WindowServer/Screen.cpp +++ b/Userland/Services/WindowServer/Screen.cpp @@ -43,18 +43,18 @@ static Screen* s_the; Screen& Screen::the() { - ASSERT(s_the); + VERIFY(s_the); return *s_the; } Screen::Screen(unsigned desired_width, unsigned desired_height, int scale_factor) { - ASSERT(!s_the); + VERIFY(!s_the); s_the = this; m_framebuffer_fd = open("/dev/fb0", O_RDWR | O_CLOEXEC); if (m_framebuffer_fd < 0) { perror("failed to open /dev/fb0"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (fb_set_buffer(m_framebuffer_fd, 0) == 0) { @@ -93,7 +93,7 @@ bool Screen::set_resolution(int width, int height, int new_scale_factor) on_change_resolution(physical_resolution.pitch, physical_resolution.width, physical_resolution.height, new_scale_factor); return false; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Screen::on_change_resolution(int pitch, int new_physical_width, int new_physical_height, int new_scale_factor) @@ -102,14 +102,14 @@ void Screen::on_change_resolution(int pitch, int new_physical_width, int new_phy if (m_framebuffer) { size_t previous_size_in_bytes = m_size_in_bytes; int rc = munmap(m_framebuffer, previous_size_in_bytes); - ASSERT(rc == 0); + VERIFY(rc == 0); } int rc = fb_get_size_in_bytes(m_framebuffer_fd, &m_size_in_bytes); - ASSERT(rc == 0); + VERIFY(rc == 0); m_framebuffer = (Gfx::RGBA32*)mmap(nullptr, m_size_in_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, m_framebuffer_fd, 0); - ASSERT(m_framebuffer && m_framebuffer != (void*)-1); + VERIFY(m_framebuffer && m_framebuffer != (void*)-1); } m_pitch = pitch; @@ -122,20 +122,20 @@ void Screen::on_change_resolution(int pitch, int new_physical_width, int new_phy void Screen::set_buffer(int index) { - ASSERT(m_can_set_buffer); + VERIFY(m_can_set_buffer); int rc = fb_set_buffer(m_framebuffer_fd, index); - ASSERT(rc == 0); + VERIFY(rc == 0); } void Screen::set_acceleration_factor(double factor) { - ASSERT(factor >= mouse_accel_min && factor <= mouse_accel_max); + VERIFY(factor >= mouse_accel_min && factor <= mouse_accel_max); m_acceleration_factor = factor; } void Screen::set_scroll_step_size(unsigned step_size) { - ASSERT(step_size >= scroll_step_size_min); + VERIFY(step_size >= scroll_step_size_min); m_scroll_step_size = step_size; } diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp index 29cbc6ea98..0774df0f31 100644 --- a/Userland/Services/WindowServer/Window.cpp +++ b/Userland/Services/WindowServer/Window.cpp @@ -153,7 +153,7 @@ void Window::set_title(const String& title) void Window::set_rect(const Gfx::IntRect& rect) { - ASSERT(!rect.is_empty()); + VERIFY(!rect.is_empty()); if (m_rect == rect) return; auto old_rect = m_rect; @@ -168,7 +168,7 @@ void Window::set_rect(const Gfx::IntRect& rect) void Window::set_rect_without_repaint(const Gfx::IntRect& rect) { - ASSERT(!rect.is_empty()); + VERIFY(!rect.is_empty()); if (m_rect == rect) return; auto old_rect = m_rect; @@ -232,7 +232,7 @@ void Window::nudge_into_desktop(bool force_titlebar_visible) void Window::set_minimum_size(const Gfx::IntSize& size) { - ASSERT(!size.is_empty()); + VERIFY(!size.is_empty()); if (m_minimum_size == size) return; @@ -265,7 +265,7 @@ void Window::handle_mouse_event(const MouseEvent& event) m_client->post_message(Messages::WindowClient::MouseWheel(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta())); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -332,7 +332,7 @@ void Window::start_minimize_animation() // next time we want to start the animation m_taskbar_rect = w.taskbar_rect(); - ASSERT(!m_have_taskbar_rect); // should remain unset! + VERIFY(!m_have_taskbar_rect); // should remain unset! return IterationDecision::Break; }; return IterationDecision::Continue; @@ -421,7 +421,7 @@ void Window::set_resizable(bool resizable) void Window::event(Core::Event& event) { if (!m_client) { - ASSERT(parent()); + VERIFY(parent()); event.ignore(); return; } @@ -721,7 +721,7 @@ void Window::set_fullscreen(bool fullscreen) Gfx::IntRect Window::tiled_rect(WindowTileType tiled) const { - ASSERT(tiled != WindowTileType::None); + VERIFY(tiled != WindowTileType::None); int frame_width = (m_frame.rect().width() - m_rect.width()) / 2; int title_bar_height = m_frame.title_bar_rect().height(); @@ -770,7 +770,7 @@ Gfx::IntRect Window::tiled_rect(WindowTileType tiled) const Screen::the().width() / 2 - frame_width, (max_height - title_bar_height) / 2); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -778,7 +778,7 @@ bool Window::set_untiled(Optional<Gfx::IntPoint> fixed_point) { if (m_tiled == WindowTileType::None) return false; - ASSERT(!resize_aspect_ratio().has_value()); + VERIFY(!resize_aspect_ratio().has_value()); m_tiled = WindowTileType::None; @@ -797,7 +797,7 @@ bool Window::set_untiled(Optional<Gfx::IntPoint> fixed_point) void Window::set_tiled(WindowTileType tiled) { - ASSERT(tiled != WindowTileType::None); + VERIFY(tiled != WindowTileType::None); if (m_tiled == tiled) return; @@ -851,7 +851,7 @@ void Window::add_accessory_window(Window& accessory_window) void Window::set_parent_window(Window& parent_window) { - ASSERT(!m_parent_window); + VERIFY(!m_parent_window); m_parent_window = parent_window; if (m_accessory) parent_window.add_accessory_window(*this); diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp index aa27c0c35e..a6ab4fc5ee 100644 --- a/Userland/Services/WindowServer/WindowFrame.cpp +++ b/Userland/Services/WindowServer/WindowFrame.cpp @@ -232,7 +232,7 @@ bool WindowFrame::frame_has_alpha() const void WindowFrame::did_set_maximized(Badge<Window>, bool maximized) { - ASSERT(m_maximize_button); + VERIFY(m_maximize_button); m_maximize_button->set_icon(maximized ? *s_restore_icon : *s_maximize_icon); } @@ -427,7 +427,7 @@ void WindowFrame::render_to_cache() if (m_top_bottom && top_bottom_height > 0) { m_bottom_y = window_rect.y() - total_frame_rect.y(); - ASSERT(m_bottom_y >= 0); + VERIFY(m_bottom_y >= 0); Gfx::Painter top_bottom_painter(*m_top_bottom); top_bottom_painter.add_clip_rect({ update_location, { frame_rect_to_update.width(), top_bottom_height - update_location.y() - (total_frame_rect.bottom() - frame_rect_to_update.bottom()) } }); @@ -441,7 +441,7 @@ void WindowFrame::render_to_cache() if (left_right_width > 0) { m_right_x = window_rect.x() - total_frame_rect.x(); - ASSERT(m_right_x >= 0); + VERIFY(m_right_x >= 0); Gfx::Painter left_right_painter(*m_left_right); left_right_painter.add_clip_rect({ update_location, { left_right_width - update_location.x() - (total_frame_rect.right() - frame_rect_to_update.right()), window_rect.height() } }); @@ -578,7 +578,7 @@ bool WindowFrame::hit_test(const Gfx::IntPoint& point) const void WindowFrame::on_mouse_event(const MouseEvent& event) { - ASSERT(!m_window.is_fullscreen()); + VERIFY(!m_window.is_fullscreen()); auto& wm = WindowManager::the(); if (m_window.type() != WindowType::Normal && m_window.type() != WindowType::ToolWindow && m_window.type() != WindowType::Notification) @@ -657,7 +657,7 @@ void WindowFrame::on_mouse_event(const MouseEvent& event) { ResizeDirection::DownLeft, ResizeDirection::Down, ResizeDirection::DownRight }, }; Gfx::IntRect outer_rect = { {}, rect().size() }; - ASSERT(outer_rect.contains(event.position())); + VERIFY(outer_rect.contains(event.position())); int window_relative_x = event.x() - outer_rect.x(); int window_relative_y = event.y() - outer_rect.y(); int hot_area_row = min(2, window_relative_y / (outer_rect.height() / 3)); @@ -675,7 +675,7 @@ void WindowFrame::start_flash_animation() { if (!m_flash_timer) { m_flash_timer = Core::Timer::construct(100, [this] { - ASSERT(m_flash_counter); + VERIFY(m_flash_counter); invalidate_title_bar(); if (!--m_flash_counter) m_flash_timer->stop(); @@ -717,7 +717,7 @@ void WindowFrame::paint_simple_rect_shadow(Gfx::Painter& painter, const Gfx::Int } // The containing_rect should have been inflated appropriately - ASSERT(containing_rect.size().contains(Gfx::IntSize { base_size, base_size })); + VERIFY(containing_rect.size().contains(Gfx::IntSize { base_size, base_size })); auto sides_height = containing_rect.height() - 2 * base_size; auto half_height = sides_height / 2; diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 9a7e556892..d3901a3131 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -58,7 +58,7 @@ static WindowManager* s_the; WindowManager& WindowManager::the() { - ASSERT(s_the); + VERIFY(s_the); return *s_the; } @@ -460,7 +460,7 @@ void WindowManager::start_window_resize(Window& window, const Gfx::IntPoint& pos }; Gfx::IntRect outer_rect = window.frame().rect(); if (!outer_rect.contains(position)) { - // FIXME: This used to be an ASSERT but crashing WindowServer over this seems silly. + // FIXME: This used to be an VERIFY but crashing WindowServer over this seems silly. dbgln("FIXME: !outer_rect.contains(position): outer_rect={}, position={}", outer_rect, position); } int window_relative_x = position.x() - outer_rect.x(); @@ -469,7 +469,7 @@ void WindowManager::start_window_resize(Window& window, const Gfx::IntPoint& pos int hot_area_column = min(2, window_relative_x / (outer_rect.width() / 3)); m_resize_direction = direction_for_hot_area[hot_area_row][hot_area_column]; if (m_resize_direction == ResizeDirection::None) { - ASSERT(!m_resize_window); + VERIFY(!m_resize_window); return; } @@ -644,7 +644,7 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo change_h = diff_y; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto new_rect = m_resize_window_original_rect; @@ -692,7 +692,7 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo new_rect.set_right_without_resize(m_resize_window_original_rect.right()); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (new_rect.contains(event.position())) @@ -772,7 +772,7 @@ auto WindowManager::DoubleClickInfo::metadata_for_button(MouseButton button) con case MouseButton::Forward: return m_forward; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -790,7 +790,7 @@ auto WindowManager::DoubleClickInfo::metadata_for_button(MouseButton button) -> case MouseButton::Forward: return m_forward; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -816,7 +816,7 @@ void WindowManager::start_menu_doubleclick(Window& window, const MouseEvent& eve // So, in order to be able to detect a double click when a menu is being // opened by the MouseDown event, we need to consider the MouseDown event // as a potential double-click trigger - ASSERT(event.type() == Event::MouseDown); + VERIFY(event.type() == Event::MouseDown); auto& metadata = m_double_click_info.metadata_for_button(event.button()); if (&window != m_double_click_info.m_clicked_window) { @@ -835,7 +835,7 @@ void WindowManager::start_menu_doubleclick(Window& window, const MouseEvent& eve bool WindowManager::is_menu_doubleclick(Window& window, const MouseEvent& event) const { - ASSERT(event.type() == Event::MouseUp); + VERIFY(event.type() == Event::MouseUp); if (&window != m_double_click_info.m_clicked_window) return false; @@ -850,7 +850,7 @@ bool WindowManager::is_menu_doubleclick(Window& window, const MouseEvent& event) void WindowManager::process_event_for_doubleclick(Window& window, MouseEvent& event) { // We only care about button presses (because otherwise it's not a doubleclick, duh!) - ASSERT(event.type() == Event::MouseUp); + VERIFY(event.type() == Event::MouseUp); if (&window != m_double_click_info.m_clicked_window) { // we either haven't clicked anywhere, or we haven't clicked on this @@ -983,7 +983,7 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind return; } - ASSERT(window.hit_test(event.position())); + VERIFY(window.hit_test(event.position())); if (event.type() == Event::MouseDown) { // We're clicking on something that's blocked by a modal window. // Flash the modal window to let the user know about it. @@ -1131,7 +1131,7 @@ Gfx::IntRect WindowManager::arena_rect_for_type(WindowType type) const case WindowType::Notification: return Screen::the().rect(); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -1310,8 +1310,8 @@ void WindowManager::set_active_window(Window* window, bool make_input) { if (window) { if (auto* modal_window = window->blocking_modal_window()) { - ASSERT(modal_window->is_modal()); - ASSERT(modal_window != window); + VERIFY(modal_window->is_modal()); + VERIFY(modal_window != window); window = modal_window; make_input = true; } @@ -1473,7 +1473,7 @@ Gfx::IntRect WindowManager::maximized_window_rect(const Window& window) const void WindowManager::start_dnd_drag(ClientConnection& client, const String& text, const Gfx::Bitmap* bitmap, const Core::MimeData& mime_data) { - ASSERT(!m_dnd_client); + VERIFY(!m_dnd_client); m_dnd_client = client; m_dnd_text = text; m_dnd_bitmap = bitmap; @@ -1484,7 +1484,7 @@ void WindowManager::start_dnd_drag(ClientConnection& client, const String& text, void WindowManager::end_dnd_drag() { - ASSERT(m_dnd_client); + VERIFY(m_dnd_client); Compositor::the().invalidate_cursor(); m_dnd_client = nullptr; m_dnd_text = {}; diff --git a/Userland/Services/WindowServer/WindowSwitcher.cpp b/Userland/Services/WindowServer/WindowSwitcher.cpp index 803887c657..df329aba7f 100644 --- a/Userland/Services/WindowServer/WindowSwitcher.cpp +++ b/Userland/Services/WindowServer/WindowSwitcher.cpp @@ -39,7 +39,7 @@ static WindowSwitcher* s_the; WindowSwitcher& WindowSwitcher::the() { - ASSERT(s_the); + VERIFY(s_the); return *s_the; } @@ -124,7 +124,7 @@ void WindowSwitcher::on_key_event(const KeyEvent& event) hide(); return; } - ASSERT(!m_windows.is_empty()); + VERIFY(!m_windows.is_empty()); int new_selected_index; @@ -135,7 +135,7 @@ void WindowSwitcher::on_key_event(const KeyEvent& event) if (new_selected_index < 0) new_selected_index = static_cast<int>(m_windows.size()) - 1; } - ASSERT(new_selected_index < static_cast<int>(m_windows.size())); + VERIFY(new_selected_index < static_cast<int>(m_windows.size())); select_window_at_index(new_selected_index); } @@ -154,7 +154,7 @@ void WindowSwitcher::select_window_at_index(int index) { m_selected_index = index; auto* highlight_window = m_windows.at(index).ptr(); - ASSERT(highlight_window); + VERIFY(highlight_window); WindowManager::the().set_highlight_window(highlight_window); redraw(); } diff --git a/Userland/Services/WindowServer/main.cpp b/Userland/Services/WindowServer/main.cpp index c7252555ff..6e5898f27c 100644 --- a/Userland/Services/WindowServer/main.cpp +++ b/Userland/Services/WindowServer/main.cpp @@ -77,7 +77,7 @@ int main(int, char**) auto theme_name = wm_config->read_entry("Theme", "Name", "Default"); auto theme = Gfx::load_system_theme(String::formatted("/res/themes/{}.ini", theme_name)); - ASSERT(theme.is_valid()); + VERIFY(theme.is_valid()); Gfx::set_system_theme(theme); auto palette = Gfx::PaletteImpl::create_with_anonymous_buffer(theme); @@ -114,5 +114,5 @@ int main(int, char**) dbgln("Entering WindowServer main loop"); loop.exec(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } diff --git a/Userland/Shell/AST.cpp b/Userland/Shell/AST.cpp index 98c1ac8eec..376c3c7f6f 100644 --- a/Userland/Shell/AST.cpp +++ b/Userland/Shell/AST.cpp @@ -39,17 +39,17 @@ void AK::Formatter<Shell::AST::Command>::format(FormatBuilder& builder, const Shell::AST::Command& value) { if (m_sign_mode != FormatBuilder::SignMode::Default) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); if (m_alternative_form) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); if (m_zero_pad) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); if (m_mode != Mode::Default && m_mode != Mode::String) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); if (m_width.has_value()) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); if (m_precision.has_value()) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); if (value.argv.is_empty()) { builder.put_literal("(ShellInternal)"); @@ -93,7 +93,7 @@ void AK::Formatter<Shell::AST::Command>::format(FormatBuilder& builder, const Sh builder.put_i64(close_redir->fd); builder.put_literal(">&-"); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -831,7 +831,7 @@ RefPtr<Value> ContinuationControl::run(RefPtr<Shell> shell) else if (m_kind == Continue) shell->raise_error(Shell::ShellError::InternalControlFlowContinue, {}, position()); else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return create<ListValue>({}); } @@ -900,7 +900,7 @@ RefPtr<Value> DynamicEvaluate::run(RefPtr<Shell> shell) // Strings are treated as variables, and Lists are treated as commands. if (result->is_string()) { auto name_part = result->resolve_as_list(shell); - ASSERT(name_part.size() == 1); + VERIFY(name_part.size() == 1); return create<SimpleVariableValue>(name_part[0]); } @@ -1418,7 +1418,7 @@ void Execute::for_each_entry(RefPtr<Shell> shell, Function<IterationDecision(Non auto line_end = offset.value(); if (line_end == 0) { auto rc = stream.discard_or_error(ifs.length()); - ASSERT(rc); + VERIFY(rc); if (shell->options.inline_exec_keep_empty_segments) if (callback(create<StringValue>("")) == IterationDecision::Break) { @@ -1429,7 +1429,7 @@ void Execute::for_each_entry(RefPtr<Shell> shell, Function<IterationDecision(Non } else { auto entry = ByteBuffer::create_uninitialized(line_end + ifs.length()); auto rc = stream.read_or_error(entry); - ASSERT(rc); + VERIFY(rc); auto str = StringView(entry.data(), entry.size() - ifs.length()); if (callback(create<StringValue>(str)) == IterationDecision::Break) { @@ -1515,7 +1515,7 @@ void Execute::for_each_entry(RefPtr<Shell> shell, Function<IterationDecision(Non if (!stream.eof()) { auto entry = ByteBuffer::create_uninitialized(stream.size()); auto rc = stream.read_or_error(entry); - ASSERT(rc); + VERIFY(rc); callback(create<StringValue>(String::copy(entry))); } } @@ -2082,7 +2082,7 @@ void PathRedirectionNode::highlight_in_editor(Line::Editor& editor, Shell& shell m_path->highlight_in_editor(editor, shell, metadata); if (m_path->is_bareword()) { auto path_text = m_path->run(nullptr)->resolve_as_list(nullptr); - ASSERT(path_text.size() == 1); + VERIFY(path_text.size() == 1); // Apply a URL to the path. auto& position = m_path->position(); auto& path = path_text[0]; @@ -2521,8 +2521,8 @@ RefPtr<Value> Juxtaposition::run(RefPtr<Shell> shell) if (left_value->is_string() && right_value->is_string()) { - ASSERT(left.size() == 1); - ASSERT(right.size() == 1); + VERIFY(left.size() == 1); + VERIFY(right.size() == 1); StringBuilder builder; builder.append(left[0]); @@ -2880,7 +2880,7 @@ RefPtr<Value> VariableDeclarations::run(RefPtr<Shell> shell) { for (auto& var : m_variables) { auto name_value = var.name->run(shell)->resolve_as_list(shell); - ASSERT(name_value.size() == 1); + VERIFY(name_value.size() == 1); auto name = name_value[0]; auto value = var.value->run(shell); shell->set_local_variable(name, value.release_nonnull()); @@ -3063,7 +3063,7 @@ Vector<String> SimpleVariableValue::resolve_as_list(RefPtr<Shell> shell) NonnullRefPtr<Value> SimpleVariableValue::resolve_without_cast(RefPtr<Shell> shell) { - ASSERT(shell); + VERIFY(shell); if (auto value = shell->lookup_local_variable(m_name)) return value.release_nonnull(); @@ -3150,7 +3150,7 @@ Result<NonnullRefPtr<Rewiring>, String> PathRedirection::apply() const return check_fd_and_return(open(path.characters(), O_RDWR | O_CREAT, 0666), path); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } PathRedirection::~PathRedirection() diff --git a/Userland/Shell/AST.h b/Userland/Shell/AST.h index b0f4e7d5f8..1497f258d2 100644 --- a/Userland/Shell/AST.h +++ b/Userland/Shell/AST.h @@ -285,8 +285,8 @@ private: class JobValue final : public Value { public: - virtual Vector<String> resolve_as_list(RefPtr<Shell>) override { ASSERT_NOT_REACHED(); } - virtual Vector<Command> resolve_as_commands(RefPtr<Shell>) override { ASSERT_NOT_REACHED(); } + virtual Vector<String> resolve_as_list(RefPtr<Shell>) override { VERIFY_NOT_REACHED(); } + virtual Vector<Command> resolve_as_commands(RefPtr<Shell>) override { VERIFY_NOT_REACHED(); } virtual ~JobValue(); virtual bool is_job() const override { return true; } JobValue(RefPtr<Job> job) @@ -441,7 +441,7 @@ public: } virtual const SyntaxError& syntax_error_node() const { - ASSERT(is_syntax_error()); + VERIFY(is_syntax_error()); return *m_syntax_error_node; } @@ -449,7 +449,7 @@ public: Vector<Command> to_lazy_evaluated_commands(RefPtr<Shell> shell); - virtual void visit(NodeVisitor&) { ASSERT_NOT_REACHED(); } + virtual void visit(NodeVisitor&) { VERIFY_NOT_REACHED(); } virtual void visit(NodeVisitor& visitor) const { const_cast<Node*>(this)->visit(visitor); } enum class Kind : u32 { @@ -696,7 +696,7 @@ private: NODE(CommandLiteral); virtual void dump(int level) const override; virtual RefPtr<Value> run(RefPtr<Shell>) override; - virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override { ASSERT_NOT_REACHED(); } + virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override { VERIFY_NOT_REACHED(); } virtual bool is_command() const override { return true; } virtual bool is_list() const override { return true; } @@ -916,7 +916,7 @@ struct HistorySelector { return selector; if (kind == Last) return size - 1; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }; struct { diff --git a/Userland/Shell/Formatter.cpp b/Userland/Shell/Formatter.cpp index 27a0dc08b1..ea7b6b4019 100644 --- a/Userland/Shell/Formatter.cpp +++ b/Userland/Shell/Formatter.cpp @@ -249,7 +249,7 @@ void Formatter::visit(const AST::CloseFdRedirection* node) void Formatter::visit(const AST::CommandLiteral*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Formatter::visit(const AST::Comment* node) @@ -270,7 +270,7 @@ void Formatter::visit(const AST::ContinuationControl* node) else if (node->continuation_kind() == AST::ContinuationControl::Continue) current_builder().append("continue"); else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); visited(node); } diff --git a/Userland/Shell/Job.h b/Userland/Shell/Job.h index baf0bc3312..f2470b283d 100644 --- a/Userland/Shell/Job.h +++ b/Userland/Shell/Job.h @@ -72,12 +72,12 @@ public: bool signaled() const { return m_term_sig != -1; } int exit_code() const { - ASSERT(exited()); + VERIFY(exited()); return m_exit_code; } int termination_signal() const { - ASSERT(signaled()); + VERIFY(signaled()); return m_term_sig; } bool should_be_disowned() const { return m_should_be_disowned; } diff --git a/Userland/Shell/Parser.cpp b/Userland/Shell/Parser.cpp index 4fbd8b75a5..9b054fee4a 100644 --- a/Userland/Shell/Parser.cpp +++ b/Userland/Shell/Parser.cpp @@ -44,7 +44,7 @@ char Parser::peek() if (at_end()) return 0; - ASSERT(m_offset < m_input.length()); + VERIFY(m_offset < m_input.length()); auto ch = m_input[m_offset]; if (ch == '\\' && m_input.length() > m_offset + 1 && m_input[m_offset + 1] == '\n') { @@ -326,7 +326,7 @@ RefPtr<AST::Node> Parser::parse_variable_decls() if (!rest) return create<AST::VariableDeclarations>(move(variables)); - ASSERT(rest->is_variable_decls()); + VERIFY(rest->is_variable_decls()); auto* rest_decl = static_cast<AST::VariableDeclarations*>(rest.ptr()); variables.append(rest_decl->variables()); @@ -1368,7 +1368,7 @@ RefPtr<AST::Node> Parser::parse_history_designator() { auto rule_start = push_start(); - ASSERT(peek() == '!'); + VERIFY(peek() == '!'); consume(); // Event selector @@ -1585,7 +1585,7 @@ RefPtr<AST::Node> Parser::parse_bareword() { restore_to(rule_start->offset, rule_start->line); auto ch = consume(); - ASSERT(ch == '~'); + VERIFY(ch == '~'); tilde = create<AST::Tilde>(move(username)); } diff --git a/Userland/Shell/Parser.h b/Userland/Shell/Parser.h index a3f09b944e..6b8218865a 100644 --- a/Userland/Shell/Parser.h +++ b/Userland/Shell/Parser.h @@ -135,10 +135,10 @@ private: ~ScopedOffset() { auto last = offsets.take_last(); - ASSERT(last == offset); + VERIFY(last == offset); auto last_line = lines.take_last(); - ASSERT(last_line == line); + VERIFY(last_line == line); } Vector<size_t>& offsets; diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp index c13d9922e1..624550c8c7 100644 --- a/Userland/Shell/Shell.cpp +++ b/Userland/Shell/Shell.cpp @@ -157,7 +157,7 @@ String Shell::prompt() const String Shell::expand_tilde(const String& expression) { - ASSERT(expression.starts_with('~')); + VERIFY(expression.starts_with('~')); StringBuilder login_name; size_t first_slash_index = expression.length(); @@ -177,7 +177,7 @@ String Shell::expand_tilde(const String& expression) const char* home = getenv("HOME"); if (!home) { auto passwd = getpwuid(getuid()); - ASSERT(passwd && passwd->pw_dir); + VERIFY(passwd && passwd->pw_dir); return String::format("%s/%s", passwd->pw_dir, path.to_string().characters()); } return String::format("%s/%s", home, path.to_string().characters()); @@ -186,7 +186,7 @@ String Shell::expand_tilde(const String& expression) auto passwd = getpwnam(login_name.to_string().characters()); if (!passwd) return expression; - ASSERT(passwd->pw_dir); + VERIFY(passwd->pw_dir); return String::format("%s/%s", passwd->pw_dir, path.to_string().characters()); } @@ -515,7 +515,7 @@ Shell::Frame Shell::push_frame(String name) void Shell::pop_frame() { - ASSERT(m_local_frames.size() > 1); + VERIFY(m_local_frames.size() > 1); m_local_frames.take_last(); } @@ -528,7 +528,7 @@ Shell::Frame::~Frame() dbgln("Current frames:"); for (auto& frame : frames) dbgln("- {:p}: {}", &frame, frame.name); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } frames.take_last(); } @@ -554,7 +554,7 @@ int Shell::run_command(const StringView& cmd, Optional<SourcePosition> source_po { // The default-constructed mode of the shell // should not be used for execution! - ASSERT(!m_default_constructed); + VERIFY(!m_default_constructed); take_error(); @@ -640,7 +640,7 @@ RefPtr<Job> Shell::run_command(const AST::Command& command) } else if (rewiring->fd_action == AST::Rewiring::Close::ImmediatelyCloseNew) { fds.add(rewiring->new_fd); } else if (rewiring->fd_action == AST::Rewiring::Close::RefreshNew) { - ASSERT(rewiring->other_pipe_end); + VERIFY(rewiring->other_pipe_end); int pipe_fd[2]; int rc = pipe(pipe_fd); @@ -652,7 +652,7 @@ RefPtr<Job> Shell::run_command(const AST::Command& command) rewiring->other_pipe_end->new_fd = pipe_fd[0]; // This fd will be added to the collection on one of the next iterations. fds.add(pipe_fd[1]); } else if (rewiring->fd_action == AST::Rewiring::Close::RefreshOld) { - ASSERT(rewiring->other_pipe_end); + VERIFY(rewiring->other_pipe_end); int pipe_fd[2]; int rc = pipe(pipe_fd); @@ -795,7 +795,7 @@ RefPtr<Job> Shell::run_command(const AST::Command& command) tcsetattr(0, TCSANOW, &default_termios); if (command.should_immediately_execute_next) { - ASSERT(command.argv.is_empty()); + VERIFY(command.argv.is_empty()); Core::EventLoop mainloop; setup_signals(); @@ -816,7 +816,7 @@ RefPtr<Job> Shell::run_command(const AST::Command& command) jobs.clear(); execute_process(move(argv)); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } close(sync_pipe[0]); @@ -924,7 +924,7 @@ void Shell::execute_process(Vector<const char*>&& argv) } _exit(126); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Shell::run_tail(const AST::Command& invoking_command, const AST::NodeWithAction& next_in_chain, int head_exit_code) @@ -998,7 +998,7 @@ NonnullRefPtrVector<Job> Shell::run_commands(Vector<AST::Command>& commands) auto close_redir = (const AST::CloseRedirection*)&redir; dbgln("close fd {}", close_redir->fd); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } #endif @@ -1623,7 +1623,7 @@ void Shell::notify_child_event() #ifdef ENSURE_WAITID_ONCE // Theoretically, this should never trip, as jobs are removed from // the job table when waitpid() succeeds *and* the child is dead. - ASSERT(!s_waited_for_pids.contains(job.pid())); + VERIFY(!s_waited_for_pids.contains(job.pid())); #endif int wstatus = 0; @@ -1641,7 +1641,7 @@ void Shell::notify_child_event() // FIXME: This should never happen, the child should stay around until we do the waitpid above. child_pid = job.pid(); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } if (child_pid == 0) { @@ -1985,7 +1985,7 @@ SavedFileDescriptors::SavedFileDescriptors(const NonnullRefPtrVector<AST::Rewiri auto flags = fcntl(new_fd, F_GETFL); auto rc = fcntl(new_fd, F_SETFL, flags | FD_CLOEXEC); - ASSERT(rc == 0); + VERIFY(rc == 0); m_saves.append({ rewiring.new_fd, new_fd }); m_collector.add(new_fd); diff --git a/Userland/Shell/SyntaxHighlighter.cpp b/Userland/Shell/SyntaxHighlighter.cpp index d202055716..e33e0baeb2 100644 --- a/Userland/Shell/SyntaxHighlighter.cpp +++ b/Userland/Shell/SyntaxHighlighter.cpp @@ -64,7 +64,7 @@ private: offset -= new_line.line_column; --offset; - ASSERT(new_line.line_number > 0); + VERIFY(new_line.line_number > 0); --new_line.line_number; auto line = m_document.line(new_line.line_number); diff --git a/Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp b/Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp index 1f9fb5003a..e7efa9aba0 100644 --- a/Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp +++ b/Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp @@ -48,7 +48,7 @@ int main(int, char**) struct sockaddr_un addr; memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; - ASSERT(strlcpy(addr.sun_path, path, sizeof(addr.sun_path)) < sizeof(addr.sun_path)); + VERIFY(strlcpy(addr.sun_path, path, sizeof(addr.sun_path)) < sizeof(addr.sun_path)); rc = bind(fd, (struct sockaddr*)(&addr), sizeof(addr)); if (rc < 0 && errno == EADDRINUSE) { diff --git a/Userland/Tests/Kernel/fuzz-syscalls.cpp b/Userland/Tests/Kernel/fuzz-syscalls.cpp index c38d6333d5..e71d3ad11a 100644 --- a/Userland/Tests/Kernel/fuzz-syscalls.cpp +++ b/Userland/Tests/Kernel/fuzz-syscalls.cpp @@ -63,16 +63,16 @@ static void do_systematic_tests() } // This is pure torture rc = syscall(Syscall::Function(i), 0xc0000001, 0xc0000002, 0xc0000003); - ASSERT(rc != -ENOSYS); + VERIFY(rc != -ENOSYS); } // Finally, test invalid syscalls: dbgln("Testing syscall #{} (n+1)", (int)Syscall::Function::__Count); rc = syscall(Syscall::Function::__Count, 0xc0000001, 0xc0000002, 0xc0000003); - ASSERT(rc == -ENOSYS); + VERIFY(rc == -ENOSYS); dbgln("Testing syscall #-1"); rc = syscall(Syscall::Function(-1), 0xc0000001, 0xc0000002, 0xc0000003); - ASSERT(rc == -ENOSYS); + VERIFY(rc == -ENOSYS); } static void randomize_from(size_t* buffer, size_t len, const Vector<size_t>& values) @@ -102,7 +102,7 @@ static void do_weird_call(size_t attempt, int syscall_fn, size_t arg1, size_t ar // Actually do the syscall ('fake_params' is passed indirectly, if any of arg1, arg2, or arg3 point to it. int rc = syscall(Syscall::Function(syscall_fn), arg1, arg2, arg3); - ASSERT(rc != -ENOSYS || is_nosys_syscall(syscall_fn)); + VERIFY(rc != -ENOSYS || is_nosys_syscall(syscall_fn)); } static void do_random_tests() @@ -111,7 +111,7 @@ static void do_random_tests() { struct sigaction act_ignore = { { SIG_IGN }, 0, 0 }; int rc = sigaction(SIGALRM, &act_ignore, nullptr); - ASSERT(rc == 0); + VERIFY(rc == 0); } // Note that we will also make lots of syscalls for randomness and debugging. diff --git a/Userland/Tests/Kernel/kill-pidtid-confusion.cpp b/Userland/Tests/Kernel/kill-pidtid-confusion.cpp index 7c9a03d4ba..0357ccdd23 100644 --- a/Userland/Tests/Kernel/kill-pidtid-confusion.cpp +++ b/Userland/Tests/Kernel/kill-pidtid-confusion.cpp @@ -87,7 +87,7 @@ static void sleep_steps(useconds_t steps) const int rc = usleep(steps * STEP_SIZE); if (rc < 0) { perror("usleep"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -143,7 +143,7 @@ static void run_pz() // Time 3: T1 calls thread_exit() dbgln("PZ(T1) calls thread_exit"); pthread_exit(nullptr); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static void* run_pz_t2_wrap(void*) diff --git a/Userland/Tests/Kernel/setpgid-across-sessions-without-leader.cpp b/Userland/Tests/Kernel/setpgid-across-sessions-without-leader.cpp index 48471e6db6..d13b83a478 100644 --- a/Userland/Tests/Kernel/setpgid-across-sessions-without-leader.cpp +++ b/Userland/Tests/Kernel/setpgid-across-sessions-without-leader.cpp @@ -95,7 +95,7 @@ static void sleep_steps(useconds_t steps) const int rc = usleep(steps * STEP_SIZE); if (rc < 0) { perror("usleep"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -146,7 +146,7 @@ int main(int, char**) } exit(1); } - ASSERT(rc == 1); + VERIFY(rc == 1); if (buf == 0) { printf("PASS\n"); return 0; @@ -171,7 +171,7 @@ static void run_pa1(void*) int rc = setsid(); if (rc < 0) { perror("setsid (PA)"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } dbgln("PA1 did setsid() -> PGA={}, SA={}, yay!", rc, getsid(0)); sleep_steps(1); @@ -210,7 +210,7 @@ static void run_pb1(void* pipe_fd_ptr) int rc = setsid(); if (rc < 0) { perror("setsid (PB)"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } dbgln("PB1 did setsid() -> PGB={}, SB={}, yay!", rc, getsid(0)); sleep_steps(1); @@ -258,7 +258,7 @@ static void run_pb2(void* pipe_fd_ptr) dbgln("PB2: setgpid SUCCESSFUL! CHANGED PGROUP!"); to_write = 1; } else { - ASSERT(rc == -1); + VERIFY(rc == -1); switch (errno) { case EACCES: dbgln("PB2: Failed with EACCES. Huh?!"); @@ -286,7 +286,7 @@ static void run_pb2(void* pipe_fd_ptr) dbgln("PB2 ends with SID={}, PGID={}, PID={}.", getsid(0), getpgid(0), getpid()); int* pipe_fd = static_cast<int*>(pipe_fd_ptr); - ASSERT(*pipe_fd); + VERIFY(*pipe_fd); rc = write(*pipe_fd, &to_write, 1); if (rc != 1) { dbgln("Wrote only {} bytes instead of 1?!", rc); diff --git a/Userland/Tests/LibC/overlong_realpath.cpp b/Userland/Tests/LibC/overlong_realpath.cpp index e4ce53f874..890ed7ba84 100644 --- a/Userland/Tests/LibC/overlong_realpath.cpp +++ b/Userland/Tests/LibC/overlong_realpath.cpp @@ -100,9 +100,9 @@ int main() all_good &= check_result("getcwd", expected_str, getcwd(nullptr, 0)); all_good &= check_result("realpath", expected_str, realpath(".", nullptr)); - ASSERT(strlen(PATH_LOREM_250) == 250); - ASSERT(strlen(TMPDIR_PATTERN) + ITERATION_DEPTH * (1 + strlen(PATH_LOREM_250)) == expected_str.length()); - ASSERT(expected_str.length() > PATH_MAX); + VERIFY(strlen(PATH_LOREM_250) == 250); + VERIFY(strlen(TMPDIR_PATTERN) + ITERATION_DEPTH * (1 + strlen(PATH_LOREM_250)) == expected_str.length()); + VERIFY(expected_str.length() > PATH_MAX); if (all_good) { printf("Overall: %sPASS%s\n", TEXT_PASS, TEXT_RESET); diff --git a/Userland/Tests/LibC/scanf.cpp b/Userland/Tests/LibC/scanf.cpp index da358ddac2..71aeb0a51f 100644 --- a/Userland/Tests/LibC/scanf.cpp +++ b/Userland/Tests/LibC/scanf.cpp @@ -126,7 +126,7 @@ static Array<u8, 32> arg_to_value_t(const Argument& arg) return value; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } #define DECL_WITH_TYPE(ty) \ diff --git a/Userland/Tests/LibC/snprintf-correctness.cpp b/Userland/Tests/LibC/snprintf-correctness.cpp index 3089419df3..71ec7028bf 100644 --- a/Userland/Tests/LibC/snprintf-correctness.cpp +++ b/Userland/Tests/LibC/snprintf-correctness.cpp @@ -76,7 +76,7 @@ static bool test_single(const Testcase& testcase) ByteBuffer actual = ByteBuffer::create_uninitialized(SANDBOX_CANARY_SIZE + testcase.dest_n + SANDBOX_CANARY_SIZE); AK::fill_with_random(actual.data(), actual.size()); ByteBuffer expected = actual.isolated_copy(); - ASSERT(actual.offset_pointer(0) != expected.offset_pointer(0)); + VERIFY(actual.offset_pointer(0) != expected.offset_pointer(0)); actual.overwrite(SANDBOX_CANARY_SIZE, testcase.dest, testcase.dest_n); expected.overwrite(SANDBOX_CANARY_SIZE, testcase.dest_expected, testcase.dest_expected_n); // "unsigned char" != "char", so we have to convince the compiler to allow this. diff --git a/Userland/Tests/LibC/strlcpy-correctness.cpp b/Userland/Tests/LibC/strlcpy-correctness.cpp index 00c3beeb38..adf56ff09d 100644 --- a/Userland/Tests/LibC/strlcpy-correctness.cpp +++ b/Userland/Tests/LibC/strlcpy-correctness.cpp @@ -78,7 +78,7 @@ static bool test_single(const Testcase& testcase) ByteBuffer actual = ByteBuffer::create_uninitialized(SANDBOX_CANARY_SIZE + testcase.dest_n + SANDBOX_CANARY_SIZE); AK::fill_with_random(actual.data(), actual.size()); ByteBuffer expected = actual.isolated_copy(); - ASSERT(actual.offset_pointer(0) != expected.offset_pointer(0)); + VERIFY(actual.offset_pointer(0) != expected.offset_pointer(0)); actual.overwrite(SANDBOX_CANARY_SIZE, testcase.dest, testcase.dest_n); expected.overwrite(SANDBOX_CANARY_SIZE, testcase.dest_expected, testcase.dest_expected_n); // "unsigned char" != "char", so we have to convince the compiler to allow this. diff --git a/Userland/Tests/UserspaceEmulator/write-oob.cpp b/Userland/Tests/UserspaceEmulator/write-oob.cpp index f75a1e5e46..348fe22998 100644 --- a/Userland/Tests/UserspaceEmulator/write-oob.cpp +++ b/Userland/Tests/UserspaceEmulator/write-oob.cpp @@ -58,7 +58,7 @@ static void run_test(void* region, ssize_t offset, size_t bits) write64(ptr); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -91,7 +91,7 @@ int main(int argc, char** argv) run_test(region, offset, 64); } else { void* region = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); - ASSERT(region); + VERIFY(region); run_test(region, offset, bits); } diff --git a/Userland/Utilities/arp.cpp b/Userland/Utilities/arp.cpp index 2be5ce7a26..2f29afbb31 100644 --- a/Userland/Utilities/arp.cpp +++ b/Userland/Utilities/arp.cpp @@ -41,7 +41,7 @@ int main() printf("Address HWaddress\n"); auto file_contents = file->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); json.value().as_array().for_each([](auto& value) { auto if_object = value.as_object(); diff --git a/Userland/Utilities/base64.cpp b/Userland/Utilities/base64.cpp index f8e0fc6ff9..030990c286 100644 --- a/Userland/Utilities/base64.cpp +++ b/Userland/Utilities/base64.cpp @@ -55,11 +55,11 @@ int main(int argc, char** argv) STDIN_FILENO, Core::IODevice::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes); - ASSERT(success); + VERIFY(success); buffer = file->read_all(); } else { auto result = Core::File::open(filepath, Core::IODevice::OpenMode::ReadOnly); - ASSERT(!result.is_error()); + VERIFY(!result.is_error()); auto file = result.value(); buffer = file->read_all(); } diff --git a/Userland/Utilities/copy.cpp b/Userland/Utilities/copy.cpp index 90d2e04430..2295703825 100644 --- a/Userland/Utilities/copy.cpp +++ b/Userland/Utilities/copy.cpp @@ -60,7 +60,7 @@ static Options parse_options(int argc, char* argv[]) STDIN_FILENO, Core::IODevice::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescriptor::No); - ASSERT(success); + VERIFY(success); auto buffer = c_stdin->read_all(); dbgln("Read size {}", buffer.size()); options.data = String((char*)buffer.data(), buffer.size()); diff --git a/Userland/Utilities/crash.cpp b/Userland/Utilities/crash.cpp index 188eb690aa..817dbc300e 100644 --- a/Userland/Utilities/crash.cpp +++ b/Userland/Utilities/crash.cpp @@ -72,7 +72,7 @@ public: printf("Unexpected error!\n"); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }; @@ -84,7 +84,7 @@ public: pid_t pid = fork(); if (pid < 0) { perror("fork"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else if (pid == 0) { run_crash_and_print_if_error(); exit(0); @@ -342,7 +342,7 @@ int main(int argc, char** argv) if (do_failing_assertion || do_all_crash_types) { Crash("Perform a failing assertion", [] { - ASSERT(1 == 2); + VERIFY(1 == 2); return Crash::Failure::DidNotCrash; }).run(run_type); } diff --git a/Userland/Utilities/df.cpp b/Userland/Utilities/df.cpp index 53a79eb7aa..2ffab267e0 100644 --- a/Userland/Utilities/df.cpp +++ b/Userland/Utilities/df.cpp @@ -71,7 +71,7 @@ int main(int argc, char** argv) auto file_contents = file->read_all(); auto json_result = JsonValue::from_string(file_contents); - ASSERT(json_result.has_value()); + VERIFY(json_result.has_value()); auto json = json_result.value().as_array(); json.for_each([](auto& value) { auto fs_object = value.as_object(); diff --git a/Userland/Utilities/du.cpp b/Userland/Utilities/du.cpp index fed2898eb4..06f28569a8 100644 --- a/Userland/Utilities/du.cpp +++ b/Userland/Utilities/du.cpp @@ -124,7 +124,7 @@ int parse_args(int argc, char** argv, Vector<String>& files, DuOption& du_option if (exclude_from) { auto file = Core::File::construct(exclude_from); bool success = file->open(Core::IODevice::ReadOnly); - ASSERT(success); + VERIFY(success); if (const auto buff = file->read_all()) { String patterns = String::copy(buff, Chomp); du_option.excluded_patterns.append(patterns.split('\n')); diff --git a/Userland/Utilities/expr.cpp b/Userland/Utilities/expr.cpp index cfcc8f7ea3..f96a67c8fa 100644 --- a/Userland/Utilities/expr.cpp +++ b/Userland/Utilities/expr.cpp @@ -112,7 +112,7 @@ private: return converted.value(); fail("Not an integer: '{}'", as_string); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } virtual String string() const override { @@ -122,7 +122,7 @@ private: case Type::String: return as_string; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } virtual Type type() const override { return m_type; } @@ -176,7 +176,7 @@ private: return m_left->integer(); return m_right->integer(); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } virtual String string() const override @@ -191,7 +191,7 @@ private: return m_left->string(); return m_right->string(); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } virtual Type type() const override { @@ -205,7 +205,7 @@ private: return m_left->type(); return m_right->type(); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } BooleanOperator m_op { BooleanOperator::And }; @@ -264,7 +264,7 @@ private: case ComparisonOperation::Greater: return left != right && !(left < right); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } virtual bool truth() const override @@ -275,7 +275,7 @@ private: case Type::String: return compare(m_left->string(), m_right->string()); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } virtual int integer() const override { return truth(); } virtual String string() const override { return truth() ? "1" : "0"; } @@ -346,7 +346,7 @@ private: case ArithmeticOperation::Remainder: return left % right; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } virtual String string() const override { @@ -399,7 +399,7 @@ private: if (m_op == StringOperation::Length) return m_str->string().length(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static auto safe_substring(const String& str, int start, int length) { diff --git a/Userland/Utilities/fgrep.cpp b/Userland/Utilities/fgrep.cpp index bf71e54c77..ed8ff4adc6 100644 --- a/Userland/Utilities/fgrep.cpp +++ b/Userland/Utilities/fgrep.cpp @@ -42,7 +42,7 @@ int main(int argc, char** argv) write(1, buf, strlen(buf)); if (feof(stdin)) return 0; - ASSERT(str); + VERIFY(str); } return 0; } diff --git a/Userland/Utilities/find.cpp b/Userland/Utilities/find.cpp index 872cf1717e..4f613a980d 100644 --- a/Userland/Utilities/find.cpp +++ b/Userland/Utilities/find.cpp @@ -110,7 +110,7 @@ private: return S_ISSOCK(type); default: // We've verified this is a correct character before. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -420,7 +420,7 @@ static NonnullOwnPtr<Command> parse_all_commands(char* argv[]) auto command = parse_complex_command(argv); if (g_have_seen_action_command) { - ASSERT(command); + VERIFY(command); return command.release_nonnull(); } @@ -461,7 +461,7 @@ static const char* parse_options(int argc, char* argv[]) g_follow_symlinks = true; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } } diff --git a/Userland/Utilities/functrace.cpp b/Userland/Utilities/functrace.cpp index 01059090f9..34d08d2ab9 100644 --- a/Userland/Utilities/functrace.cpp +++ b/Userland/Utilities/functrace.cpp @@ -170,7 +170,7 @@ int main(int argc, char** argv) } // FIXME: we could miss some leaf functions that were called with a jump - ASSERT(instruction.mnemonic() == "CALL"); + VERIFY(instruction.mnemonic() == "CALL"); ++depth; new_function = true; diff --git a/Userland/Utilities/grep.cpp b/Userland/Utilities/grep.cpp index 97d26d49e9..ecf73fb49c 100644 --- a/Userland/Utilities/grep.cpp +++ b/Userland/Utilities/grep.cpp @@ -195,7 +195,7 @@ int main(int argc, char** argv) ssize_t nread = 0; ScopeGuard free_line = [line] { free(line); }; while ((nread = getline(&line, &line_len, stdin)) != -1) { - ASSERT(nread > 0); + VERIFY(nread > 0); StringView line_view(line, nread - 1); bool is_binary = line_view.contains(0); diff --git a/Userland/Utilities/gron.cpp b/Userland/Utilities/gron.cpp index 0c1b50eca9..38359d515d 100644 --- a/Userland/Utilities/gron.cpp +++ b/Userland/Utilities/gron.cpp @@ -77,7 +77,7 @@ int main(int argc, char** argv) auto file_contents = file->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); if (use_color) { color_name = "\033[33;1m"; diff --git a/Userland/Utilities/gunzip.cpp b/Userland/Utilities/gunzip.cpp index b7081d4a54..8898cbae15 100644 --- a/Userland/Utilities/gunzip.cpp +++ b/Userland/Utilities/gunzip.cpp @@ -74,7 +74,7 @@ int main(int argc, char** argv) if (!keep_input_files) { const auto retval = unlink(String { input_filename }.characters()); - ASSERT(retval == 0); + VERIFY(retval == 0); } } } diff --git a/Userland/Utilities/ifconfig.cpp b/Userland/Utilities/ifconfig.cpp index 2a1b000d9b..78ed5ebac0 100644 --- a/Userland/Utilities/ifconfig.cpp +++ b/Userland/Utilities/ifconfig.cpp @@ -65,7 +65,7 @@ int main(int argc, char** argv) auto file_contents = file->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); json.value().as_array().for_each([](auto& value) { auto if_object = value.as_object(); diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index d7b48407fd..b2ee3ae9ef 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -323,7 +323,7 @@ static void print_typed_array(const JS::Object& object, HashTable<JS::Object*>& } JS_ENUMERATE_TYPED_ARRAYS #undef __JS_ENUMERATE - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static void print_primitive_wrapper_object(const FlyString& name, const JS::Object& object, HashTable<JS::Object*>& seen_objects) @@ -884,7 +884,7 @@ int main(int argc, char** argv) break; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return results; diff --git a/Userland/Utilities/ls.cpp b/Userland/Utilities/ls.cpp index 4c26dd68c8..3e3f74c75d 100644 --- a/Userland/Utilities/ls.cpp +++ b/Userland/Utilities/ls.cpp @@ -372,7 +372,7 @@ static int do_file_system_object_long(const char* path) while (di.has_next()) { FileMetadata metadata; metadata.name = di.next_path(); - ASSERT(!metadata.name.is_empty()); + VERIFY(!metadata.name.is_empty()); if (metadata.name.ends_with('~') && flag_ignore_backups && metadata.name != path) continue; @@ -382,7 +382,7 @@ static int do_file_system_object_long(const char* path) builder.append('/'); builder.append(metadata.name); metadata.path = builder.to_string(); - ASSERT(!metadata.path.is_null()); + VERIFY(!metadata.path.is_null()); int rc = lstat(metadata.path.characters(), &metadata.stat); if (rc < 0) { perror("lstat"); diff --git a/Userland/Utilities/lsirq.cpp b/Userland/Utilities/lsirq.cpp index 8a24308c20..82402cc1b8 100644 --- a/Userland/Utilities/lsirq.cpp +++ b/Userland/Utilities/lsirq.cpp @@ -59,7 +59,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv) printf("%4s %-10s\n", " ", "CPU0"); auto file_contents = proc_interrupts->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); json.value().as_array().for_each([](auto& value) { auto handler = value.as_object(); auto purpose = handler.get("purpose").to_string(); diff --git a/Userland/Utilities/lsof.cpp b/Userland/Utilities/lsof.cpp index 9a9bafa0bd..086d7812ea 100644 --- a/Userland/Utilities/lsof.cpp +++ b/Userland/Utilities/lsof.cpp @@ -95,7 +95,7 @@ static Vector<OpenFile> get_open_files_by_pid(pid_t pid) auto result = parser.parse(); if (!result.has_value()) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Vector<OpenFile> files; @@ -105,7 +105,7 @@ static Vector<OpenFile> get_open_files_by_pid(pid_t pid) open_file.fd = object.as_object().get("fd").to_int(); String name = object.as_object().get("absolute_path").to_string(); - ASSERT(parse_name(name, open_file)); + VERIFY(parse_name(name, open_file)); open_file.full_name = name; files.append(open_file); diff --git a/Userland/Utilities/lspci.cpp b/Userland/Utilities/lspci.cpp index 45a3f48932..388e59b55c 100644 --- a/Userland/Utilities/lspci.cpp +++ b/Userland/Utilities/lspci.cpp @@ -86,7 +86,7 @@ int main(int argc, char** argv) auto file_contents = proc_pci->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); json.value().as_array().for_each([db, format](auto& value) { auto dev = value.as_object(); auto seg = dev.get("seg").to_u32(); diff --git a/Userland/Utilities/man.cpp b/Userland/Utilities/man.cpp index fc54db06e6..971e075d83 100644 --- a/Userland/Utilities/man.cpp +++ b/Userland/Utilities/man.cpp @@ -114,7 +114,7 @@ int main(int argc, char* argv[]) printf("%s(%s)\t\tSerenityOS manual\n", name, section); auto document = Markdown::Document::parse(source); - ASSERT(document); + VERIFY(document); String rendered = document->render_for_terminal(view_width); printf("%s", rendered.characters()); diff --git a/Userland/Utilities/mount.cpp b/Userland/Utilities/mount.cpp index d9d831d1c1..f475d271ee 100644 --- a/Userland/Utilities/mount.cpp +++ b/Userland/Utilities/mount.cpp @@ -145,7 +145,7 @@ static bool print_mounts() auto content = df->read_all(); auto json = JsonValue::from_string(content); - ASSERT(json.has_value()); + VERIFY(json.has_value()); json.value().as_array().for_each([](auto& value) { auto fs_object = value.as_object(); diff --git a/Userland/Utilities/ntpquery.cpp b/Userland/Utilities/ntpquery.cpp index 07003b4f38..692a5b4d54 100644 --- a/Userland/Utilities/ntpquery.cpp +++ b/Userland/Utilities/ntpquery.cpp @@ -74,7 +74,7 @@ const unsigned SecondsFrom1900To1970 = (70u * 365u + 70u / 4u) * 24u * 60u * 60u static NtpTimestamp ntp_timestamp_from_timeval(const timeval& t) { - ASSERT(t.tv_usec >= 0 && t.tv_usec < 1'000'000); // Fits in 20 bits when normalized. + VERIFY(t.tv_usec >= 0 && t.tv_usec < 1'000'000); // Fits in 20 bits when normalized. // Seconds just need translation to the different origin. uint32_t seconds = t.tv_sec + SecondsFrom1900To1970; @@ -100,9 +100,9 @@ static String format_ntp_timestamp(NtpTimestamp ntp_timestamp) struct tm tm; gmtime_r(&t.tv_sec, &tm); size_t written = strftime(buffer, sizeof(buffer), "%Y-%m-%dT%T.", &tm); - ASSERT(written == 20); + VERIFY(written == 20); written += snprintf(buffer + written, sizeof(buffer) - written, "%06d", (int)t.tv_usec); - ASSERT(written == 26); + VERIFY(written == 26); buffer[written++] = 'Z'; buffer[written] = '\0'; return buffer; @@ -231,9 +231,9 @@ int main(int argc, char** argv) } cmsghdr* cmsg = CMSG_FIRSTHDR(&msg); - ASSERT(cmsg->cmsg_level == SOL_SOCKET); - ASSERT(cmsg->cmsg_type == SCM_TIMESTAMP); - ASSERT(!CMSG_NXTHDR(&msg, cmsg)); + VERIFY(cmsg->cmsg_level == SOL_SOCKET); + VERIFY(cmsg->cmsg_type == SCM_TIMESTAMP); + VERIFY(!CMSG_NXTHDR(&msg, cmsg)); timeval kernel_receive_time; memcpy(&kernel_receive_time, CMSG_DATA(cmsg), sizeof(kernel_receive_time)); diff --git a/Userland/Utilities/ping.cpp b/Userland/Utilities/ping.cpp index 78bf70ddfa..977b97c929 100644 --- a/Userland/Utilities/ping.cpp +++ b/Userland/Utilities/ping.cpp @@ -164,7 +164,7 @@ int main(int argc, char** argv) bool fits = String("Hello there!\n").copy_characters_to_buffer(ping_packet.msg, sizeof(ping_packet.msg)); // It's a constant string, we can be sure that it fits. - ASSERT(fits); + VERIFY(fits); ping_packet.header.checksum = internet_checksum(&ping_packet, sizeof(PingPacket)); diff --git a/Userland/Utilities/pmap.cpp b/Userland/Utilities/pmap.cpp index e0a6a17611..b752ecb3cb 100644 --- a/Userland/Utilities/pmap.cpp +++ b/Userland/Utilities/pmap.cpp @@ -70,7 +70,7 @@ int main(int argc, char** argv) auto file_contents = file->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); Vector<JsonValue> sorted_regions = json.value().as_array().values(); quick_sort(sorted_regions, [](auto& a, auto& b) { diff --git a/Userland/Utilities/printf.cpp b/Userland/Utilities/printf.cpp index bb434e761c..97fe8e64be 100644 --- a/Userland/Utilities/printf.cpp +++ b/Userland/Utilities/printf.cpp @@ -205,7 +205,7 @@ template<typename V> struct ArgvNextArgument<int*, V> { ALWAYS_INLINE int* operator()(V) const { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return nullptr; } }; diff --git a/Userland/Utilities/strace.cpp b/Userland/Utilities/strace.cpp index 64d005cfbb..c43f987e51 100644 --- a/Userland/Utilities/strace.cpp +++ b/Userland/Utilities/strace.cpp @@ -105,7 +105,7 @@ int main(int argc, char** argv) perror("execvp"); exit(1); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } g_pid = pid; diff --git a/Userland/Utilities/syscall.cpp b/Userland/Utilities/syscall.cpp index 1742821acf..f5275f75be 100644 --- a/Userland/Utilities/syscall.cpp +++ b/Userland/Utilities/syscall.cpp @@ -143,7 +143,7 @@ static FlatPtr parse_parameter_buffer(ArgIter& iter) fprintf(stderr, "Error: Unmatched '['?!\n"); exit(1); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static FlatPtr parse_from(ArgIter& iter) diff --git a/Userland/Utilities/tar.cpp b/Userland/Utilities/tar.cpp index b828e3d8d1..a3ce48d49e 100644 --- a/Userland/Utilities/tar.cpp +++ b/Userland/Utilities/tar.cpp @@ -120,7 +120,7 @@ int main(int argc, char** argv) } default: // FIXME: Implement other file types - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } } @@ -129,7 +129,7 @@ int main(int argc, char** argv) } // FIXME: Implement other operations. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return 0; } diff --git a/Userland/Utilities/test-js.cpp b/Userland/Utilities/test-js.cpp index 52996c6b93..f5f8489c6e 100644 --- a/Userland/Utilities/test-js.cpp +++ b/Userland/Utilities/test-js.cpp @@ -121,7 +121,7 @@ public: : m_test_root(move(test_root)) , m_print_times(print_times) { - ASSERT(!s_the); + VERIFY(!s_the); s_the = this; } @@ -201,7 +201,7 @@ static double get_time_in_ms() { struct timeval tv1; auto return_code = gettimeofday(&tv1, nullptr); - ASSERT(return_code >= 0); + VERIFY(return_code >= 0); return static_cast<double>(tv1.tv_sec) * 1000.0 + static_cast<double>(tv1.tv_usec) / 1000.0; } @@ -334,16 +334,16 @@ JSFileResult TestRunner::run_file_test(const String& test_path) test_json.value().as_object().for_each_member([&](const String& suite_name, const JsonValue& suite_value) { JSSuite suite { suite_name }; - ASSERT(suite_value.is_object()); + VERIFY(suite_value.is_object()); suite_value.as_object().for_each_member([&](const String& test_name, const JsonValue& test_value) { JSTest test { test_name, TestResult::Fail, "" }; - ASSERT(test_value.is_object()); - ASSERT(test_value.as_object().has("result")); + VERIFY(test_value.is_object()); + VERIFY(test_value.as_object().has("result")); auto result = test_value.as_object().get("result"); - ASSERT(result.is_string()); + VERIFY(result.is_string()); auto result_string = result.as_string(); if (result_string == "pass") { test.result = TestResult::Pass; @@ -352,9 +352,9 @@ JSFileResult TestRunner::run_file_test(const String& test_path) test.result = TestResult::Fail; m_counts.tests_failed++; suite.most_severe_test_result = TestResult::Fail; - ASSERT(test_value.as_object().has("details")); + VERIFY(test_value.as_object().has("details")); auto details = test_value.as_object().get("details"); - ASSERT(result.is_string()); + VERIFY(result.is_string()); test.details = details.as_string(); } else { test.result = TestResult::Skip; @@ -425,7 +425,7 @@ static void print_modifiers(Vector<Modifier> modifiers) case CLEAR: return "\033[0m"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }(); out("{}", code); } @@ -625,7 +625,7 @@ JSFileResult Test262ParserTestRunner::run_file_test(const String& test_path) } else if (dirname.ends_with("pass") || dirname.ends_with("pass-explicit")) { expecting_file_to_parse = true; } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto start_time = get_time_in_ms(); diff --git a/Userland/Utilities/test-pthread.cpp b/Userland/Utilities/test-pthread.cpp index 36914f6634..ba56367410 100644 --- a/Userland/Utilities/test-pthread.cpp +++ b/Userland/Utilities/test-pthread.cpp @@ -50,7 +50,7 @@ static void test_once() for (auto& thread : threads) [[maybe_unused]] auto res = thread.join(); - ASSERT(v.size() == 1); + VERIFY(v.size() == 1); } int main() diff --git a/Userland/Utilities/test-web.cpp b/Userland/Utilities/test-web.cpp index 040eb90a3e..2b918b012c 100644 --- a/Userland/Utilities/test-web.cpp +++ b/Userland/Utilities/test-web.cpp @@ -186,7 +186,7 @@ static double get_time_in_ms() { struct timeval tv1; auto return_code = gettimeofday(&tv1, nullptr); - ASSERT(return_code >= 0); + VERIFY(return_code >= 0); return static_cast<double>(tv1.tv_sec) * 1000.0 + static_cast<double>(tv1.tv_usec) / 1000.0; } @@ -230,7 +230,7 @@ void TestRunner::run() cleanup_and_exit(); } - ASSERT(m_page_view->document()); + VERIFY(m_page_view->document()); // We want to keep the same document since the interpreter is tied to the document, // and we don't want to lose the test state. So, we just clear the document and @@ -303,7 +303,7 @@ static Optional<JsonValue> get_test_results(JS::Interpreter& interpreter) JSFileResult TestRunner::run_file_test(const String& test_path) { double start_time = get_time_in_ms(); - ASSERT(m_page_view->document()); + VERIFY(m_page_view->document()); auto& old_interpreter = m_page_view->document()->interpreter(); if (!m_js_test_common) { @@ -396,16 +396,16 @@ JSFileResult TestRunner::run_file_test(const String& test_path) test_json.value().as_object().for_each_member([&](const String& suite_name, const JsonValue& suite_value) { JSSuite suite { suite_name }; - ASSERT(suite_value.is_object()); + VERIFY(suite_value.is_object()); suite_value.as_object().for_each_member([&](const String& test_name, const JsonValue& test_value) { JSTest test { test_name, TestResult::Fail, "" }; - ASSERT(test_value.is_object()); - ASSERT(test_value.as_object().has("result")); + VERIFY(test_value.is_object()); + VERIFY(test_value.as_object().has("result")); auto result = test_value.as_object().get("result"); - ASSERT(result.is_string()); + VERIFY(result.is_string()); auto result_string = result.as_string(); if (result_string == "pass") { test.result = TestResult::Pass; @@ -414,9 +414,9 @@ JSFileResult TestRunner::run_file_test(const String& test_path) test.result = TestResult::Fail; m_counts.tests_failed++; suite.most_severe_test_result = TestResult::Fail; - ASSERT(test_value.as_object().has("details")); + VERIFY(test_value.as_object().has("details")); auto details = test_value.as_object().get("details"); - ASSERT(result.is_string()); + VERIFY(result.is_string()); test.details = details.as_string(); } else { test.result = TestResult::Skip; @@ -492,7 +492,7 @@ static void print_modifiers(Vector<Modifier> modifiers) case CLEAR: return "\033[0m"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }; printf("%s", code().characters()); } diff --git a/Userland/Utilities/test.cpp b/Userland/Utilities/test.cpp index a81c84933c..0cf039e135 100644 --- a/Userland/Utilities/test.cpp +++ b/Userland/Utilities/test.cpp @@ -158,7 +158,7 @@ private: case SymbolicLink: return S_ISLNK(statbuf.st_mode); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -193,7 +193,7 @@ private: case Any: return access(m_path.characters(), F_OK) == 0; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -272,7 +272,7 @@ private: case NotEqual: return m_lhs != m_rhs; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -325,7 +325,7 @@ private: case ModificationTimestampGreater: return statbuf_l.st_mtime > statbuf_r.st_mtime; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Utilities/test_efault.cpp b/Userland/Utilities/test_efault.cpp index b063fcfb78..ba46c8f3f0 100644 --- a/Userland/Utilities/test_efault.cpp +++ b/Userland/Utilities/test_efault.cpp @@ -62,14 +62,14 @@ int main(int, char**) // Test a one-page mapping (4KB) u8* one_page = (u8*)mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); - ASSERT(one_page); + VERIFY(one_page); EXPECT_OK(read, one_page, 4096); EXPECT_EFAULT(read, one_page, 4097); EXPECT_EFAULT(read, one_page - 1, 4096); // Test a two-page mapping (8KB) u8* two_page = (u8*)mmap(nullptr, 8192, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); - ASSERT(two_page); + VERIFY(two_page); EXPECT_OK(read, two_page, 4096); EXPECT_OK(read, two_page + 4096, 4096); @@ -93,7 +93,7 @@ int main(int, char**) // Test the page just below where the kernel VM begins. u8* jerk_page = (u8*)mmap((void*)(0xc0000000 - PAGE_SIZE), PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, 0, 0); - ASSERT(jerk_page == (void*)(0xc0000000 - PAGE_SIZE)); + VERIFY(jerk_page == (void*)(0xc0000000 - PAGE_SIZE)); EXPECT_OK(read, jerk_page, 4096); EXPECT_EFAULT(read, jerk_page, 4097); diff --git a/Userland/Utilities/test_env.cpp b/Userland/Utilities/test_env.cpp index ce5467ecf9..f8019cf59b 100644 --- a/Userland/Utilities/test_env.cpp +++ b/Userland/Utilities/test_env.cpp @@ -35,11 +35,11 @@ static void assert_env(const char* name, const char* value) if (!result) { perror("getenv"); printf("(When reading value for '%s'; we expected '%s'.)\n", name, value); - ASSERT(false); + VERIFY(false); } if (strcmp(result, value) != 0) { printf("Expected '%s', got '%s' instead.\n", value, result); - ASSERT(false); + VERIFY(false); } } @@ -54,7 +54,7 @@ static void test_puttenv() int rc = putenv(to_put); if (rc) { perror("putenv"); - ASSERT(false); + VERIFY(false); } assert_env("PUTENVTEST", "HELLOPUTENV"); // Do not free `to_put`! @@ -65,7 +65,7 @@ static void test_settenv() int rc = setenv("SETENVTEST", "HELLO SETENV!", 0); if (rc) { perror("setenv"); - ASSERT(false); + VERIFY(false); } // This used to trigger a very silly bug! :) assert_env("SETENVTEST", "HELLO SETENV!"); @@ -73,14 +73,14 @@ static void test_settenv() rc = setenv("SETENVTEST", "How are you today?", 0); if (rc) { perror("setenv"); - ASSERT(false); + VERIFY(false); } assert_env("SETENVTEST", "HELLO SETENV!"); rc = setenv("SETENVTEST", "Goodbye, friend!", 1); if (rc) { perror("setenv"); - ASSERT(false); + VERIFY(false); } assert_env("SETENVTEST", "Goodbye, friend!"); } @@ -90,7 +90,7 @@ static void test_settenv_overwrite_empty() int rc = setenv("EMPTYTEST", "Forcefully overwrite non-existing envvar", 1); if (rc) { perror("setenv"); - ASSERT(false); + VERIFY(false); } assert_env("EMPTYTEST", "Forcefully overwrite non-existing envvar"); } diff --git a/Userland/Utilities/test_io.cpp b/Userland/Utilities/test_io.cpp index 316840a8e5..404d76f2b9 100644 --- a/Userland/Utilities/test_io.cpp +++ b/Userland/Utilities/test_io.cpp @@ -56,11 +56,11 @@ static void test_read_from_directory() { char buffer[BUFSIZ]; int fd = open("/", O_DIRECTORY | O_RDONLY); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc; EXPECT_ERROR_3(EISDIR, read, fd, buffer, sizeof(buffer)); rc = close(fd); - ASSERT(rc == 0); + VERIFY(rc == 0); } static void test_write_to_directory() @@ -69,33 +69,33 @@ static void test_write_to_directory() int fd = open("/", O_DIRECTORY | O_RDONLY); if (fd < 0) perror("open"); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc; EXPECT_ERROR_3(EBADF, write, fd, str, sizeof(str)); rc = close(fd); - ASSERT(rc == 0); + VERIFY(rc == 0); } static void test_read_from_writeonly() { char buffer[BUFSIZ]; int fd = open("/tmp/xxxx123", O_CREAT | O_WRONLY); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc; EXPECT_ERROR_3(EBADF, read, fd, buffer, sizeof(buffer)); rc = close(fd); - ASSERT(rc == 0); + VERIFY(rc == 0); } static void test_write_to_readonly() { char str[] = "hello"; int fd = open("/tmp/abcd123", O_CREAT | O_RDONLY); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc; EXPECT_ERROR_3(EBADF, write, fd, str, sizeof(str)); rc = close(fd); - ASSERT(rc == 0); + VERIFY(rc == 0); } static void test_read_past_eof() @@ -104,7 +104,7 @@ static void test_read_past_eof() int fd = open("/home/anon/myfile.txt", O_RDONLY); if (fd < 0) perror("open"); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc; rc = lseek(fd, 9999, SEEK_SET); if (rc < 0) @@ -115,13 +115,13 @@ static void test_read_past_eof() if (rc > 0) fprintf(stderr, "read %d bytes past EOF\n", rc); rc = close(fd); - ASSERT(rc == 0); + VERIFY(rc == 0); } static void test_ftruncate_readonly() { int fd = open("/tmp/trunctest", O_RDONLY | O_CREAT, 0666); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc; EXPECT_ERROR_2(EBADF, ftruncate, fd, 0); close(fd); @@ -130,7 +130,7 @@ static void test_ftruncate_readonly() static void test_ftruncate_negative() { int fd = open("/tmp/trunctest", O_RDWR | O_CREAT, 0666); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc; EXPECT_ERROR_2(EINVAL, ftruncate, fd, -1); close(fd); @@ -139,7 +139,7 @@ static void test_ftruncate_negative() static void test_mmap_directory() { int fd = open("/tmp", O_RDONLY | O_DIRECTORY); - ASSERT(fd >= 0); + VERIFY(fd >= 0); auto* ptr = mmap(nullptr, 4096, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0); if (ptr != MAP_FAILED) { fprintf(stderr, "Boo! mmap() of a directory succeeded!\n"); @@ -155,13 +155,13 @@ static void test_mmap_directory() static void test_tmpfs_read_past_end() { int fd = open("/tmp/x", O_RDWR | O_CREAT | O_TRUNC, 0600); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc = ftruncate(fd, 1); - ASSERT(rc == 0); + VERIFY(rc == 0); rc = lseek(fd, 4096, SEEK_SET); - ASSERT(rc == 4096); + VERIFY(rc == 4096); char buffer[16]; int nread = read(fd, buffer, sizeof(buffer)); @@ -174,10 +174,10 @@ static void test_tmpfs_read_past_end() static void test_procfs_read_past_end() { int fd = open("/proc/uptime", O_RDONLY); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc = lseek(fd, 4096, SEEK_SET); - ASSERT(rc == 4096); + VERIFY(rc == 4096); char buffer[16]; int nread = read(fd, buffer, sizeof(buffer)); @@ -190,12 +190,12 @@ static void test_procfs_read_past_end() static void test_open_create_device() { int fd = open("/tmp/fakedevice", (O_RDWR | O_CREAT), (S_IFCHR | 0600)); - ASSERT(fd >= 0); + VERIFY(fd >= 0); struct stat st; if (fstat(fd, &st) < 0) { perror("stat"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (st.st_mode != 0100600) { @@ -210,11 +210,11 @@ static void test_unlink_symlink() int rc = symlink("/proc/2/foo", "/tmp/linky"); if (rc < 0) { perror("symlink"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto target = Core::File::read_link("/tmp/linky"); - ASSERT(target == "/proc/2/foo"); + VERIFY(target == "/proc/2/foo"); rc = unlink("/tmp/linky"); if (rc < 0) { @@ -226,10 +226,10 @@ static void test_unlink_symlink() static void test_eoverflow() { int fd = open("/tmp/x", O_RDWR); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc = lseek(fd, INT32_MAX, SEEK_SET); - ASSERT(rc == INT32_MAX); + VERIFY(rc == INT32_MAX); char buffer[16]; rc = read(fd, buffer, sizeof(buffer)); @@ -246,13 +246,13 @@ static void test_eoverflow() static void test_rmdir_while_inside_dir() { int rc = mkdir("/home/anon/testdir", 0700); - ASSERT(rc == 0); + VERIFY(rc == 0); rc = chdir("/home/anon/testdir"); - ASSERT(rc == 0); + VERIFY(rc == 0); rc = rmdir("/home/anon/testdir"); - ASSERT(rc == 0); + VERIFY(rc == 0); int fd = open("x", O_CREAT | O_RDWR, 0600); if (fd >= 0 || errno != ENOENT) { @@ -260,7 +260,7 @@ static void test_rmdir_while_inside_dir() } rc = chdir("/home/anon"); - ASSERT(rc == 0); + VERIFY(rc == 0); } static void test_writev() @@ -276,18 +276,18 @@ static void test_writev() int nwritten = writev(pipefds[1], iov, 2); if (nwritten < 0) { perror("writev"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (nwritten != 12) { fprintf(stderr, "Didn't write 12 bytes to pipe with writev\n"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } char buffer[32]; int nread = read(pipefds[0], buffer, sizeof(buffer)); if (nread != 12 || memcmp(buffer, "HelloFriends", 12)) { fprintf(stderr, "Didn't read the expected data from pipe after writev\n"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } close(pipefds[0]); @@ -299,7 +299,7 @@ static void test_rmdir_root() int rc = rmdir("/"); if (rc != -1 || errno != EBUSY) { warnln("rmdir(/) didn't fail with EBUSY"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Utilities/unzip.cpp b/Userland/Utilities/unzip.cpp index d21228c822..d62d1d3d9b 100644 --- a/Userland/Utilities/unzip.cpp +++ b/Userland/Utilities/unzip.cpp @@ -101,7 +101,7 @@ static bool unpack_file_for_central_directory_index(off_t central_directory_inde return false; auto compression_method = buffer[1] << 8 | buffer[0]; // FIXME: Remove once any decompression is supported. - ASSERT(compression_method == None); + VERIFY(compression_method == None); if (!seek_and_read(buffer, file, local_file_header_index + LFHCompressedSizeOffset, 4)) return false; diff --git a/Userland/Utilities/utmpupdate.cpp b/Userland/Utilities/utmpupdate.cpp index cb18839f7b..17db0f568e 100644 --- a/Userland/Utilities/utmpupdate.cpp +++ b/Userland/Utilities/utmpupdate.cpp @@ -96,7 +96,7 @@ int main(int argc, char** argv) entry.set("login_at", time(nullptr)); json.set(tty_name, move(entry)); } else { - ASSERT(flag_delete); + VERIFY(flag_delete); dbgln("Removing {} from utmp", tty_name); json.remove(tty_name); } diff --git a/Userland/Utilities/watch.cpp b/Userland/Utilities/watch.cpp index 1377a7667c..c7e9e3a547 100644 --- a/Userland/Utilities/watch.cpp +++ b/Userland/Utilities/watch.cpp @@ -98,7 +98,7 @@ static int run_command(const Vector<const char*>& command) do { exited_pid = waitpid(child_pid, &status, 0); } while (exited_pid < 0 && errno == EINTR); - ASSERT(exited_pid == child_pid); + VERIFY(exited_pid == child_pid); child_pid = -1; if (exited_pid < 0) { perror("waitpid"); |