1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:27:45 +00:00

Everywhere: Rename ASSERT => VERIFY

(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
This commit is contained in:
Andreas Kling 2021-02-23 20:42:32 +01:00
parent b33a6a443e
commit 5d180d1f99
725 changed files with 3448 additions and 3448 deletions

View file

@ -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;

View file

@ -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();

View file

@ -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();

View file

@ -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);
}

View file

@ -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;