mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:27:34 +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:
parent
b33a6a443e
commit
5d180d1f99
725 changed files with 3448 additions and 3448 deletions
|
@ -39,8 +39,8 @@ AsyncDeviceRequest::~AsyncDeviceRequest()
|
|||
{
|
||||
{
|
||||
ScopedSpinLock lock(m_lock);
|
||||
ASSERT(is_completed_result(m_result));
|
||||
ASSERT(m_sub_requests_pending.is_empty());
|
||||
VERIFY(is_completed_result(m_result));
|
||||
VERIFY(m_sub_requests_pending.is_empty());
|
||||
}
|
||||
|
||||
// We should not need any locking here anymore. The destructor should
|
||||
|
@ -50,8 +50,8 @@ AsyncDeviceRequest::~AsyncDeviceRequest()
|
|||
// Which means there should be no more pending sub-requests and the
|
||||
// entire AsyncDeviceRequest hierarchy should be immutable.
|
||||
for (auto& sub_request : m_sub_requests_complete) {
|
||||
ASSERT(is_completed_result(sub_request.m_result)); // Shouldn't need any locking anymore
|
||||
ASSERT(sub_request.m_parent_request == this);
|
||||
VERIFY(is_completed_result(sub_request.m_result)); // Shouldn't need any locking anymore
|
||||
VERIFY(sub_request.m_parent_request == this);
|
||||
sub_request.m_parent_request = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ void AsyncDeviceRequest::request_finished()
|
|||
|
||||
auto AsyncDeviceRequest::wait(timeval* timeout) -> RequestWaitResult
|
||||
{
|
||||
ASSERT(!m_parent_request);
|
||||
VERIFY(!m_parent_request);
|
||||
auto request_result = get_request_result();
|
||||
if (is_completed_result(request_result))
|
||||
return { request_result, Thread::BlockResult::NotBlocked };
|
||||
|
@ -87,14 +87,14 @@ auto AsyncDeviceRequest::get_request_result() const -> RequestResult
|
|||
void AsyncDeviceRequest::add_sub_request(NonnullRefPtr<AsyncDeviceRequest> sub_request)
|
||||
{
|
||||
// Sub-requests cannot be for the same device
|
||||
ASSERT(&m_device != &sub_request->m_device);
|
||||
ASSERT(sub_request->m_parent_request == nullptr);
|
||||
VERIFY(&m_device != &sub_request->m_device);
|
||||
VERIFY(sub_request->m_parent_request == nullptr);
|
||||
sub_request->m_parent_request = this;
|
||||
|
||||
bool should_start;
|
||||
{
|
||||
ScopedSpinLock lock(m_lock);
|
||||
ASSERT(!is_completed_result(m_result));
|
||||
VERIFY(!is_completed_result(m_result));
|
||||
m_sub_requests_pending.append(sub_request);
|
||||
should_start = (m_result == Started);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ void AsyncDeviceRequest::sub_request_finished(AsyncDeviceRequest& sub_request)
|
|||
bool all_completed;
|
||||
{
|
||||
ScopedSpinLock lock(m_lock);
|
||||
ASSERT(m_result == Started);
|
||||
VERIFY(m_result == Started);
|
||||
size_t index;
|
||||
for (index = 0; index < m_sub_requests_pending.size(); index++) {
|
||||
if (&m_sub_requests_pending[index] == &sub_request) {
|
||||
|
@ -117,7 +117,7 @@ void AsyncDeviceRequest::sub_request_finished(AsyncDeviceRequest& sub_request)
|
|||
break;
|
||||
}
|
||||
}
|
||||
ASSERT(index < m_sub_requests_pending.size());
|
||||
VERIFY(index < m_sub_requests_pending.size());
|
||||
all_completed = m_sub_requests_pending.is_empty();
|
||||
if (all_completed) {
|
||||
// Aggregate any errors
|
||||
|
@ -126,7 +126,7 @@ void AsyncDeviceRequest::sub_request_finished(AsyncDeviceRequest& sub_request)
|
|||
for (index = 0; index < m_sub_requests_complete.size(); index++) {
|
||||
auto& sub_request = m_sub_requests_complete[index];
|
||||
auto sub_result = sub_request.get_request_result();
|
||||
ASSERT(is_completed_result(sub_result));
|
||||
VERIFY(is_completed_result(sub_result));
|
||||
switch (sub_result) {
|
||||
case Failure:
|
||||
any_failures = true;
|
||||
|
@ -154,11 +154,11 @@ void AsyncDeviceRequest::sub_request_finished(AsyncDeviceRequest& sub_request)
|
|||
|
||||
void AsyncDeviceRequest::complete(RequestResult result)
|
||||
{
|
||||
ASSERT(result == Success || result == Failure || result == MemoryFault);
|
||||
VERIFY(result == Success || result == Failure || result == MemoryFault);
|
||||
ScopedCritical critical;
|
||||
{
|
||||
ScopedSpinLock lock(m_lock);
|
||||
ASSERT(m_result == Started);
|
||||
VERIFY(m_result == Started);
|
||||
m_result = result;
|
||||
}
|
||||
if (Processor::current().in_irq()) {
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
|
||||
void set_private(void* priv)
|
||||
{
|
||||
ASSERT(!m_private || !priv);
|
||||
VERIFY(!m_private || !priv);
|
||||
m_private = priv;
|
||||
}
|
||||
void* get_private() const { return m_private; }
|
||||
|
|
|
@ -101,7 +101,7 @@ u16 BXVGADevice::get_register(u16 index)
|
|||
void BXVGADevice::revert_resolution()
|
||||
{
|
||||
set_resolution_registers(m_framebuffer_width, m_framebuffer_height);
|
||||
ASSERT(validate_setup_resolution(m_framebuffer_width, m_framebuffer_height));
|
||||
VERIFY(validate_setup_resolution(m_framebuffer_width, m_framebuffer_height));
|
||||
}
|
||||
|
||||
void BXVGADevice::set_resolution_registers(size_t width, size_t height)
|
||||
|
@ -152,7 +152,7 @@ bool BXVGADevice::validate_setup_resolution(size_t width, size_t height)
|
|||
|
||||
void BXVGADevice::set_y_offset(size_t y_offset)
|
||||
{
|
||||
ASSERT(y_offset == 0 || y_offset == m_framebuffer_height);
|
||||
VERIFY(y_offset == 0 || y_offset == m_framebuffer_height);
|
||||
m_y_offset = y_offset;
|
||||
set_register(VBE_DISPI_INDEX_Y_OFFSET, (u16)y_offset);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ bool BlockDevice::read_block(unsigned index, UserOrKernelBuffer& buffer)
|
|||
dbgln("BlockDevice::read_block({}) cancelled", index);
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ bool BlockDevice::write_block(unsigned index, const UserOrKernelBuffer& buffer)
|
|||
dbgln("BlockDevice::write_block({}) cancelled", index);
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
case Write:
|
||||
return "BlockDeviceRequest (write)";
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ Device::Device(unsigned major, unsigned minor)
|
|||
if (it != all_devices().end()) {
|
||||
dbgln("Already registered {},{}: {}", major, minor, it->value->class_name());
|
||||
}
|
||||
ASSERT(!all_devices().contains(device_id));
|
||||
VERIFY(!all_devices().contains(device_id));
|
||||
all_devices().set(device_id, this);
|
||||
}
|
||||
|
||||
|
@ -86,8 +86,8 @@ void Device::process_next_queued_request(Badge<AsyncDeviceRequest>, const AsyncD
|
|||
|
||||
{
|
||||
ScopedSpinLock lock(m_requests_lock);
|
||||
ASSERT(!m_requests.is_empty());
|
||||
ASSERT(m_requests.first().ptr() == &completed_request);
|
||||
VERIFY(!m_requests.is_empty());
|
||||
VERIFY(m_requests.first().ptr() == &completed_request);
|
||||
m_requests.remove(m_requests.begin());
|
||||
if (!m_requests.is_empty())
|
||||
next_request = m_requests.first().ptr();
|
||||
|
|
|
@ -41,13 +41,13 @@ UNMAP_AFTER_INIT void I8042Controller::initialize()
|
|||
|
||||
I8042Controller& I8042Controller::the()
|
||||
{
|
||||
ASSERT(s_the);
|
||||
VERIFY(s_the);
|
||||
return *s_the;
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT I8042Controller::I8042Controller()
|
||||
{
|
||||
ASSERT(!s_the);
|
||||
VERIFY(!s_the);
|
||||
s_the = this;
|
||||
|
||||
u8 configuration;
|
||||
|
@ -148,7 +148,7 @@ UNMAP_AFTER_INIT I8042Controller::I8042Controller()
|
|||
|
||||
void I8042Controller::irq_process_input_buffer(Device)
|
||||
{
|
||||
ASSERT(Processor::current().in_irq());
|
||||
VERIFY(Processor::current().in_irq());
|
||||
|
||||
u8 status = IO::in8(I8042_STATUS);
|
||||
if (!(status & I8042_BUFFER_FULL))
|
||||
|
@ -171,10 +171,10 @@ void I8042Controller::do_drain()
|
|||
|
||||
bool I8042Controller::do_reset_device(Device device)
|
||||
{
|
||||
ASSERT(device != Device::None);
|
||||
ASSERT(m_lock.is_locked());
|
||||
VERIFY(device != Device::None);
|
||||
VERIFY(m_lock.is_locked());
|
||||
|
||||
ASSERT(!Processor::current().in_irq());
|
||||
VERIFY(!Processor::current().in_irq());
|
||||
if (do_send_command(device, 0xff) != I8042_ACK)
|
||||
return false;
|
||||
// Wait until we get the self-test result
|
||||
|
@ -183,20 +183,20 @@ bool I8042Controller::do_reset_device(Device device)
|
|||
|
||||
u8 I8042Controller::do_send_command(Device device, u8 command)
|
||||
{
|
||||
ASSERT(device != Device::None);
|
||||
ASSERT(m_lock.is_locked());
|
||||
VERIFY(device != Device::None);
|
||||
VERIFY(m_lock.is_locked());
|
||||
|
||||
ASSERT(!Processor::current().in_irq());
|
||||
VERIFY(!Processor::current().in_irq());
|
||||
|
||||
return do_write_to_device(device, command);
|
||||
}
|
||||
|
||||
u8 I8042Controller::do_send_command(Device device, u8 command, u8 data)
|
||||
{
|
||||
ASSERT(device != Device::None);
|
||||
ASSERT(m_lock.is_locked());
|
||||
VERIFY(device != Device::None);
|
||||
VERIFY(m_lock.is_locked());
|
||||
|
||||
ASSERT(!Processor::current().in_irq());
|
||||
VERIFY(!Processor::current().in_irq());
|
||||
|
||||
u8 response = do_write_to_device(device, command);
|
||||
if (response == I8042_ACK)
|
||||
|
@ -206,10 +206,10 @@ u8 I8042Controller::do_send_command(Device device, u8 command, u8 data)
|
|||
|
||||
u8 I8042Controller::do_write_to_device(Device device, u8 data)
|
||||
{
|
||||
ASSERT(device != Device::None);
|
||||
ASSERT(m_lock.is_locked());
|
||||
VERIFY(device != Device::None);
|
||||
VERIFY(m_lock.is_locked());
|
||||
|
||||
ASSERT(!Processor::current().in_irq());
|
||||
VERIFY(!Processor::current().in_irq());
|
||||
|
||||
int attempts = 0;
|
||||
u8 response;
|
||||
|
@ -230,7 +230,7 @@ u8 I8042Controller::do_write_to_device(Device device, u8 data)
|
|||
|
||||
u8 I8042Controller::do_read_from_device(Device device)
|
||||
{
|
||||
ASSERT(device != Device::None);
|
||||
VERIFY(device != Device::None);
|
||||
|
||||
prepare_for_input(device);
|
||||
return IO::in8(I8042_BUFFER);
|
||||
|
@ -238,7 +238,7 @@ u8 I8042Controller::do_read_from_device(Device device)
|
|||
|
||||
void I8042Controller::prepare_for_input(Device device)
|
||||
{
|
||||
ASSERT(m_lock.is_locked());
|
||||
VERIFY(m_lock.is_locked());
|
||||
const u8 buffer_type = device == Device::Keyboard ? I8042_KEYBOARD_BUFFER : I8042_MOUSE_BUFFER;
|
||||
for (;;) {
|
||||
u8 status = IO::in8(I8042_STATUS);
|
||||
|
@ -249,7 +249,7 @@ void I8042Controller::prepare_for_input(Device device)
|
|||
|
||||
void I8042Controller::prepare_for_output()
|
||||
{
|
||||
ASSERT(m_lock.is_locked());
|
||||
VERIFY(m_lock.is_locked());
|
||||
for (;;) {
|
||||
if (!(IO::in8(I8042_STATUS) & 2))
|
||||
return;
|
||||
|
@ -258,14 +258,14 @@ void I8042Controller::prepare_for_output()
|
|||
|
||||
void I8042Controller::do_wait_then_write(u8 port, u8 data)
|
||||
{
|
||||
ASSERT(m_lock.is_locked());
|
||||
VERIFY(m_lock.is_locked());
|
||||
prepare_for_output();
|
||||
IO::out8(port, data);
|
||||
}
|
||||
|
||||
u8 I8042Controller::do_wait_then_read(u8 port)
|
||||
{
|
||||
ASSERT(m_lock.is_locked());
|
||||
VERIFY(m_lock.is_locked());
|
||||
prepare_for_input(Device::None);
|
||||
return IO::in8(port);
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ private:
|
|||
|
||||
static int device_to_deviceinfo_index(Device device)
|
||||
{
|
||||
ASSERT(device != Device::None);
|
||||
VERIFY(device != Device::None);
|
||||
return (device == Device::Keyboard) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -450,7 +450,7 @@ KResultOr<size_t> KeyboardDevice::read(FileDescription&, size_t, UserOrKernelBuf
|
|||
});
|
||||
if (n < 0)
|
||||
return KResult((ErrnoCode)-n);
|
||||
ASSERT((size_t)n == sizeof(Event));
|
||||
VERIFY((size_t)n == sizeof(Event));
|
||||
nread += sizeof(Event);
|
||||
|
||||
lock.lock();
|
||||
|
|
|
@ -114,7 +114,7 @@ void PS2MouseDevice::irq_handle_byte_read(u8 byte)
|
|||
evaluate_block_conditions();
|
||||
};
|
||||
|
||||
ASSERT(m_data_state < sizeof(m_data.bytes) / sizeof(m_data.bytes[0]));
|
||||
VERIFY(m_data_state < sizeof(m_data.bytes) / sizeof(m_data.bytes[0]));
|
||||
m_data.bytes[m_data_state] = byte;
|
||||
|
||||
switch (m_data_state) {
|
||||
|
@ -136,7 +136,7 @@ void PS2MouseDevice::irq_handle_byte_read(u8 byte)
|
|||
commit_packet();
|
||||
break;
|
||||
case 3:
|
||||
ASSERT(m_has_wheel);
|
||||
VERIFY(m_has_wheel);
|
||||
commit_packet();
|
||||
break;
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ bool PS2MouseDevice::can_read(const FileDescription&, size_t) const
|
|||
|
||||
KResultOr<size_t> PS2MouseDevice::read(FileDescription&, size_t, UserOrKernelBuffer& buffer, size_t size)
|
||||
{
|
||||
ASSERT(size > 0);
|
||||
VERIFY(size > 0);
|
||||
size_t nread = 0;
|
||||
size_t remaining_space_in_buffer = static_cast<size_t>(size) - nread;
|
||||
ScopedSpinLock lock(m_queue_lock);
|
||||
|
|
|
@ -153,7 +153,7 @@ void SB16::set_irq_register(u8 irq_number)
|
|||
bitmask = 0b1000;
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
IO::out8(0x224, 0x80);
|
||||
IO::out8(0x225, bitmask);
|
||||
|
@ -258,7 +258,7 @@ KResultOr<size_t> SB16::write(FileDescription&, size_t, const UserOrKernelBuffer
|
|||
#if SB16_DEBUG
|
||||
klog() << "SB16: Writing buffer of " << length << " bytes";
|
||||
#endif
|
||||
ASSERT(length <= PAGE_SIZE);
|
||||
VERIFY(length <= PAGE_SIZE);
|
||||
const int BLOCK_SIZE = 32 * 1024;
|
||||
if (length > BLOCK_SIZE) {
|
||||
return ENOSPC;
|
||||
|
|
|
@ -296,7 +296,7 @@ QueueHead* UHCIController::allocate_queue_head() const
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED(); // Let's just assert for now, this should never happen
|
||||
VERIFY_NOT_REACHED(); // Let's just assert for now, this should never happen
|
||||
return nullptr; // Huh!? We're outta queue heads!
|
||||
}
|
||||
|
||||
|
@ -312,7 +312,7 @@ TransferDescriptor* UHCIController::allocate_transfer_descriptor() const
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED(); // Let's just assert for now, this should never happen
|
||||
VERIFY_NOT_REACHED(); // Let's just assert for now, this should never happen
|
||||
return nullptr; // Huh?! We're outta TDs!!
|
||||
}
|
||||
|
||||
|
|
|
@ -105,13 +105,13 @@ struct alignas(16) TransferDescriptor final {
|
|||
void set_in_use(bool in_use) { m_in_use = in_use; }
|
||||
void set_max_len(u16 max_len)
|
||||
{
|
||||
ASSERT(max_len < 0x500 || max_len == 0x7ff);
|
||||
VERIFY(max_len < 0x500 || max_len == 0x7ff);
|
||||
m_token |= (max_len << 21);
|
||||
}
|
||||
|
||||
void set_device_address(u8 address)
|
||||
{
|
||||
ASSERT(address <= 0x7f);
|
||||
VERIFY(address <= 0x7f);
|
||||
m_token |= (address << 8);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue