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
Notes: sideshowbarker 2024-07-18 21:58:46 +09:00
725 changed files with 3448 additions and 3448 deletions

View file

@ -44,7 +44,7 @@ Plan9FS::~Plan9FS()
{
// Make sure to destroy the root inode before the FS gets destroyed.
if (m_root_inode) {
ASSERT(m_root_inode->ref_count() == 1);
VERIFY(m_root_inode->ref_count() == 1);
m_root_inode = nullptr;
}
}
@ -153,7 +153,7 @@ public:
template<typename N>
Decoder& read_number(N& number)
{
ASSERT(sizeof(number) <= m_data.length());
VERIFY(sizeof(number) <= m_data.length());
memcpy(&number, m_data.characters_without_null_termination(), sizeof(number));
m_data = m_data.substring_view(sizeof(number), m_data.length() - sizeof(number));
return *this;
@ -170,14 +170,14 @@ public:
template<typename T>
Message& operator>>(T& t)
{
ASSERT(m_have_been_built);
VERIFY(m_have_been_built);
m_built.decoder >> t;
return *this;
}
StringView read_data()
{
ASSERT(m_have_been_built);
VERIFY(m_have_been_built);
return m_built.decoder.read_data();
}
@ -197,7 +197,7 @@ private:
template<typename N>
Message& append_number(N number)
{
ASSERT(!m_have_been_built);
VERIFY(!m_have_been_built);
m_builder.append(reinterpret_cast<const char*>(&number), sizeof(number));
return *this;
}
@ -330,7 +330,7 @@ Plan9FS::Message::Decoder& Plan9FS::Message::Decoder::operator>>(StringView& str
{
u16 length;
*this >> length;
ASSERT(length <= m_data.length());
VERIFY(length <= m_data.length());
string = m_data.substring_view(0, length);
m_data = m_data.substring_view_starting_after_substring(string);
return *this;
@ -340,7 +340,7 @@ StringView Plan9FS::Message::Decoder::read_data()
{
u32 length;
*this >> length;
ASSERT(length <= m_data.length());
VERIFY(length <= m_data.length());
auto data = m_data.substring_view(0, length);
m_data = m_data.substring_view_starting_after_substring(data);
return data;
@ -401,12 +401,12 @@ Plan9FS::Message& Plan9FS::Message::operator=(Message&& message)
const KBuffer& Plan9FS::Message::build()
{
ASSERT(!m_have_been_built);
VERIFY(!m_have_been_built);
auto tmp_buffer = m_builder.build();
// FIXME: We should not assume success here.
ASSERT(tmp_buffer);
VERIFY(tmp_buffer);
m_have_been_built = true;
m_builder.~KBufferBuilder();
@ -470,7 +470,7 @@ bool Plan9FS::Plan9FSBlockCondition::should_add_blocker(Thread::Blocker& b, void
void Plan9FS::Plan9FSBlockCondition::unblock_completed(u16 tag)
{
unblock([&](Thread::Blocker& b, void*, bool&) {
ASSERT(b.blocker_type() == Thread::Blocker::Type::Plan9FS);
VERIFY(b.blocker_type() == Thread::Blocker::Type::Plan9FS);
auto& blocker = static_cast<Blocker&>(b);
return blocker.unblock(tag);
});
@ -479,7 +479,7 @@ void Plan9FS::Plan9FSBlockCondition::unblock_completed(u16 tag)
void Plan9FS::Plan9FSBlockCondition::unblock_all()
{
unblock([&](Thread::Blocker& b, void*, bool&) {
ASSERT(b.blocker_type() == Thread::Blocker::Type::Plan9FS);
VERIFY(b.blocker_type() == Thread::Blocker::Type::Plan9FS);
auto& blocker = static_cast<Blocker&>(b);
return blocker.unblock();
});
@ -498,13 +498,13 @@ bool Plan9FS::is_complete(const ReceiveCompletion& completion)
LOCKER(m_lock);
if (m_completions.contains(completion.tag)) {
// If it's still in the map then it can't be complete
ASSERT(!completion.completed);
VERIFY(!completion.completed);
return false;
}
// if it's not in the map anymore, it must be complete. But we MUST
// hold m_lock to be able to check completion.completed!
ASSERT(completion.completed);
VERIFY(completion.completed);
return true;
}