diff --git a/AK/Array.h b/AK/Array.h index 815d1eaf4cc..19e15f4e635 100644 --- a/AK/Array.h +++ b/AK/Array.h @@ -43,12 +43,12 @@ struct Array { constexpr const T& at(size_t index) const { - ASSERT(index < size()); + VERIFY(index < size()); return (*this)[index]; } constexpr T& at(size_t index) { - ASSERT(index < size()); + VERIFY(index < size()); return (*this)[index]; } diff --git a/AK/Assertions.h b/AK/Assertions.h index 352ab090e01..bd50e66efef 100644 --- a/AK/Assertions.h +++ b/AK/Assertions.h @@ -31,9 +31,9 @@ #else # include # ifndef __serenity__ -# define ASSERT assert -# define ASSERT_NOT_REACHED() assert(false) +# define VERIFY assert +# define VERIFY_NOT_REACHED() assert(false) # define RELEASE_ASSERT assert -# define TODO ASSERT_NOT_REACHED +# define TODO VERIFY_NOT_REACHED # endif #endif diff --git a/AK/Bitmap.h b/AK/Bitmap.h index a9129e3cd1d..9c7a4688291 100644 --- a/AK/Bitmap.h +++ b/AK/Bitmap.h @@ -85,12 +85,12 @@ public: size_t size_in_bytes() const { return ceil_div(m_size, static_cast(8)); } bool get(size_t index) const { - ASSERT(index < m_size); + VERIFY(index < m_size); return 0 != (m_data[index / 8] & (1u << (index % 8))); } void set(size_t index, bool value) const { - ASSERT(index < m_size); + VERIFY(index < m_size); if (value) m_data[index / 8] |= static_cast((1u << (index % 8))); else @@ -104,8 +104,8 @@ public: size_t count_in_range(size_t start, size_t len, bool value) const { - ASSERT(start < m_size); - ASSERT(start + len <= m_size); + VERIFY(start < m_size); + VERIFY(start + len <= m_size); if (len == 0) return 0; @@ -153,8 +153,8 @@ public: void grow(size_t size, bool default_value) { - ASSERT(m_owned); - ASSERT(size > m_size); + VERIFY(m_owned); + VERIFY(size > m_size); auto previous_size_bytes = size_in_bytes(); auto previous_size = m_size; @@ -176,8 +176,8 @@ public: template void set_range(size_t start, size_t len) { - ASSERT(start < m_size); - ASSERT(start + len <= m_size); + VERIFY(start < m_size); + VERIFY(start + len <= m_size); if (len == 0) return; @@ -228,7 +228,7 @@ public: template Optional find_one_anywhere(size_t hint = 0) const { - ASSERT(hint < m_size); + VERIFY(hint < m_size); const u8* end = &m_data[m_size / 8]; for (;;) { @@ -249,7 +249,7 @@ public: byte = m_data[i]; if constexpr (!VALUE) byte = ~byte; - ASSERT(byte != 0); + VERIFY(byte != 0); return i * 8 + __builtin_ffs(byte) - 1; } } @@ -264,7 +264,7 @@ public: u8 byte = VALUE ? 0x00 : 0xff; size_t i = (const u8*)ptr32 - &m_data[0]; size_t byte_count = m_size / 8; - ASSERT(i <= byte_count); + VERIFY(i <= byte_count); while (i < byte_count && m_data[i] == byte) i++; if (i == byte_count) { @@ -279,7 +279,7 @@ public: byte = m_data[i]; if constexpr (!VALUE) byte = ~byte; - ASSERT(byte != 0); + VERIFY(byte != 0); return i * 8 + __builtin_ffs(byte) - 1; } @@ -288,7 +288,7 @@ public: val32 = *ptr32; if constexpr (!VALUE) val32 = ~val32; - ASSERT(val32 != 0); + VERIFY(val32 != 0); return ((const u8*)ptr32 - &m_data[0]) * 8 + __builtin_ffsl(val32) - 1; } } @@ -317,7 +317,7 @@ public: byte = m_data[i]; if constexpr (!VALUE) byte = ~byte; - ASSERT(byte != 0); + VERIFY(byte != 0); return i * 8 + __builtin_ffs(byte) - 1; } @@ -509,7 +509,7 @@ public: : m_size(size) , m_owned(true) { - ASSERT(m_size != 0); + VERIFY(m_size != 0); m_data = reinterpret_cast(kmalloc(size_in_bytes())); fill(default_value); } diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index feabaeaa4c5..65ba418f4ab 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -54,12 +54,12 @@ public: u8& operator[](size_t i) { - ASSERT(i < m_size); + VERIFY(i < m_size); return m_data[i]; } const u8& operator[](size_t i) const { - ASSERT(i < m_size); + VERIFY(i < m_size); return m_data[i]; } bool is_empty() const { return !m_size; } @@ -83,7 +83,7 @@ public: // NOTE: trim() does not reallocate. void trim(size_t size) { - ASSERT(size <= m_size); + VERIFY(size <= m_size); m_size = size; } @@ -145,12 +145,12 @@ public: u8& operator[](size_t i) { - ASSERT(m_impl); + VERIFY(m_impl); return (*m_impl)[i]; } u8 operator[](size_t i) const { - ASSERT(m_impl); + VERIFY(m_impl); return (*m_impl)[i]; } bool is_empty() const { return !m_impl || m_impl->is_empty(); } @@ -215,7 +215,7 @@ public: return {}; // I cannot hand you a slice I don't have - ASSERT(offset + size <= this->size()); + VERIFY(offset + size <= this->size()); return copy(offset_pointer(offset), size); } @@ -232,7 +232,7 @@ public: { if (data_size == 0) return; - ASSERT(data != nullptr); + VERIFY(data != nullptr); int old_size = size(); grow(size() + data_size); __builtin_memcpy(this->data() + old_size, data, data_size); @@ -246,7 +246,7 @@ public: void overwrite(size_t offset, const void* data, size_t data_size) { // make sure we're not told to write past the end - ASSERT(offset + data_size <= size()); + VERIFY(offset + data_size <= size()); __builtin_memcpy(this->data() + offset, data, data_size); } @@ -285,7 +285,7 @@ inline ByteBufferImpl::ByteBufferImpl(const void* data, size_t size) inline void ByteBufferImpl::grow(size_t size) { - ASSERT(size > m_size); + VERIFY(size > m_size); if (size == 0) { if (m_data) kfree(m_data); diff --git a/AK/Checked.h b/AK/Checked.h index efa66403442..3ed63f0132f 100644 --- a/AK/Checked.h +++ b/AK/Checked.h @@ -156,13 +156,13 @@ public: ALWAYS_INLINE constexpr bool operator!() const { - ASSERT(!m_overflow); + VERIFY(!m_overflow); return !m_value; } ALWAYS_INLINE constexpr T value() const { - ASSERT(!m_overflow); + VERIFY(!m_overflow); return m_value; } diff --git a/AK/CheckedFormatString.h b/AK/CheckedFormatString.h index 891716728a5..896dabed238 100644 --- a/AK/CheckedFormatString.h +++ b/AK/CheckedFormatString.h @@ -42,7 +42,7 @@ #ifndef DBGLN_NO_COMPILETIME_FORMAT_CHECK namespace AK::Format::Detail { -// We have to define a local "purely constexpr" Array that doesn't lead back to us (via e.g. ASSERT) +// We have to define a local "purely constexpr" Array that doesn't lead back to us (via e.g. VERIFY) template struct Array { constexpr static size_t size() { return Size; } diff --git a/AK/CircularDeque.h b/AK/CircularDeque.h index 27b31ea2c11..9f5714367c8 100644 --- a/AK/CircularDeque.h +++ b/AK/CircularDeque.h @@ -50,7 +50,7 @@ public: T dequeue_end() { - ASSERT(!this->is_empty()); + VERIFY(!this->is_empty()); auto& slot = this->elements()[(this->m_head + this->m_size - 1) % Capacity]; T value = move(slot); slot.~T(); diff --git a/AK/CircularDuplexStream.h b/AK/CircularDuplexStream.h index 029383a13ca..b91f69d2a09 100644 --- a/AK/CircularDuplexStream.h +++ b/AK/CircularDuplexStream.h @@ -55,7 +55,7 @@ public: } const auto nwritten = write(bytes); - ASSERT(nwritten == bytes.size()); + VERIFY(nwritten == bytes.size()); return true; } @@ -123,7 +123,7 @@ public: Bytes reserve_contigous_space(size_t count) { - ASSERT(count <= remaining_contigous_space()); + VERIFY(count <= remaining_contigous_space()); Bytes bytes { m_queue.m_storage + (m_queue.head_index() + m_queue.size()) % Capacity, count }; diff --git a/AK/CircularQueue.h b/AK/CircularQueue.h index a7f03f038c0..2c2acf846c1 100644 --- a/AK/CircularQueue.h +++ b/AK/CircularQueue.h @@ -76,7 +76,7 @@ public: T dequeue() { - ASSERT(!is_empty()); + VERIFY(!is_empty()); auto& slot = elements()[m_head]; T value = move(slot); slot.~T(); diff --git a/AK/DoublyLinkedList.h b/AK/DoublyLinkedList.h index b838012b04c..0450c38faa6 100644 --- a/AK/DoublyLinkedList.h +++ b/AK/DoublyLinkedList.h @@ -91,22 +91,22 @@ public: T& first() { - ASSERT(m_head); + VERIFY(m_head); return m_head->value; } const T& first() const { - ASSERT(m_head); + VERIFY(m_head); return m_head->value; } T& last() { - ASSERT(m_head); + VERIFY(m_head); return m_tail->value; } const T& last() const { - ASSERT(m_head); + VERIFY(m_head); return m_tail->value; } @@ -117,13 +117,13 @@ public: requires { T(value); }, "Conversion operator is missing."); auto* node = new Node(forward(value)); if (!m_head) { - ASSERT(!m_tail); + VERIFY(!m_tail); m_head = node; m_tail = node; return; } - ASSERT(m_tail); - ASSERT(!node->next); + VERIFY(m_tail); + VERIFY(!node->next); m_tail->next = node; node->prev = m_tail; m_tail = node; @@ -135,13 +135,13 @@ public: static_assert(IsSame::value); auto* node = new Node(forward(value)); if (!m_head) { - ASSERT(!m_tail); + VERIFY(!m_tail); m_head = node; m_tail = node; return; } - ASSERT(m_tail); - ASSERT(!node->prev); + VERIFY(m_tail); + VERIFY(!node->prev); m_head->prev = node; node->next = m_head; m_head = node; @@ -174,20 +174,20 @@ public: void remove(Iterator it) { - ASSERT(it.m_node); + VERIFY(it.m_node); auto* node = it.m_node; if (node->prev) { - ASSERT(node != m_head); + VERIFY(node != m_head); node->prev->next = node->next; } else { - ASSERT(node == m_head); + VERIFY(node == m_head); m_head = node->next; } if (node->next) { - ASSERT(node != m_tail); + VERIFY(node != m_tail); node->next->prev = node->prev; } else { - ASSERT(node == m_tail); + VERIFY(node == m_tail); m_tail = node->prev; } delete node; diff --git a/AK/FlyString.cpp b/AK/FlyString.cpp index adbe1928989..cb1b564fd62 100644 --- a/AK/FlyString.cpp +++ b/AK/FlyString.cpp @@ -38,8 +38,8 @@ struct FlyStringImplTraits : public AK::Traits { static unsigned hash(const StringImpl* s) { return s ? s->hash() : 0; } static bool equals(const StringImpl* a, const StringImpl* b) { - ASSERT(a); - ASSERT(b); + VERIFY(a); + VERIFY(b); return *a == *b; } }; @@ -70,7 +70,7 @@ FlyString::FlyString(const String& string) string.impl()->set_fly({}, true); m_impl = string.impl(); } else { - ASSERT((*it)->is_fly()); + VERIFY((*it)->is_fly()); m_impl = *it; } } diff --git a/AK/Format.cpp b/AK/Format.cpp index 1c5494b1485..698b8397288 100644 --- a/AK/Format.cpp +++ b/AK/Format.cpp @@ -47,7 +47,7 @@ constexpr size_t use_next_index = NumericLimits::max(); // 65 bytes. Choosing a larger power of two won't hurt and is a bit of mitigation against out-of-bounds accesses. inline size_t convert_unsigned_to_string(u64 value, Array& buffer, u8 base, bool upper_case) { - ASSERT(base >= 2 && base <= 16); + VERIFY(base >= 2 && base <= 16); static constexpr const char* lowercase_lookup = "0123456789abcdef"; static constexpr const char* uppercase_lookup = "0123456789ABCDEF"; @@ -80,7 +80,7 @@ void vformat_impl(TypeErasedFormatParams& params, FormatBuilder& builder, Format FormatParser::FormatSpecifier specifier; if (!parser.consume_specifier(specifier)) { - ASSERT(parser.is_eof()); + VERIFY(parser.is_eof()); return; } @@ -118,9 +118,9 @@ size_t TypeErasedParameter::to_size() const else if (type == TypeErasedParameter::Type::Int64) svalue = *reinterpret_cast(value); else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); - ASSERT(svalue >= 0); + VERIFY(svalue >= 0); return static_cast(svalue); } @@ -163,7 +163,7 @@ bool FormatParser::consume_number(size_t& value) } bool FormatParser::consume_specifier(FormatSpecifier& specifier) { - ASSERT(!next_is('}')); + VERIFY(!next_is('}')); if (!consume_specific('{')) return false; @@ -176,7 +176,7 @@ bool FormatParser::consume_specifier(FormatSpecifier& specifier) size_t level = 1; while (level > 0) { - ASSERT(!is_eof()); + VERIFY(!is_eof()); if (consume_specific('{')) { ++level; @@ -194,7 +194,7 @@ bool FormatParser::consume_specifier(FormatSpecifier& specifier) specifier.flags = m_input.substring_view(begin, tell() - begin - 1); } else { if (!consume_specific('}')) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); specifier.flags = ""; } @@ -210,7 +210,7 @@ bool FormatParser::consume_replacement_field(size_t& index) index = use_next_index; if (!consume_specific('}')) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return true; } @@ -426,7 +426,7 @@ void vformat(const LogStream& stream, StringView fmtstr, TypeErasedFormatParams void StandardFormatter::parse(TypeErasedFormatParams& params, FormatParser& parser) { if (StringView { "<^>" }.contains(parser.peek(1))) { - ASSERT(!parser.next_is(is_any_of("{}"))); + VERIFY(!parser.next_is(is_any_of("{}"))); m_fill = parser.consume(); } @@ -498,21 +498,21 @@ void StandardFormatter::parse(TypeErasedFormatParams& params, FormatParser& pars if (!parser.is_eof()) dbgln("{} did not consume '{}'", __PRETTY_FUNCTION__, parser.remaining()); - ASSERT(parser.is_eof()); + VERIFY(parser.is_eof()); } void Formatter::format(FormatBuilder& builder, StringView 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 && m_mode != Mode::Character) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); if (m_width.has_value() && m_precision.has_value()) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); m_width = m_width.value_or(0); m_precision = m_precision.value_or(NumericLimits::max()); @@ -530,7 +530,7 @@ void Formatter::value>::Type>::format(FormatB { if (m_mode == Mode::Character) { // FIXME: We just support ASCII for now, in the future maybe unicode? - ASSERT(value >= 0 && value <= 127); + VERIFY(value >= 0 && value <= 127); m_mode = Mode::String; @@ -539,17 +539,17 @@ void Formatter::value>::Type>::format(FormatB } if (m_precision.has_value()) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); if (m_mode == Mode::Pointer) { if (m_sign_mode != FormatBuilder::SignMode::Default) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); if (m_align != FormatBuilder::Align::Default) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); if (m_alternative_form) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); if (m_width.has_value()) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); m_mode = Mode::Hexadecimal; m_alternative_form = true; @@ -574,7 +574,7 @@ void Formatter::value>::Type>::format(FormatB base = 16; upper_case = true; } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_width = m_width.value_or(0); @@ -621,7 +621,7 @@ void Formatter::format(FormatBuilder& builder, double value) base = 16; upper_case = true; } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_width = m_width.value_or(0); @@ -647,7 +647,7 @@ void vout(FILE* file, StringView fmtstr, TypeErasedFormatParams params, bool new const auto string = builder.string_view(); const auto retval = ::fwrite(string.characters_without_null_termination(), 1, string.length(), file); - ASSERT(static_cast(retval) == string.length()); + VERIFY(static_cast(retval) == string.length()); } #endif diff --git a/AK/Format.h b/AK/Format.h index 64ad1cf97e3..c5b6ce795ef 100644 --- a/AK/Format.h +++ b/AK/Format.h @@ -87,7 +87,7 @@ struct TypeErasedParameter { return Type::Int64; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } template diff --git a/AK/Function.h b/AK/Function.h index 9be7e9b7258..d5bef1cb280 100644 --- a/AK/Function.h +++ b/AK/Function.h @@ -53,7 +53,7 @@ public: Out operator()(In... in) const { - ASSERT(m_callable_wrapper); + VERIFY(m_callable_wrapper); return m_callable_wrapper->call(forward(in)...); } diff --git a/AK/GenericLexer.cpp b/AK/GenericLexer.cpp index 4ea809973f1..13afba4423e 100644 --- a/AK/GenericLexer.cpp +++ b/AK/GenericLexer.cpp @@ -79,14 +79,14 @@ bool GenericLexer::next_is(const char* expected) const // Go back to the previous character void GenericLexer::retreat() { - ASSERT(m_index > 0); + VERIFY(m_index > 0); m_index--; } // Consume a character and advance the parser index char GenericLexer::consume() { - ASSERT(!is_eof()); + VERIFY(!is_eof()); return m_input[m_index++]; } diff --git a/AK/HashTable.h b/AK/HashTable.h index 9f4aaf4e748..3c5007ad6bd 100644 --- a/AK/HashTable.h +++ b/AK/HashTable.h @@ -157,7 +157,7 @@ public: void ensure_capacity(size_t capacity) { - ASSERT(capacity >= size()); + VERIFY(capacity >= size()); rehash(capacity * 2); } @@ -256,11 +256,11 @@ public: void remove(Iterator iterator) { - ASSERT(iterator.m_bucket); + VERIFY(iterator.m_bucket); auto& bucket = *iterator.m_bucket; - ASSERT(bucket.used); - ASSERT(!bucket.end); - ASSERT(!bucket.deleted); + VERIFY(bucket.used); + VERIFY(!bucket.end); + VERIFY(!bucket.deleted); bucket.slot()->~T(); bucket.used = false; bucket.deleted = true; diff --git a/AK/IDAllocator.h b/AK/IDAllocator.h index 3064d68e630..068aa7046ec 100644 --- a/AK/IDAllocator.h +++ b/AK/IDAllocator.h @@ -49,7 +49,7 @@ public: return allocated_id; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void deallocate(int id) diff --git a/AK/IPv4Address.h b/AK/IPv4Address.h index 4f557f84244..8f81130904f 100644 --- a/AK/IPv4Address.h +++ b/AK/IPv4Address.h @@ -65,7 +65,7 @@ public: constexpr u8 operator[](int i) const { - ASSERT(i >= 0 && i < 4); + VERIFY(i >= 0 && i < 4); return octet(SubnetClass(i)); } diff --git a/AK/InlineLinkedList.h b/AK/InlineLinkedList.h index e8edbd77110..869a00a357f 100644 --- a/AK/InlineLinkedList.h +++ b/AK/InlineLinkedList.h @@ -178,7 +178,7 @@ template inline void InlineLinkedList::prepend(T* node) { if (!m_head) { - ASSERT(!m_tail); + VERIFY(!m_tail); m_head = node; m_tail = node; node->set_prev(0); @@ -186,7 +186,7 @@ inline void InlineLinkedList::prepend(T* node) return; } - ASSERT(m_tail); + VERIFY(m_tail); m_head->set_prev(node); node->set_next(m_head); node->set_prev(0); @@ -197,7 +197,7 @@ template inline void InlineLinkedList::append(T* node) { if (!m_tail) { - ASSERT(!m_head); + VERIFY(!m_head); m_head = node; m_tail = node; node->set_prev(0); @@ -205,7 +205,7 @@ inline void InlineLinkedList::append(T* node) return; } - ASSERT(m_head); + VERIFY(m_head); m_tail->set_next(node); node->set_prev(m_tail); node->set_next(0); @@ -215,18 +215,18 @@ inline void InlineLinkedList::append(T* node) template inline void InlineLinkedList::insert_before(T* before_node, T* node) { - ASSERT(before_node); - ASSERT(node); - ASSERT(before_node != node); - ASSERT(!is_empty()); + VERIFY(before_node); + VERIFY(node); + VERIFY(before_node != node); + VERIFY(!is_empty()); if (m_head == before_node) { - ASSERT(!before_node->prev()); + VERIFY(!before_node->prev()); m_head = node; node->set_prev(0); node->set_next(before_node); before_node->set_prev(node); } else { - ASSERT(before_node->prev()); + VERIFY(before_node->prev()); node->set_prev(before_node->prev()); before_node->prev()->set_next(node); node->set_next(before_node); @@ -237,18 +237,18 @@ inline void InlineLinkedList::insert_before(T* before_node, T* node) template inline void InlineLinkedList::insert_after(T* after_node, T* node) { - ASSERT(after_node); - ASSERT(node); - ASSERT(after_node != node); - ASSERT(!is_empty()); + VERIFY(after_node); + VERIFY(node); + VERIFY(after_node != node); + VERIFY(!is_empty()); if (m_tail == after_node) { - ASSERT(!after_node->next()); + VERIFY(!after_node->next()); m_tail = node; node->set_prev(after_node); node->set_next(0); after_node->set_next(node); } else { - ASSERT(after_node->next()); + VERIFY(after_node->next()); node->set_prev(after_node); node->set_next(after_node->next()); after_node->next()->set_prev(node); @@ -260,18 +260,18 @@ template inline void InlineLinkedList::remove(T* node) { if (node->prev()) { - ASSERT(node != m_head); + VERIFY(node != m_head); node->prev()->set_next(node->next()); } else { - ASSERT(node == m_head); + VERIFY(node == m_head); m_head = node->next(); } if (node->next()) { - ASSERT(node != m_tail); + VERIFY(node != m_tail); node->next()->set_prev(node->prev()); } else { - ASSERT(node == m_tail); + VERIFY(node == m_tail); m_tail = node->prev(); } @@ -310,15 +310,15 @@ inline void InlineLinkedList::append(InlineLinkedList& other) return; } - ASSERT(tail()); - ASSERT(other.head()); + VERIFY(tail()); + VERIFY(other.head()); T* other_head = other.head(); T* other_tail = other.tail(); other.clear(); - ASSERT(!m_tail->next()); + VERIFY(!m_tail->next()); m_tail->set_next(other_head); - ASSERT(!other_head->prev()); + VERIFY(!other_head->prev()); other_head->set_prev(m_tail); m_tail = other_tail; } diff --git a/AK/IntrusiveList.h b/AK/IntrusiveList.h index 46045f7f22c..bb27ce70e2c 100644 --- a/AK/IntrusiveList.h +++ b/AK/IntrusiveList.h @@ -284,7 +284,7 @@ inline IntrusiveListNode::~IntrusiveListNode() inline void IntrusiveListNode::remove() { - ASSERT(m_storage); + VERIFY(m_storage); if (m_storage->m_first == this) m_storage->m_first = m_next; if (m_storage->m_last == this) diff --git a/AK/JsonArraySerializer.h b/AK/JsonArraySerializer.h index 6bc2c28925f..15e5705ed3c 100644 --- a/AK/JsonArraySerializer.h +++ b/AK/JsonArraySerializer.h @@ -92,7 +92,7 @@ public: void finish() { - ASSERT(!m_finished); + VERIFY(!m_finished); m_finished = true; m_builder.append(']'); } diff --git a/AK/JsonObject.h b/AK/JsonObject.h index 57bb515f9e4..c127887b374 100644 --- a/AK/JsonObject.h +++ b/AK/JsonObject.h @@ -191,7 +191,7 @@ inline void JsonValue::serialize(Builder& builder) const builder.append("null"); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/AK/JsonObjectSerializer.h b/AK/JsonObjectSerializer.h index 0ba6a3e47ed..83f532244aa 100644 --- a/AK/JsonObjectSerializer.h +++ b/AK/JsonObjectSerializer.h @@ -141,7 +141,7 @@ public: void finish() { - ASSERT(!m_finished); + VERIFY(!m_finished); m_finished = true; m_builder.append('}'); } diff --git a/AK/JsonPath.cpp b/AK/JsonPath.cpp index 7cbc14488f0..7ae6d0daba4 100644 --- a/AK/JsonPath.cpp +++ b/AK/JsonPath.cpp @@ -45,7 +45,7 @@ JsonValue JsonPath::resolve(const JsonValue& top_root) const root = JsonValue { root.as_array().at(element.index()) }; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } return root; diff --git a/AK/JsonPath.h b/AK/JsonPath.h index d6c3a2acb94..3841a6a4d67 100644 --- a/AK/JsonPath.h +++ b/AK/JsonPath.h @@ -56,13 +56,13 @@ public: Kind kind() const { return m_kind; } const String& key() const { - ASSERT(m_kind == Kind::Key); + VERIFY(m_kind == Kind::Key); return m_key; } size_t index() const { - ASSERT(m_kind == Kind::Index); + VERIFY(m_kind == Kind::Index); return m_index; } diff --git a/AK/JsonValue.cpp b/AK/JsonValue.cpp index 288fdc6cc8e..4d8a6a9c5d6 100644 --- a/AK/JsonValue.cpp +++ b/AK/JsonValue.cpp @@ -55,7 +55,7 @@ void JsonValue::copy_from(const JsonValue& other) m_type = other.m_type; switch (m_type) { case Type::String: - ASSERT(!m_value.as_string); + VERIFY(!m_value.as_string); m_value.as_string = other.m_value.as_string; m_value.as_string->ref(); break; diff --git a/AK/JsonValue.h b/AK/JsonValue.h index d3bf23cb2c9..36e8b9bfd91 100644 --- a/AK/JsonValue.h +++ b/AK/JsonValue.h @@ -127,56 +127,56 @@ public: i32 as_i32() const { - ASSERT(is_i32()); + VERIFY(is_i32()); return m_value.as_i32; } u32 as_u32() const { - ASSERT(is_u32()); + VERIFY(is_u32()); return m_value.as_u32; } i64 as_i64() const { - ASSERT(is_i64()); + VERIFY(is_i64()); return m_value.as_i64; } u64 as_u64() const { - ASSERT(is_u64()); + VERIFY(is_u64()); return m_value.as_u64; } int as_bool() const { - ASSERT(is_bool()); + VERIFY(is_bool()); return m_value.as_bool; } String as_string() const { - ASSERT(is_string()); + VERIFY(is_string()); return *m_value.as_string; } const JsonObject& as_object() const { - ASSERT(is_object()); + VERIFY(is_object()); return *m_value.as_object; } const JsonArray& as_array() const { - ASSERT(is_array()); + VERIFY(is_array()); return *m_value.as_array; } #if !defined(KERNEL) double as_double() const { - ASSERT(is_double()); + VERIFY(is_double()); return m_value.as_double; } #endif diff --git a/AK/MACAddress.h b/AK/MACAddress.h index 3d3a4d9d417..7e46e5aca71 100644 --- a/AK/MACAddress.h +++ b/AK/MACAddress.h @@ -52,13 +52,13 @@ public: constexpr const u8& operator[](unsigned i) const { - ASSERT(i < s_mac_address_length); + VERIFY(i < s_mac_address_length); return m_data[i]; } constexpr u8& operator[](unsigned i) { - ASSERT(i < s_mac_address_length); + VERIFY(i < s_mac_address_length); return m_data[i]; } diff --git a/AK/MappedFile.cpp b/AK/MappedFile.cpp index a2b9fb87b87..cd10ef3b0ca 100644 --- a/AK/MappedFile.cpp +++ b/AK/MappedFile.cpp @@ -68,7 +68,7 @@ MappedFile::MappedFile(void* ptr, size_t size) MappedFile::~MappedFile() { auto rc = munmap(m_data, m_size); - ASSERT(rc == 0); + VERIFY(rc == 0); } } diff --git a/AK/MemMem.h b/AK/MemMem.h index 33af7e16306..d154e767190 100644 --- a/AK/MemMem.h +++ b/AK/MemMem.h @@ -37,7 +37,7 @@ namespace AK { namespace { const static void* bitap_bitwise(const void* haystack, size_t haystack_length, const void* needle, size_t needle_length) { - ASSERT(needle_length < 32); + VERIFY(needle_length < 32); u64 lookup = 0xfffffffe; diff --git a/AK/MemoryStream.h b/AK/MemoryStream.h index 8b17934010e..2ac424568d2 100644 --- a/AK/MemoryStream.h +++ b/AK/MemoryStream.h @@ -79,7 +79,7 @@ public: void seek(size_t offset) { - ASSERT(offset < m_bytes.size()); + VERIFY(offset < m_bytes.size()); m_offset = offset; } @@ -309,7 +309,7 @@ public: auto buffer = ByteBuffer::create_uninitialized(size()); const auto nread = read_without_consuming(buffer); - ASSERT(nread == buffer.size()); + VERIFY(nread == buffer.size()); return buffer; } diff --git a/AK/NonnullOwnPtr.h b/AK/NonnullOwnPtr.h index 321ea67b7dc..1b4e4c8ac29 100644 --- a/AK/NonnullOwnPtr.h +++ b/AK/NonnullOwnPtr.h @@ -59,13 +59,13 @@ public: NonnullOwnPtr(NonnullOwnPtr&& other) : m_ptr(other.leak_ptr()) { - ASSERT(m_ptr); + VERIFY(m_ptr); } template NonnullOwnPtr(NonnullOwnPtr&& other) : m_ptr(other.leak_ptr()) { - ASSERT(m_ptr); + VERIFY(m_ptr); } ~NonnullOwnPtr() { @@ -147,7 +147,7 @@ public: template NonnullOwnPtr release_nonnull() { - ASSERT(m_ptr); + VERIFY(m_ptr); return NonnullOwnPtr(NonnullOwnPtr::Adopt, static_cast(*leak_ptr())); } diff --git a/AK/NonnullRefPtr.h b/AK/NonnullRefPtr.h index 33666d03029..69499c54ee9 100644 --- a/AK/NonnullRefPtr.h +++ b/AK/NonnullRefPtr.h @@ -72,42 +72,42 @@ public: ALWAYS_INLINE NonnullRefPtr(const T& object) : m_bits((FlatPtr)&object) { - ASSERT(!(m_bits & 1)); + VERIFY(!(m_bits & 1)); const_cast(object).ref(); } template ALWAYS_INLINE NonnullRefPtr(const U& object) : m_bits((FlatPtr) static_cast(&object)) { - ASSERT(!(m_bits & 1)); + VERIFY(!(m_bits & 1)); const_cast(static_cast(object)).ref(); } ALWAYS_INLINE NonnullRefPtr(AdoptTag, T& object) : m_bits((FlatPtr)&object) { - ASSERT(!(m_bits & 1)); + VERIFY(!(m_bits & 1)); } ALWAYS_INLINE NonnullRefPtr(NonnullRefPtr&& other) : m_bits((FlatPtr)&other.leak_ref()) { - ASSERT(!(m_bits & 1)); + VERIFY(!(m_bits & 1)); } template ALWAYS_INLINE NonnullRefPtr(NonnullRefPtr&& other) : m_bits((FlatPtr)&other.leak_ref()) { - ASSERT(!(m_bits & 1)); + VERIFY(!(m_bits & 1)); } ALWAYS_INLINE NonnullRefPtr(const NonnullRefPtr& other) : m_bits((FlatPtr)other.add_ref()) { - ASSERT(!(m_bits & 1)); + VERIFY(!(m_bits & 1)); } template ALWAYS_INLINE NonnullRefPtr(const NonnullRefPtr& other) : m_bits((FlatPtr)other.add_ref()) { - ASSERT(!(m_bits & 1)); + VERIFY(!(m_bits & 1)); } ALWAYS_INLINE ~NonnullRefPtr() { @@ -170,7 +170,7 @@ public: [[nodiscard]] ALWAYS_INLINE T& leak_ref() { T* ptr = exchange(nullptr); - ASSERT(ptr); + VERIFY(ptr); return *ptr; } @@ -253,7 +253,7 @@ private: ALWAYS_INLINE T* as_nonnull_ptr() const { T* ptr = (T*)(m_bits.load(AK::MemoryOrder::memory_order_relaxed) & ~(FlatPtr)1); - ASSERT(ptr); + VERIFY(ptr); return ptr; } @@ -273,7 +273,7 @@ private: Kernel::Processor::wait_check(); #endif } - ASSERT(!(bits & 1)); + VERIFY(!(bits & 1)); f((T*)bits); m_bits.store(bits, AK::MemoryOrder::memory_order_release); } @@ -286,7 +286,7 @@ private: ALWAYS_INLINE T* exchange(T* new_ptr) { - ASSERT(!((FlatPtr)new_ptr & 1)); + VERIFY(!((FlatPtr)new_ptr & 1)); #ifdef KERNEL // We don't want to be pre-empted while we have the lock bit set Kernel::ScopedCritical critical; @@ -301,7 +301,7 @@ private: Kernel::Processor::wait_check(); #endif } - ASSERT(!(expected & 1)); + VERIFY(!(expected & 1)); return (T*)expected; } diff --git a/AK/Optional.h b/AK/Optional.h index 8d385e8ea43..4d31bcab3dd 100644 --- a/AK/Optional.h +++ b/AK/Optional.h @@ -128,19 +128,19 @@ public: [[nodiscard]] ALWAYS_INLINE T& value() { - ASSERT(m_has_value); + VERIFY(m_has_value); return *reinterpret_cast(&m_storage); } [[nodiscard]] ALWAYS_INLINE const T& value() const { - ASSERT(m_has_value); + VERIFY(m_has_value); return *reinterpret_cast(&m_storage); } [[nodiscard]] T release_value() { - ASSERT(m_has_value); + VERIFY(m_has_value); T released_value = move(value()); value().~T(); m_has_value = false; diff --git a/AK/OwnPtr.h b/AK/OwnPtr.h index 2e9de4d7b13..6da0b675926 100644 --- a/AK/OwnPtr.h +++ b/AK/OwnPtr.h @@ -112,7 +112,7 @@ public: { OwnPtr ptr(move(other)); swap(ptr); - ASSERT(m_ptr); + VERIFY(m_ptr); return *this; } @@ -147,14 +147,14 @@ public: NonnullOwnPtr release_nonnull() { - ASSERT(m_ptr); + VERIFY(m_ptr); return NonnullOwnPtr(NonnullOwnPtr::Adopt, *leak_ptr()); } template NonnullOwnPtr release_nonnull() { - ASSERT(m_ptr); + VERIFY(m_ptr); return NonnullOwnPtr(NonnullOwnPtr::Adopt, static_cast(*leak_ptr())); } @@ -163,25 +163,25 @@ public: T* operator->() { - ASSERT(m_ptr); + VERIFY(m_ptr); return m_ptr; } const T* operator->() const { - ASSERT(m_ptr); + VERIFY(m_ptr); return m_ptr; } T& operator*() { - ASSERT(m_ptr); + VERIFY(m_ptr); return *m_ptr; } const T& operator*() const { - ASSERT(m_ptr); + VERIFY(m_ptr); return *m_ptr; } diff --git a/AK/Queue.h b/AK/Queue.h index 80fd00109d2..07451cf2c1f 100644 --- a/AK/Queue.h +++ b/AK/Queue.h @@ -52,7 +52,7 @@ public: T dequeue() { - ASSERT(!is_empty()); + VERIFY(!is_empty()); auto value = move((*m_segments.first())[m_index_into_first++]); if (m_index_into_first == segment_size) { m_segments.take_first(); @@ -64,7 +64,7 @@ public: const T& head() const { - ASSERT(!is_empty()); + VERIFY(!is_empty()); return (*m_segments.first())[m_index_into_first]; } diff --git a/AK/RefCounted.h b/AK/RefCounted.h index 18574a375b8..4d003a3bba3 100644 --- a/AK/RefCounted.h +++ b/AK/RefCounted.h @@ -70,8 +70,8 @@ public: ALWAYS_INLINE void ref() const { auto old_ref_count = m_ref_count.fetch_add(1, AK::MemoryOrder::memory_order_relaxed); - ASSERT(old_ref_count > 0); - ASSERT(!Checked::addition_would_overflow(old_ref_count, 1)); + VERIFY(old_ref_count > 0); + VERIFY(!Checked::addition_would_overflow(old_ref_count, 1)); } [[nodiscard]] ALWAYS_INLINE bool try_ref() const @@ -80,7 +80,7 @@ public: for (;;) { if (expected == 0) return false; - ASSERT(!Checked::addition_would_overflow(expected, 1)); + VERIFY(!Checked::addition_would_overflow(expected, 1)); if (m_ref_count.compare_exchange_strong(expected, expected + 1, AK::MemoryOrder::memory_order_acquire)) return true; } @@ -95,13 +95,13 @@ protected: RefCountedBase() = default; ALWAYS_INLINE ~RefCountedBase() { - ASSERT(m_ref_count.load(AK::MemoryOrder::memory_order_relaxed) == 0); + VERIFY(m_ref_count.load(AK::MemoryOrder::memory_order_relaxed) == 0); } ALWAYS_INLINE RefCountType deref_base() const { auto old_ref_count = m_ref_count.fetch_sub(1, AK::MemoryOrder::memory_order_acq_rel); - ASSERT(old_ref_count > 0); + VERIFY(old_ref_count > 0); return old_ref_count - 1; } diff --git a/AK/RefPtr.h b/AK/RefPtr.h index 8241cf67494..aad97e22c2e 100644 --- a/AK/RefPtr.h +++ b/AK/RefPtr.h @@ -50,7 +50,7 @@ struct RefPtrTraits { ALWAYS_INLINE static FlatPtr as_bits(T* ptr) { - ASSERT(!((FlatPtr)ptr & 1)); + VERIFY(!((FlatPtr)ptr & 1)); return (FlatPtr)ptr; } @@ -70,7 +70,7 @@ struct RefPtrTraits { ALWAYS_INLINE static FlatPtr exchange(Atomic& atomic_var, FlatPtr new_value) { // Only exchange when lock is not held - ASSERT(!(new_value & 1)); + VERIFY(!(new_value & 1)); FlatPtr expected = atomic_var.load(AK::MemoryOrder::memory_order_relaxed); for (;;) { expected &= ~(FlatPtr)1; // only if lock bit is not set @@ -86,7 +86,7 @@ struct RefPtrTraits { ALWAYS_INLINE static bool exchange_if_null(Atomic& atomic_var, FlatPtr new_value) { // Only exchange when lock is not held - ASSERT(!(new_value & 1)); + VERIFY(!(new_value & 1)); for (;;) { FlatPtr expected = default_null_value; // only if lock bit is not set if (atomic_var.compare_exchange_strong(expected, new_value, AK::MemoryOrder::memory_order_acq_rel)) @@ -116,13 +116,13 @@ struct RefPtrTraits { Kernel::Processor::wait_check(); #endif } - ASSERT(!(bits & 1)); + VERIFY(!(bits & 1)); return bits; } ALWAYS_INLINE static void unlock(Atomic& atomic_var, FlatPtr new_value) { - ASSERT(!(new_value & 1)); + VERIFY(!(new_value & 1)); atomic_var.store(new_value, AK::MemoryOrder::memory_order_release); } @@ -153,14 +153,14 @@ public: : m_bits(PtrTraits::as_bits(const_cast(&object))) { T* ptr = const_cast(&object); - ASSERT(ptr); - ASSERT(!is_null()); + VERIFY(ptr); + VERIFY(!is_null()); ptr->ref(); } RefPtr(AdoptTag, T& object) : m_bits(PtrTraits::as_bits(&object)) { - ASSERT(!is_null()); + VERIFY(!is_null()); } RefPtr(RefPtr&& other) : m_bits(other.leak_ref_raw()) @@ -179,7 +179,7 @@ public: ALWAYS_INLINE RefPtr(NonnullRefPtr&& other) : m_bits(PtrTraits::as_bits(&other.leak_ref())) { - ASSERT(!is_null()); + VERIFY(!is_null()); } template> RefPtr(RefPtr&& other) @@ -330,7 +330,7 @@ public: NonnullRefPtr release_nonnull() { FlatPtr bits = PtrTraits::exchange(m_bits, PtrTraits::default_null_value); - ASSERT(!PtrTraits::is_null(bits)); + VERIFY(!PtrTraits::is_null(bits)); return NonnullRefPtr(NonnullRefPtr::Adopt, *PtrTraits::as_ptr(bits)); } @@ -384,7 +384,7 @@ public: { // make sure we are holding a null value FlatPtr bits = m_bits.load(AK::MemoryOrder::memory_order_relaxed); - ASSERT(PtrTraits::is_null(bits)); + VERIFY(PtrTraits::is_null(bits)); return PtrTraits::to_null_value(bits); } template::value && !IsNullPointer::value>::Type* = nullptr> @@ -392,7 +392,7 @@ public: { // make sure that new null value would be interpreted as a null value FlatPtr bits = PtrTraits::from_null_value(value); - ASSERT(PtrTraits::is_null(bits)); + VERIFY(PtrTraits::is_null(bits)); assign_raw(bits); } @@ -454,7 +454,7 @@ private: ALWAYS_INLINE T* as_nonnull_ptr(FlatPtr bits) const { - ASSERT(!PtrTraits::is_null(bits)); + VERIFY(!PtrTraits::is_null(bits)); return PtrTraits::as_ptr(bits); } diff --git a/AK/Singleton.h b/AK/Singleton.h index 27d38f654f3..18797eb6286 100644 --- a/AK/Singleton.h +++ b/AK/Singleton.h @@ -83,9 +83,9 @@ public: } if constexpr (allow_create) { // We should always return an instance if we allow creating one - ASSERT(obj != nullptr); + VERIFY(obj != nullptr); } - ASSERT(obj != (T*)0x1); + VERIFY(obj != (T*)0x1); } return obj; } diff --git a/AK/SinglyLinkedList.h b/AK/SinglyLinkedList.h index 92d238a529e..a90089fe7ff 100644 --- a/AK/SinglyLinkedList.h +++ b/AK/SinglyLinkedList.h @@ -104,28 +104,28 @@ public: T& first() { - ASSERT(head()); + VERIFY(head()); return head()->value; } const T& first() const { - ASSERT(head()); + VERIFY(head()); return head()->value; } T& last() { - ASSERT(head()); + VERIFY(head()); return tail()->value; } const T& last() const { - ASSERT(head()); + VERIFY(head()); return tail()->value; } T take_first() { - ASSERT(m_head); + VERIFY(m_head); auto* prev_head = m_head; T value = move(first()); if (m_tail == m_head) @@ -187,7 +187,7 @@ public: void remove(Iterator iterator) { - ASSERT(!iterator.is_end()); + VERIFY(!iterator.is_end()); if (m_head == iterator.m_node) m_head = iterator.m_node->next; if (m_tail == iterator.m_node) diff --git a/AK/SourceGenerator.h b/AK/SourceGenerator.h index 15c0aaae42b..bd1cbf2164c 100644 --- a/AK/SourceGenerator.h +++ b/AK/SourceGenerator.h @@ -78,11 +78,11 @@ public: const auto placeholder = consume_until_without_consuming_stop_character(m_closing); if (!lexer.consume_specific(m_closing)) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); m_builder.append(get(placeholder)); } else { - ASSERT(lexer.is_eof()); + VERIFY(lexer.is_eof()); } } } diff --git a/AK/Span.h b/AK/Span.h index 7f4eda89b7e..42393f315a6 100644 --- a/AK/Span.h +++ b/AK/Span.h @@ -140,12 +140,12 @@ public: [[nodiscard]] ALWAYS_INLINE constexpr Span slice(size_t start, size_t length) const { - ASSERT(start + length <= size()); + VERIFY(start + length <= size()); return { this->m_values + start, length }; } [[nodiscard]] ALWAYS_INLINE constexpr Span slice(size_t start) const { - ASSERT(start <= size()); + VERIFY(start <= size()); return { this->m_values + start, size() - start }; } @@ -156,20 +156,20 @@ public: ALWAYS_INLINE constexpr T* offset(size_t start) const { - ASSERT(start < this->m_size); + VERIFY(start < this->m_size); return this->m_values + start; } ALWAYS_INLINE constexpr void overwrite(size_t offset, const void* data, size_t data_size) { // make sure we're not told to write past the end - ASSERT(offset + data_size <= size()); + VERIFY(offset + data_size <= size()); __builtin_memcpy(this->data() + offset, data, data_size); } ALWAYS_INLINE constexpr size_t copy_to(Span::Type> other) const { - ASSERT(other.size() >= size()); + VERIFY(other.size() >= size()); return TypedTransfer::Type>::copy(other.data(), data(), size()); } @@ -198,12 +198,12 @@ public: ALWAYS_INLINE constexpr const T& at(size_t index) const { - ASSERT(index < this->m_size); + VERIFY(index < this->m_size); return this->m_values[index]; } ALWAYS_INLINE constexpr T& at(size_t index) { - ASSERT(index < this->m_size); + VERIFY(index < this->m_size); return this->m_values[index]; } diff --git a/AK/StackInfo.cpp b/AK/StackInfo.cpp index 2e7f46153ab..6927996adcb 100644 --- a/AK/StackInfo.cpp +++ b/AK/StackInfo.cpp @@ -42,17 +42,17 @@ StackInfo::StackInfo() #ifdef __serenity__ if (get_stack_bounds(&m_base, &m_size) < 0) { perror("get_stack_bounds"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } #elif __linux__ pthread_attr_t attr = {}; if (int rc = pthread_getattr_np(pthread_self(), &attr) != 0) { fprintf(stderr, "pthread_getattr_np: %s\n", strerror(-rc)); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (int rc = pthread_attr_getstack(&attr, (void**)&m_base, &m_size) != 0) { fprintf(stderr, "pthread_attr_getstack: %s\n", strerror(-rc)); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } pthread_attr_destroy(&attr); #elif __APPLE__ @@ -73,7 +73,7 @@ StackInfo::StackInfo() } m_base = top_of_stack - m_size; #else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); #endif m_top = m_base + m_size; diff --git a/AK/StdLibExtras.h b/AK/StdLibExtras.h index b2667006723..0e6cd49df7e 100644 --- a/AK/StdLibExtras.h +++ b/AK/StdLibExtras.h @@ -57,7 +57,7 @@ constexpr T max(const T& a, const T& b) template constexpr T clamp(const T& value, const T& min, const T& max) { - ASSERT(max >= min); + VERIFY(max >= min); if (value > max) return max; if (value < min) diff --git a/AK/Stream.h b/AK/Stream.h index 58a6e130cc2..a1226c44fa4 100644 --- a/AK/Stream.h +++ b/AK/Stream.h @@ -37,7 +37,7 @@ namespace AK::Detail { class Stream { public: - virtual ~Stream() { ASSERT(!has_any_error()); } + virtual ~Stream() { VERIFY(!has_any_error()); } virtual bool has_recoverable_error() const { return m_recoverable_error; } virtual bool has_fatal_error() const { return m_fatal_error; } @@ -45,7 +45,7 @@ public: virtual bool handle_recoverable_error() { - ASSERT(!has_fatal_error()); + VERIFY(!has_fatal_error()); return exchange(m_recoverable_error, false); } virtual bool handle_fatal_error() { return exchange(m_fatal_error, false); } diff --git a/AK/String.cpp b/AK/String.cpp index e9ab733f01f..f81e2eddba6 100644 --- a/AK/String.cpp +++ b/AK/String.cpp @@ -104,7 +104,7 @@ String String::empty() bool String::copy_characters_to_buffer(char* buffer, size_t buffer_size) const { // We must fit at least the NUL-terminator. - ASSERT(buffer_size > 0); + VERIFY(buffer_size > 0); size_t characters_to_copy = min(length(), buffer_size - 1); __builtin_memcpy(buffer, characters(), characters_to_copy); @@ -127,8 +127,8 @@ String String::isolated_copy() const String String::substring(size_t start) const { - ASSERT(m_impl); - ASSERT(start <= length()); + VERIFY(m_impl); + VERIFY(start <= length()); return { characters() + start, length() - start }; } @@ -136,24 +136,24 @@ String String::substring(size_t start, size_t length) const { if (!length) return ""; - ASSERT(m_impl); - ASSERT(start + length <= m_impl->length()); + VERIFY(m_impl); + VERIFY(start + length <= m_impl->length()); // FIXME: This needs some input bounds checking. return { characters() + start, length }; } StringView String::substring_view(size_t start, size_t length) const { - ASSERT(m_impl); - ASSERT(start + length <= m_impl->length()); + VERIFY(m_impl); + VERIFY(start + length <= m_impl->length()); // FIXME: This needs some input bounds checking. return { characters() + start, length }; } StringView String::substring_view(size_t start) const { - ASSERT(m_impl); - ASSERT(start <= length()); + VERIFY(m_impl); + VERIFY(start <= length()); return { characters() + start, length() - start }; } diff --git a/AK/StringBuilder.cpp b/AK/StringBuilder.cpp index 7acfd9b93c9..c4be4e1baa5 100644 --- a/AK/StringBuilder.cpp +++ b/AK/StringBuilder.cpp @@ -40,12 +40,12 @@ inline void StringBuilder::will_append(size_t size) { Checked needed_capacity = m_length; needed_capacity += size; - ASSERT(!needed_capacity.has_overflow()); + VERIFY(!needed_capacity.has_overflow()); if (needed_capacity < inline_capacity) return; Checked expanded_capacity = needed_capacity; expanded_capacity *= 2; - ASSERT(!expanded_capacity.has_overflow()); + VERIFY(!expanded_capacity.has_overflow()); if (m_buffer.is_null()) { m_buffer.grow(expanded_capacity.value()); memcpy(m_buffer.data(), m_inline_buffer, m_length); diff --git a/AK/StringImpl.cpp b/AK/StringImpl.cpp index 86b4073cc77..9d38b04b1bd 100644 --- a/AK/StringImpl.cpp +++ b/AK/StringImpl.cpp @@ -88,9 +88,9 @@ static inline size_t allocation_size_for_stringimpl(size_t length) NonnullRefPtr StringImpl::create_uninitialized(size_t length, char*& buffer) { - ASSERT(length); + VERIFY(length); void* slot = kmalloc(allocation_size_for_stringimpl(length)); - ASSERT(slot); + VERIFY(slot); auto new_stringimpl = adopt(*new (slot) StringImpl(ConstructWithInlineBuffer, length)); buffer = const_cast(new_stringimpl->characters()); buffer[length] = '\0'; diff --git a/AK/StringImpl.h b/AK/StringImpl.h index 506775ef8aa..e86fe54dd17 100644 --- a/AK/StringImpl.h +++ b/AK/StringImpl.h @@ -66,7 +66,7 @@ public: const char& operator[](size_t i) const { - ASSERT(i < m_length); + VERIFY(i < m_length); return characters()[i]; } diff --git a/AK/StringView.cpp b/AK/StringView.cpp index a27771a19d3..c04b7ada3a1 100644 --- a/AK/StringView.cpp +++ b/AK/StringView.cpp @@ -79,7 +79,7 @@ Vector StringView::split_view(const char separator, bool keep_empty) Vector StringView::split_view(const StringView& separator, bool keep_empty) const { - ASSERT(!separator.is_empty()); + VERIFY(!separator.is_empty()); if (is_empty()) return {}; @@ -197,20 +197,20 @@ bool StringView::equals_ignoring_case(const StringView& other) const StringView StringView::substring_view(size_t start, size_t length) const { - ASSERT(start + length <= m_length); + VERIFY(start + length <= m_length); return { m_characters + start, length }; } StringView StringView::substring_view(size_t start) const { - ASSERT(start <= m_length); + VERIFY(start <= m_length); return { m_characters + start, length() - start }; } StringView StringView::substring_view_starting_from_substring(const StringView& substring) const { const char* remaining_characters = substring.characters_without_null_termination(); - ASSERT(remaining_characters >= m_characters); - ASSERT(remaining_characters <= m_characters + m_length); + VERIFY(remaining_characters >= m_characters); + VERIFY(remaining_characters <= m_characters + m_length); size_t remaining_length = m_length - (remaining_characters - m_characters); return { remaining_characters, remaining_length }; } @@ -218,8 +218,8 @@ StringView StringView::substring_view_starting_from_substring(const StringView& StringView StringView::substring_view_starting_after_substring(const StringView& substring) const { const char* remaining_characters = substring.characters_without_null_termination() + substring.length(); - ASSERT(remaining_characters >= m_characters); - ASSERT(remaining_characters <= m_characters + m_length); + VERIFY(remaining_characters >= m_characters); + VERIFY(remaining_characters <= m_characters + m_length); size_t remaining_length = m_length - (remaining_characters - m_characters); return { remaining_characters, remaining_length }; } diff --git a/AK/StringView.h b/AK/StringView.h index 6f6f9058deb..8d6192a795b 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -42,13 +42,13 @@ public: : m_characters(characters) , m_length(length) { - ASSERT(!Checked::addition_would_overflow((uintptr_t)characters, length)); + VERIFY(!Checked::addition_would_overflow((uintptr_t)characters, length)); } ALWAYS_INLINE StringView(const unsigned char* characters, size_t length) : m_characters((const char*)characters) , m_length(length) { - ASSERT(!Checked::addition_would_overflow((uintptr_t)characters, length)); + VERIFY(!Checked::addition_would_overflow((uintptr_t)characters, length)); } ALWAYS_INLINE constexpr StringView(const char* cstring) : m_characters(cstring) diff --git a/AK/TestSuite.h b/AK/TestSuite.h index 9c5e7ed9e53..810b7e57678 100644 --- a/AK/TestSuite.h +++ b/AK/TestSuite.h @@ -38,11 +38,11 @@ void warnln(CheckedFormatString&& fmtstr, const Parameters&...); using AK::warnln; -#undef ASSERT -#define ASSERT(x) \ +#undef VERIFY +#define VERIFY(x) \ do { \ if (!(x)) \ - ::AK::warnln("\033[31;1mFAIL\033[0m: {}:{}: ASSERT({}) failed", __FILE__, __LINE__, #x); \ + ::AK::warnln("\033[31;1mFAIL\033[0m: {}:{}: VERIFY({}) failed", __FILE__, __LINE__, #x); \ } while (false) #undef RELEASE_ASSERT @@ -52,10 +52,10 @@ using AK::warnln; ::AK::warnln("\033[31;1mFAIL\033[0m: {}:{}: RELEASE_ASSERT({}) failed", __FILE__, __LINE__, #x); \ } while (false) -#undef ASSERT_NOT_REACHED -#define ASSERT_NOT_REACHED() \ +#undef VERIFY_NOT_REACHED +#define VERIFY_NOT_REACHED() \ do { \ - ::AK::warnln("\033[31;1mFAIL\033[0m: {}:{}: ASSERT_NOT_REACHED() called", __FILE__, __LINE__); \ + ::AK::warnln("\033[31;1mFAIL\033[0m: {}:{}: VERIFY_NOT_REACHED() called", __FILE__, __LINE__); \ ::abort(); \ } while (false) diff --git a/AK/Tests/TestFormat.cpp b/AK/Tests/TestFormat.cpp index fa1c8d2618e..8113f957dcd 100644 --- a/AK/Tests/TestFormat.cpp +++ b/AK/Tests/TestFormat.cpp @@ -177,7 +177,7 @@ TEST_CASE(pointers) EXPECT_EQ(String::formatted("{:p}", ptr), "0x0000000000004000"); EXPECT_EQ(String::formatted("{}", ptr), "0x0000000000004000"); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/AK/Tests/TestJSON.cpp b/AK/Tests/TestJSON.cpp index 447e5acf33d..bdc2a405201 100644 --- a/AK/Tests/TestJSON.cpp +++ b/AK/Tests/TestJSON.cpp @@ -36,7 +36,7 @@ TEST_CASE(load_form) { FILE* fp = fopen("test.frm", "r"); - ASSERT(fp); + VERIFY(fp); StringBuilder builder; for (;;) { @@ -69,7 +69,7 @@ TEST_CASE(load_form) BENCHMARK_CASE(load_4chan_catalog) { FILE* fp = fopen("4chan_catalog.json", "r"); - ASSERT(fp); + VERIFY(fp); StringBuilder builder; for (;;) { diff --git a/AK/Tests/TestUtf8.cpp b/AK/Tests/TestUtf8.cpp index a98129a2875..8ea82d4ed41 100644 --- a/AK/Tests/TestUtf8.cpp +++ b/AK/Tests/TestUtf8.cpp @@ -38,7 +38,7 @@ TEST_CASE(decode_ascii) size_t i = 0; for (u32 code_point : utf8) { - ASSERT(i < expected_size); + VERIFY(i < expected_size); EXPECT_EQ(code_point, expected[i]); i++; } @@ -57,7 +57,7 @@ TEST_CASE(decode_utf8) size_t i = 0; for (u32 code_point : utf8) { - ASSERT(i < expected_size); + VERIFY(i < expected_size); EXPECT_EQ(code_point, expected[i]); i++; } diff --git a/AK/Time.cpp b/AK/Time.cpp index b8db7db208d..067c333ea95 100644 --- a/AK/Time.cpp +++ b/AK/Time.cpp @@ -31,7 +31,7 @@ namespace AK { int day_of_year(int year, unsigned month, int day) { - ASSERT(month >= 1 && month <= 12); + VERIFY(month >= 1 && month <= 12); static const int seek_table[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int day_of_year = seek_table[month - 1] + day - 1; @@ -44,7 +44,7 @@ int day_of_year(int year, unsigned month, int day) int days_in_month(int year, unsigned month) { - ASSERT(month >= 1 && month <= 12); + VERIFY(month >= 1 && month <= 12); if (month == 2) return is_leap_year(year) ? 29 : 28; @@ -54,7 +54,7 @@ int days_in_month(int year, unsigned month) unsigned day_of_week(int year, unsigned month, int day) { - ASSERT(month >= 1 && month <= 12); + VERIFY(month >= 1 && month <= 12); static const int seek_table[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 }; if (month < 3) --year; diff --git a/AK/TypeCasts.h b/AK/TypeCasts.h index 92e773b2081..0e8f4e50ae2 100644 --- a/AK/TypeCasts.h +++ b/AK/TypeCasts.h @@ -51,7 +51,7 @@ template ALWAYS_INLINE CopyConst* downcast(InputType* input) { static_assert(IsBaseOf::value); - ASSERT(!input || is(*input)); + VERIFY(!input || is(*input)); return static_cast*>(input); } @@ -59,7 +59,7 @@ template ALWAYS_INLINE CopyConst& downcast(InputType& input) { static_assert(IsBaseOf::value); - ASSERT(is(input)); + VERIFY(is(input)); return static_cast&>(input); } diff --git a/AK/UUID.cpp b/AK/UUID.cpp index d779e4a5ef0..6ad5b1dd137 100644 --- a/AK/UUID.cpp +++ b/AK/UUID.cpp @@ -41,7 +41,7 @@ UUID::UUID(Array uuid_buffer) void UUID::convert_string_view_to_uuid(const StringView& uuid_string_view) { - ASSERT(uuid_string_view.length() == 36); + VERIFY(uuid_string_view.length() == 36); auto first_unit = decode_hex(uuid_string_view.substring_view(0, 8)); auto second_unit = decode_hex(uuid_string_view.substring_view(9, 4)); auto third_unit = decode_hex(uuid_string_view.substring_view(14, 4)); diff --git a/AK/Utf32View.h b/AK/Utf32View.h index 73b096086d9..1f028e5d4c1 100644 --- a/AK/Utf32View.h +++ b/AK/Utf32View.h @@ -51,7 +51,7 @@ public: } Utf32CodepointIterator& operator++() { - ASSERT(m_length > 0); + VERIFY(m_length > 0); m_ptr++; m_length--; return *this; @@ -62,7 +62,7 @@ public: } u32 operator*() const { - ASSERT(m_length > 0); + VERIFY(m_length > 0); return *m_ptr; } @@ -88,7 +88,7 @@ public: : m_code_points(code_points) , m_length(length) { - ASSERT(code_points || length == 0); + VERIFY(code_points || length == 0); } Utf32CodepointIterator begin() const @@ -107,8 +107,8 @@ public: size_t iterator_offset(const Utf32CodepointIterator& it) const { - ASSERT(it.m_ptr >= m_code_points); - ASSERT(it.m_ptr < m_code_points + m_length); + VERIFY(it.m_ptr >= m_code_points); + VERIFY(it.m_ptr < m_code_points + m_length); return ((ptrdiff_t)it.m_ptr - (ptrdiff_t)m_code_points) / sizeof(u32); } @@ -116,9 +116,9 @@ public: { if (length == 0) return {}; - ASSERT(offset < m_length); - ASSERT(!Checked::addition_would_overflow(offset, length)); - ASSERT((offset + length) <= m_length); + VERIFY(offset < m_length); + VERIFY(!Checked::addition_would_overflow(offset, length)); + VERIFY((offset + length) <= m_length); return Utf32View(m_code_points + offset, length); } diff --git a/AK/Utf8View.cpp b/AK/Utf8View.cpp index ede1eb2391c..eb0143d567f 100644 --- a/AK/Utf8View.cpp +++ b/AK/Utf8View.cpp @@ -67,8 +67,8 @@ Utf8CodepointIterator Utf8View::end() const size_t Utf8View::byte_offset_of(const Utf8CodepointIterator& it) const { - ASSERT(it.m_ptr >= begin_ptr()); - ASSERT(it.m_ptr <= end_ptr()); + VERIFY(it.m_ptr >= begin_ptr()); + VERIFY(it.m_ptr <= end_ptr()); return it.m_ptr - begin_ptr(); } @@ -162,15 +162,15 @@ bool Utf8CodepointIterator::operator!=(const Utf8CodepointIterator& other) const Utf8CodepointIterator& Utf8CodepointIterator::operator++() { - ASSERT(m_length > 0); + VERIFY(m_length > 0); size_t code_point_length_in_bytes = 0; u32 value; bool first_byte_makes_sense = decode_first_byte(*m_ptr, code_point_length_in_bytes, value); - ASSERT(first_byte_makes_sense); + VERIFY(first_byte_makes_sense); - ASSERT(code_point_length_in_bytes <= m_length); + VERIFY(code_point_length_in_bytes <= m_length); m_ptr += code_point_length_in_bytes; m_length -= code_point_length_in_bytes; @@ -179,17 +179,17 @@ Utf8CodepointIterator& Utf8CodepointIterator::operator++() size_t Utf8CodepointIterator::code_point_length_in_bytes() const { - ASSERT(m_length > 0); + VERIFY(m_length > 0); size_t code_point_length_in_bytes = 0; u32 value; bool first_byte_makes_sense = decode_first_byte(*m_ptr, code_point_length_in_bytes, value); - ASSERT(first_byte_makes_sense); + VERIFY(first_byte_makes_sense); return code_point_length_in_bytes; } u32 Utf8CodepointIterator::operator*() const { - ASSERT(m_length > 0); + VERIFY(m_length > 0); u32 code_point_value_so_far = 0; size_t code_point_length_in_bytes = 0; @@ -197,13 +197,13 @@ u32 Utf8CodepointIterator::operator*() const bool first_byte_makes_sense = decode_first_byte(m_ptr[0], code_point_length_in_bytes, code_point_value_so_far); if (!first_byte_makes_sense) dbgln("First byte doesn't make sense, bytes: {}", StringView { (const char*)m_ptr, m_length }); - ASSERT(first_byte_makes_sense); + VERIFY(first_byte_makes_sense); if (code_point_length_in_bytes > m_length) dbgln("Not enough bytes (need {}, have {}), first byte is: {:#02x}, '{}'", code_point_length_in_bytes, m_length, m_ptr[0], (const char*)m_ptr); - ASSERT(code_point_length_in_bytes <= m_length); + VERIFY(code_point_length_in_bytes <= m_length); for (size_t offset = 1; offset < code_point_length_in_bytes; offset++) { - ASSERT(m_ptr[offset] >> 6 == 2); + VERIFY(m_ptr[offset] >> 6 == 2); code_point_value_so_far <<= 6; code_point_value_so_far |= m_ptr[offset] & 63; } diff --git a/AK/Vector.h b/AK/Vector.h index 97b3b790cfd..9f7a20d61d3 100644 --- a/AK/Vector.h +++ b/AK/Vector.h @@ -191,12 +191,12 @@ public: ALWAYS_INLINE const T& at(size_t i) const { - ASSERT(i < m_size); + VERIFY(i < m_size); return data()[i]; } ALWAYS_INLINE T& at(size_t i) { - ASSERT(i < m_size); + VERIFY(i < m_size); return data()[i]; } @@ -211,7 +211,7 @@ public: T take_last() { - ASSERT(!is_empty()); + VERIFY(!is_empty()); T value = move(last()); last().~T(); --m_size; @@ -220,7 +220,7 @@ public: T take_first() { - ASSERT(!is_empty()); + VERIFY(!is_empty()); T value = move(first()); remove(0); return value; @@ -235,14 +235,14 @@ public: T unstable_take(size_t index) { - ASSERT(index < m_size); + VERIFY(index < m_size); swap(at(index), at(m_size - 1)); return take_last(); } void remove(size_t index) { - ASSERT(index < m_size); + VERIFY(index < m_size); if constexpr (Traits::is_trivial()) { TypedTransfer::copy(slot(index), slot(index + 1), m_size - index - 1); @@ -261,8 +261,8 @@ public: { if (count == 0) return; - ASSERT(index + count > index); - ASSERT(index + count <= m_size); + VERIFY(index + count > index); + VERIFY(index + count <= m_size); if constexpr (Traits::is_trivial()) { TypedTransfer::copy(slot(index), slot(index + count), m_size - index - count); @@ -281,7 +281,7 @@ public: template void insert(size_t index, U&& value) { - ASSERT(index <= size()); + VERIFY(index <= size()); if (index == size()) return append(forward(value)); grow_capacity(size() + 1); @@ -403,7 +403,7 @@ public: template ALWAYS_INLINE void unchecked_append(U&& value) { - ASSERT((size() + 1) <= capacity()); + VERIFY((size() + 1) <= capacity()); new (slot(m_size)) T(forward(value)); ++m_size; } @@ -506,7 +506,7 @@ public: void shrink(size_t new_size, bool keep_capacity = false) { - ASSERT(new_size <= size()); + VERIFY(new_size <= size()); if (new_size == size()) return; diff --git a/AK/WeakPtr.h b/AK/WeakPtr.h index 165de017a94..332d97bf76e 100644 --- a/AK/WeakPtr.h +++ b/AK/WeakPtr.h @@ -229,7 +229,7 @@ inline WeakPtr Weakable::make_weak_ptr() const if (static_cast(this)->unref()) { // We just dropped the last reference, which should have called // revoke_weak_ptrs, which should have invalidated our weak_ptr - ASSERT(!weak_ptr.strong_ref()); + VERIFY(!weak_ptr.strong_ref()); return {}; } } diff --git a/AK/Weakable.h b/AK/Weakable.h index ec0ae2a77fb..84e91fc068c 100644 --- a/AK/Weakable.h +++ b/AK/Weakable.h @@ -91,7 +91,7 @@ public: void revoke() { auto current_consumers = m_consumers.fetch_or(1u, AK::MemoryOrder::memory_order_relaxed); - ASSERT(!(current_consumers & 1u)); + VERIFY(!(current_consumers & 1u)); // We flagged revokation, now wait until everyone trying to obtain // a strong reference is done while (current_consumers > 0) { diff --git a/Kernel/ACPI/DynamicParser.cpp b/Kernel/ACPI/DynamicParser.cpp index 31328c5928f..a71952ef057 100644 --- a/Kernel/ACPI/DynamicParser.cpp +++ b/Kernel/ACPI/DynamicParser.cpp @@ -40,39 +40,39 @@ UNMAP_AFTER_INIT DynamicParser::DynamicParser(PhysicalAddress rsdp) void DynamicParser::handle_irq(const RegisterState&) { // FIXME: Implement IRQ handling of ACPI signals! - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void DynamicParser::enable_aml_interpretation() { // FIXME: Implement AML Interpretation - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void DynamicParser::enable_aml_interpretation(File&) { // FIXME: Implement AML Interpretation - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void DynamicParser::enable_aml_interpretation(u8*, u32) { // FIXME: Implement AML Interpretation - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void DynamicParser::disable_aml_interpretation() { // FIXME: Implement AML Interpretation - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void DynamicParser::try_acpi_shutdown() { // FIXME: Implement AML Interpretation to perform ACPI shutdown - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void DynamicParser::build_namespace() { // FIXME: Implement AML Interpretation to build the ACPI namespace - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Kernel/ACPI/MultiProcessorParser.cpp b/Kernel/ACPI/MultiProcessorParser.cpp index 274faf6b181..3e26567f141 100644 --- a/Kernel/ACPI/MultiProcessorParser.cpp +++ b/Kernel/ACPI/MultiProcessorParser.cpp @@ -96,7 +96,7 @@ UNMAP_AFTER_INIT void MultiProcessorParser::parse_configuration_table() entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::CompatibilityBusAddressSpaceModifierEntry); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } --entry_count; } diff --git a/Kernel/ACPI/Parser.cpp b/Kernel/ACPI/Parser.cpp index be2146e7a88..8a7cf442551 100644 --- a/Kernel/ACPI/Parser.cpp +++ b/Kernel/ACPI/Parser.cpp @@ -47,7 +47,7 @@ Parser* Parser::the() void Parser::set_the(Parser& parser) { - ASSERT(!s_acpi_parser); + VERIFY(!s_acpi_parser); s_acpi_parser = &parser; } @@ -89,7 +89,7 @@ UNMAP_AFTER_INIT void Parser::init_fadt() klog() << "ACPI: Searching for the Fixed ACPI Data Table"; m_fadt = find_table("FACP"); - ASSERT(!m_fadt.is_null()); + VERIFY(!m_fadt.is_null()); auto sdt = map_typed(m_fadt); @@ -148,13 +148,13 @@ void Parser::access_generic_address(const Structures::GenericAddressStructure& s switch (structure.access_size) { case (u8)GenericAddressStructure::AccessSize::QWord: { dbgln("Trying to send QWord to IO port"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } case (u8)GenericAddressStructure::AccessSize::Undefined: { dbgln("ACPI Warning: Unknown access size {}", structure.access_size); - ASSERT(structure.bit_width != (u8)GenericAddressStructure::BitWidth::QWord); - ASSERT(structure.bit_width != (u8)GenericAddressStructure::BitWidth::Undefined); + VERIFY(structure.bit_width != (u8)GenericAddressStructure::BitWidth::QWord); + VERIFY(structure.bit_width != (u8)GenericAddressStructure::BitWidth::Undefined); dbgln("ACPI: Bit Width - {} bits", structure.bit_width); address.out(value, structure.bit_width); break; @@ -182,7 +182,7 @@ void Parser::access_generic_address(const Structures::GenericAddressStructure& s break; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return; } @@ -193,16 +193,16 @@ void Parser::access_generic_address(const Structures::GenericAddressStructure& s u32 offset_in_pci_address = structure.address & 0xFFFF; if (structure.access_size == (u8)GenericAddressStructure::AccessSize::QWord) { dbgln("Trying to send QWord to PCI configuration space"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(structure.access_size != (u8)GenericAddressStructure::AccessSize::Undefined); + VERIFY(structure.access_size != (u8)GenericAddressStructure::AccessSize::Undefined); PCI::raw_access(pci_address, offset_in_pci_address, (1 << (structure.access_size - 1)), value); return; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool Parser::validate_reset_register() @@ -222,7 +222,7 @@ void Parser::try_acpi_reboot() dbgln_if(ACPI_DEBUG, "ACPI: Rebooting, Probing FADT ({})", m_fadt); auto fadt = map_typed(m_fadt); - ASSERT(validate_reset_register()); + VERIFY(validate_reset_register()); access_generic_address(fadt->reset_reg, fadt->reset_value); Processor::halt(); } @@ -255,7 +255,7 @@ UNMAP_AFTER_INIT void Parser::initialize_main_system_description_table() #if ACPI_DEBUG dbgln("ACPI: Checking Main SDT Length to choose the correct mapping size"); #endif - ASSERT(!m_main_system_description_table.is_null()); + VERIFY(!m_main_system_description_table.is_null()); auto length = get_table_size(m_main_system_description_table); auto revision = get_table_revision(m_main_system_description_table); @@ -333,7 +333,7 @@ UNMAP_AFTER_INIT Optional StaticParsing::find_rsdp() UNMAP_AFTER_INIT PhysicalAddress StaticParsing::find_table(PhysicalAddress rsdp_address, const StringView& signature) { // FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables. - ASSERT(signature.length() == 4); + VERIFY(signature.length() == 4); auto rsdp = map_typed(rsdp_address); @@ -345,13 +345,13 @@ UNMAP_AFTER_INIT PhysicalAddress StaticParsing::find_table(PhysicalAddress rsdp_ return search_table_in_xsdt(PhysicalAddress(rsdp->xsdt_ptr), signature); return search_table_in_rsdt(PhysicalAddress(rsdp->base.rsdt_ptr), signature); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } UNMAP_AFTER_INIT static PhysicalAddress search_table_in_xsdt(PhysicalAddress xsdt_address, const StringView& signature) { // FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables. - ASSERT(signature.length() == 4); + VERIFY(signature.length() == 4); auto xsdt = map_typed(xsdt_address); @@ -365,7 +365,7 @@ UNMAP_AFTER_INIT static PhysicalAddress search_table_in_xsdt(PhysicalAddress xsd static bool match_table_signature(PhysicalAddress table_header, const StringView& signature) { // FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables. - ASSERT(signature.length() == 4); + VERIFY(signature.length() == 4); auto table = map_typed(table_header); return !strncmp(table->h.sig, signature.characters_without_null_termination(), 4); @@ -374,7 +374,7 @@ static bool match_table_signature(PhysicalAddress table_header, const StringView UNMAP_AFTER_INIT static PhysicalAddress search_table_in_rsdt(PhysicalAddress rsdt_address, const StringView& signature) { // FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables. - ASSERT(signature.length() == 4); + VERIFY(signature.length() == 4); auto rsdt = map_typed(rsdt_address); @@ -387,22 +387,22 @@ UNMAP_AFTER_INIT static PhysicalAddress search_table_in_rsdt(PhysicalAddress rsd void Parser::enable_aml_interpretation() { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Parser::enable_aml_interpretation(File&) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Parser::enable_aml_interpretation(u8*, u32) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Parser::disable_aml_interpretation() { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Kernel/Arch/i386/CPU.cpp b/Kernel/Arch/i386/CPU.cpp index 8c0cc390e1b..2a29ae5d830 100644 --- a/Kernel/Arch/i386/CPU.cpp +++ b/Kernel/Arch/i386/CPU.cpp @@ -319,7 +319,7 @@ void page_fault_handler(TrapFrame* trap) dbgln("Continuing after resolved page fault"); #endif } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -390,7 +390,7 @@ static void unimp_trap() GenericInterruptHandler& get_interrupt_handler(u8 interrupt_number) { - ASSERT(s_interrupt_handler[interrupt_number] != nullptr); + VERIFY(s_interrupt_handler[interrupt_number] != nullptr); return *s_interrupt_handler[interrupt_number]; } @@ -401,14 +401,14 @@ static void revert_to_unused_handler(u8 interrupt_number) void register_generic_interrupt_handler(u8 interrupt_number, GenericInterruptHandler& handler) { - ASSERT(interrupt_number < GENERIC_INTERRUPT_HANDLERS_COUNT); + VERIFY(interrupt_number < GENERIC_INTERRUPT_HANDLERS_COUNT); if (s_interrupt_handler[interrupt_number] != nullptr) { if (s_interrupt_handler[interrupt_number]->type() == HandlerType::UnhandledInterruptHandler) { s_interrupt_handler[interrupt_number] = &handler; return; } if (s_interrupt_handler[interrupt_number]->is_shared_handler() && !s_interrupt_handler[interrupt_number]->is_sharing_with_others()) { - ASSERT(s_interrupt_handler[interrupt_number]->type() == HandlerType::SharedIRQHandler); + VERIFY(s_interrupt_handler[interrupt_number]->type() == HandlerType::SharedIRQHandler); static_cast(s_interrupt_handler[interrupt_number])->register_handler(handler); return; } @@ -417,7 +417,7 @@ void register_generic_interrupt_handler(u8 interrupt_number, GenericInterruptHan static_cast(s_interrupt_handler[interrupt_number])->register_handler(handler); return; } - ASSERT(s_interrupt_handler[interrupt_number]->type() == HandlerType::IRQHandler); + VERIFY(s_interrupt_handler[interrupt_number]->type() == HandlerType::IRQHandler); auto& previous_handler = *s_interrupt_handler[interrupt_number]; s_interrupt_handler[interrupt_number] = nullptr; SharedIRQHandler::initialize(interrupt_number); @@ -425,7 +425,7 @@ void register_generic_interrupt_handler(u8 interrupt_number, GenericInterruptHan static_cast(s_interrupt_handler[interrupt_number])->register_handler(handler); return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { s_interrupt_handler[interrupt_number] = &handler; } @@ -433,13 +433,13 @@ void register_generic_interrupt_handler(u8 interrupt_number, GenericInterruptHan void unregister_generic_interrupt_handler(u8 interrupt_number, GenericInterruptHandler& handler) { - ASSERT(s_interrupt_handler[interrupt_number] != nullptr); + VERIFY(s_interrupt_handler[interrupt_number] != nullptr); if (s_interrupt_handler[interrupt_number]->type() == HandlerType::UnhandledInterruptHandler) { dbgln("Trying to unregister unused handler (?)"); return; } if (s_interrupt_handler[interrupt_number]->is_shared_handler() && !s_interrupt_handler[interrupt_number]->is_sharing_with_others()) { - ASSERT(s_interrupt_handler[interrupt_number]->type() == HandlerType::SharedIRQHandler); + VERIFY(s_interrupt_handler[interrupt_number]->type() == HandlerType::SharedIRQHandler); static_cast(s_interrupt_handler[interrupt_number])->unregister_handler(handler); if (!static_cast(s_interrupt_handler[interrupt_number])->sharing_devices_count()) { revert_to_unused_handler(interrupt_number); @@ -447,11 +447,11 @@ void unregister_generic_interrupt_handler(u8 interrupt_number, GenericInterruptH return; } if (!s_interrupt_handler[interrupt_number]->is_shared_handler()) { - ASSERT(s_interrupt_handler[interrupt_number]->type() == HandlerType::IRQHandler); + VERIFY(s_interrupt_handler[interrupt_number]->type() == HandlerType::IRQHandler); revert_to_unused_handler(interrupt_number); return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } UNMAP_AFTER_INIT void register_interrupt_handler(u8 index, void (*f)()) @@ -692,11 +692,11 @@ void handle_interrupt(TrapFrame* trap) { clac(); auto& regs = *trap->regs; - ASSERT(regs.isr_number >= IRQ_VECTOR_BASE && regs.isr_number <= (IRQ_VECTOR_BASE + GENERIC_INTERRUPT_HANDLERS_COUNT)); + VERIFY(regs.isr_number >= IRQ_VECTOR_BASE && regs.isr_number <= (IRQ_VECTOR_BASE + GENERIC_INTERRUPT_HANDLERS_COUNT)); u8 irq = (u8)(regs.isr_number - 0x50); s_entropy_source_interrupts.add_random_event(irq); auto* handler = s_interrupt_handler[irq]; - ASSERT(handler); + VERIFY(handler); handler->increment_invoking_counter(); handler->handle_interrupt(regs); handler->eoi(); @@ -792,7 +792,7 @@ static volatile bool s_smp_enabled; Vector& Processor::processors() { - ASSERT(s_processors); + VERIFY(s_processors); return *s_processors; } @@ -803,8 +803,8 @@ Processor& Processor::by_id(u32 cpu) // for all APs to finish, after which this array never gets modified // again, so it's safe to not protect access to it here auto& procs = processors(); - ASSERT(procs[cpu] != nullptr); - ASSERT(procs.size() > cpu); + VERIFY(procs[cpu] != nullptr); + VERIFY(procs.size() > cpu); return *procs[cpu]; } @@ -861,7 +861,7 @@ UNMAP_AFTER_INIT void Processor::cpu_detect() u32 max_extended_leaf = CPUID(0x80000000).eax(); - ASSERT(max_extended_leaf >= 0x80000001); + VERIFY(max_extended_leaf >= 0x80000001); CPUID extended_processor_info(0x80000001); if (extended_processor_info.edx() & (1 << 20)) set_feature(CPUFeature::NX); @@ -1049,14 +1049,14 @@ UNMAP_AFTER_INIT void Processor::early_initialize(u32 cpu) cpu_setup(); gdt_init(); - ASSERT(is_initialized()); // sanity check - ASSERT(¤t() == this); // sanity check + VERIFY(is_initialized()); // sanity check + VERIFY(¤t() == this); // sanity check } UNMAP_AFTER_INIT void Processor::initialize(u32 cpu) { - ASSERT(m_self == this); - ASSERT(¤t() == this); // sanity check + VERIFY(m_self == this); + VERIFY(¤t() == this); // sanity check dmesgln("CPU[{}]: Supported features: {}", id(), features_string()); if (!has_feature(CPUFeature::RDRAND)) @@ -1069,7 +1069,7 @@ UNMAP_AFTER_INIT void Processor::initialize(u32 cpu) flush_idt(); if (cpu == 0) { - ASSERT((FlatPtr(&s_clean_fpu_state) & 0xF) == 0); + VERIFY((FlatPtr(&s_clean_fpu_state) & 0xF) == 0); asm volatile("fninit"); asm volatile("fxsave %0" : "=m"(s_clean_fpu_state)); @@ -1095,7 +1095,7 @@ void Processor::write_raw_gdt_entry(u16 selector, u32 low, u32 high) if (i > m_gdt_length) { m_gdt_length = i + 1; - ASSERT(m_gdt_length <= sizeof(m_gdt) / sizeof(m_gdt[0])); + VERIFY(m_gdt_length <= sizeof(m_gdt) / sizeof(m_gdt[0])); m_gdtr.limit = (m_gdt_length + 1) * 8 - 1; } m_gdt[i].low = low; @@ -1178,14 +1178,14 @@ Vector Processor::capture_stack_trace(Thread& thread, size_t max_frames // reflect the status at the last context switch. ScopedSpinLock lock(g_scheduler_lock); if (&thread == Processor::current_thread()) { - ASSERT(thread.state() == Thread::Running); + VERIFY(thread.state() == Thread::Running); // Leave the scheduler lock. If we trigger page faults we may // need to be preempted. Since this is our own thread it won't // cause any problems as the stack won't change below this frame. lock.unlock(); capture_current_thread(); } else if (thread.is_active()) { - ASSERT(thread.cpu() != Processor::id()); + VERIFY(thread.cpu() != Processor::id()); // If this is the case, the thread is currently running // on another processor. We can't trust the kernel stack as // it may be changing at any time. We need to probably send @@ -1197,8 +1197,8 @@ Vector Processor::capture_stack_trace(Thread& thread, size_t max_frames [&]() { dbgln("CPU[{}] getting stack for cpu #{}", Processor::id(), proc.get_id()); ProcessPagingScope paging_scope(thread.process()); - ASSERT(&Processor::current() != &proc); - ASSERT(&thread == Processor::current_thread()); + VERIFY(&Processor::current() != &proc); + VERIFY(&thread == Processor::current_thread()); // NOTE: Because the other processor is still holding the // scheduler lock while waiting for this callback to finish, // the current thread on the target processor cannot change @@ -1212,7 +1212,7 @@ Vector Processor::capture_stack_trace(Thread& thread, size_t max_frames } else { switch (thread.state()) { case Thread::Running: - ASSERT_NOT_REACHED(); // should have been handled above + VERIFY_NOT_REACHED(); // should have been handled above case Thread::Runnable: case Thread::Stopped: case Thread::Blocked: @@ -1251,8 +1251,8 @@ Vector Processor::capture_stack_trace(Thread& thread, size_t max_frames extern "C" void enter_thread_context(Thread* from_thread, Thread* to_thread) { - ASSERT(from_thread == to_thread || from_thread->state() != Thread::Running); - ASSERT(to_thread->state() == Thread::Running); + VERIFY(from_thread == to_thread || from_thread->state() != Thread::Running); + VERIFY(to_thread->state() == Thread::Running); Processor::set_current_thread(*to_thread); @@ -1287,9 +1287,9 @@ extern "C" void enter_thread_context(Thread* from_thread, Thread* to_thread) void Processor::switch_context(Thread*& from_thread, Thread*& to_thread) { - ASSERT(!in_irq()); - ASSERT(m_in_critical == 1); - ASSERT(is_kernel_mode()); + VERIFY(!in_irq()); + VERIFY(m_in_critical == 1); + VERIFY(is_kernel_mode()); dbgln_if(CONTEXT_SWITCH_DEBUG, "switch_context --> switching out of: {} {}", VirtualAddress(from_thread), *from_thread); from_thread->save_critical(m_in_critical); @@ -1344,12 +1344,12 @@ void Processor::switch_context(Thread*& from_thread, Thread*& to_thread) extern "C" void context_first_init([[maybe_unused]] Thread* from_thread, [[maybe_unused]] Thread* to_thread, [[maybe_unused]] TrapFrame* trap) { - ASSERT(!are_interrupts_enabled()); - ASSERT(is_kernel_mode()); + VERIFY(!are_interrupts_enabled()); + VERIFY(is_kernel_mode()); dbgln_if(CONTEXT_SWITCH_DEBUG, "switch_context <-- from {} {} to {} {} (context_first_init)", VirtualAddress(from_thread), *from_thread, VirtualAddress(to_thread), *to_thread); - ASSERT(to_thread == Thread::current()); + VERIFY(to_thread == Thread::current()); Scheduler::enter_current(*from_thread, true); @@ -1388,13 +1388,13 @@ void exit_kernel_thread(void) u32 Processor::init_context(Thread& thread, bool leave_crit) { - ASSERT(is_kernel_mode()); - ASSERT(g_scheduler_lock.is_locked()); + VERIFY(is_kernel_mode()); + VERIFY(g_scheduler_lock.is_locked()); if (leave_crit) { // Leave the critical section we set up in in Process::exec, // but because we still have the scheduler lock we should end up with 1 m_in_critical--; // leave it without triggering anything or restoring flags - ASSERT(in_critical() == 1); + VERIFY(in_critical() == 1); } u32 kernel_stack_top = thread.kernel_stack_top(); @@ -1405,7 +1405,7 @@ u32 Processor::init_context(Thread& thread, bool leave_crit) u32 stack_top = kernel_stack_top; // TODO: handle NT? - ASSERT((cpu_flags() & 0x24000) == 0); // Assume !(NT | VM) + VERIFY((cpu_flags() & 0x24000) == 0); // Assume !(NT | VM) auto& tss = thread.tss(); bool return_to_user = (tss.cs & 3) != 0; @@ -1503,7 +1503,7 @@ u32 Processor::init_context(Thread& thread, bool leave_crit) extern "C" u32 do_init_context(Thread* thread, u32 flags) { - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); thread->tss().eflags = flags; return Processor::current().init_context(*thread, true); } @@ -1536,18 +1536,18 @@ void Processor::assume_context(Thread& thread, u32 flags) { dbgln_if(CONTEXT_SWITCH_DEBUG, "Assume context for thread {} {}", VirtualAddress(&thread), thread); - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); Scheduler::prepare_after_exec(); // in_critical() should be 2 here. The critical section in Process::exec // and then the scheduler lock - ASSERT(Processor::current().in_critical() == 2); + VERIFY(Processor::current().in_critical() == 2); do_assume_context(&thread, flags); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } extern "C" UNMAP_AFTER_INIT void pre_init_finished(void) { - ASSERT(g_scheduler_lock.own_lock()); + VERIFY(g_scheduler_lock.own_lock()); // Because init_finished() will wait on the other APs, we need // to release the scheduler lock so that the other APs can also get @@ -1567,7 +1567,7 @@ extern "C" UNMAP_AFTER_INIT void post_init_finished(void) UNMAP_AFTER_INIT void Processor::initialize_context_switching(Thread& initial_thread) { - ASSERT(initial_thread.process().is_kernel_process()); + VERIFY(initial_thread.process().is_kernel_process()); auto& tss = initial_thread.tss(); m_tss = tss; @@ -1605,13 +1605,13 @@ UNMAP_AFTER_INIT void Processor::initialize_context_switching(Thread& initial_th ); // clang-format on - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Processor::enter_trap(TrapFrame& trap, bool raise_irq) { - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(&Processor::current() == this); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(&Processor::current() == this); trap.prev_irq_level = m_in_irq; if (raise_irq) m_in_irq++; @@ -1629,9 +1629,9 @@ void Processor::enter_trap(TrapFrame& trap, bool raise_irq) void Processor::exit_trap(TrapFrame& trap) { - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(&Processor::current() == this); - ASSERT(m_in_irq >= trap.prev_irq_level); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(&Processor::current() == this); + VERIFY(m_in_irq >= trap.prev_irq_level); m_in_irq = trap.prev_irq_level; smp_process_pending_messages(); @@ -1644,7 +1644,7 @@ void Processor::exit_trap(TrapFrame& trap) auto& current_trap = current_thread->current_trap(); current_trap = trap.next_trap; if (current_trap) { - ASSERT(current_trap->regs); + VERIFY(current_trap->regs); // If we have another higher level trap then we probably returned // from an interrupt or irq handler. The cs register of the // new/higher level trap tells us what the mode prior to it was @@ -1659,8 +1659,8 @@ void Processor::exit_trap(TrapFrame& trap) void Processor::check_invoke_scheduler() { - ASSERT(!m_in_irq); - ASSERT(!m_in_critical); + VERIFY(!m_in_irq); + VERIFY(!m_in_critical); if (m_invoke_scheduler_async && m_scheduler_initialized) { m_invoke_scheduler_async = false; Scheduler::invoke_async(); @@ -1724,7 +1724,7 @@ ProcessorMessage& Processor::smp_get_from_pool() } } - ASSERT(msg != nullptr); + VERIFY(msg != nullptr); return *msg; } @@ -1732,15 +1732,15 @@ Atomic Processor::s_idle_cpu_mask { 0 }; u32 Processor::smp_wake_n_idle_processors(u32 wake_count) { - ASSERT(Processor::current().in_critical()); - ASSERT(wake_count > 0); + VERIFY(Processor::current().in_critical()); + VERIFY(wake_count > 0); if (!s_smp_enabled) return 0; // Wake at most N - 1 processors if (wake_count >= Processor::count()) { wake_count = Processor::count() - 1; - ASSERT(wake_count > 0); + VERIFY(wake_count > 0); } u32 current_id = Processor::current().id(); @@ -1853,7 +1853,7 @@ bool Processor::smp_process_pending_messages() case ProcessorMessage::FlushTlb: if (is_user_address(VirtualAddress(msg->flush_tlb.ptr))) { // We assume that we don't cross into kernel land! - ASSERT(is_user_range(VirtualAddress(msg->flush_tlb.ptr), msg->flush_tlb.page_count * PAGE_SIZE)); + VERIFY(is_user_range(VirtualAddress(msg->flush_tlb.ptr), msg->flush_tlb.page_count * PAGE_SIZE)); if (read_cr3() != msg->flush_tlb.page_directory->cr3()) { // This processor isn't using this page directory right now, we can ignore this request dbgln_if(SMP_DEBUG, "SMP[{}]: No need to flush {} pages at {}", id(), msg->flush_tlb.page_count, VirtualAddress(msg->flush_tlb.ptr)); @@ -1866,7 +1866,7 @@ bool Processor::smp_process_pending_messages() bool is_async = msg->async; // Need to cache this value *before* dropping the ref count! auto prev_refs = atomic_fetch_sub(&msg->refs, 1u, AK::MemoryOrder::memory_order_acq_rel); - ASSERT(prev_refs != 0); + VERIFY(prev_refs != 0); if (prev_refs == 1) { // All processors handled this. If this is an async message, // we need to clean it up and return it to the pool @@ -1894,7 +1894,7 @@ bool Processor::smp_queue_message(ProcessorMessage& msg) // the queue at any given time. We rely on the fact that the messages // are pooled and never get freed! auto& msg_entry = msg.per_proc_entries[id()]; - ASSERT(msg_entry.msg == &msg); + VERIFY(msg_entry.msg == &msg); ProcessorMessageEntry* next = nullptr; do { msg_entry.next = next; @@ -1909,7 +1909,7 @@ void Processor::smp_broadcast_message(ProcessorMessage& msg) dbgln_if(SMP_DEBUG, "SMP[{}]: Broadcast message {} to cpus: {} proc: {}", cur_proc.get_id(), VirtualAddress(&msg), count(), VirtualAddress(&cur_proc)); atomic_store(&msg.refs, count() - 1, AK::MemoryOrder::memory_order_release); - ASSERT(msg.refs > 0); + VERIFY(msg.refs > 0); bool need_broadcast = false; for_each( [&](Processor& proc) -> IterationDecision { @@ -1928,7 +1928,7 @@ void Processor::smp_broadcast_message(ProcessorMessage& msg) void Processor::smp_broadcast_wait_sync(ProcessorMessage& msg) { auto& cur_proc = Processor::current(); - ASSERT(!msg.async); + VERIFY(!msg.async); // If synchronous then we must cleanup and return the message back // to the pool. Otherwise, the last processor to complete it will return it while (atomic_load(&msg.refs, AK::MemoryOrder::memory_order_consume) != 0) { @@ -1971,7 +1971,7 @@ void Processor::smp_broadcast(void (*callback)(), bool async) void Processor::smp_unicast_message(u32 cpu, ProcessorMessage& msg, bool async) { auto& cur_proc = Processor::current(); - ASSERT(cpu != cur_proc.get_id()); + VERIFY(cpu != cur_proc.get_id()); auto& target_proc = processors()[cpu]; msg.async = async; @@ -2068,8 +2068,8 @@ UNMAP_AFTER_INIT void Processor::deferred_call_pool_init() void Processor::deferred_call_return_to_pool(DeferredCallEntry* entry) { - ASSERT(m_in_critical); - ASSERT(!entry->was_allocated); + VERIFY(m_in_critical); + VERIFY(!entry->was_allocated); entry->next = m_free_deferred_call_pool_entry; m_free_deferred_call_pool_entry = entry; @@ -2077,13 +2077,13 @@ void Processor::deferred_call_return_to_pool(DeferredCallEntry* entry) DeferredCallEntry* Processor::deferred_call_get_free() { - ASSERT(m_in_critical); + VERIFY(m_in_critical); if (m_free_deferred_call_pool_entry) { // Fast path, we have an entry in our pool auto* entry = m_free_deferred_call_pool_entry; m_free_deferred_call_pool_entry = entry->next; - ASSERT(!entry->was_allocated); + VERIFY(!entry->was_allocated); return entry; } @@ -2094,7 +2094,7 @@ DeferredCallEntry* Processor::deferred_call_get_free() void Processor::deferred_call_execute_pending() { - ASSERT(m_in_critical); + VERIFY(m_in_critical); if (!m_pending_deferred_calls) return; @@ -2137,7 +2137,7 @@ void Processor::deferred_call_execute_pending() void Processor::deferred_call_queue_entry(DeferredCallEntry* entry) { - ASSERT(m_in_critical); + VERIFY(m_in_critical); entry->next = m_pending_deferred_calls; m_pending_deferred_calls = entry; } diff --git a/Kernel/Arch/i386/CPU.h b/Kernel/Arch/i386/CPU.h index 054750675b6..1e0e90875ef 100644 --- a/Kernel/Arch/i386/CPU.h +++ b/Kernel/Arch/i386/CPU.h @@ -912,14 +912,14 @@ public: ALWAYS_INLINE void restore_irq(u32 prev_irq) { - ASSERT(prev_irq <= m_in_irq); + VERIFY(prev_irq <= m_in_irq); if (!prev_irq) { u32 prev_critical = 0; if (m_in_critical.compare_exchange_strong(prev_critical, 1)) { m_in_irq = prev_irq; deferred_call_execute_pending(); auto prev_raised = m_in_critical.exchange(prev_critical); - ASSERT(prev_raised == prev_critical + 1); + VERIFY(prev_raised == prev_critical + 1); check_invoke_scheduler(); } else if (prev_critical == 0) { check_invoke_scheduler(); @@ -949,11 +949,11 @@ public: ALWAYS_INLINE void leave_critical(u32 prev_flags) { cli(); // Need to prevent IRQs from interrupting us here! - ASSERT(m_in_critical > 0); + VERIFY(m_in_critical > 0); if (m_in_critical == 1) { if (!m_in_irq) { deferred_call_execute_pending(); - ASSERT(m_in_critical == 1); + VERIFY(m_in_critical == 1); } m_in_critical--; if (!m_in_irq) @@ -981,7 +981,7 @@ public: ALWAYS_INLINE void restore_critical(u32 prev_crit, u32 prev_flags) { m_in_critical.store(prev_crit, AK::MemoryOrder::memory_order_release); - ASSERT(!prev_crit || !(prev_flags & 0x200)); + VERIFY(!prev_crit || !(prev_flags & 0x200)); if (prev_flags & 0x200) sti(); else @@ -1105,14 +1105,14 @@ public: void leave() { - ASSERT(m_valid); + VERIFY(m_valid); m_valid = false; Processor::current().leave_critical(m_prev_flags); } void enter() { - ASSERT(!m_valid); + VERIFY(!m_valid); m_valid = true; Processor::current().enter_critical(m_prev_flags); } diff --git a/Kernel/Arch/i386/ProcessorInfo.cpp b/Kernel/Arch/i386/ProcessorInfo.cpp index 2c101c3eb10..a7f8f4ec4d0 100644 --- a/Kernel/Arch/i386/ProcessorInfo.cpp +++ b/Kernel/Arch/i386/ProcessorInfo.cpp @@ -52,7 +52,7 @@ ProcessorInfo::ProcessorInfo(Processor& processor) m_cpuid = builder.build(); } { - ASSERT(max_leaf >= 1); + VERIFY(max_leaf >= 1); CPUID cpuid(1); m_stepping = cpuid.eax() & 0xf; u32 model = (cpuid.eax() >> 4) & 0xf; diff --git a/Kernel/Assertions.h b/Kernel/Assertions.h index 6a0c6b70e1a..350e3caf831 100644 --- a/Kernel/Assertions.h +++ b/Kernel/Assertions.h @@ -31,11 +31,11 @@ #ifdef DEBUG [[noreturn]] void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func); -# define ASSERT(expr) (static_cast(expr) ? void(0) : __assertion_failed(# expr, __FILE__, __LINE__, __PRETTY_FUNCTION__)) -# define ASSERT_NOT_REACHED() ASSERT(false) +# define VERIFY(expr) (static_cast(expr) ? void(0) : __assertion_failed(# expr, __FILE__, __LINE__, __PRETTY_FUNCTION__)) +# define VERIFY_NOT_REACHED() VERIFY(false) #else -# define ASSERT(expr) -# define ASSERT_NOT_REACHED() CRASH() +# define VERIFY(expr) +# define VERIFY_NOT_REACHED() CRASH() #endif #define CRASH() \ do { \ @@ -47,6 +47,6 @@ CRASH(); \ } while (0) -#define ASSERT_INTERRUPTS_DISABLED() ASSERT(!(cpu_flags() & 0x200)) -#define ASSERT_INTERRUPTS_ENABLED() ASSERT(cpu_flags() & 0x200) -#define TODO ASSERT_NOT_REACHED +#define VERIFY_INTERRUPTS_DISABLED() VERIFY(!(cpu_flags() & 0x200)) +#define VERIFY_INTERRUPTS_ENABLED() VERIFY(cpu_flags() & 0x200) +#define TODO VERIFY_NOT_REACHED diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp index 907777cb804..2bc06796468 100644 --- a/Kernel/CommandLine.cpp +++ b/Kernel/CommandLine.cpp @@ -45,13 +45,13 @@ UNMAP_AFTER_INIT void CommandLine::early_initialize(const char* cmd_line) const CommandLine& kernel_command_line() { - ASSERT(s_the); + VERIFY(s_the); return *s_the; } UNMAP_AFTER_INIT void CommandLine::initialize() { - ASSERT(!s_the); + VERIFY(!s_the); s_the = new CommandLine(s_cmd_line); } diff --git a/Kernel/DMI.cpp b/Kernel/DMI.cpp index 584020c1953..eb4f52bf1a3 100644 --- a/Kernel/DMI.cpp +++ b/Kernel/DMI.cpp @@ -81,7 +81,7 @@ size_t DMIExpose::structure_table_length() const UNMAP_AFTER_INIT void DMIExpose::initialize_exposer() { - ASSERT(!(m_entry_point.is_null())); + VERIFY(!(m_entry_point.is_null())); if (m_using_64bit_entry_point) { set_64_bit_entry_initialization_values(); } else { diff --git a/Kernel/Devices/AsyncDeviceRequest.cpp b/Kernel/Devices/AsyncDeviceRequest.cpp index 07665b874ea..28e6bea121d 100644 --- a/Kernel/Devices/AsyncDeviceRequest.cpp +++ b/Kernel/Devices/AsyncDeviceRequest.cpp @@ -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 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()) { diff --git a/Kernel/Devices/AsyncDeviceRequest.h b/Kernel/Devices/AsyncDeviceRequest.h index 7d8010bd339..0577a3aa17f 100644 --- a/Kernel/Devices/AsyncDeviceRequest.h +++ b/Kernel/Devices/AsyncDeviceRequest.h @@ -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; } diff --git a/Kernel/Devices/BXVGADevice.cpp b/Kernel/Devices/BXVGADevice.cpp index 4a5a5382d69..98d0420d45c 100644 --- a/Kernel/Devices/BXVGADevice.cpp +++ b/Kernel/Devices/BXVGADevice.cpp @@ -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); } diff --git a/Kernel/Devices/BlockDevice.cpp b/Kernel/Devices/BlockDevice.cpp index f2863ecb558..17e679e5a2d 100644 --- a/Kernel/Devices/BlockDevice.cpp +++ b/Kernel/Devices/BlockDevice.cpp @@ -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; } diff --git a/Kernel/Devices/BlockDevice.h b/Kernel/Devices/BlockDevice.h index 35ac1b8f68c..e2f3d771f4c 100644 --- a/Kernel/Devices/BlockDevice.h +++ b/Kernel/Devices/BlockDevice.h @@ -57,7 +57,7 @@ public: case Write: return "BlockDeviceRequest (write)"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Kernel/Devices/Device.cpp b/Kernel/Devices/Device.cpp index 77b951e89c4..edfe2fcd38b 100644 --- a/Kernel/Devices/Device.cpp +++ b/Kernel/Devices/Device.cpp @@ -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, 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(); diff --git a/Kernel/Devices/I8042Controller.cpp b/Kernel/Devices/I8042Controller.cpp index 451ee1b5138..9877df385c1 100644 --- a/Kernel/Devices/I8042Controller.cpp +++ b/Kernel/Devices/I8042Controller.cpp @@ -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); } diff --git a/Kernel/Devices/I8042Controller.h b/Kernel/Devices/I8042Controller.h index 78c4d41efad..d4c728f05f2 100644 --- a/Kernel/Devices/I8042Controller.h +++ b/Kernel/Devices/I8042Controller.h @@ -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; } diff --git a/Kernel/Devices/KeyboardDevice.cpp b/Kernel/Devices/KeyboardDevice.cpp index b2f3389b590..2d0bf5e0bbd 100644 --- a/Kernel/Devices/KeyboardDevice.cpp +++ b/Kernel/Devices/KeyboardDevice.cpp @@ -450,7 +450,7 @@ KResultOr 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(); diff --git a/Kernel/Devices/PS2MouseDevice.cpp b/Kernel/Devices/PS2MouseDevice.cpp index 7d8f4cdfa5e..9c4d42266a6 100644 --- a/Kernel/Devices/PS2MouseDevice.cpp +++ b/Kernel/Devices/PS2MouseDevice.cpp @@ -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 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) - nread; ScopedSpinLock lock(m_queue_lock); diff --git a/Kernel/Devices/SB16.cpp b/Kernel/Devices/SB16.cpp index 539a7a7b505..2110e1aa2bf 100644 --- a/Kernel/Devices/SB16.cpp +++ b/Kernel/Devices/SB16.cpp @@ -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 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; diff --git a/Kernel/Devices/USB/UHCIController.cpp b/Kernel/Devices/USB/UHCIController.cpp index ba5f0df1dd4..51430d35b14 100644 --- a/Kernel/Devices/USB/UHCIController.cpp +++ b/Kernel/Devices/USB/UHCIController.cpp @@ -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!! } diff --git a/Kernel/Devices/USB/UHCIDescriptorTypes.h b/Kernel/Devices/USB/UHCIDescriptorTypes.h index 8ffd2d4ffa1..cbdba0ab255 100644 --- a/Kernel/Devices/USB/UHCIDescriptorTypes.h +++ b/Kernel/Devices/USB/UHCIDescriptorTypes.h @@ -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); } diff --git a/Kernel/DoubleBuffer.cpp b/Kernel/DoubleBuffer.cpp index 790201cc8b5..2797e9e31b1 100644 --- a/Kernel/DoubleBuffer.cpp +++ b/Kernel/DoubleBuffer.cpp @@ -53,7 +53,7 @@ void DoubleBuffer::flip() { if (m_storage.is_null()) return; - ASSERT(m_read_buffer_index == m_read_buffer->size); + VERIFY(m_read_buffer_index == m_read_buffer->size); swap(m_read_buffer, m_write_buffer); m_write_buffer->size = 0; m_read_buffer_index = 0; @@ -64,7 +64,7 @@ ssize_t DoubleBuffer::write(const UserOrKernelBuffer& data, size_t size) { if (!size || m_storage.is_null()) return 0; - ASSERT(size > 0); + VERIFY(size > 0); LOCKER(m_lock); size_t bytes_to_write = min(size, m_space_for_writing); u8* write_ptr = m_write_buffer->data + m_write_buffer->size; @@ -81,7 +81,7 @@ ssize_t DoubleBuffer::read(UserOrKernelBuffer& data, size_t size) { if (!size || m_storage.is_null()) return 0; - ASSERT(size > 0); + VERIFY(size > 0); LOCKER(m_lock); if (m_read_buffer_index >= m_read_buffer->size && m_write_buffer->size != 0) flip(); diff --git a/Kernel/DoubleBuffer.h b/Kernel/DoubleBuffer.h index 6db3718b8ee..e2289a62c66 100644 --- a/Kernel/DoubleBuffer.h +++ b/Kernel/DoubleBuffer.h @@ -56,7 +56,7 @@ public: void set_unblock_callback(Function callback) { - ASSERT(!m_unblock_callback); + VERIFY(!m_unblock_callback); m_unblock_callback = move(callback); } diff --git a/Kernel/FileSystem/BlockBasedFileSystem.cpp b/Kernel/FileSystem/BlockBasedFileSystem.cpp index 350d2200d24..84c8a292414 100644 --- a/Kernel/FileSystem/BlockBasedFileSystem.cpp +++ b/Kernel/FileSystem/BlockBasedFileSystem.cpp @@ -78,7 +78,7 @@ public: { if (auto it = m_hash.find(block_index); it != m_hash.end()) { auto& entry = const_cast(*it->value); - ASSERT(entry.block_index == block_index); + VERIFY(entry.block_index == block_index); return entry; } @@ -90,7 +90,7 @@ public: return get(block_index); } - ASSERT(m_clean_list.last()); + VERIFY(m_clean_list.last()); auto& new_entry = *m_clean_list.last(); m_clean_list.prepend(new_entry); @@ -127,7 +127,7 @@ private: BlockBasedFS::BlockBasedFS(FileDescription& file_description) : FileBackedFS(file_description) { - ASSERT(file_description.file().is_seekable()); + VERIFY(file_description.file().is_seekable()); } BlockBasedFS::~BlockBasedFS() @@ -136,8 +136,8 @@ BlockBasedFS::~BlockBasedFS() KResult BlockBasedFS::write_block(BlockIndex index, const UserOrKernelBuffer& data, size_t count, size_t offset, bool allow_cache) { - ASSERT(m_logical_block_size); - ASSERT(offset + count <= block_size()); + VERIFY(m_logical_block_size); + VERIFY(offset + count <= block_size()); dbgln_if(BBFS_DEBUG, "BlockBasedFileSystem::write_block {}, size={}", index, count); if (!allow_cache) { @@ -147,7 +147,7 @@ KResult BlockBasedFS::write_block(BlockIndex index, const UserOrKernelBuffer& da auto nwritten = file_description().write(data, count); if (nwritten.is_error()) return nwritten.error(); - ASSERT(nwritten.value() == count); + VERIFY(nwritten.value() == count); return KSuccess; } @@ -171,8 +171,8 @@ bool BlockBasedFS::raw_read(BlockIndex index, UserOrKernelBuffer& buffer) u32 base_offset = index.value() * m_logical_block_size; file_description().seek(base_offset, SEEK_SET); auto nread = file_description().read(buffer, m_logical_block_size); - ASSERT(!nread.is_error()); - ASSERT(nread.value() == m_logical_block_size); + VERIFY(!nread.is_error()); + VERIFY(nread.value() == m_logical_block_size); return true; } bool BlockBasedFS::raw_write(BlockIndex index, const UserOrKernelBuffer& buffer) @@ -180,8 +180,8 @@ bool BlockBasedFS::raw_write(BlockIndex index, const UserOrKernelBuffer& buffer) size_t base_offset = index.value() * m_logical_block_size; file_description().seek(base_offset, SEEK_SET); auto nwritten = file_description().write(buffer, m_logical_block_size); - ASSERT(!nwritten.is_error()); - ASSERT(nwritten.value() == m_logical_block_size); + VERIFY(!nwritten.is_error()); + VERIFY(nwritten.value() == m_logical_block_size); return true; } @@ -208,7 +208,7 @@ bool BlockBasedFS::raw_write_blocks(BlockIndex index, size_t count, const UserOr KResult BlockBasedFS::write_blocks(BlockIndex index, unsigned count, const UserOrKernelBuffer& data, bool allow_cache) { - ASSERT(m_logical_block_size); + VERIFY(m_logical_block_size); dbgln_if(BBFS_DEBUG, "BlockBasedFileSystem::write_blocks {}, count={}", index, count); for (unsigned i = 0; i < count; ++i) { auto result = write_block(BlockIndex { index.value() + i }, data.offset(i * block_size()), block_size(), 0, allow_cache); @@ -220,8 +220,8 @@ KResult BlockBasedFS::write_blocks(BlockIndex index, unsigned count, const UserO KResult BlockBasedFS::read_block(BlockIndex index, UserOrKernelBuffer* buffer, size_t count, size_t offset, bool allow_cache) const { - ASSERT(m_logical_block_size); - ASSERT(offset + count <= block_size()); + VERIFY(m_logical_block_size); + VERIFY(offset + count <= block_size()); dbgln_if(BBFS_DEBUG, "BlockBasedFileSystem::read_block {}", index); if (!allow_cache) { @@ -231,7 +231,7 @@ KResult BlockBasedFS::read_block(BlockIndex index, UserOrKernelBuffer* buffer, s auto nread = file_description().read(*buffer, count); if (nread.is_error()) return nread.error(); - ASSERT(nread.value() == count); + VERIFY(nread.value() == count); return KSuccess; } @@ -243,7 +243,7 @@ KResult BlockBasedFS::read_block(BlockIndex index, UserOrKernelBuffer* buffer, s auto nread = file_description().read(entry_data_buffer, block_size()); if (nread.is_error()) return nread.error(); - ASSERT(nread.value() == block_size()); + VERIFY(nread.value() == block_size()); entry.has_data = true; } if (buffer && !buffer->write(entry.data + offset, count)) @@ -253,7 +253,7 @@ KResult BlockBasedFS::read_block(BlockIndex index, UserOrKernelBuffer* buffer, s KResult BlockBasedFS::read_blocks(BlockIndex index, unsigned count, UserOrKernelBuffer& buffer, bool allow_cache) const { - ASSERT(m_logical_block_size); + VERIFY(m_logical_block_size); if (!count) return EINVAL; if (count == 1) diff --git a/Kernel/FileSystem/DevFS.cpp b/Kernel/FileSystem/DevFS.cpp index 1019eb5b42c..eeb88f4c4e4 100644 --- a/Kernel/FileSystem/DevFS.cpp +++ b/Kernel/FileSystem/DevFS.cpp @@ -61,7 +61,7 @@ size_t DevFS::allocate_inode_index() { LOCKER(m_lock); m_next_inode_index = m_next_inode_index.value() + 1; - ASSERT(m_next_inode_index > 0); + VERIFY(m_next_inode_index > 0); return 1 + m_next_inode_index.value(); } @@ -102,17 +102,17 @@ DevFSInode::DevFSInode(DevFS& fs) } ssize_t DevFSInode::read_bytes(off_t, ssize_t, UserOrKernelBuffer&, FileDescription*) const { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } KResult DevFSInode::traverse_as_directory(Function) const { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } RefPtr DevFSInode::lookup(StringView) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void DevFSInode::flush_metadata() @@ -121,7 +121,7 @@ void DevFSInode::flush_metadata() ssize_t DevFSInode::write_bytes(off_t, ssize_t, const UserOrKernelBuffer&, FileDescription*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } KResultOr> DevFSInode::create_child(const String&, mode_t, dev_t, uid_t, gid_t) @@ -141,7 +141,7 @@ KResult DevFSInode::remove_child(const StringView&) KResultOr DevFSInode::directory_entry_count() const { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } KResult DevFSInode::chmod(mode_t) @@ -174,8 +174,8 @@ DevFSLinkInode::DevFSLinkInode(DevFS& fs, String name) ssize_t DevFSLinkInode::read_bytes(off_t offset, ssize_t, UserOrKernelBuffer& buffer, FileDescription*) const { LOCKER(m_lock); - ASSERT(offset == 0); - ASSERT(!m_link.is_null()); + VERIFY(offset == 0); + VERIFY(!m_link.is_null()); if (!buffer.write(((const u8*)m_link.substring_view(0).characters_without_null_termination()) + offset, m_link.length())) return -EFAULT; return m_link.length(); @@ -195,8 +195,8 @@ InodeMetadata DevFSLinkInode::metadata() const ssize_t DevFSLinkInode::write_bytes(off_t offset, ssize_t count, const UserOrKernelBuffer& buffer, FileDescription*) { LOCKER(m_lock); - ASSERT(offset == 0); - ASSERT(buffer.is_kernel_buffer()); + VERIFY(offset == 0); + VERIFY(buffer.is_kernel_buffer()); m_link = buffer.copy_into_string(count); return count; } @@ -361,7 +361,7 @@ String DevFSDeviceInode::name() const ssize_t DevFSDeviceInode::read_bytes(off_t offset, ssize_t count, UserOrKernelBuffer& buffer, FileDescription* description) const { LOCKER(m_lock); - ASSERT(!!description); + VERIFY(!!description); if (!m_attached_device->can_read(*description, offset)) return -EIO; auto nread = const_cast(*m_attached_device).read(*description, offset, buffer, count); @@ -387,7 +387,7 @@ InodeMetadata DevFSDeviceInode::metadata() const ssize_t DevFSDeviceInode::write_bytes(off_t offset, ssize_t count, const UserOrKernelBuffer& buffer, FileDescription* description) { LOCKER(m_lock); - ASSERT(!!description); + VERIFY(!!description); if (!m_attached_device->can_read(*description, offset)) return -EIO; auto nread = const_cast(*m_attached_device).write(*description, offset, buffer, count); diff --git a/Kernel/FileSystem/DevPtsFS.cpp b/Kernel/FileSystem/DevPtsFS.cpp index b3bdec9dced..e47e0f6d2a6 100644 --- a/Kernel/FileSystem/DevPtsFS.cpp +++ b/Kernel/FileSystem/DevPtsFS.cpp @@ -63,7 +63,7 @@ bool DevPtsFS::initialize() static unsigned inode_index_to_pty_index(InodeIndex inode_index) { - ASSERT(inode_index > 1); + VERIFY(inode_index > 1); return inode_index.value() - 2; } @@ -84,7 +84,7 @@ RefPtr DevPtsFS::get_inode(InodeIdentifier inode_id) const unsigned pty_index = inode_index_to_pty_index(inode_id.index()); auto* device = Device::get_device(201, pty_index); - ASSERT(device); + VERIFY(device); auto inode = adopt(*new DevPtsFSInode(const_cast(*this), inode_id.index(), static_cast(device))); inode->m_metadata.inode = inode_id; @@ -122,12 +122,12 @@ DevPtsFSInode::~DevPtsFSInode() ssize_t DevPtsFSInode::read_bytes(off_t, ssize_t, UserOrKernelBuffer&, FileDescription*) const { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } ssize_t DevPtsFSInode::write_bytes(off_t, ssize_t, const UserOrKernelBuffer&, FileDescription*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } InodeMetadata DevPtsFSInode::metadata() const @@ -159,14 +159,14 @@ KResult DevPtsFSInode::traverse_as_directory(Function DevPtsFSInode::directory_entry_count() const { - ASSERT(identifier().index() == 1); + VERIFY(identifier().index() == 1); return 2 + s_ptys->size(); } RefPtr DevPtsFSInode::lookup(StringView name) { - ASSERT(identifier().index() == 1); + VERIFY(identifier().index() == 1); if (name == "." || name == "..") return this; diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index 0b6fb423e21..eae9e081952 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -91,28 +91,28 @@ Ext2FS::~Ext2FS() bool Ext2FS::flush_super_block() { LOCKER(m_lock); - ASSERT((sizeof(ext2_super_block) % logical_block_size()) == 0); + VERIFY((sizeof(ext2_super_block) % logical_block_size()) == 0); auto super_block_buffer = UserOrKernelBuffer::for_kernel_buffer((u8*)&m_super_block); bool success = raw_write_blocks(2, (sizeof(ext2_super_block) / logical_block_size()), super_block_buffer); - ASSERT(success); + VERIFY(success); return true; } const ext2_group_desc& Ext2FS::group_descriptor(GroupIndex group_index) const { // FIXME: Should this fail gracefully somehow? - ASSERT(group_index <= m_block_group_count); - ASSERT(group_index > 0); + VERIFY(group_index <= m_block_group_count); + VERIFY(group_index > 0); return block_group_descriptors()[group_index.value() - 1]; } bool Ext2FS::initialize() { LOCKER(m_lock); - ASSERT((sizeof(ext2_super_block) % logical_block_size()) == 0); + VERIFY((sizeof(ext2_super_block) % logical_block_size()) == 0); auto super_block_buffer = UserOrKernelBuffer::for_kernel_buffer((u8*)&m_super_block); bool success = raw_read_blocks(2, (sizeof(ext2_super_block) / logical_block_size()), super_block_buffer); - ASSERT(success); + VERIFY(success); auto& super_block = this->super_block(); if constexpr (EXT2_DEBUG) { @@ -134,7 +134,7 @@ bool Ext2FS::initialize() set_block_size(EXT2_BLOCK_SIZE(&super_block)); - ASSERT(block_size() <= (int)max_block_size); + VERIFY(block_size() <= (int)max_block_size); m_block_group_count = ceil_div(super_block.s_blocks_count, super_block.s_blocks_per_group); @@ -227,7 +227,7 @@ Ext2FS::BlockListShape Ext2FS::compute_block_list_shape(unsigned blocks) const shape.meta_blocks += divide_rounded_up(shape.triply_indirect_blocks, entries_per_block * entries_per_block); shape.meta_blocks += divide_rounded_up(shape.triply_indirect_blocks, entries_per_block); blocks_remaining -= shape.triply_indirect_blocks; - ASSERT(blocks_remaining == 0); + VERIFY(blocks_remaining == 0); return shape; } @@ -302,7 +302,7 @@ KResult Ext2FS::write_block_list_for_inode(InodeIndex inode_index, ext2_inode& e auto block_contents = ByteBuffer::create_uninitialized(block_size()); OutputMemoryStream stream { block_contents }; - ASSERT(new_shape.indirect_blocks <= entries_per_block); + VERIFY(new_shape.indirect_blocks <= entries_per_block); for (unsigned i = 0; i < new_shape.indirect_blocks; ++i) { stream << blocks[output_block_index++].value(); --remaining_blocks; @@ -355,7 +355,7 @@ KResult Ext2FS::write_block_list_for_inode(InodeIndex inode_index, ext2_inode& e } auto* dind_block_as_pointers = (unsigned*)dind_block_contents.data(); - ASSERT(indirect_block_count <= entries_per_block); + VERIFY(indirect_block_count <= entries_per_block); for (unsigned i = 0; i < indirect_block_count; ++i) { bool ind_block_dirty = false; @@ -386,7 +386,7 @@ KResult Ext2FS::write_block_list_for_inode(InodeIndex inode_index, ext2_inode& e if (entries_to_write > entries_per_block) entries_to_write = entries_per_block; - ASSERT(entries_to_write <= entries_per_block); + VERIFY(entries_to_write <= entries_per_block); for (unsigned j = 0; j < entries_to_write; ++j) { BlockIndex output_block = blocks[output_block_index++]; if (ind_block_as_pointers[j] != output_block) { @@ -405,7 +405,7 @@ KResult Ext2FS::write_block_list_for_inode(InodeIndex inode_index, ext2_inode& e if (ind_block_dirty) { auto buffer = UserOrKernelBuffer::for_kernel_buffer(ind_block_contents.data()); int err = write_block(indirect_block_index, buffer, block_size()); - ASSERT(err >= 0); + VERIFY(err >= 0); } } for (unsigned i = indirect_block_count; i < entries_per_block; ++i) { @@ -418,7 +418,7 @@ KResult Ext2FS::write_block_list_for_inode(InodeIndex inode_index, ext2_inode& e if (dind_block_dirty) { auto buffer = UserOrKernelBuffer::for_kernel_buffer(dind_block_contents.data()); int err = write_block(e2inode.i_block[EXT2_DIND_BLOCK], buffer, block_size()); - ASSERT(err >= 0); + VERIFY(err >= 0); } } @@ -427,7 +427,7 @@ KResult Ext2FS::write_block_list_for_inode(InodeIndex inode_index, ext2_inode& e // FIXME: Implement! dbgln("we don't know how to write tind ext2fs blocks yet!"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Vector Ext2FS::block_list_for_inode(const ext2_inode& e2inode, bool include_block_list_blocks) const @@ -536,13 +536,13 @@ Vector Ext2FS::block_list_for_inode_impl(const ext2_inode& e void Ext2FS::free_inode(Ext2FSInode& inode) { LOCKER(m_lock); - ASSERT(inode.m_raw_inode.i_links_count == 0); + VERIFY(inode.m_raw_inode.i_links_count == 0); dbgln_if(EXT2_DEBUG, "Ext2FS: Inode {} has no more links, time to delete!", inode.index()); // Mark all blocks used by this inode as free. auto block_list = block_list_for_inode(inode.m_raw_inode, true); for (auto block_index : block_list) { - ASSERT(block_index <= super_block().s_blocks_count); + VERIFY(block_index <= super_block().s_blocks_count); if (block_index.value()) set_block_allocation_state(block_index, false); } @@ -674,7 +674,7 @@ void Ext2FSInode::flush_metadata() RefPtr Ext2FS::get_inode(InodeIdentifier inode) const { LOCKER(m_lock); - ASSERT(inode.fsid() == fsid()); + VERIFY(inode.fsid() == fsid()); { auto it = m_inode_cache.find(inode.index()); @@ -706,14 +706,14 @@ RefPtr Ext2FS::get_inode(InodeIdentifier inode) const ssize_t Ext2FSInode::read_bytes(off_t offset, ssize_t count, UserOrKernelBuffer& buffer, FileDescription* description) const { Locker inode_locker(m_lock); - ASSERT(offset >= 0); + VERIFY(offset >= 0); if (m_raw_inode.i_size == 0) return 0; // Symbolic links shorter than 60 characters are store inline inside the i_block array. // This avoids wasting an entire block on short links. (Most links are short.) if (is_symlink() && size() < max_inline_symlink_length) { - ASSERT(offset == 0); + VERIFY(offset == 0); ssize_t nread = min((off_t)size() - offset, static_cast(count)); if (!buffer.write(((const u8*)m_raw_inode.i_block) + offset, (size_t)nread)) return -EFAULT; @@ -748,7 +748,7 @@ ssize_t Ext2FSInode::read_bytes(off_t offset, ssize_t count, UserOrKernelBuffer& for (size_t bi = first_block_logical_index; remaining_count && bi <= last_block_logical_index; ++bi) { auto block_index = m_block_list[bi]; - ASSERT(block_index.value()); + VERIFY(block_index.value()); size_t offset_into_block = (bi == first_block_logical_index) ? offset_into_first_block : 0; size_t num_bytes_to_copy = min(block_size - offset_into_block, remaining_count); auto buffer_offset = buffer.offset(nread); @@ -827,7 +827,7 @@ KResult Ext2FSInode::resize(u64 new_size) auto nwritten = write_bytes(clear_from, min(sizeof(zero_buffer), bytes_to_clear), UserOrKernelBuffer::for_kernel_buffer(zero_buffer), nullptr); if (nwritten < 0) return KResult((ErrnoCode)-nwritten); - ASSERT(nwritten != 0); + VERIFY(nwritten != 0); bytes_to_clear -= nwritten; clear_from += nwritten; } @@ -838,8 +838,8 @@ KResult Ext2FSInode::resize(u64 new_size) ssize_t Ext2FSInode::write_bytes(off_t offset, ssize_t count, const UserOrKernelBuffer& data, FileDescription* description) { - ASSERT(offset >= 0); - ASSERT(count >= 0); + VERIFY(offset >= 0); + VERIFY(count >= 0); Locker inode_locker(m_lock); Locker fs_locker(fs().m_lock); @@ -849,7 +849,7 @@ ssize_t Ext2FSInode::write_bytes(off_t offset, ssize_t count, const UserOrKernel return result; if (is_symlink()) { - ASSERT(offset == 0); + VERIFY(offset == 0); if (max((size_t)(offset + count), (size_t)m_raw_inode.i_size) < max_inline_symlink_length) { dbgln_if(EXT2_DEBUG, "Ext2FS: write_bytes poking into i_block array for inline symlink '{}' ({} bytes)", data.copy_into_string(count), count); if (!data.read(((u8*)m_raw_inode.i_block) + offset, (size_t)count)) @@ -937,7 +937,7 @@ u8 Ext2FS::internal_file_type_to_directory_entry_type(const DirectoryEntryView& KResult Ext2FSInode::traverse_as_directory(Function callback) const { LOCKER(m_lock); - ASSERT(is_directory()); + VERIFY(is_directory()); dbgln_if(EXT2_VERY_DEBUG, "Ext2FS: Traversing as directory: {}", index()); @@ -1020,7 +1020,7 @@ KResultOr> Ext2FSInode::create_child(const String& name, mo KResult Ext2FSInode::add_child(Inode& child, const StringView& name, mode_t mode) { LOCKER(m_lock); - ASSERT(is_directory()); + VERIFY(is_directory()); if (name.length() > EXT2_NAME_LEN) return ENAMETOOLONG; @@ -1064,7 +1064,7 @@ KResult Ext2FSInode::remove_child(const StringView& name) { LOCKER(m_lock); dbgln_if(EXT2_DEBUG, "Ext2FSInode::remove_child('{}') in inode {}", name, index()); - ASSERT(is_directory()); + VERIFY(is_directory()); auto it = m_lookup_cache.find(name); if (it == m_lookup_cache.end()) @@ -1162,7 +1162,7 @@ auto Ext2FS::allocate_blocks(GroupIndex preferred_group_index, size_t count) -> } } - ASSERT(found_a_group); + VERIFY(found_a_group); auto& bgd = group_descriptor(group_index); auto& cached_bitmap = get_bitmap_block(bgd.bg_block_bitmap); @@ -1172,7 +1172,7 @@ auto Ext2FS::allocate_blocks(GroupIndex preferred_group_index, size_t count) -> BlockIndex first_block_in_group = (group_index.value() - 1) * blocks_per_group() + first_block_index().value(); size_t free_region_size = 0; auto first_unset_bit_index = block_bitmap.find_longest_range_of_unset_bits(count - blocks.size(), free_region_size); - ASSERT(first_unset_bit_index.has_value()); + VERIFY(first_unset_bit_index.has_value()); dbgln_if(EXT2_DEBUG, "Ext2FS: allocating free region of size: {} [{}]", free_region_size, group_index); for (size_t i = 0; i < free_region_size; ++i) { BlockIndex block_index = (first_unset_bit_index.value() + i) + first_block_in_group.value(); @@ -1182,7 +1182,7 @@ auto Ext2FS::allocate_blocks(GroupIndex preferred_group_index, size_t count) -> } } - ASSERT(blocks.size() == count); + VERIFY(blocks.size() == count); return blocks; } @@ -1239,7 +1239,7 @@ InodeIndex Ext2FS::find_a_free_inode(GroupIndex preferred_group) InodeIndex inode = first_free_inode_in_group; dbgln_if(EXT2_DEBUG, "Ext2FS: found suitable inode {}", inode); - ASSERT(get_inode_allocation_state(inode) == false); + VERIFY(get_inode_allocation_state(inode) == false); return inode; } @@ -1285,7 +1285,7 @@ bool Ext2FS::set_inode_allocation_state(InodeIndex inode_index, bool new_state) dbgln_if(EXT2_DEBUG, "Ext2FS: set_inode_allocation_state({}) {} -> {}", inode_index, current_state, new_state); if (current_state == new_state) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return true; } @@ -1325,14 +1325,14 @@ Ext2FS::CachedBitmap& Ext2FS::get_bitmap_block(BlockIndex bitmap_block_index) auto block = KBuffer::create_with_size(block_size(), Region::Access::Read | Region::Access::Write, "Ext2FS: Cached bitmap block"); auto buffer = UserOrKernelBuffer::for_kernel_buffer(block.data()); int err = read_block(bitmap_block_index, &buffer, block_size()); - ASSERT(err >= 0); + VERIFY(err >= 0); m_cached_bitmaps.append(make(bitmap_block_index, move(block))); return *m_cached_bitmaps.last(); } bool Ext2FS::set_block_allocation_state(BlockIndex block_index, bool new_state) { - ASSERT(block_index != 0); + VERIFY(block_index != 0); LOCKER(m_lock); auto group_index = group_index_from_block_index(block_index); @@ -1346,7 +1346,7 @@ bool Ext2FS::set_block_allocation_state(BlockIndex block_index, bool new_state) dbgln_if(EXT2_DEBUG, "Ext2FS: block {} state: {} -> {} (in bitmap block {})", block_index, current_state, new_state, bgd.bg_block_bitmap); if (current_state == new_state) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return true; } @@ -1374,7 +1374,7 @@ bool Ext2FS::set_block_allocation_state(BlockIndex block_index, bool new_state) KResult Ext2FS::create_directory(Ext2FSInode& parent_inode, const String& name, mode_t mode, uid_t uid, gid_t gid) { LOCKER(m_lock); - ASSERT(is_directory(mode)); + VERIFY(is_directory(mode)); auto inode_or_error = create_inode(parent_inode, name, mode, 0, uid, gid); if (inode_or_error.is_error()) @@ -1424,7 +1424,7 @@ KResultOr> Ext2FS::create_inode(Ext2FSInode& parent_inode, // Looks like we're good, time to update the inode bitmap and group+global inode counters. bool success = set_inode_allocation_state(inode_id, true); - ASSERT(success); + VERIFY(success); struct timeval now; kgettimeofday(now); @@ -1450,7 +1450,7 @@ KResultOr> Ext2FS::create_inode(Ext2FSInode& parent_inode, e2inode.i_flags = 0; success = write_ext2_inode(inode_id, e2inode); - ASSERT(success); + VERIFY(success); // We might have cached the fact that this inode didn't exist. Wipe the slate. m_inode_cache.remove(inode_id); @@ -1487,7 +1487,7 @@ bool Ext2FSInode::populate_lookup_cache() const RefPtr Ext2FSInode::lookup(StringView name) { - ASSERT(is_directory()); + VERIFY(is_directory()); if (!populate_lookup_cache()) return {}; LOCKER(m_lock); @@ -1549,7 +1549,7 @@ KResult Ext2FSInode::decrement_link_count() LOCKER(m_lock); if (fs().is_readonly()) return EROFS; - ASSERT(m_raw_inode.i_links_count); + VERIFY(m_raw_inode.i_links_count); --m_raw_inode.i_links_count; if (ref_count() == 1 && m_raw_inode.i_links_count == 0) fs().uncache_inode(index()); @@ -1565,7 +1565,7 @@ void Ext2FS::uncache_inode(InodeIndex index) KResultOr Ext2FSInode::directory_entry_count() const { - ASSERT(is_directory()); + VERIFY(is_directory()); LOCKER(m_lock); populate_lookup_cache(); return m_lookup_cache.size(); diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp index 72cda752ca9..952fce5f130 100644 --- a/Kernel/FileSystem/FIFO.cpp +++ b/Kernel/FileSystem/FIFO.cpp @@ -134,13 +134,13 @@ void FIFO::detach(Direction direction) #if FIFO_DEBUG klog() << "close reader (" << m_readers << " - 1)"; #endif - ASSERT(m_readers); + VERIFY(m_readers); --m_readers; } else if (direction == Direction::Writer) { #if FIFO_DEBUG klog() << "close writer (" << m_writers << " - 1)"; #endif - ASSERT(m_writers); + VERIFY(m_writers); --m_writers; } diff --git a/Kernel/FileSystem/File.h b/Kernel/FileSystem/File.h index 98f35993ecc..a43964f1919 100644 --- a/Kernel/FileSystem/File.h +++ b/Kernel/FileSystem/File.h @@ -50,7 +50,7 @@ public: virtual bool should_add_blocker(Thread::Blocker& b, void* data) override { - ASSERT(b.blocker_type() == Thread::Blocker::Type::File); + VERIFY(b.blocker_type() == Thread::Blocker::Type::File); auto& blocker = static_cast(b); return !blocker.unblock(true, data); } @@ -59,7 +59,7 @@ public: { ScopedSpinLock lock(m_lock); do_unblock([&](auto& b, void* data, bool&) { - ASSERT(b.blocker_type() == Thread::Blocker::Type::File); + VERIFY(b.blocker_type() == Thread::Blocker::Type::File); auto& blocker = static_cast(b); return blocker.unblock(false, data); }); @@ -159,7 +159,7 @@ protected: private: ALWAYS_INLINE void do_evaluate_block_conditions() { - ASSERT(!Processor::current().in_irq()); + VERIFY(!Processor::current().in_irq()); block_condition().unblock(); } diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp index a11d7d3bc65..b7df9bc6598 100644 --- a/Kernel/FileSystem/FileDescription.cpp +++ b/Kernel/FileSystem/FileDescription.cpp @@ -107,7 +107,7 @@ Thread::FileBlocker::BlockFlags FileDescription::should_unblock(Thread::FileBloc if ((u32)block_flags & (u32)Thread::FileBlocker::BlockFlags::SocketFlags) { auto* sock = socket(); - ASSERT(sock); + VERIFY(sock); if (((u32)block_flags & (u32)Thread::FileBlocker::BlockFlags::Accept) && sock->can_accept()) unblock_flags |= (u32)Thread::FileBlocker::BlockFlags::Accept; if (((u32)block_flags & (u32)Thread::FileBlocker::BlockFlags::Connect) && sock->setup_state() == Socket::SetupState::Completed) @@ -205,8 +205,8 @@ bool FileDescription::can_read() const KResultOr> FileDescription::read_entire_file() { // HACK ALERT: (This entire function) - ASSERT(m_file->is_inode()); - ASSERT(m_inode); + VERIFY(m_file->is_inode()); + VERIFY(m_inode); return m_inode->read_entire(this); } diff --git a/Kernel/FileSystem/FileSystem.cpp b/Kernel/FileSystem/FileSystem.cpp index 49f1b284f3e..2cef2ccd516 100644 --- a/Kernel/FileSystem/FileSystem.cpp +++ b/Kernel/FileSystem/FileSystem.cpp @@ -95,7 +95,7 @@ void FS::lock_all() void FS::set_block_size(size_t block_size) { - ASSERT(block_size > 0); + VERIFY(block_size > 0); if (block_size == m_block_size) return; m_block_size = block_size; diff --git a/Kernel/FileSystem/Inode.cpp b/Kernel/FileSystem/Inode.cpp index 7475ed97847..8858fd4a6d5 100644 --- a/Kernel/FileSystem/Inode.cpp +++ b/Kernel/FileSystem/Inode.cpp @@ -49,7 +49,7 @@ SpinLock& Inode::all_inodes_lock() InlineLinkedList& Inode::all_with_lock() { - ASSERT(s_all_inodes_lock.is_locked()); + VERIFY(s_all_inodes_lock.is_locked()); return *s_list; } @@ -66,7 +66,7 @@ void Inode::sync() } for (auto& inode : inodes) { - ASSERT(inode.is_metadata_dirty()); + VERIFY(inode.is_metadata_dirty()); inode.flush_metadata(); } } @@ -83,7 +83,7 @@ KResultOr> Inode::read_entire(FileDescription* descriptio nread = read_bytes(offset, sizeof(buffer), buf, description); if (nread < 0) return KResult((ErrnoCode)-nread); - ASSERT(nread <= (ssize_t)sizeof(buffer)); + VERIFY(nread <= (ssize_t)sizeof(buffer)); if (nread <= 0) break; builder.append((const char*)buffer, nread); @@ -203,27 +203,27 @@ bool Inode::unbind_socket() void Inode::register_watcher(Badge, InodeWatcher& watcher) { LOCKER(m_lock); - ASSERT(!m_watchers.contains(&watcher)); + VERIFY(!m_watchers.contains(&watcher)); m_watchers.set(&watcher); } void Inode::unregister_watcher(Badge, InodeWatcher& watcher) { LOCKER(m_lock); - ASSERT(m_watchers.contains(&watcher)); + VERIFY(m_watchers.contains(&watcher)); m_watchers.remove(&watcher); } NonnullRefPtr Inode::fifo() { LOCKER(m_lock); - ASSERT(metadata().is_fifo()); + VERIFY(metadata().is_fifo()); // FIXME: Release m_fifo when it is closed by all readers and writers if (!m_fifo) m_fifo = FIFO::create(metadata().uid); - ASSERT(m_fifo); + VERIFY(m_fifo); return *m_fifo; } @@ -233,7 +233,7 @@ void Inode::set_metadata_dirty(bool metadata_dirty) if (metadata_dirty) { // Sanity check. - ASSERT(!fs().is_readonly()); + VERIFY(!fs().is_readonly()); } if (m_metadata_dirty == metadata_dirty) diff --git a/Kernel/FileSystem/InodeFile.cpp b/Kernel/FileSystem/InodeFile.cpp index 755e9abbeac..bd073157356 100644 --- a/Kernel/FileSystem/InodeFile.cpp +++ b/Kernel/FileSystem/InodeFile.cpp @@ -122,8 +122,8 @@ KResultOr InodeFile::mmap(Process& process, FileDescription& descriptio String InodeFile::absolute_path(const FileDescription& description) const { - ASSERT_NOT_REACHED(); - ASSERT(description.custody()); + VERIFY_NOT_REACHED(); + VERIFY(description.custody()); return description.absolute_path(); } @@ -140,15 +140,15 @@ KResult InodeFile::truncate(u64 size) KResult InodeFile::chown(FileDescription& description, uid_t uid, gid_t gid) { - ASSERT(description.inode() == m_inode); - ASSERT(description.custody()); + VERIFY(description.inode() == m_inode); + VERIFY(description.custody()); return VFS::the().chown(*description.custody(), uid, gid); } KResult InodeFile::chmod(FileDescription& description, mode_t mode) { - ASSERT(description.inode() == m_inode); - ASSERT(description.custody()); + VERIFY(description.inode() == m_inode); + VERIFY(description.custody()); return VFS::the().chmod(*description.custody(), mode); } diff --git a/Kernel/FileSystem/InodeWatcher.cpp b/Kernel/FileSystem/InodeWatcher.cpp index fca37c099c7..17de99259ae 100644 --- a/Kernel/FileSystem/InodeWatcher.cpp +++ b/Kernel/FileSystem/InodeWatcher.cpp @@ -60,7 +60,7 @@ bool InodeWatcher::can_write(const FileDescription&, size_t) const KResultOr InodeWatcher::read(FileDescription&, size_t, UserOrKernelBuffer& buffer, size_t buffer_size) { LOCKER(m_lock); - ASSERT(!m_queue.is_empty() || !m_inode); + VERIFY(!m_queue.is_empty() || !m_inode); if (!m_inode) return 0; diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp index 5b6b30bcf86..5f11831cf49 100644 --- a/Kernel/FileSystem/Plan9FileSystem.cpp +++ b/Kernel/FileSystem/Plan9FileSystem.cpp @@ -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 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 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 Message& append_number(N number) { - ASSERT(!m_have_been_built); + VERIFY(!m_have_been_built); m_builder.append(reinterpret_cast(&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(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(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; } diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index 14789c8d983..3f77764b9df 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -150,14 +150,14 @@ static inline ProcFileType to_proc_file_type(const InodeIdentifier& identifier) static inline int to_fd(const InodeIdentifier& identifier) { - ASSERT(to_proc_parent_directory(identifier) == PDI_PID_fd); + VERIFY(to_proc_parent_directory(identifier) == PDI_PID_fd); return (identifier.index().value() & 0xff) - FI_MaxStaticFileIndex; } static inline size_t to_sys_index(const InodeIdentifier& identifier) { - ASSERT(to_proc_parent_directory(identifier) == PDI_Root_sys); - ASSERT(to_proc_file_type(identifier) == FI_Root_sys_variable); + VERIFY(to_proc_parent_directory(identifier) == PDI_Root_sys); + VERIFY(to_proc_file_type(identifier) == FI_Root_sys_variable); return identifier.index().value() >> 16u; } @@ -178,7 +178,7 @@ static inline InodeIdentifier to_identifier_with_stack(unsigned fsid, ThreadID t static inline InodeIdentifier sys_var_to_identifier(unsigned fsid, unsigned index) { - ASSERT(index < 256); + VERIFY(index < 256); return { fsid, (PDI_Root_sys << 12u) | (index << 16u) | FI_Root_sys_variable }; } @@ -199,7 +199,7 @@ static inline InodeIdentifier to_parent_id(const InodeIdentifier& identifier) case PDI_PID_stacks: return to_identifier(identifier.fsid(), PDI_PID, to_pid(identifier), FI_PID_stacks); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } #if 0 @@ -436,7 +436,7 @@ static bool procfs$devices(InodeIdentifier, KBufferBuilder& builder) else if (device.is_character_device()) obj.add("type", "character"); else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }); array.finish(); return true; @@ -633,7 +633,7 @@ static bool procfs$pid_exe(InodeIdentifier identifier, KBufferBuilder& builder) if (!process) return false; auto* custody = process->executable(); - ASSERT(custody); + VERIFY(custody); builder.append(custody->absolute_path().bytes()); return true; } @@ -884,14 +884,14 @@ SysVariable& SysVariable::for_inode(InodeIdentifier id) if (index >= sys_variables().size()) return sys_variables()[0]; auto& variable = sys_variables()[index]; - ASSERT(variable.address); + VERIFY(variable.address); return variable; } static bool read_sys_bool(InodeIdentifier inode_id, KBufferBuilder& builder) { auto& variable = SysVariable::for_inode(inode_id); - ASSERT(variable.type == SysVariable::Type::Boolean); + VERIFY(variable.type == SysVariable::Type::Boolean); u8 buffer[2]; auto* lockable_bool = reinterpret_cast*>(variable.address); @@ -907,7 +907,7 @@ static bool read_sys_bool(InodeIdentifier inode_id, KBufferBuilder& builder) static ssize_t write_sys_bool(InodeIdentifier inode_id, const UserOrKernelBuffer& buffer, size_t size) { auto& variable = SysVariable::for_inode(inode_id); - ASSERT(variable.type == SysVariable::Type::Boolean); + VERIFY(variable.type == SysVariable::Type::Boolean); char value = 0; bool did_read = false; @@ -920,7 +920,7 @@ static ssize_t write_sys_bool(InodeIdentifier inode_id, const UserOrKernelBuffer }); if (nread < 0) return nread; - ASSERT(nread == 0 || (nread == 1 && did_read)); + VERIFY(nread == 0 || (nread == 1 && did_read)); if (nread == 0 || !(value == '0' || value == '1')) return (ssize_t)size; @@ -936,7 +936,7 @@ static ssize_t write_sys_bool(InodeIdentifier inode_id, const UserOrKernelBuffer static bool read_sys_string(InodeIdentifier inode_id, KBufferBuilder& builder) { auto& variable = SysVariable::for_inode(inode_id); - ASSERT(variable.type == SysVariable::Type::String); + VERIFY(variable.type == SysVariable::Type::String); auto* lockable_string = reinterpret_cast*>(variable.address); LOCKER(lockable_string->lock(), Lock::Mode::Shared); @@ -947,7 +947,7 @@ static bool read_sys_string(InodeIdentifier inode_id, KBufferBuilder& builder) static ssize_t write_sys_string(InodeIdentifier inode_id, const UserOrKernelBuffer& buffer, size_t size) { auto& variable = SysVariable::for_inode(inode_id); - ASSERT(variable.type == SysVariable::Type::String); + VERIFY(variable.type == SysVariable::Type::String); auto string_copy = buffer.copy_into_string(size); if (string_copy.is_null()) @@ -1032,7 +1032,7 @@ RefPtr ProcFS::get_inode(InodeIdentifier inode_id) const } auto inode = adopt(*new ProcFSInode(const_cast(*this), inode_id.index())); auto result = m_inodes.set(inode_id.index().value(), inode.ptr()); - ASSERT(result == ((it == m_inodes.end()) ? AK::HashSetResult::InsertedNewEntry : AK::HashSetResult::ReplacedExistingEntry)); + VERIFY(result == ((it == m_inodes.end()) ? AK::HashSetResult::InsertedNewEntry : AK::HashSetResult::ReplacedExistingEntry)); return inode; } @@ -1081,7 +1081,7 @@ KResult ProcFSInode::refresh_data(FileDescription& description) const bool (*read_callback)(InodeIdentifier, KBufferBuilder&) = nullptr; if (directory_entry) { read_callback = directory_entry->read_callback; - ASSERT(read_callback); + VERIFY(read_callback); } else { switch (to_proc_parent_directory(identifier())) { case PDI_PID_fd: @@ -1093,7 +1093,7 @@ KResult ProcFSInode::refresh_data(FileDescription& description) const case PDI_Root_sys: switch (SysVariable::for_inode(identifier()).type) { case SysVariable::Type::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case SysVariable::Type::Boolean: read_callback = read_sys_bool; break; @@ -1103,10 +1103,10 @@ KResult ProcFSInode::refresh_data(FileDescription& description) const } break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(read_callback); + VERIFY(read_callback); } if (!cached_data) @@ -1231,8 +1231,8 @@ InodeMetadata ProcFSInode::metadata() const ssize_t ProcFSInode::read_bytes(off_t offset, ssize_t count, UserOrKernelBuffer& buffer, FileDescription* description) const { dbgln_if(PROCFS_DEBUG, "ProcFS: read_bytes offset: {} count: {}", offset, count); - ASSERT(offset >= 0); - ASSERT(buffer.user_or_kernel_ptr()); + VERIFY(offset >= 0); + VERIFY(buffer.user_or_kernel_ptr()); if (!description) return -EIO; @@ -1350,7 +1350,7 @@ KResult ProcFSInode::traverse_as_directory(Function ProcFSInode::lookup(StringView name) { - ASSERT(is_directory()); + VERIFY(is_directory()); if (name == ".") return this; if (name == "..") @@ -1490,7 +1490,7 @@ ssize_t ProcFSInode::write_bytes(off_t offset, ssize_t size, const UserOrKernelB if (to_proc_parent_directory(identifier()) == PDI_Root_sys) { switch (SysVariable::for_inode(identifier()).type) { case SysVariable::Type::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case SysVariable::Type::Boolean: write_callback = write_sys_bool; break; @@ -1506,9 +1506,9 @@ ssize_t ProcFSInode::write_bytes(off_t offset, ssize_t size, const UserOrKernelB write_callback = directory_entry->write_callback; } - ASSERT(is_persistent_inode(identifier())); + VERIFY(is_persistent_inode(identifier())); // FIXME: Being able to write into ProcFS at a non-zero offset seems like something we should maybe support.. - ASSERT(offset == 0); + VERIFY(offset == 0); ssize_t nwritten = write_callback(identifier(), buffer, (size_t)size); if (nwritten < 0) klog() << "ProcFS: Writing " << size << " bytes failed: " << nwritten; @@ -1565,7 +1565,7 @@ KResultOr> ProcFSInode::resolve_as_link(Custody& base, Re res = &process->root_directory(); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (!res) @@ -1666,7 +1666,7 @@ KResult ProcFSInode::remove_child([[maybe_unused]] const StringView& name) KResultOr ProcFSInode::directory_entry_count() const { - ASSERT(is_directory()); + VERIFY(is_directory()); size_t count = 0; KResult result = traverse_as_directory([&count](auto&) { ++count; diff --git a/Kernel/FileSystem/ProcFS.h b/Kernel/FileSystem/ProcFS.h index d5cf67939f9..cff537b6928 100644 --- a/Kernel/FileSystem/ProcFS.h +++ b/Kernel/FileSystem/ProcFS.h @@ -131,19 +131,19 @@ private: // ^Inode virtual KResult attach(FileDescription&) override; virtual void did_seek(FileDescription&, off_t) override; - virtual ssize_t read_bytes(off_t, ssize_t, UserOrKernelBuffer&, FileDescription*) const override { ASSERT_NOT_REACHED(); } + virtual ssize_t read_bytes(off_t, ssize_t, UserOrKernelBuffer&, FileDescription*) const override { VERIFY_NOT_REACHED(); } virtual InodeMetadata metadata() const override; - virtual KResult traverse_as_directory(Function) const override { ASSERT_NOT_REACHED(); } + virtual KResult traverse_as_directory(Function) const override { VERIFY_NOT_REACHED(); } virtual RefPtr lookup(StringView name) override; virtual void flush_metadata() override {}; - virtual ssize_t write_bytes(off_t, ssize_t, const UserOrKernelBuffer&, FileDescription*) override { ASSERT_NOT_REACHED(); } + virtual ssize_t write_bytes(off_t, ssize_t, const UserOrKernelBuffer&, FileDescription*) override { VERIFY_NOT_REACHED(); } virtual KResultOr> create_child(const String& name, mode_t, dev_t, uid_t, gid_t) override; virtual KResult add_child(Inode&, const StringView& name, mode_t) override; virtual KResult remove_child(const StringView& name) override; virtual KResultOr directory_entry_count() const override; virtual KResult chmod(mode_t) override { return EINVAL; } virtual KResult chown(uid_t, gid_t) override { return EINVAL; } - virtual KResultOr> resolve_as_link(Custody&, RefPtr*, int, int) const override { ASSERT_NOT_REACHED(); } + virtual KResultOr> resolve_as_link(Custody&, RefPtr*, int, int) const override { VERIFY_NOT_REACHED(); } virtual FileDescription* preopen_fd() override { return m_fd; } ProcFS& fs() { return static_cast(Inode::fs()); } diff --git a/Kernel/FileSystem/TmpFS.cpp b/Kernel/FileSystem/TmpFS.cpp index 03afca502e3..07e45841fc6 100644 --- a/Kernel/FileSystem/TmpFS.cpp +++ b/Kernel/FileSystem/TmpFS.cpp @@ -52,7 +52,7 @@ bool TmpFS::initialize() NonnullRefPtr TmpFS::root_inode() const { - ASSERT(!m_root_inode.is_null()); + VERIFY(!m_root_inode.is_null()); return *m_root_inode; } @@ -60,7 +60,7 @@ NonnullRefPtr TmpFS::root_inode() const void TmpFS::register_inode(TmpFSInode& inode) { LOCKER(m_lock); - ASSERT(inode.identifier().fsid() == fsid()); + VERIFY(inode.identifier().fsid() == fsid()); auto index = inode.identifier().index(); m_inodes.set(index, inode); @@ -69,7 +69,7 @@ void TmpFS::register_inode(TmpFSInode& inode) void TmpFS::unregister_inode(InodeIdentifier identifier) { LOCKER(m_lock); - ASSERT(identifier.fsid() == fsid()); + VERIFY(identifier.fsid() == fsid()); m_inodes.remove(identifier.index()); } @@ -84,7 +84,7 @@ unsigned TmpFS::next_inode_index() RefPtr TmpFS::get_inode(InodeIdentifier identifier) const { LOCKER(m_lock, Lock::Mode::Shared); - ASSERT(identifier.fsid() == fsid()); + VERIFY(identifier.fsid() == fsid()); auto it = m_inodes.find(identifier.index()); if (it == m_inodes.end()) @@ -149,9 +149,9 @@ KResult TmpFSInode::traverse_as_directory(Function= 0); - ASSERT(offset >= 0); + VERIFY(!is_directory()); + VERIFY(size >= 0); + VERIFY(offset >= 0); if (!m_content) return 0; @@ -170,8 +170,8 @@ ssize_t TmpFSInode::read_bytes(off_t offset, ssize_t size, UserOrKernelBuffer& b ssize_t TmpFSInode::write_bytes(off_t offset, ssize_t size, const UserOrKernelBuffer& buffer, FileDescription*) { LOCKER(m_lock); - ASSERT(!is_directory()); - ASSERT(offset >= 0); + VERIFY(!is_directory()); + VERIFY(offset >= 0); auto result = prepare_to_write_data(); if (result.is_error()) @@ -217,7 +217,7 @@ ssize_t TmpFSInode::write_bytes(off_t offset, ssize_t size, const UserOrKernelBu RefPtr TmpFSInode::lookup(StringView name) { LOCKER(m_lock, Lock::Mode::Shared); - ASSERT(is_directory()); + VERIFY(is_directory()); if (name == ".") return this; @@ -233,7 +233,7 @@ RefPtr TmpFSInode::lookup(StringView name) KResultOr TmpFSInode::directory_entry_count() const { LOCKER(m_lock, Lock::Mode::Shared); - ASSERT(is_directory()); + VERIFY(is_directory()); return 2 + m_children.size(); } @@ -301,8 +301,8 @@ KResultOr> TmpFSInode::create_child(const String& name, mod KResult TmpFSInode::add_child(Inode& child, const StringView& name, mode_t) { LOCKER(m_lock); - ASSERT(is_directory()); - ASSERT(child.fsid() == fsid()); + VERIFY(is_directory()); + VERIFY(child.fsid() == fsid()); if (name.length() > NAME_MAX) return ENAMETOOLONG; @@ -315,7 +315,7 @@ KResult TmpFSInode::add_child(Inode& child, const StringView& name, mode_t) KResult TmpFSInode::remove_child(const StringView& name) { LOCKER(m_lock); - ASSERT(is_directory()); + VERIFY(is_directory()); if (name == "." || name == "..") return KSuccess; @@ -332,7 +332,7 @@ KResult TmpFSInode::remove_child(const StringView& name) KResult TmpFSInode::truncate(u64 size) { LOCKER(m_lock); - ASSERT(!is_directory()); + VERIFY(!is_directory()); if (size == 0) m_content.clear(); diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp index d7fc8fa278b..55b0da3ba05 100644 --- a/Kernel/FileSystem/VirtualFileSystem.cpp +++ b/Kernel/FileSystem/VirtualFileSystem.cpp @@ -67,7 +67,7 @@ UNMAP_AFTER_INIT VFS::~VFS() InodeIdentifier VFS::root_inode_id() const { - ASSERT(m_root_inode); + VERIFY(m_root_inode); return m_root_inode->identifier(); } @@ -211,8 +211,8 @@ KResult VFS::traverse_directory_inode(Inode& dir_inode, Functionidentifier(); if (is_root_inode && !is_vfs_root(dir_inode.identifier()) && entry.name == "..") { auto mount = find_mount_for_guest(dir_inode); - ASSERT(mount); - ASSERT(mount->host()); + VERIFY(mount); + VERIFY(mount->host()); resolved_inode = mount->host()->identifier(); } callback({ entry.name, resolved_inode, entry.file_type }); @@ -697,7 +697,7 @@ KResult VFS::unlink(StringView path, Custody& base) // We have just checked that the inode is not a directory, and thus it's not // the root. So it should have a parent. Note that this would be invalidated // if we were to support bind-mounting regular files on top of the root. - ASSERT(parent_custody); + VERIFY(parent_custody); auto& parent_inode = parent_custody->inode(); auto current_process = Process::current(); diff --git a/Kernel/FutexQueue.cpp b/Kernel/FutexQueue.cpp index 3dc558def94..465032a7a28 100644 --- a/Kernel/FutexQueue.cpp +++ b/Kernel/FutexQueue.cpp @@ -32,9 +32,9 @@ namespace Kernel { bool FutexQueue::should_add_blocker(Thread::Blocker& b, void* data) { - ASSERT(data != nullptr); // Thread that is requesting to be blocked - ASSERT(m_lock.is_locked()); - ASSERT(b.blocker_type() == Thread::Blocker::Type::Futex); + VERIFY(data != nullptr); // Thread that is requesting to be blocked + VERIFY(m_lock.is_locked()); + VERIFY(b.blocker_type() == Thread::Blocker::Type::Futex); dbgln_if(FUTEXQUEUE_DEBUG, "FutexQueue @ {}: should block thread {}", this, *static_cast(data)); @@ -50,12 +50,12 @@ u32 FutexQueue::wake_n_requeue(u32 wake_count, const Function& ge u32 did_wake = 0, did_requeue = 0; do_unblock([&](Thread::Blocker& b, void* data, bool& stop_iterating) { - ASSERT(data); - ASSERT(b.blocker_type() == Thread::Blocker::Type::Futex); + VERIFY(data); + VERIFY(b.blocker_type() == Thread::Blocker::Type::Futex); auto& blocker = static_cast(b); dbgln_if(FUTEXQUEUE_DEBUG, "FutexQueue @ {}: wake_n_requeue unblocking {}", this, *static_cast(data)); - ASSERT(did_wake < wake_count); + VERIFY(did_wake < wake_count); if (blocker.unblock()) { if (++did_wake >= wake_count) stop_iterating = true; @@ -72,7 +72,7 @@ u32 FutexQueue::wake_n_requeue(u32 wake_count, const Function& ge // While still holding m_lock, notify each blocker for (auto& info : blockers_to_requeue) { - ASSERT(info.blocker->blocker_type() == Thread::Blocker::Type::Futex); + VERIFY(info.blocker->blocker_type() == Thread::Blocker::Type::Futex); auto& blocker = *static_cast(info.blocker); blocker.begin_requeue(); } @@ -84,7 +84,7 @@ u32 FutexQueue::wake_n_requeue(u32 wake_count, const Function& ge // Now that we have the lock of the target, append the blockers // and notify them that they completed the move for (auto& info : blockers_to_requeue) { - ASSERT(info.blocker->blocker_type() == Thread::Blocker::Type::Futex); + VERIFY(info.blocker->blocker_type() == Thread::Blocker::Type::Futex); auto& blocker = *static_cast(info.blocker); blocker.finish_requeue(*target_futex_queue); } @@ -107,12 +107,12 @@ u32 FutexQueue::wake_n(u32 wake_count, const Optional& bitset, bool& is_emp dbgln_if(FUTEXQUEUE_DEBUG, "FutexQueue @ {}: wake_n({})", this, wake_count); u32 did_wake = 0; do_unblock([&](Thread::Blocker& b, void* data, bool& stop_iterating) { - ASSERT(data); - ASSERT(b.blocker_type() == Thread::Blocker::Type::Futex); + VERIFY(data); + VERIFY(b.blocker_type() == Thread::Blocker::Type::Futex); auto& blocker = static_cast(b); dbgln_if(FUTEXQUEUE_DEBUG, "FutexQueue @ {}: wake_n unblocking {}", this, *static_cast(data)); - ASSERT(did_wake < wake_count); + VERIFY(did_wake < wake_count); if (bitset.has_value() ? blocker.unblock_bitset(bitset.value()) : blocker.unblock()) { if (++did_wake >= wake_count) stop_iterating = true; @@ -130,8 +130,8 @@ u32 FutexQueue::wake_all(bool& is_empty) dbgln_if(FUTEXQUEUE_DEBUG, "FutexQueue @ {}: wake_all", this); u32 did_wake = 0; do_unblock([&](Thread::Blocker& b, void* data, bool&) { - ASSERT(data); - ASSERT(b.blocker_type() == Thread::Blocker::Type::Futex); + VERIFY(data); + VERIFY(b.blocker_type() == Thread::Blocker::Type::Futex); auto& blocker = static_cast(b); dbgln_if(FUTEXQUEUE_DEBUG, "FutexQueue @ {}: wake_all unblocking {}", this, *static_cast(data)); if (blocker.unblock(true)) { diff --git a/Kernel/Heap/Heap.h b/Kernel/Heap/Heap.h index 5ded4f27cdd..dc53364113c 100644 --- a/Kernel/Heap/Heap.h +++ b/Kernel/Heap/Heap.h @@ -56,7 +56,7 @@ public: { // To keep the alignment of the memory passed in, place the bitmap // at the end of the memory block. - ASSERT(m_total_chunks * CHUNK_SIZE + (m_total_chunks + 7) / 8 <= memory_size); + VERIFY(m_total_chunks * CHUNK_SIZE + (m_total_chunks + 7) / 8 <= memory_size); } ~Heap() { @@ -108,13 +108,13 @@ public: if (!ptr) return; auto* a = (AllocationHeader*)((((u8*)ptr) - sizeof(AllocationHeader))); - ASSERT((u8*)a >= m_chunks && (u8*)ptr < m_chunks + m_total_chunks * CHUNK_SIZE); - ASSERT((u8*)a + a->allocation_size_in_chunks * CHUNK_SIZE <= m_chunks + m_total_chunks * CHUNK_SIZE); + VERIFY((u8*)a >= m_chunks && (u8*)ptr < m_chunks + m_total_chunks * CHUNK_SIZE); + VERIFY((u8*)a + a->allocation_size_in_chunks * CHUNK_SIZE <= m_chunks + m_total_chunks * CHUNK_SIZE); FlatPtr start = ((FlatPtr)a - (FlatPtr)m_chunks) / CHUNK_SIZE; m_bitmap.set_range(start, a->allocation_size_in_chunks, false); - ASSERT(m_allocated_chunks >= a->allocation_size_in_chunks); + VERIFY(m_allocated_chunks >= a->allocation_size_in_chunks); m_allocated_chunks -= a->allocation_size_in_chunks; if constexpr (HEAP_SCRUB_BYTE_FREE != 0) { @@ -129,8 +129,8 @@ public: return h.allocate(new_size); auto* a = (AllocationHeader*)((((u8*)ptr) - sizeof(AllocationHeader))); - ASSERT((u8*)a >= m_chunks && (u8*)ptr < m_chunks + m_total_chunks * CHUNK_SIZE); - ASSERT((u8*)a + a->allocation_size_in_chunks * CHUNK_SIZE <= m_chunks + m_total_chunks * CHUNK_SIZE); + VERIFY((u8*)a >= m_chunks && (u8*)ptr < m_chunks + m_total_chunks * CHUNK_SIZE); + VERIFY((u8*)a + a->allocation_size_in_chunks * CHUNK_SIZE <= m_chunks + m_total_chunks * CHUNK_SIZE); size_t old_size = a->allocation_size_in_chunks * CHUNK_SIZE; @@ -319,7 +319,7 @@ public: return; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void* reallocate(void* ptr, size_t new_size) @@ -330,12 +330,12 @@ public: if (subheap->heap.contains(ptr)) return subheap->heap.reallocate(ptr, new_size, *this); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } HeapType& add_subheap(void* memory, size_t memory_size) { - ASSERT(memory_size > sizeof(SubHeap)); + VERIFY(memory_size > sizeof(SubHeap)); // Place the SubHeap structure at the beginning of the new memory block memory_size -= sizeof(SubHeap); diff --git a/Kernel/Heap/SlabAllocator.cpp b/Kernel/Heap/SlabAllocator.cpp index 55720013c4f..da5bc8d23b2 100644 --- a/Kernel/Heap/SlabAllocator.cpp +++ b/Kernel/Heap/SlabAllocator.cpp @@ -86,7 +86,7 @@ public: void dealloc(void* ptr) { - ASSERT(ptr); + VERIFY(ptr); if (ptr < m_base || ptr >= m_end) { kfree(ptr); return; @@ -159,7 +159,7 @@ void* slab_alloc(size_t slab_size) return s_slab_allocator_64.alloc(); if (slab_size <= 128) return s_slab_allocator_128.alloc(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void slab_dealloc(void* ptr, size_t slab_size) @@ -172,7 +172,7 @@ void slab_dealloc(void* ptr, size_t slab_size) return s_slab_allocator_64.dealloc(ptr); if (slab_size <= 128) return s_slab_allocator_128.dealloc(ptr); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void slab_alloc_stats(Function callback) diff --git a/Kernel/Heap/kmalloc.cpp b/Kernel/Heap/kmalloc.cpp index 538fda36191..b66e2767328 100644 --- a/Kernel/Heap/kmalloc.cpp +++ b/Kernel/Heap/kmalloc.cpp @@ -71,7 +71,7 @@ struct KmallocGlobalHeap { klog() << "kmalloc(): Cannot expand heap before MM is initialized!"; return false; } - ASSERT(!m_adding); + VERIFY(!m_adding); TemporaryChange change(m_adding, true); // At this point we have very little memory left. Any attempt to // kmalloc() could fail, so use our backup memory first, so we @@ -231,7 +231,7 @@ void* kmalloc_eternal(size_t size) ScopedSpinLock lock(s_lock); void* ptr = s_next_eternal_ptr; s_next_eternal_ptr += size; - ASSERT(s_next_eternal_ptr < s_end_of_eternal_range); + VERIFY(s_next_eternal_ptr < s_end_of_eternal_range); g_kmalloc_bytes_eternal += size; return ptr; } diff --git a/Kernel/IO.h b/Kernel/IO.h index 41a8df2f33a..e2110b513fe 100644 --- a/Kernel/IO.h +++ b/Kernel/IO.h @@ -121,7 +121,7 @@ public: return IO::in16(get()); if constexpr (sizeof(T) == 1) return IO::in8(get()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } template @@ -139,7 +139,7 @@ public: IO::out8(get(), value); return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } inline void out(u32 value, u8 bit_width) @@ -156,7 +156,7 @@ public: IO::out8(get(), value); return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool is_null() const { return m_address == 0; } diff --git a/Kernel/Interrupts/APIC.cpp b/Kernel/Interrupts/APIC.cpp index 888ec06761e..d892ab5fba4 100644 --- a/Kernel/Interrupts/APIC.cpp +++ b/Kernel/Interrupts/APIC.cpp @@ -142,13 +142,13 @@ bool APIC::initialized() APIC& APIC::the() { - ASSERT(APIC::initialized()); + VERIFY(APIC::initialized()); return *s_apic; } UNMAP_AFTER_INIT void APIC::initialize() { - ASSERT(!APIC::initialized()); + VERIFY(!APIC::initialized()); s_apic.ensure_instance(); } @@ -302,7 +302,7 @@ UNMAP_AFTER_INIT bool APIC::init_bsp() UNMAP_AFTER_INIT void APIC::do_boot_aps() { - ASSERT(m_processor_enabled_cnt > 1); + VERIFY(m_processor_enabled_cnt > 1); u32 aps_to_enable = m_processor_enabled_cnt - 1; // Copy the APIC startup code and variables to P0x00008000 @@ -326,7 +326,7 @@ UNMAP_AFTER_INIT void APIC::do_boot_aps() // Store pointers to all stacks for the APs to use auto ap_stack_array = APIC_INIT_VAR_PTR(u32, apic_startup_region->vaddr().as_ptr(), ap_cpu_init_stacks); - ASSERT(aps_to_enable == apic_ap_stacks.size()); + VERIFY(aps_to_enable == apic_ap_stacks.size()); for (size_t i = 0; i < aps_to_enable; i++) { ap_stack_array[i] = apic_ap_stacks[i]->vaddr().get() + Thread::default_kernel_stack_size; #if APIC_DEBUG @@ -429,7 +429,7 @@ UNMAP_AFTER_INIT void APIC::enable(u32 cpu) } // Use the CPU# as logical apic id - ASSERT(cpu <= 0xff); + VERIFY(cpu <= 0xff); write_register(APIC_REG_LD, (read_register(APIC_REG_LD) & 0x00ffffff) | (cpu << 24)); // TODO: only if not in x2apic mode // read it back to make sure it's actually set @@ -468,18 +468,18 @@ UNMAP_AFTER_INIT void APIC::enable(u32 cpu) Thread* APIC::get_idle_thread(u32 cpu) const { - ASSERT(cpu > 0); + VERIFY(cpu > 0); return m_ap_idle_threads[cpu - 1]; } UNMAP_AFTER_INIT void APIC::init_finished(u32 cpu) { // This method is called once the boot stack is no longer needed - ASSERT(cpu > 0); - ASSERT(cpu < m_processor_enabled_cnt); + VERIFY(cpu > 0); + VERIFY(cpu < m_processor_enabled_cnt); // Since we're waiting on other APs here, we shouldn't have the // scheduler lock - ASSERT(!g_scheduler_lock.own_lock()); + VERIFY(!g_scheduler_lock.own_lock()); // Notify the BSP that we are done initializing. It will unmap the startup data at P8000 m_apic_ap_count.fetch_add(1, AK::MemoryOrder::memory_order_acq_rel); @@ -519,8 +519,8 @@ void APIC::send_ipi(u32 cpu) #if APIC_SMP_DEBUG klog() << "SMP: Send IPI from cpu #" << Processor::id() << " to cpu #" << cpu; #endif - ASSERT(cpu != Processor::id()); - ASSERT(cpu < 8); + VERIFY(cpu != Processor::id()); + VERIFY(cpu < 8); wait_for_pending_icr(); write_icr(ICRReg(IRQ_APIC_IPI + IRQ_VECTOR_BASE, ICRReg::Fixed, ICRReg::Logical, ICRReg::Assert, ICRReg::TriggerMode::Edge, ICRReg::NoShorthand, cpu)); } @@ -531,8 +531,8 @@ UNMAP_AFTER_INIT APICTimer* APIC::initialize_timers(HardwareTimerBase& calibrati return nullptr; // We should only initialize and calibrate the APIC timer once on the BSP! - ASSERT(Processor::id() == 0); - ASSERT(!m_apic_timer); + VERIFY(Processor::id() == 0); + VERIFY(!m_apic_timer); m_apic_timer = APICTimer::initialize(IRQ_APIC_TIMER, calibration_timer); return m_apic_timer; @@ -583,7 +583,7 @@ void APIC::setup_local_timer(u32 ticks, TimerMode timer_mode, bool enable) config |= (1 << 3) | 2; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } write_register(APIC_REG_TIMER_CONFIGURATION, config); diff --git a/Kernel/Interrupts/GenericInterruptHandler.cpp b/Kernel/Interrupts/GenericInterruptHandler.cpp index 9e51cb78f0d..97f57ed3cea 100644 --- a/Kernel/Interrupts/GenericInterruptHandler.cpp +++ b/Kernel/Interrupts/GenericInterruptHandler.cpp @@ -56,8 +56,8 @@ GenericInterruptHandler::~GenericInterruptHandler() void GenericInterruptHandler::change_interrupt_number(u8 number) { - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(!m_disable_remap); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(!m_disable_remap); unregister_generic_interrupt_handler(InterruptManagement::acquire_mapped_interrupt_number(interrupt_number()), *this); m_interrupt_number = number; register_generic_interrupt_handler(InterruptManagement::acquire_mapped_interrupt_number(interrupt_number()), *this); diff --git a/Kernel/Interrupts/IOAPIC.cpp b/Kernel/Interrupts/IOAPIC.cpp index 2292e820a6b..06213bdf4d9 100644 --- a/Kernel/Interrupts/IOAPIC.cpp +++ b/Kernel/Interrupts/IOAPIC.cpp @@ -80,7 +80,7 @@ void IOAPIC::map_interrupt_redirection(u8 interrupt_vector) active_low = false; break; case 2: - ASSERT_NOT_REACHED(); // Reserved value + VERIFY_NOT_REACHED(); // Reserved value case 3: active_low = true; break; @@ -96,7 +96,7 @@ void IOAPIC::map_interrupt_redirection(u8 interrupt_vector) trigger_level_mode = false; break; case 2: - ASSERT_NOT_REACHED(); // Reserved value + VERIFY_NOT_REACHED(); // Reserved value case 3: trigger_level_mode = true; break; @@ -127,8 +127,8 @@ bool IOAPIC::is_enabled() const void IOAPIC::spurious_eoi(const GenericInterruptHandler& handler) const { InterruptDisabler disabler; - ASSERT(handler.type() == HandlerType::SpuriousInterruptHandler); - ASSERT(handler.interrupt_number() == APIC::spurious_interrupt_vector()); + VERIFY(handler.type() == HandlerType::SpuriousInterruptHandler); + VERIFY(handler.interrupt_number() == APIC::spurious_interrupt_vector()); klog() << "IOAPIC::spurious_eoi - Spurious Interrupt occurred"; } @@ -148,7 +148,7 @@ void IOAPIC::map_isa_interrupts() active_low = false; break; case 2: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case 3: active_low = true; break; @@ -164,7 +164,7 @@ void IOAPIC::map_isa_interrupts() trigger_level_mode = false; break; case 2: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case 3: trigger_level_mode = true; break; @@ -196,7 +196,7 @@ void IOAPIC::reset_redirection_entry(int index) const void IOAPIC::configure_redirection_entry(int index, u8 interrupt_vector, u8 delivery_mode, bool logical_destination, bool active_low, bool trigger_level_mode, bool masked, u8 destination) const { InterruptDisabler disabler; - ASSERT((u32)index < m_redirection_entries_count); + VERIFY((u32)index < m_redirection_entries_count); u32 redirection_entry1 = interrupt_vector | (delivery_mode & 0b111) << 8 | logical_destination << 11 | active_low << 13 | trigger_level_mode << 15 | masked << 16; u32 redirection_entry2 = destination << 24; write_register((index << 1) + IOAPIC_REDIRECTION_ENTRY_OFFSET, redirection_entry1); @@ -219,7 +219,7 @@ void IOAPIC::mask_all_redirection_entries() const void IOAPIC::mask_redirection_entry(u8 index) const { - ASSERT((u32)index < m_redirection_entries_count); + VERIFY((u32)index < m_redirection_entries_count); u32 redirection_entry = read_register((index << 1) + IOAPIC_REDIRECTION_ENTRY_OFFSET); if (redirection_entry & (1 << 16)) return; @@ -228,13 +228,13 @@ void IOAPIC::mask_redirection_entry(u8 index) const bool IOAPIC::is_redirection_entry_masked(u8 index) const { - ASSERT((u32)index < m_redirection_entries_count); + VERIFY((u32)index < m_redirection_entries_count); return (read_register((index << 1) + IOAPIC_REDIRECTION_ENTRY_OFFSET) & (1 << 16)) != 0; } void IOAPIC::unmask_redirection_entry(u8 index) const { - ASSERT((u32)index < m_redirection_entries_count); + VERIFY((u32)index < m_redirection_entries_count); u32 redirection_entry = read_register((index << 1) + IOAPIC_REDIRECTION_ENTRY_OFFSET); if (!(redirection_entry & (1 << 16))) return; @@ -249,7 +249,7 @@ bool IOAPIC::is_vector_enabled(u8 interrupt_vector) const u8 IOAPIC::read_redirection_entry_vector(u8 index) const { - ASSERT((u32)index < m_redirection_entries_count); + VERIFY((u32)index < m_redirection_entries_count); return (read_register((index << 1) + IOAPIC_REDIRECTION_ENTRY_OFFSET) & 0xFF); } @@ -266,52 +266,52 @@ Optional IOAPIC::find_redirection_entry_by_vector(u8 vector) const void IOAPIC::disable(const GenericInterruptHandler& handler) { InterruptDisabler disabler; - ASSERT(!is_hard_disabled()); + VERIFY(!is_hard_disabled()); u8 interrupt_vector = handler.interrupt_number(); - ASSERT(interrupt_vector >= gsi_base() && interrupt_vector < interrupt_vectors_count()); + VERIFY(interrupt_vector >= gsi_base() && interrupt_vector < interrupt_vectors_count()); auto found_index = find_redirection_entry_by_vector(interrupt_vector); if (!found_index.has_value()) { map_interrupt_redirection(interrupt_vector); found_index = find_redirection_entry_by_vector(interrupt_vector); } - ASSERT(found_index.has_value()); + VERIFY(found_index.has_value()); mask_redirection_entry(found_index.value()); } void IOAPIC::enable(const GenericInterruptHandler& handler) { InterruptDisabler disabler; - ASSERT(!is_hard_disabled()); + VERIFY(!is_hard_disabled()); u8 interrupt_vector = handler.interrupt_number(); - ASSERT(interrupt_vector >= gsi_base() && interrupt_vector < interrupt_vectors_count()); + VERIFY(interrupt_vector >= gsi_base() && interrupt_vector < interrupt_vectors_count()); auto found_index = find_redirection_entry_by_vector(interrupt_vector); if (!found_index.has_value()) { map_interrupt_redirection(interrupt_vector); found_index = find_redirection_entry_by_vector(interrupt_vector); } - ASSERT(found_index.has_value()); + VERIFY(found_index.has_value()); unmask_redirection_entry(found_index.value()); } void IOAPIC::eoi(const GenericInterruptHandler& handler) const { InterruptDisabler disabler; - ASSERT(!is_hard_disabled()); - ASSERT(handler.interrupt_number() >= gsi_base() && handler.interrupt_number() < interrupt_vectors_count()); - ASSERT(handler.type() != HandlerType::SpuriousInterruptHandler); + VERIFY(!is_hard_disabled()); + VERIFY(handler.interrupt_number() >= gsi_base() && handler.interrupt_number() < interrupt_vectors_count()); + VERIFY(handler.type() != HandlerType::SpuriousInterruptHandler); APIC::the().eoi(); } u16 IOAPIC::get_isr() const { InterruptDisabler disabler; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } u16 IOAPIC::get_irr() const { InterruptDisabler disabler; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void IOAPIC::write_register(u32 index, u32 value) const diff --git a/Kernel/Interrupts/IRQHandler.cpp b/Kernel/Interrupts/IRQHandler.cpp index c9f921157fd..8fd0a5edc83 100644 --- a/Kernel/Interrupts/IRQHandler.cpp +++ b/Kernel/Interrupts/IRQHandler.cpp @@ -46,7 +46,7 @@ bool IRQHandler::eoi() { dbgln_if(IRQ_DEBUG, "EOI IRQ {}", interrupt_number()); if (!m_shared_with_others) { - ASSERT(!m_responsible_irq_controller.is_null()); + VERIFY(!m_responsible_irq_controller.is_null()); m_responsible_irq_controller->eoi(*this); return true; } diff --git a/Kernel/Interrupts/InterruptManagement.cpp b/Kernel/Interrupts/InterruptManagement.cpp index e0f43b8ae3a..3a4b97f6473 100644 --- a/Kernel/Interrupts/InterruptManagement.cpp +++ b/Kernel/Interrupts/InterruptManagement.cpp @@ -52,13 +52,13 @@ bool InterruptManagement::initialized() InterruptManagement& InterruptManagement::the() { - ASSERT(InterruptManagement::initialized()); + VERIFY(InterruptManagement::initialized()); return *s_interrupt_management; } UNMAP_AFTER_INIT void InterruptManagement::initialize() { - ASSERT(!InterruptManagement::initialized()); + VERIFY(!InterruptManagement::initialized()); s_interrupt_management = new InterruptManagement(); if (kernel_command_line().lookup("smp").value_or("off") == "on") @@ -78,8 +78,8 @@ void InterruptManagement::enumerate_interrupt_handlers(Function= 0); - ASSERT(!m_interrupt_controllers[index].is_null()); + VERIFY(index >= 0); + VERIFY(!m_interrupt_controllers[index].is_null()); return *m_interrupt_controllers[index]; } @@ -94,7 +94,7 @@ u8 InterruptManagement::acquire_mapped_interrupt_number(u8 original_irq) u8 InterruptManagement::acquire_irq_number(u8 mapped_interrupt_vector) { - ASSERT(InterruptManagement::initialized()); + VERIFY(InterruptManagement::initialized()); return InterruptManagement::the().get_irq_vector(mapped_interrupt_vector); } @@ -102,7 +102,7 @@ u8 InterruptManagement::get_mapped_interrupt_vector(u8 original_irq) { // FIXME: For SMP configuration (with IOAPICs) use a better routing scheme to make redirections more efficient. // FIXME: Find a better way to handle conflict with Syscall interrupt gate. - ASSERT((original_irq + IRQ_VECTOR_BASE) != syscall_vector); + VERIFY((original_irq + IRQ_VECTOR_BASE) != syscall_vector); return original_irq; } @@ -122,7 +122,7 @@ RefPtr InterruptManagement::get_responsible_irq_controller(u8 int if (!irq_controller->is_hard_disabled()) return irq_controller; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } UNMAP_AFTER_INIT PhysicalAddress InterruptManagement::search_for_madt() @@ -149,7 +149,7 @@ UNMAP_AFTER_INIT void InterruptManagement::switch_to_pic_mode() SpuriousInterruptHandler::initialize(7); SpuriousInterruptHandler::initialize(15); for (auto& irq_controller : m_interrupt_controllers) { - ASSERT(irq_controller); + VERIFY(irq_controller); if (irq_controller->type() == IRQControllerType::i82093AA) { irq_controller->hard_disable(); dbgln("Interrupts: Detected {} - Disabled", irq_controller->model()); @@ -180,7 +180,7 @@ UNMAP_AFTER_INIT void InterruptManagement::switch_to_ioapic_mode() } } for (auto& irq_controller : m_interrupt_controllers) { - ASSERT(irq_controller); + VERIFY(irq_controller); if (irq_controller->type() == IRQControllerType::i8259) { irq_controller->hard_disable(); dbgln("Interrupts: Detected {} - Disabled", irq_controller->model()); @@ -198,7 +198,7 @@ UNMAP_AFTER_INIT void InterruptManagement::switch_to_ioapic_mode() UNMAP_AFTER_INIT void InterruptManagement::locate_apic_data() { - ASSERT(!m_madt.is_null()); + VERIFY(!m_madt.is_null()); auto madt = map_typed(m_madt); int irq_controller_count = 0; diff --git a/Kernel/Interrupts/PIC.cpp b/Kernel/Interrupts/PIC.cpp index 57e9c6bec6c..4de473cf493 100644 --- a/Kernel/Interrupts/PIC.cpp +++ b/Kernel/Interrupts/PIC.cpp @@ -69,8 +69,8 @@ bool PIC::is_enabled() const void PIC::disable(const GenericInterruptHandler& handler) { InterruptDisabler disabler; - ASSERT(!is_hard_disabled()); - ASSERT(handler.interrupt_number() >= gsi_base() && handler.interrupt_number() < interrupt_vectors_count()); + VERIFY(!is_hard_disabled()); + VERIFY(handler.interrupt_number() >= gsi_base() && handler.interrupt_number() < interrupt_vectors_count()); u8 irq = handler.interrupt_number(); if (m_cached_irq_mask & (1 << irq)) return; @@ -94,7 +94,7 @@ UNMAP_AFTER_INIT PIC::PIC() void PIC::spurious_eoi(const GenericInterruptHandler& handler) const { - ASSERT(handler.type() == HandlerType::SpuriousInterruptHandler); + VERIFY(handler.type() == HandlerType::SpuriousInterruptHandler); if (handler.interrupt_number() == 7) return; if (handler.interrupt_number() == 15) { @@ -111,15 +111,15 @@ bool PIC::is_vector_enabled(u8 irq) const void PIC::enable(const GenericInterruptHandler& handler) { InterruptDisabler disabler; - ASSERT(!is_hard_disabled()); - ASSERT(handler.interrupt_number() >= gsi_base() && handler.interrupt_number() < interrupt_vectors_count()); + VERIFY(!is_hard_disabled()); + VERIFY(handler.interrupt_number() >= gsi_base() && handler.interrupt_number() < interrupt_vectors_count()); enable_vector(handler.interrupt_number()); } void PIC::enable_vector(u8 irq) { InterruptDisabler disabler; - ASSERT(!is_hard_disabled()); + VERIFY(!is_hard_disabled()); if (!(m_cached_irq_mask & (1 << irq))) return; u8 imr; @@ -138,9 +138,9 @@ void PIC::enable_vector(u8 irq) void PIC::eoi(const GenericInterruptHandler& handler) const { InterruptDisabler disabler; - ASSERT(!is_hard_disabled()); + VERIFY(!is_hard_disabled()); u8 irq = handler.interrupt_number(); - ASSERT(irq >= gsi_base() && irq < interrupt_vectors_count()); + VERIFY(irq >= gsi_base() && irq < interrupt_vectors_count()); if ((1 << irq) & m_cached_irq_mask) { spurious_eoi(handler); return; diff --git a/Kernel/Interrupts/SharedIRQHandler.cpp b/Kernel/Interrupts/SharedIRQHandler.cpp index b878365f43f..95c1c2eb39d 100644 --- a/Kernel/Interrupts/SharedIRQHandler.cpp +++ b/Kernel/Interrupts/SharedIRQHandler.cpp @@ -84,7 +84,7 @@ SharedIRQHandler::~SharedIRQHandler() void SharedIRQHandler::handle_interrupt(const RegisterState& regs) { - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); if constexpr (INTERRUPT_DEBUG) { dbgln("Interrupt @ {}", interrupt_number()); @@ -94,7 +94,7 @@ void SharedIRQHandler::handle_interrupt(const RegisterState& regs) int i = 0; for (auto* handler : m_handlers) { dbgln_if(INTERRUPT_DEBUG, "Going for Interrupt Handling @ {}, Shared Interrupt {}", i, interrupt_number()); - ASSERT(handler != nullptr); + VERIFY(handler != nullptr); handler->increment_invoking_counter(); handler->handle_interrupt(regs); dbgln_if(INTERRUPT_DEBUG, "Going for Interrupt Handling @ {}, Shared Interrupt {} - End", i, interrupt_number()); diff --git a/Kernel/Interrupts/SpuriousInterruptHandler.cpp b/Kernel/Interrupts/SpuriousInterruptHandler.cpp index 353932cb2bc..116823c1426 100644 --- a/Kernel/Interrupts/SpuriousInterruptHandler.cpp +++ b/Kernel/Interrupts/SpuriousInterruptHandler.cpp @@ -36,7 +36,7 @@ UNMAP_AFTER_INIT void SpuriousInterruptHandler::initialize(u8 interrupt_number) void SpuriousInterruptHandler::register_handler(GenericInterruptHandler& handler) { - ASSERT(!m_real_handler); + VERIFY(!m_real_handler); m_real_handler = &handler; } void SpuriousInterruptHandler::unregister_handler(GenericInterruptHandler&) @@ -88,7 +88,7 @@ void SpuriousInterruptHandler::enable_interrupt_vector() void SpuriousInterruptHandler::disable_interrupt_vector() { - ASSERT(!m_real_irq); // this flag should not be set when we call this method + VERIFY(!m_real_irq); // this flag should not be set when we call this method if (!m_enabled) return; m_enabled = false; diff --git a/Kernel/Interrupts/UnhandledInterruptHandler.h b/Kernel/Interrupts/UnhandledInterruptHandler.h index 63d89b7c553..f076aff6c65 100644 --- a/Kernel/Interrupts/UnhandledInterruptHandler.h +++ b/Kernel/Interrupts/UnhandledInterruptHandler.h @@ -43,7 +43,7 @@ public: virtual HandlerType type() const override { return HandlerType::UnhandledInterruptHandler; } virtual const char* purpose() const override { return "Unhandled Interrupt Handler"; } - virtual const char* controller() const override { ASSERT_NOT_REACHED(); } + virtual const char* controller() const override { VERIFY_NOT_REACHED(); } virtual size_t sharing_devices_count() const override { return 0; } virtual bool is_shared_handler() const override { return false; } diff --git a/Kernel/KBuffer.h b/Kernel/KBuffer.h index dcf2a8ebb68..b0e6032e0f1 100644 --- a/Kernel/KBuffer.h +++ b/Kernel/KBuffer.h @@ -97,7 +97,7 @@ public: void set_size(size_t size) { - ASSERT(size <= capacity()); + VERIFY(size <= capacity()); m_size = size; } diff --git a/Kernel/KResult.h b/Kernel/KResult.h index 5039af8b3db..341df32baa8 100644 --- a/Kernel/KResult.h +++ b/Kernel/KResult.h @@ -143,7 +143,7 @@ public: [[nodiscard]] ALWAYS_INLINE KResult error() const { - ASSERT(m_is_error); + VERIFY(m_is_error); return m_error; } @@ -151,20 +151,20 @@ public: [[nodiscard]] ALWAYS_INLINE T& value() { - ASSERT(!m_is_error); + VERIFY(!m_is_error); return *reinterpret_cast(&m_storage); } [[nodiscard]] ALWAYS_INLINE const T& value() const { - ASSERT(!m_is_error); + VERIFY(!m_is_error); return *reinterpret_cast(&m_storage); } [[nodiscard]] ALWAYS_INLINE T release_value() { - ASSERT(!m_is_error); - ASSERT(m_have_storage); + VERIFY(!m_is_error); + VERIFY(m_have_storage); T released_value(move(*reinterpret_cast(&m_storage))); value().~T(); m_have_storage = false; diff --git a/Kernel/KSyms.cpp b/Kernel/KSyms.cpp index 744f55ff19d..27208c5a0b8 100644 --- a/Kernel/KSyms.cpp +++ b/Kernel/KSyms.cpp @@ -44,7 +44,7 @@ static u8 parse_hex_digit(char nibble) { if (nibble >= '0' && nibble <= '9') return nibble - '0'; - ASSERT(nibble >= 'a' && nibble <= 'f'); + VERIFY(nibble >= 'a' && nibble <= 'f'); return 10 + (nibble - 'a'); } @@ -152,7 +152,7 @@ NEVER_INLINE static void dump_backtrace_impl(FlatPtr base_pointer, bool use_ksym } return; } - ASSERT(recognized_symbol_count <= max_recognized_symbol_count); + VERIFY(recognized_symbol_count <= max_recognized_symbol_count); for (size_t i = 0; i < recognized_symbol_count; ++i) { auto& symbol = recognized_symbols[i]; if (!symbol.address) diff --git a/Kernel/Lock.cpp b/Kernel/Lock.cpp index b7a313c3c07..e8af04d7fd3 100644 --- a/Kernel/Lock.cpp +++ b/Kernel/Lock.cpp @@ -45,8 +45,8 @@ void Lock::lock(Mode mode) { // NOTE: This may be called from an interrupt handler (not an IRQ handler) // and also from within critical sections! - ASSERT(!Processor::current().in_irq()); - ASSERT(mode != Mode::Unlocked); + VERIFY(!Processor::current().in_irq()); + VERIFY(mode != Mode::Unlocked); auto current_thread = Thread::current(); ScopedCritical critical; // in case we're not in a critical section already for (;;) { @@ -62,15 +62,15 @@ void Lock::lock(Mode mode) case Mode::Unlocked: { dbgln_if(LOCK_TRACE_DEBUG, "Lock::lock @ ({}) {}: acquire {}, currently unlocked", this, m_name, mode_to_string(mode)); m_mode = mode; - ASSERT(!m_holder); - ASSERT(m_shared_holders.is_empty()); + VERIFY(!m_holder); + VERIFY(m_shared_holders.is_empty()); if (mode == Mode::Exclusive) { m_holder = current_thread; } else { - ASSERT(mode == Mode::Shared); + VERIFY(mode == Mode::Shared); m_shared_holders.set(current_thread, 1); } - ASSERT(m_times_locked == 0); + VERIFY(m_times_locked == 0); m_times_locked++; #if LOCK_DEBUG current_thread->holding_lock(*this, 1, file, line); @@ -80,10 +80,10 @@ void Lock::lock(Mode mode) return; } case Mode::Exclusive: { - ASSERT(m_holder); + VERIFY(m_holder); if (m_holder != current_thread) break; - ASSERT(m_shared_holders.is_empty()); + VERIFY(m_shared_holders.is_empty()); if constexpr (LOCK_TRACE_DEBUG) { if (mode == Mode::Exclusive) @@ -92,8 +92,8 @@ void Lock::lock(Mode mode) dbgln("Lock::lock @ {} ({}): acquire exclusive (requested {}), currently exclusive, holding: {}", this, m_name, mode_to_string(mode), m_times_locked); } - ASSERT(mode == Mode::Exclusive || mode == Mode::Shared); - ASSERT(m_times_locked > 0); + VERIFY(mode == Mode::Exclusive || mode == Mode::Shared); + VERIFY(m_times_locked > 0); m_times_locked++; #if LOCK_DEBUG current_thread->holding_lock(*this, 1, file, line); @@ -102,15 +102,15 @@ void Lock::lock(Mode mode) return; } case Mode::Shared: { - ASSERT(!m_holder); + VERIFY(!m_holder); if (mode != Mode::Shared) break; dbgln_if(LOCK_TRACE_DEBUG, "Lock::lock @ {} ({}): acquire {}, currently shared, locks held {}", this, m_name, mode_to_string(mode), m_times_locked); - ASSERT(m_times_locked > 0); + VERIFY(m_times_locked > 0); m_times_locked++; - ASSERT(!m_shared_holders.is_empty()); + VERIFY(!m_shared_holders.is_empty()); auto it = m_shared_holders.find(current_thread); if (it != m_shared_holders.end()) it->value++; @@ -123,7 +123,7 @@ void Lock::lock(Mode mode) return; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_lock.store(false, AK::memory_order_release); dbgln_if(LOCK_TRACE_DEBUG, "Lock::lock @ {} ({}) waiting...", this, m_name); @@ -136,7 +136,7 @@ void Lock::unlock() { // NOTE: This may be called from an interrupt handler (not an IRQ handler) // and also from within critical sections! - ASSERT(!Processor::current().in_irq()); + VERIFY(!Processor::current().in_irq()); auto current_thread = Thread::current(); ScopedCritical critical; // in case we're not in a critical section already for (;;) { @@ -149,37 +149,37 @@ void Lock::unlock() dbgln("Lock::unlock @ {} ({}): release {}, holding: {}", this, m_name, mode_to_string(current_mode), m_times_locked); } - ASSERT(current_mode != Mode::Unlocked); + VERIFY(current_mode != Mode::Unlocked); - ASSERT(m_times_locked > 0); + VERIFY(m_times_locked > 0); m_times_locked--; switch (current_mode) { case Mode::Exclusive: - ASSERT(m_holder == current_thread); - ASSERT(m_shared_holders.is_empty()); + VERIFY(m_holder == current_thread); + VERIFY(m_shared_holders.is_empty()); if (m_times_locked == 0) m_holder = nullptr; break; case Mode::Shared: { - ASSERT(!m_holder); + VERIFY(!m_holder); auto it = m_shared_holders.find(current_thread); - ASSERT(it != m_shared_holders.end()); + VERIFY(it != m_shared_holders.end()); if (it->value > 1) { it->value--; } else { - ASSERT(it->value > 0); + VERIFY(it->value > 0); m_shared_holders.remove(it); } break; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool unlocked_last = (m_times_locked == 0); if (unlocked_last) { - ASSERT(current_mode == Mode::Exclusive ? !m_holder : m_shared_holders.is_empty()); + VERIFY(current_mode == Mode::Exclusive ? !m_holder : m_shared_holders.is_empty()); m_mode = Mode::Unlocked; m_queue.should_block(false); } @@ -204,7 +204,7 @@ auto Lock::force_unlock_if_locked(u32& lock_count_to_restore) -> Mode { // NOTE: This may be called from an interrupt handler (not an IRQ handler) // and also from within critical sections! - ASSERT(!Processor::current().in_irq()); + VERIFY(!Processor::current().in_irq()); auto current_thread = Thread::current(); ScopedCritical critical; // in case we're not in a critical section already for (;;) { @@ -224,7 +224,7 @@ auto Lock::force_unlock_if_locked(u32& lock_count_to_restore) -> Mode m_holder->holding_lock(*this, -(int)lock_count_to_restore); #endif m_holder = nullptr; - ASSERT(m_times_locked > 0); + VERIFY(m_times_locked > 0); lock_count_to_restore = m_times_locked; m_times_locked = 0; m_mode = Mode::Unlocked; @@ -234,7 +234,7 @@ auto Lock::force_unlock_if_locked(u32& lock_count_to_restore) -> Mode break; } case Mode::Shared: { - ASSERT(!m_holder); + VERIFY(!m_holder); auto it = m_shared_holders.find(current_thread); if (it == m_shared_holders.end()) { m_lock.store(false, AK::MemoryOrder::memory_order_release); @@ -245,14 +245,14 @@ auto Lock::force_unlock_if_locked(u32& lock_count_to_restore) -> Mode dbgln_if(LOCK_RESTORE_DEBUG, "Lock::force_unlock_if_locked @ {}: unlocking exclusive with lock count: {}, total locks: {}", this, it->value, m_times_locked); - ASSERT(it->value > 0); + VERIFY(it->value > 0); lock_count_to_restore = it->value; - ASSERT(lock_count_to_restore > 0); + VERIFY(lock_count_to_restore > 0); #if LOCK_DEBUG m_holder->holding_lock(*this, -(int)lock_count_to_restore); #endif m_shared_holders.remove(it); - ASSERT(m_times_locked >= lock_count_to_restore); + VERIFY(m_times_locked >= lock_count_to_restore); m_times_locked -= lock_count_to_restore; if (m_times_locked == 0) { m_mode = Mode::Unlocked; @@ -269,7 +269,7 @@ auto Lock::force_unlock_if_locked(u32& lock_count_to_restore) -> Mode break; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_queue.wake_one(); return previous_mode; @@ -290,9 +290,9 @@ void Lock::restore_lock(const char* file, int line, Mode mode, u32 lock_count) void Lock::restore_lock(Mode mode, u32 lock_count) #endif { - ASSERT(mode != Mode::Unlocked); - ASSERT(lock_count > 0); - ASSERT(!Processor::current().in_irq()); + VERIFY(mode != Mode::Unlocked); + VERIFY(lock_count > 0); + VERIFY(!Processor::current().in_irq()); auto current_thread = Thread::current(); ScopedCritical critical; // in case we're not in a critical section already for (;;) { @@ -305,10 +305,10 @@ void Lock::restore_lock(Mode mode, u32 lock_count) dbgln_if(LOCK_RESTORE_DEBUG, "Lock::restore_lock @ {}: restoring {} with lock count {}, was unlocked", this, mode_to_string(mode), lock_count); - ASSERT(m_times_locked == 0); + VERIFY(m_times_locked == 0); m_times_locked = lock_count; - ASSERT(!m_holder); - ASSERT(m_shared_holders.is_empty()); + VERIFY(!m_holder); + VERIFY(m_shared_holders.is_empty()); m_holder = current_thread; m_queue.should_block(true); m_lock.store(false, AK::memory_order_release); @@ -325,13 +325,13 @@ void Lock::restore_lock(Mode mode, u32 lock_count) dbgln_if(LOCK_RESTORE_DEBUG, "Lock::restore_lock @ {}: restoring {} with lock count {}, was {}", this, mode_to_string(mode), lock_count, mode_to_string(expected_mode)); - ASSERT(expected_mode == Mode::Shared || m_times_locked == 0); + VERIFY(expected_mode == Mode::Shared || m_times_locked == 0); m_times_locked += lock_count; - ASSERT(!m_holder); - ASSERT((expected_mode == Mode::Unlocked) == m_shared_holders.is_empty()); + VERIFY(!m_holder); + VERIFY((expected_mode == Mode::Unlocked) == m_shared_holders.is_empty()); auto set_result = m_shared_holders.set(current_thread, lock_count); // There may be other shared lock holders already, but we should not have an entry yet - ASSERT(set_result == AK::HashSetResult::InsertedNewEntry); + VERIFY(set_result == AK::HashSetResult::InsertedNewEntry); m_queue.should_block(true); m_lock.store(false, AK::memory_order_release); #if LOCK_DEBUG @@ -340,7 +340,7 @@ void Lock::restore_lock(Mode mode, u32 lock_count) return; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_lock.store(false, AK::memory_order_relaxed); @@ -352,7 +352,7 @@ void Lock::restore_lock(Mode mode, u32 lock_count) void Lock::clear_waiters() { - ASSERT(m_mode != Mode::Shared); + VERIFY(m_mode != Mode::Shared); m_queue.wake_all(); } diff --git a/Kernel/Lock.h b/Kernel/Lock.h index 22d98a44f53..d92d082aa26 100644 --- a/Kernel/Lock.h +++ b/Kernel/Lock.h @@ -117,13 +117,13 @@ public: } ALWAYS_INLINE void unlock() { - ASSERT(m_locked); + VERIFY(m_locked); m_locked = false; m_lock.unlock(); } ALWAYS_INLINE void lock(Lock::Mode mode = Lock::Mode::Exclusive) { - ASSERT(!m_locked); + VERIFY(!m_locked); m_locked = true; m_lock.lock(mode); } diff --git a/Kernel/Net/E1000NetworkAdapter.cpp b/Kernel/Net/E1000NetworkAdapter.cpp index 0b3fa951bd5..d337ce6f29f 100644 --- a/Kernel/Net/E1000NetworkAdapter.cpp +++ b/Kernel/Net/E1000NetworkAdapter.cpp @@ -308,7 +308,7 @@ UNMAP_AFTER_INIT void E1000NetworkAdapter::read_mac_address() mac[5] = tmp >> 8; set_mac_address(mac); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -323,7 +323,7 @@ UNMAP_AFTER_INIT void E1000NetworkAdapter::initialize_rx_descriptors() for (size_t i = 0; i < number_of_rx_descriptors; ++i) { auto& descriptor = rx_descriptors[i]; auto region = MM.allocate_contiguous_kernel_region(8192, "E1000 RX buffer", Region::Access::Read | Region::Access::Write); - ASSERT(region); + VERIFY(region); m_rx_buffers_regions.append(region.release_nonnull()); descriptor.addr = m_rx_buffers_regions[i].physical_page(0)->paddr().get(); descriptor.status = 0; @@ -344,7 +344,7 @@ UNMAP_AFTER_INIT void E1000NetworkAdapter::initialize_tx_descriptors() for (size_t i = 0; i < number_of_tx_descriptors; ++i) { auto& descriptor = tx_descriptors[i]; auto region = MM.allocate_contiguous_kernel_region(8192, "E1000 TX buffer", Region::Access::Read | Region::Access::Write); - ASSERT(region); + VERIFY(region); m_tx_buffers_regions.append(region.release_nonnull()); descriptor.addr = m_tx_buffers_regions[i].physical_page(0)->paddr().get(); descriptor.cmd = 0; @@ -426,7 +426,7 @@ void E1000NetworkAdapter::send_raw(ReadonlyBytes payload) #endif auto* tx_descriptors = (e1000_tx_desc*)m_tx_descriptors_region->vaddr().as_ptr(); auto& descriptor = tx_descriptors[tx_current]; - ASSERT(payload.size() <= 8192); + VERIFY(payload.size() <= 8192); auto* vptr = (void*)m_tx_buffers_regions[tx_current].vaddr().as_ptr(); memcpy(vptr, payload.data(), payload.size()); descriptor.length = payload.size(); @@ -464,7 +464,7 @@ void E1000NetworkAdapter::receive() break; auto* buffer = m_rx_buffers_regions[rx_current].vaddr().as_ptr(); u16 length = rx_descriptors[rx_current].length; - ASSERT(length <= 8192); + VERIFY(length <= 8192); #if E1000_DEBUG klog() << "E1000: Received 1 packet @ " << buffer << " (" << length << ") bytes!"; #endif diff --git a/Kernel/Net/IPv4.h b/Kernel/Net/IPv4.h index 796792860a5..39f671a572b 100644 --- a/Kernel/Net/IPv4.h +++ b/Kernel/Net/IPv4.h @@ -105,7 +105,7 @@ public: NetworkOrdered compute_checksum() const { - ASSERT(!m_checksum); + VERIFY(!m_checksum); return internet_checksum(this, sizeof(IPv4Packet)); } diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp index 29a7ba918ab..d08c29e2046 100644 --- a/Kernel/Net/IPv4Socket.cpp +++ b/Kernel/Net/IPv4Socket.cpp @@ -97,7 +97,7 @@ void IPv4Socket::get_peer_address(sockaddr* address, socklen_t* address_size) KResult IPv4Socket::bind(Userspace user_address, socklen_t address_size) { - ASSERT(setup_state() == SetupState::Unstarted); + VERIFY(setup_state() == SetupState::Unstarted); if (address_size != sizeof(sockaddr_in)) return EINVAL; @@ -260,7 +260,7 @@ KResultOr IPv4Socket::receive_byte_buffered(FileDescription& description } } - ASSERT(!m_receive_buffer.is_empty()); + VERIFY(!m_receive_buffer.is_empty()); int nreceived = m_receive_buffer.read(buffer, buffer_length); if (nreceived > 0) Thread::current()->did_ipv4_socket_read((size_t)nreceived); @@ -311,8 +311,8 @@ KResultOr IPv4Socket::receive_packet_buffered(FileDescription& descripti // Unblocked due to timeout. return EAGAIN; } - ASSERT(m_can_read); - ASSERT(!m_receive_queue.is_empty()); + VERIFY(m_can_read); + VERIFY(!m_receive_queue.is_empty()); packet = m_receive_queue.take_first(); set_can_read(!m_receive_queue.is_empty()); @@ -321,7 +321,7 @@ KResultOr IPv4Socket::receive_packet_buffered(FileDescription& descripti packet.data.value().size(), m_receive_queue.size()); } - ASSERT(packet.data.has_value()); + VERIFY(packet.data.has_value()); packet_timestamp = packet.timestamp; @@ -337,7 +337,7 @@ KResultOr IPv4Socket::receive_packet_buffered(FileDescription& descripti return EFAULT; socklen_t out_length = sizeof(sockaddr_in); - ASSERT(addr_length); + VERIFY(addr_length); if (!copy_to_user(addr_length, &out_length)) return EFAULT; } @@ -390,7 +390,7 @@ bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port, size_t space_in_receive_buffer = m_receive_buffer.space_for_writing(); if (packet_size > space_in_receive_buffer) { dbgln("IPv4Socket({}): did_receive refusing packet since buffer is full.", this); - ASSERT(m_can_read); + VERIFY(m_can_read); return false; } auto scratch_buffer = UserOrKernelBuffer::for_kernel_buffer(m_scratch_buffer.value().data()); @@ -451,7 +451,7 @@ String IPv4Socket::absolute_path(const FileDescription&) const builder.append(" (connecting)"); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return builder.to_string(); diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index 6ce81118ac4..d77d4c287f5 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -97,7 +97,7 @@ void LocalSocket::get_peer_address(sockaddr* address, socklen_t* address_size) KResult LocalSocket::bind(Userspace user_address, socklen_t address_size) { - ASSERT(setup_state() == SetupState::Unstarted); + VERIFY(setup_state() == SetupState::Unstarted); if (address_size != sizeof(sockaddr_un)) return EINVAL; @@ -123,7 +123,7 @@ KResult LocalSocket::bind(Userspace user_address, socklen_t add auto file = move(result.value()); - ASSERT(file->inode()); + VERIFY(file->inode()); if (!file->inode()->bind_socket(*this)) return EADDRINUSE; @@ -136,7 +136,7 @@ KResult LocalSocket::bind(Userspace user_address, socklen_t add KResult LocalSocket::connect(FileDescription& description, Userspace address, socklen_t address_size, ShouldBlock) { - ASSERT(!m_bound); + VERIFY(!m_bound); if (address_size != sizeof(sockaddr_un)) return EINVAL; u16 sa_family_copy; @@ -162,14 +162,14 @@ KResult LocalSocket::connect(FileDescription& description, Userspaceinode()); + VERIFY(m_file->inode()); if (!m_file->inode()->socket()) return ECONNREFUSED; m_address.sun_family = sa_family_copy; memcpy(m_address.sun_path, safe_address, sizeof(m_address.sun_path)); - ASSERT(m_connect_side_fd == &description); + VERIFY(m_connect_side_fd == &description); set_connect_side_role(Role::Connecting); auto peer = m_file->inode()->socket(); @@ -217,12 +217,12 @@ KResult LocalSocket::listen(size_t backlog) KResult LocalSocket::attach(FileDescription& description) { - ASSERT(!m_accept_side_fd_open); + VERIFY(!m_accept_side_fd_open); if (m_connect_side_role == Role::None) { - ASSERT(m_connect_side_fd == nullptr); + VERIFY(m_connect_side_fd == nullptr); m_connect_side_fd = &description; } else { - ASSERT(m_connect_side_fd != &description); + VERIFY(m_connect_side_fd != &description); m_accept_side_fd_open = true; } @@ -235,7 +235,7 @@ void LocalSocket::detach(FileDescription& description) if (m_connect_side_fd == &description) { m_connect_side_fd = nullptr; } else { - ASSERT(m_accept_side_fd_open); + VERIFY(m_accept_side_fd_open); m_accept_side_fd_open = false; } @@ -261,7 +261,7 @@ bool LocalSocket::has_attached_peer(const FileDescription& description) const return m_connect_side_fd != nullptr; if (role == Role::Connected) return m_accept_side_fd_open; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool LocalSocket::can_write(const FileDescription& description, size_t) const @@ -325,7 +325,7 @@ KResultOr LocalSocket::recvfrom(FileDescription& description, UserOrKern } if (!has_attached_peer(description) && socket_buffer->is_empty()) return 0; - ASSERT(!socket_buffer->is_empty()); + VERIFY(!socket_buffer->is_empty()); auto nread = socket_buffer->read(buffer, buffer_size); if (nread > 0) Thread::current()->did_unix_socket_read(nread); @@ -438,7 +438,7 @@ NonnullRefPtrVector& LocalSocket::recvfd_queue_for(const FileDe return m_fds_for_client; if (role == Role::Accepted) return m_fds_for_server; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } NonnullRefPtrVector& LocalSocket::sendfd_queue_for(const FileDescription& description) @@ -448,7 +448,7 @@ NonnullRefPtrVector& LocalSocket::sendfd_queue_for(const FileDe return m_fds_for_server; if (role == Role::Accepted) return m_fds_for_client; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } KResult LocalSocket::sendfd(const FileDescription& socket_description, FileDescription& passing_description) diff --git a/Kernel/Net/NetworkAdapter.cpp b/Kernel/Net/NetworkAdapter.cpp index 6e403bde9c3..9798a09659f 100644 --- a/Kernel/Net/NetworkAdapter.cpp +++ b/Kernel/Net/NetworkAdapter.cpp @@ -208,7 +208,7 @@ size_t NetworkAdapter::dequeue_packet(u8* buffer, size_t buffer_size, timeval& p packet_timestamp = packet_with_timestamp.timestamp; auto packet = move(packet_with_timestamp.packet); size_t packet_size = packet.size(); - ASSERT(packet_size <= buffer_size); + VERIFY(packet_size <= buffer_size); memcpy(buffer, packet.data(), packet_size); if (m_unused_packet_buffers_count < 100) { m_unused_packet_buffers.append(packet); diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp index f3254fb4423..51dbecba6b8 100644 --- a/Kernel/Net/NetworkTask.cpp +++ b/Kernel/Net/NetworkTask.cpp @@ -314,8 +314,8 @@ void handle_udp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp) return; } - ASSERT(socket->type() == SOCK_DGRAM); - ASSERT(socket->local_port() == udp_packet.destination_port()); + VERIFY(socket->type() == SOCK_DGRAM); + VERIFY(socket->local_port() == udp_packet.destination_port()); socket->did_receive(ipv4_packet.source(), udp_packet.source_port(), KBuffer::copy(&ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size()), packet_timestamp); } @@ -391,8 +391,8 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp) LOCKER(socket->lock()); - ASSERT(socket->type() == SOCK_STREAM); - ASSERT(socket->local_port() == tcp_packet.destination_port()); + VERIFY(socket->type() == SOCK_STREAM); + VERIFY(socket->local_port() == tcp_packet.destination_port()); #if TCP_DEBUG klog() << "handle_tcp: got socket; state=" << socket->tuple().to_string().characters() << " " << TCPSocket::to_string(socket->state()); diff --git a/Kernel/Net/Routing.cpp b/Kernel/Net/Routing.cpp index a7cc5f519ca..4c5e0109a19 100644 --- a/Kernel/Net/Routing.cpp +++ b/Kernel/Net/Routing.cpp @@ -77,7 +77,7 @@ public: void unblock(const IPv4Address& ip_addr, const MACAddress& addr) { BlockCondition::unblock([&](auto& b, void*, bool&) { - ASSERT(b.blocker_type() == Thread::Blocker::Type::Routing); + VERIFY(b.blocker_type() == Thread::Blocker::Type::Routing); auto& blocker = static_cast(b); return blocker.unblock(false, ip_addr, addr); }); @@ -86,7 +86,7 @@ public: protected: virtual bool should_add_blocker(Thread::Blocker& b, void*) override { - ASSERT(b.blocker_type() == Thread::Blocker::Type::Routing); + VERIFY(b.blocker_type() == Thread::Blocker::Type::Routing); auto& blocker = static_cast(b); auto val = s_arp_table->resource().get(blocker.ip_addr()); if (!val.has_value()) @@ -107,7 +107,7 @@ ARPTableBlocker::ARPTableBlocker(IPv4Address ip_addr, Optional& addr void ARPTableBlocker::not_blocking(bool timeout_in_past) { - ASSERT(timeout_in_past || !m_should_block); + VERIFY(timeout_in_past || !m_should_block); auto addr = s_arp_table->resource().get(ip_addr()); ScopedSpinLock lock(m_lock); diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp index 9456a48807b..aeacd3b1fda 100644 --- a/Kernel/Net/Socket.cpp +++ b/Kernel/Net/Socket.cpp @@ -76,7 +76,7 @@ RefPtr Socket::accept() return nullptr; dbgln_if(SOCKET_DEBUG, "Socket({}) de-queueing connection", this); auto client = m_pending.take_first(); - ASSERT(!client->is_connected()); + VERIFY(!client->is_connected()); auto& process = *Process::current(); client->m_acceptor = { process.pid().value(), process.uid(), process.gid() }; client->m_connected = true; @@ -101,7 +101,7 @@ KResult Socket::setsockopt(int level, int option, Userspace user_va { if (level != SOL_SOCKET) return ENOPROTOOPT; - ASSERT(level == SOL_SOCKET); + VERIFY(level == SOL_SOCKET); switch (option) { case SO_SNDTIMEO: if (user_value_size != sizeof(timeval)) diff --git a/Kernel/Net/TCPSocket.cpp b/Kernel/Net/TCPSocket.cpp index 8d796828b70..703abb7072e 100644 --- a/Kernel/Net/TCPSocket.cpp +++ b/Kernel/Net/TCPSocket.cpp @@ -132,13 +132,13 @@ RefPtr TCPSocket::create_client(const IPv4Address& new_local_address, void TCPSocket::release_to_originator() { - ASSERT(!!m_originator); + VERIFY(!!m_originator); m_originator.strong_ref()->release_for_accept(this); } void TCPSocket::release_for_accept(RefPtr socket) { - ASSERT(m_pending_release_for_accept.contains(socket->tuple())); + VERIFY(m_pending_release_for_accept.contains(socket->tuple())); m_pending_release_for_accept.remove(socket->tuple()); // FIXME: Should we observe this error somehow? [[maybe_unused]] auto rc = queue_connection_from(*socket); @@ -170,7 +170,7 @@ KResultOr TCPSocket::protocol_receive(ReadonlyBytes raw_ipv4_packet, Use #if TCP_SOCKET_DEBUG klog() << "payload_size " << payload_size << ", will it fit in " << buffer_size << "?"; #endif - ASSERT(buffer_size >= payload_size); + VERIFY(buffer_size >= payload_size); if (!buffer.write(tcp_packet.payload(), payload_size)) return EFAULT; return payload_size; @@ -189,7 +189,7 @@ KResult TCPSocket::send_tcp_packet(u16 flags, const UserOrKernelBuffer* payload, const size_t buffer_size = sizeof(TCPPacket) + payload_size; auto buffer = ByteBuffer::create_zeroed(buffer_size); auto& tcp_packet = *(TCPPacket*)(buffer.data()); - ASSERT(local_port()); + VERIFY(local_port()); tcp_packet.set_source_port(local_port()); tcp_packet.set_destination_port(peer_port()); tcp_packet.set_window_size(1024); @@ -219,7 +219,7 @@ KResult TCPSocket::send_tcp_packet(u16 flags, const UserOrKernelBuffer* payload, } auto routing_decision = route_to(peer_address(), local_address(), bound_interface()); - ASSERT(!routing_decision.is_zero()); + VERIFY(!routing_decision.is_zero()); auto packet_buffer = UserOrKernelBuffer::for_kernel_buffer(buffer.data()); auto result = routing_decision.adapter->send_ipv4( @@ -236,7 +236,7 @@ KResult TCPSocket::send_tcp_packet(u16 flags, const UserOrKernelBuffer* payload, void TCPSocket::send_outgoing_packets() { auto routing_decision = route_to(peer_address(), local_address(), bound_interface()); - ASSERT(!routing_decision.is_zero()); + VERIFY(!routing_decision.is_zero()); auto now = kgettimeofday(); @@ -321,7 +321,7 @@ NetworkOrdered TCPSocket::compute_tcp_checksum(const IPv4Address& source, c if (checksum > 0xffff) checksum = (checksum >> 16) + (checksum & 0xffff); } - ASSERT(packet.data_offset() * 4 == sizeof(TCPPacket)); + VERIFY(packet.data_offset() * 4 == sizeof(TCPPacket)); w = (const NetworkOrdered*)packet.payload(); for (size_t i = 0; i < payload_size / sizeof(u16); ++i) { checksum += w[i]; @@ -391,7 +391,7 @@ KResult TCPSocket::protocol_connect(FileDescription& description, ShouldBlock sh if (Thread::current()->block({}, description, unblock_flags).was_interrupted()) return EINTR; locker.lock(); - ASSERT(setup_state() == SetupState::Completed); + VERIFY(setup_state() == SetupState::Completed); if (has_error()) { // TODO: check unblock_flags m_role = Role::None; return ECONNREFUSED; diff --git a/Kernel/Net/UDPSocket.cpp b/Kernel/Net/UDPSocket.cpp index e40d6692d11..915ed95a845 100644 --- a/Kernel/Net/UDPSocket.cpp +++ b/Kernel/Net/UDPSocket.cpp @@ -58,7 +58,7 @@ SocketHandle UDPSocket::from_port(u16 port) if (it == sockets_by_port().resource().end()) return {}; socket = (*it).value; - ASSERT(socket); + VERIFY(socket); } return { *socket }; } @@ -83,8 +83,8 @@ KResultOr UDPSocket::protocol_receive(ReadonlyBytes raw_ipv4_packet, Use { auto& ipv4_packet = *(const IPv4Packet*)(raw_ipv4_packet.data()); auto& udp_packet = *static_cast(ipv4_packet.payload()); - ASSERT(udp_packet.length() >= sizeof(UDPPacket)); // FIXME: This should be rejected earlier. - ASSERT(buffer_size >= (udp_packet.length() - sizeof(UDPPacket))); + VERIFY(udp_packet.length() >= sizeof(UDPPacket)); // FIXME: This should be rejected earlier. + VERIFY(buffer_size >= (udp_packet.length() - sizeof(UDPPacket))); if (!buffer.write(udp_packet.payload(), udp_packet.length() - sizeof(UDPPacket))) return EFAULT; return udp_packet.length() - sizeof(UDPPacket); diff --git a/Kernel/PCI/Access.cpp b/Kernel/PCI/Access.cpp index 3e95a7593d0..8cdf7587713 100644 --- a/Kernel/PCI/Access.cpp +++ b/Kernel/PCI/Access.cpp @@ -44,7 +44,7 @@ inline u32 read32(Address address, u32 field) { return Access::the().read32_fiel Access& Access::the() { if (s_access == nullptr) { - ASSERT_NOT_REACHED(); // We failed to initialize the PCI subsystem, so stop here! + VERIFY_NOT_REACHED(); // We failed to initialize the PCI subsystem, so stop here! } return *s_access; } @@ -69,7 +69,7 @@ PhysicalID Access::get_physical_id(Address address) const return physical_id; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } u8 Access::early_read8_field(Address address, u32 field) @@ -110,7 +110,7 @@ void Access::enumerate_functions(int type, u8 bus, u8 device, u8 function, Funct #if PCI_DEBUG klog() << "PCI: Found secondary bus: " << secondary_bus; #endif - ASSERT(secondary_bus != bus); + VERIFY(secondary_bus != bus); enumerate_bus(type, secondary_bus, callback, recursive); } } @@ -188,7 +188,7 @@ Vector get_capabilities(Address address) void raw_access(Address address, u32 field, size_t access_size, u32 value) { - ASSERT(access_size != 0); + VERIFY(access_size != 0); if (access_size == 1) { write8(address, field, value); return; @@ -201,7 +201,7 @@ void raw_access(Address address, u32 field, size_t access_size, u32 value) write32(address, field, value); return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } ID get_id(Address address) @@ -303,7 +303,7 @@ void disable_bus_mastering(Address address) size_t get_BAR_space_size(Address address, u8 bar_number) { // See PCI Spec 2.3, Page 222 - ASSERT(bar_number < 6); + VERIFY(bar_number < 6); u8 field = (PCI_BAR0 + (bar_number << 2)); u32 bar_reserved = read32(address, field); write32(address, field, 0xFFFFFFFF); diff --git a/Kernel/PCI/MMIOAccess.cpp b/Kernel/PCI/MMIOAccess.cpp index 9720efc73ab..9580a080c63 100644 --- a/Kernel/PCI/MMIOAccess.cpp +++ b/Kernel/PCI/MMIOAccess.cpp @@ -68,14 +68,14 @@ uint32_t MMIOAccess::segment_count() const uint8_t MMIOAccess::segment_start_bus(u32 seg) const { auto segment = m_segments.get(seg); - ASSERT(segment.has_value()); + VERIFY(segment.has_value()); return segment.value().get_start_bus(); } uint8_t MMIOAccess::segment_end_bus(u32 seg) const { auto segment = m_segments.get(seg); - ASSERT(segment.has_value()); + VERIFY(segment.has_value()); return segment.value().get_end_bus(); } @@ -153,7 +153,7 @@ UNMAP_AFTER_INIT Optional MMIOAccess::get_device_configuration_s u8 MMIOAccess::read8_field(Address address, u32 field) { InterruptDisabler disabler; - ASSERT(field <= 0xfff); + VERIFY(field <= 0xfff); dbgln_if(PCI_DEBUG, "PCI: MMIO Reading 8-bit field {:#08x} for {}", field, address); return *((u8*)(get_device_configuration_space(address).value().get() + (field & 0xfff))); } @@ -161,7 +161,7 @@ u8 MMIOAccess::read8_field(Address address, u32 field) u16 MMIOAccess::read16_field(Address address, u32 field) { InterruptDisabler disabler; - ASSERT(field < 0xfff); + VERIFY(field < 0xfff); dbgln_if(PCI_DEBUG, "PCI: MMIO Reading 16-bit field {:#08x} for {}", field, address); return *((u16*)(get_device_configuration_space(address).value().get() + (field & 0xfff))); } @@ -169,7 +169,7 @@ u16 MMIOAccess::read16_field(Address address, u32 field) u32 MMIOAccess::read32_field(Address address, u32 field) { InterruptDisabler disabler; - ASSERT(field <= 0xffc); + VERIFY(field <= 0xffc); dbgln_if(PCI_DEBUG, "PCI: MMIO Reading 32-bit field {:#08x} for {}", field, address); return *((u32*)(get_device_configuration_space(address).value().get() + (field & 0xfff))); } @@ -177,21 +177,21 @@ u32 MMIOAccess::read32_field(Address address, u32 field) void MMIOAccess::write8_field(Address address, u32 field, u8 value) { InterruptDisabler disabler; - ASSERT(field <= 0xfff); + VERIFY(field <= 0xfff); dbgln_if(PCI_DEBUG, "PCI: MMIO Writing 8-bit field {:#08x}, value={:#02x} for {}", field, value, address); *((u8*)(get_device_configuration_space(address).value().get() + (field & 0xfff))) = value; } void MMIOAccess::write16_field(Address address, u32 field, u16 value) { InterruptDisabler disabler; - ASSERT(field < 0xfff); + VERIFY(field < 0xfff); dbgln_if(PCI_DEBUG, "PCI: MMIO Writing 16-bit field {:#08x}, value={:#02x} for {}", field, value, address); *((u16*)(get_device_configuration_space(address).value().get() + (field & 0xfff))) = value; } void MMIOAccess::write32_field(Address address, u32 field, u32 value) { InterruptDisabler disabler; - ASSERT(field <= 0xffc); + VERIFY(field <= 0xffc); dbgln_if(PCI_DEBUG, "PCI: MMIO Writing 32-bit field {:#08x}, value={:#02x} for {}", field, value, address); *((u32*)(get_device_configuration_space(address).value().get() + (field & 0xfff))) = value; } diff --git a/Kernel/PerformanceEventBuffer.cpp b/Kernel/PerformanceEventBuffer.cpp index c0e6d2e06c1..1f58bfc28de 100644 --- a/Kernel/PerformanceEventBuffer.cpp +++ b/Kernel/PerformanceEventBuffer.cpp @@ -104,7 +104,7 @@ KResult PerformanceEventBuffer::append_with_eip_and_ebp(u32 eip, u32 ebp, int ty PerformanceEvent& PerformanceEventBuffer::at(size_t index) { - ASSERT(index < capacity()); + VERIFY(index < capacity()); auto* events = reinterpret_cast(m_buffer->data()); return events[index]; } @@ -120,7 +120,7 @@ OwnPtr PerformanceEventBuffer::to_json(ProcessID pid, const String& exe bool PerformanceEventBuffer::to_json(KBufferBuilder& builder, ProcessID pid, const String& executable_path) const { auto process = Process::from_pid(pid); - ASSERT(process); + VERIFY(process); ScopedSpinLock locker(process->space().get_lock()); JsonObjectSerializer object(builder); diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index fedadb50997..d518106c378 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -238,7 +238,7 @@ Process::Process(RefPtr& first_thread, const String& name, uid_t uid, gi } else { // NOTE: This non-forked code path is only taken when the kernel creates a process "manually" (at boot.) auto thread_or_error = Thread::try_create(*this); - ASSERT(!thread_or_error.is_error()); + VERIFY(!thread_or_error.is_error()); first_thread = thread_or_error.release_value(); first_thread->detach(); } @@ -246,8 +246,8 @@ Process::Process(RefPtr& first_thread, const String& name, uid_t uid, gi Process::~Process() { - ASSERT(thread_count() == 0); // all threads should have been finalized - ASSERT(!m_alarm_timer); + VERIFY(thread_count() == 0); // all threads should have been finalized + VERIFY(!m_alarm_timer); { ScopedSpinLock processses_lock(g_processes_lock); @@ -304,9 +304,9 @@ void create_signal_trampoline() void Process::crash(int signal, u32 eip, bool out_of_memory) { - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(!is_dead()); - ASSERT(Process::current() == this); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(!is_dead()); + VERIFY(Process::current() == this); if (out_of_memory) { dbgln("\033[31;1mOut of memory\033[m, killing: {}", *this); @@ -322,12 +322,12 @@ void Process::crash(int signal, u32 eip, bool out_of_memory) m_termination_signal = signal; set_dump_core(!out_of_memory); space().dump_regions(); - ASSERT(is_user_process()); + VERIFY(is_user_process()); die(); // We can not return from here, as there is nowhere // to unwind to, so die right away. Thread::current()->die_if_needed(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } RefPtr Process::from_pid(ProcessID pid) @@ -431,8 +431,8 @@ KResultOr Process::get_syscall_path_argument(const Syscall::StringArgume bool Process::dump_core() { - ASSERT(is_dumpable()); - ASSERT(should_core_dump()); + VERIFY(is_dumpable()); + VERIFY(should_core_dump()); dbgln("Generating coredump for pid: {}", m_pid.value()); auto coredump_path = String::formatted("/tmp/coredump/{}_{}_{}", name(), m_pid.value(), RTC::now()); auto coredump = CoreDump::create(*this, coredump_path); @@ -443,8 +443,8 @@ bool Process::dump_core() bool Process::dump_perfcore() { - ASSERT(is_dumpable()); - ASSERT(m_perf_event_buffer); + VERIFY(is_dumpable()); + VERIFY(m_perf_event_buffer); dbgln("Generating perfcore for pid: {}", m_pid.value()); auto description_or_error = VFS::the().open(String::formatted("perfcore.{}", m_pid.value()), O_CREAT | O_EXCL, 0400, current_directory(), UidAndGid { m_uid, m_gid }); if (description_or_error.is_error()) @@ -460,7 +460,7 @@ bool Process::dump_perfcore() void Process::finalize() { - ASSERT(Thread::current() == g_finalizer); + VERIFY(Thread::current() == g_finalizer); dbgln_if(PROCESS_DEBUG, "Finalizing process {}", *this); @@ -508,7 +508,7 @@ void Process::finalize() m_space->remove_all_regions({}); - ASSERT(ref_count() > 0); + VERIFY(ref_count() > 0); // WaitBlockCondition::finalize will be in charge of dropping the last // reference if there are still waiters around, or whenever the last // waitable states are consumed. Unless there is no parent around @@ -545,9 +545,9 @@ void Process::die() void Process::terminate_due_to_signal(u8 signal) { - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(signal < 32); - ASSERT(Process::current() == this); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(signal < 32); + VERIFY(Process::current() == this); dbgln("Terminating {} due to signal {}", *this, signal); m_termination_status = 0; m_termination_signal = signal; @@ -576,7 +576,7 @@ KResult Process::send_signal(u8 signal, Process* sender) RefPtr Process::create_kernel_thread(void (*entry)(void*), void* entry_data, u32 priority, const String& name, u32 affinity, bool joinable) { - ASSERT((priority >= THREAD_PRIORITY_MIN) && (priority <= THREAD_PRIORITY_MAX)); + VERIFY((priority >= THREAD_PRIORITY_MIN) && (priority <= THREAD_PRIORITY_MAX)); // FIXME: Do something with guard pages? @@ -648,7 +648,7 @@ void Process::stop_tracing() void Process::tracer_trap(Thread& thread, const RegisterState& regs) { - ASSERT(m_tracer.ptr()); + VERIFY(m_tracer.ptr()); m_tracer->set_regs(regs); thread.send_urgent_signal_to_self(SIGTRAP); } @@ -663,7 +663,7 @@ PerformanceEventBuffer& Process::ensure_perf_events() bool Process::remove_thread(Thread& thread) { auto thread_cnt_before = m_thread_count.fetch_sub(1, AK::MemoryOrder::memory_order_acq_rel); - ASSERT(thread_cnt_before != 0); + VERIFY(thread_cnt_before != 0); ScopedSpinLock thread_list_lock(m_thread_list_lock); m_thread_list.remove(thread); return thread_cnt_before == 1; diff --git a/Kernel/Process.h b/Kernel/Process.h index f9ee565867a..e4ba7c7b772 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -614,7 +614,7 @@ extern RecursiveSpinLock g_processes_lock; template inline void Process::for_each(Callback callback) { - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); ScopedSpinLock lock(g_processes_lock); for (auto* process = g_processes->head(); process;) { auto* next_process = process->next(); @@ -627,7 +627,7 @@ inline void Process::for_each(Callback callback) template inline void Process::for_each_child(Callback callback) { - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); ProcessID my_pid = pid(); ScopedSpinLock lock(g_processes_lock); for (auto* process = g_processes->head(); process;) { @@ -655,7 +655,7 @@ inline IterationDecision Process::for_each_thread(Callback callback) const template inline void Process::for_each_in_pgrp(ProcessGroupID pgid, Callback callback) { - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); ScopedSpinLock lock(g_processes_lock); for (auto* process = g_processes->head(); process;) { auto* next_process = process->next(); @@ -698,7 +698,7 @@ inline const LogStream& operator<<(const LogStream& stream, const Process& proce dbgln("Has made a promise"); \ cli(); \ Process::current()->crash(SIGABRT, 0); \ - ASSERT_NOT_REACHED(); \ + VERIFY_NOT_REACHED(); \ } \ } while (0) @@ -711,7 +711,7 @@ inline const LogStream& operator<<(const LogStream& stream, const Process& proce Process::current()->coredump_metadata().set( \ "pledge_violation", #promise); \ Process::current()->crash(SIGABRT, 0); \ - ASSERT_NOT_REACHED(); \ + VERIFY_NOT_REACHED(); \ } \ } while (0) diff --git a/Kernel/Random.cpp b/Kernel/Random.cpp index 08127d7f827..41e053dbb3c 100644 --- a/Kernel/Random.cpp +++ b/Kernel/Random.cpp @@ -97,7 +97,7 @@ void KernelRng::wait_for_entropy() void KernelRng::wake_if_ready() { - ASSERT(get_lock().is_locked()); + VERIFY(get_lock().is_locked()); if (resource().is_ready()) { m_seed_queue.wake_all(); } @@ -167,7 +167,7 @@ bool get_good_random_bytes(u8* buffer, size_t buffer_size, bool allow_wait, bool // NOTE: The only case where this function should ever return false and // not actually return random data is if fallback_to_fast == false and // allow_wait == false and interrupts are enabled! - ASSERT(result || !fallback_to_fast); + VERIFY(result || !fallback_to_fast); return result; } @@ -176,7 +176,7 @@ void get_fast_random_bytes(u8* buffer, size_t buffer_size) // Try to get good randomness, but don't block if we can't right now // and allow falling back to fast randomness auto result = get_good_random_bytes(buffer, buffer_size, false, true); - ASSERT(result); + VERIFY(result); } } diff --git a/Kernel/Random.h b/Kernel/Random.h index a51125a2558..faa0f96801e 100644 --- a/Kernel/Random.h +++ b/Kernel/Random.h @@ -64,10 +64,10 @@ public: this->reseed(); } - ASSERT(is_seeded()); + VERIFY(is_seeded()); // FIXME: More than 2^20 bytes cannot be generated without refreshing the key. - ASSERT(n < (1 << 20)); + VERIFY(n < (1 << 20)); typename CipherType::CTRMode cipher(m_key, KeySize, Crypto::Cipher::Intent::Encryption); @@ -98,7 +98,7 @@ public: [[nodiscard]] bool is_ready() const { - ASSERT(m_lock.is_locked()); + VERIFY(m_lock.is_locked()); return is_seeded() || m_p0_len >= reseed_threshold; } diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 0127f2844a5..0bf6e0b6e05 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -81,11 +81,11 @@ static inline u32 thread_priority_to_priority_index(u32 thread_priority) { // Converts the priority in the range of THREAD_PRIORITY_MIN...THREAD_PRIORITY_MAX // to a index into g_ready_queues where 0 is the highest priority bucket - ASSERT(thread_priority >= THREAD_PRIORITY_MIN && thread_priority <= THREAD_PRIORITY_MAX); + VERIFY(thread_priority >= THREAD_PRIORITY_MIN && thread_priority <= THREAD_PRIORITY_MAX); constexpr u32 thread_priority_count = THREAD_PRIORITY_MAX - THREAD_PRIORITY_MIN + 1; static_assert(thread_priority_count > 0); auto priority_bucket = ((thread_priority_count - (thread_priority - THREAD_PRIORITY_MIN)) / thread_priority_count) * (g_ready_queue_buckets - 1); - ASSERT(priority_bucket < g_ready_queue_buckets); + VERIFY(priority_bucket < g_ready_queue_buckets); return priority_bucket; } @@ -97,10 +97,10 @@ Thread& Scheduler::pull_next_runnable_thread() auto priority_mask = g_ready_queues_mask; while (priority_mask != 0) { auto priority = __builtin_ffsl(priority_mask); - ASSERT(priority > 0); + VERIFY(priority > 0); auto& ready_queue = g_ready_queues[--priority]; for (auto& thread : ready_queue.thread_list) { - ASSERT(thread.m_runnable_priority == (int)priority); + VERIFY(thread.m_runnable_priority == (int)priority); if (thread.is_active()) continue; if (!(thread.affinity() & affinity_mask)) @@ -134,14 +134,14 @@ bool Scheduler::dequeue_runnable_thread(Thread& thread, bool check_affinity) ScopedSpinLock lock(g_ready_queues_lock); auto priority = thread.m_runnable_priority; if (priority < 0) { - ASSERT(!thread.m_ready_queue_node.is_in_list()); + VERIFY(!thread.m_ready_queue_node.is_in_list()); return false; } if (check_affinity && !(thread.affinity() & (1 << Processor::current().id()))) return false; - ASSERT(g_ready_queues_mask & (1u << priority)); + VERIFY(g_ready_queues_mask & (1u << priority)); auto& ready_queue = g_ready_queues[priority]; thread.m_runnable_priority = -1; ready_queue.thread_list.remove(thread); @@ -152,15 +152,15 @@ bool Scheduler::dequeue_runnable_thread(Thread& thread, bool check_affinity) void Scheduler::queue_runnable_thread(Thread& thread) { - ASSERT(g_scheduler_lock.own_lock()); + VERIFY(g_scheduler_lock.own_lock()); if (&thread == Processor::current().idle_thread()) return; auto priority = thread_priority_to_priority_index(thread.priority()); ScopedSpinLock lock(g_ready_queues_lock); - ASSERT(thread.m_runnable_priority < 0); + VERIFY(thread.m_runnable_priority < 0); thread.m_runnable_priority = (int)priority; - ASSERT(!thread.m_ready_queue_node.is_in_list()); + VERIFY(!thread.m_ready_queue_node.is_in_list()); auto& ready_queue = g_ready_queues[priority]; bool was_empty = ready_queue.thread_list.is_empty(); ready_queue.thread_list.append(thread); @@ -170,7 +170,7 @@ void Scheduler::queue_runnable_thread(Thread& thread) UNMAP_AFTER_INIT void Scheduler::start() { - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); // We need to acquire our scheduler lock, which will be released // by the idle thread once control transferred there @@ -178,23 +178,23 @@ UNMAP_AFTER_INIT void Scheduler::start() auto& processor = Processor::current(); processor.set_scheduler_data(*new SchedulerPerProcessorData()); - ASSERT(processor.is_initialized()); + VERIFY(processor.is_initialized()); auto& idle_thread = *processor.idle_thread(); - ASSERT(processor.current_thread() == &idle_thread); - ASSERT(processor.idle_thread() == &idle_thread); + VERIFY(processor.current_thread() == &idle_thread); + VERIFY(processor.idle_thread() == &idle_thread); idle_thread.set_ticks_left(time_slice_for(idle_thread)); idle_thread.did_schedule(); idle_thread.set_initialized(true); processor.init_context(idle_thread, false); idle_thread.set_state(Thread::Running); - ASSERT(idle_thread.affinity() == (1u << processor.get_id())); + VERIFY(idle_thread.affinity() == (1u << processor.get_id())); processor.initialize_context_switching(idle_thread); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool Scheduler::pick_next() { - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); auto current_thread = Thread::current(); @@ -209,7 +209,7 @@ bool Scheduler::pick_next() // We may be on a different processor after we got switched // back to this thread! auto& scheduler_data = Processor::current().get_scheduler_data(); - ASSERT(scheduler_data.m_in_scheduler); + VERIFY(scheduler_data.m_in_scheduler); scheduler_data.m_in_scheduler = false; }); @@ -305,7 +305,7 @@ bool Scheduler::yield() auto current_thread = Thread::current(); dbgln_if(SCHEDULER_DEBUG, "Scheduler[{}]: yielding thread {} in_irq={}", proc.get_id(), *current_thread, proc.in_irq()); - ASSERT(current_thread != nullptr); + VERIFY(current_thread != nullptr); if (proc.in_irq() || proc.in_critical()) { // If we're handling an IRQ we can't switch context, or we're in // a critical section where we don't want to switch contexts, then @@ -324,10 +324,10 @@ bool Scheduler::yield() bool Scheduler::donate_to_and_switch(Thread* beneficiary, [[maybe_unused]] const char* reason) { - ASSERT(g_scheduler_lock.own_lock()); + VERIFY(g_scheduler_lock.own_lock()); auto& proc = Processor::current(); - ASSERT(proc.in_critical() == 1); + VERIFY(proc.in_critical() == 1); unsigned ticks_left = Thread::current()->ticks_left(); if (!beneficiary || beneficiary->state() != Thread::Runnable || ticks_left <= 1) @@ -342,7 +342,7 @@ bool Scheduler::donate_to_and_switch(Thread* beneficiary, [[maybe_unused]] const bool Scheduler::donate_to(RefPtr& beneficiary, const char* reason) { - ASSERT(beneficiary); + VERIFY(beneficiary); if (beneficiary == Thread::current()) return Scheduler::yield(); @@ -359,11 +359,11 @@ bool Scheduler::donate_to(RefPtr& beneficiary, const char* reason) // We may be on a different processor after we got switched // back to this thread! auto& scheduler_data = Processor::current().get_scheduler_data(); - ASSERT(scheduler_data.m_in_scheduler); + VERIFY(scheduler_data.m_in_scheduler); scheduler_data.m_in_scheduler = false; }); - ASSERT(!proc.in_irq()); + VERIFY(!proc.in_irq()); if (proc.in_critical() > 1) { scheduler_data.m_pending_beneficiary = beneficiary; // Save the beneficiary @@ -413,7 +413,7 @@ bool Scheduler::context_switch(Thread* thread) // NOTE: from_thread at this point reflects the thread we were // switched from, and thread reflects Thread::current() enter_current(*from_thread, false); - ASSERT(thread == Thread::current()); + VERIFY(thread == Thread::current()); #if ARCH(I386) if (thread->process().is_user_process()) { @@ -429,7 +429,7 @@ bool Scheduler::context_switch(Thread* thread) void Scheduler::enter_current(Thread& prev_thread, bool is_first) { - ASSERT(g_scheduler_lock.own_lock()); + VERIFY(g_scheduler_lock.own_lock()); prev_thread.set_active(false); if (prev_thread.state() == Thread::Dying) { // If the thread we switched from is marked as dying, then notify @@ -457,7 +457,7 @@ void Scheduler::leave_on_first_switch(u32 flags) // clean up and release locks manually here g_scheduler_lock.unlock(flags); auto& scheduler_data = Processor::current().get_scheduler_data(); - ASSERT(scheduler_data.m_in_scheduler); + VERIFY(scheduler_data.m_in_scheduler); scheduler_data.m_in_scheduler = false; } @@ -465,9 +465,9 @@ void Scheduler::prepare_after_exec() { // This is called after exec() when doing a context "switch" into // the new process. This is called from Processor::assume_context - ASSERT(g_scheduler_lock.own_lock()); + VERIFY(g_scheduler_lock.own_lock()); auto& scheduler_data = Processor::current().get_scheduler_data(); - ASSERT(!scheduler_data.m_in_scheduler); + VERIFY(!scheduler_data.m_in_scheduler); scheduler_data.m_in_scheduler = true; } @@ -475,22 +475,22 @@ void Scheduler::prepare_for_idle_loop() { // This is called when the CPU finished setting up the idle loop // and is about to run it. We need to acquire he scheduler lock - ASSERT(!g_scheduler_lock.own_lock()); + VERIFY(!g_scheduler_lock.own_lock()); g_scheduler_lock.lock(); auto& scheduler_data = Processor::current().get_scheduler_data(); - ASSERT(!scheduler_data.m_in_scheduler); + VERIFY(!scheduler_data.m_in_scheduler); scheduler_data.m_in_scheduler = true; } Process* Scheduler::colonel() { - ASSERT(s_colonel_process); + VERIFY(s_colonel_process); return s_colonel_process; } UNMAP_AFTER_INIT void Scheduler::initialize() { - ASSERT(&Processor::current() != nullptr); // sanity check + VERIFY(&Processor::current() != nullptr); // sanity check RefPtr idle_thread; g_finalizer_wait_queue = new WaitQueue; @@ -498,8 +498,8 @@ UNMAP_AFTER_INIT void Scheduler::initialize() g_finalizer_has_work.store(false, AK::MemoryOrder::memory_order_release); s_colonel_process = Process::create_kernel_process(idle_thread, "colonel", idle_loop, nullptr, 1).leak_ref(); - ASSERT(s_colonel_process); - ASSERT(idle_thread); + VERIFY(s_colonel_process); + VERIFY(idle_thread); idle_thread->set_priority(THREAD_PRIORITY_MIN); idle_thread->set_name(StringView("idle thread #0")); @@ -514,28 +514,28 @@ UNMAP_AFTER_INIT void Scheduler::set_idle_thread(Thread* idle_thread) UNMAP_AFTER_INIT Thread* Scheduler::create_ap_idle_thread(u32 cpu) { - ASSERT(cpu != 0); + VERIFY(cpu != 0); // This function is called on the bsp, but creates an idle thread for another AP - ASSERT(Processor::id() == 0); + VERIFY(Processor::id() == 0); - ASSERT(s_colonel_process); + VERIFY(s_colonel_process); Thread* idle_thread = s_colonel_process->create_kernel_thread(idle_loop, nullptr, THREAD_PRIORITY_MIN, String::format("idle thread #%u", cpu), 1 << cpu, false); - ASSERT(idle_thread); + VERIFY(idle_thread); return idle_thread; } void Scheduler::timer_tick(const RegisterState& regs) { - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(Processor::current().in_irq()); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(Processor::current().in_irq()); auto current_thread = Processor::current_thread(); if (!current_thread) return; // Sanity checks - ASSERT(current_thread->current_trap()); - ASSERT(current_thread->current_trap()->regs == ®s); + VERIFY(current_thread->current_trap()); + VERIFY(current_thread->current_trap()->regs == ®s); #if !SCHEDULE_ON_ALL_PROCESSORS bool is_bsp = Processor::id() == 0; @@ -543,7 +543,7 @@ void Scheduler::timer_tick(const RegisterState& regs) return; // TODO: This prevents scheduling on other CPUs! #endif if (current_thread->process().is_profiling()) { - ASSERT(current_thread->process().perf_events()); + VERIFY(current_thread->process().perf_events()); auto& perf_events = *current_thread->process().perf_events(); [[maybe_unused]] auto rc = perf_events.append_with_eip_and_ebp(regs.eip, regs.ebp, PERF_EVENT_SAMPLE, 0, 0); } @@ -551,16 +551,16 @@ void Scheduler::timer_tick(const RegisterState& regs) if (current_thread->tick()) return; - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(Processor::current().in_irq()); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(Processor::current().in_irq()); Processor::current().invoke_scheduler_async(); } void Scheduler::invoke_async() { - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); auto& proc = Processor::current(); - ASSERT(!proc.in_irq()); + VERIFY(!proc.in_irq()); // Since this function is called when leaving critical sections (such // as a SpinLock), we need to check if we're not already doing this @@ -572,8 +572,8 @@ void Scheduler::invoke_async() void Scheduler::yield_from_critical() { auto& proc = Processor::current(); - ASSERT(proc.in_critical()); - ASSERT(!proc.in_irq()); + VERIFY(proc.in_critical()); + VERIFY(!proc.in_irq()); yield(); // Flag a context switch @@ -594,14 +594,14 @@ void Scheduler::idle_loop(void*) { auto& proc = Processor::current(); dbgln("Scheduler[{}]: idle loop running", proc.get_id()); - ASSERT(are_interrupts_enabled()); + VERIFY(are_interrupts_enabled()); for (;;) { proc.idle_begin(); asm("hlt"); proc.idle_end(); - ASSERT_INTERRUPTS_ENABLED(); + VERIFY_INTERRUPTS_ENABLED(); #if SCHEDULE_ON_ALL_PROCESSORS yield(); #else diff --git a/Kernel/SpinLock.h b/Kernel/SpinLock.h index 42da93492cc..c0b7290c2bb 100644 --- a/Kernel/SpinLock.h +++ b/Kernel/SpinLock.h @@ -53,7 +53,7 @@ public: ALWAYS_INLINE void unlock(u32 prev_flags) { - ASSERT(is_locked()); + VERIFY(is_locked()); m_lock.store(0, AK::memory_order_release); Processor::current().leave_critical(prev_flags); } @@ -98,8 +98,8 @@ public: ALWAYS_INLINE void unlock(u32 prev_flags) { - ASSERT(m_recursions > 0); - ASSERT(m_lock.load(AK::memory_order_relaxed) == FlatPtr(&Processor::current())); + VERIFY(m_recursions > 0); + VERIFY(m_lock.load(AK::memory_order_relaxed) == FlatPtr(&Processor::current())); if (--m_recursions == 0) m_lock.store(0, AK::memory_order_release); Processor::current().leave_critical(prev_flags); @@ -137,7 +137,7 @@ public: ScopedSpinLock(LockType& lock) : m_lock(&lock) { - ASSERT(m_lock); + VERIFY(m_lock); m_prev_flags = m_lock->lock(); m_have_lock = true; } @@ -161,16 +161,16 @@ public: ALWAYS_INLINE void lock() { - ASSERT(m_lock); - ASSERT(!m_have_lock); + VERIFY(m_lock); + VERIFY(!m_have_lock); m_prev_flags = m_lock->lock(); m_have_lock = true; } ALWAYS_INLINE void unlock() { - ASSERT(m_lock); - ASSERT(m_have_lock); + VERIFY(m_lock); + VERIFY(m_have_lock); m_lock->unlock(m_prev_flags); m_prev_flags = 0; m_have_lock = false; diff --git a/Kernel/StdLib.cpp b/Kernel/StdLib.cpp index 34e8375bb93..2b6df4871e4 100644 --- a/Kernel/StdLib.cpp +++ b/Kernel/StdLib.cpp @@ -110,7 +110,7 @@ Optional user_atomic_compare_exchange_relaxed(volatile u32* var, u32& expe { if (FlatPtr(var) & 3) return {}; // not aligned! - ASSERT(!Kernel::is_user_range(VirtualAddress(&expected), sizeof(expected))); + VERIFY(!Kernel::is_user_range(VirtualAddress(&expected), sizeof(expected))); bool is_user = Kernel::is_user_range(VirtualAddress(FlatPtr(var)), sizeof(*var)); if (!is_user) return {}; @@ -169,11 +169,11 @@ bool copy_to_user(void* dest_ptr, const void* src_ptr, size_t n) bool is_user = Kernel::is_user_range(VirtualAddress(dest_ptr), n); if (!is_user) return false; - ASSERT(!Kernel::is_user_range(VirtualAddress(src_ptr), n)); + VERIFY(!Kernel::is_user_range(VirtualAddress(src_ptr), n)); Kernel::SmapDisabler disabler; void* fault_at; if (!Kernel::safe_memcpy(dest_ptr, src_ptr, n, fault_at)) { - ASSERT(VirtualAddress(fault_at) >= VirtualAddress(dest_ptr) && VirtualAddress(fault_at) <= VirtualAddress((FlatPtr)dest_ptr + n)); + VERIFY(VirtualAddress(fault_at) >= VirtualAddress(dest_ptr) && VirtualAddress(fault_at) <= VirtualAddress((FlatPtr)dest_ptr + n)); klog() << "copy_to_user(" << dest_ptr << ", " << src_ptr << ", " << n << ") failed at " << VirtualAddress(fault_at); return false; } @@ -185,11 +185,11 @@ bool copy_from_user(void* dest_ptr, const void* src_ptr, size_t n) bool is_user = Kernel::is_user_range(VirtualAddress(src_ptr), n); if (!is_user) return false; - ASSERT(!Kernel::is_user_range(VirtualAddress(dest_ptr), n)); + VERIFY(!Kernel::is_user_range(VirtualAddress(dest_ptr), n)); Kernel::SmapDisabler disabler; void* fault_at; if (!Kernel::safe_memcpy(dest_ptr, src_ptr, n, fault_at)) { - ASSERT(VirtualAddress(fault_at) >= VirtualAddress(src_ptr) && VirtualAddress(fault_at) <= VirtualAddress((FlatPtr)src_ptr + n)); + VERIFY(VirtualAddress(fault_at) >= VirtualAddress(src_ptr) && VirtualAddress(fault_at) <= VirtualAddress((FlatPtr)src_ptr + n)); klog() << "copy_from_user(" << dest_ptr << ", " << src_ptr << ", " << n << ") failed at " << VirtualAddress(fault_at); return false; } @@ -361,22 +361,22 @@ extern "C" int __cxa_atexit(void (*)(void*), void*, void*); [[noreturn]] void __stack_chk_fail() { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } [[noreturn]] void __stack_chk_fail_local() { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } extern "C" int __cxa_atexit(void (*)(void*), void*, void*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return 0; } [[noreturn]] void __cxa_pure_virtual() { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Kernel/Storage/IDEChannel.cpp b/Kernel/Storage/IDEChannel.cpp index 2a9de03376c..103153a639e 100644 --- a/Kernel/Storage/IDEChannel.cpp +++ b/Kernel/Storage/IDEChannel.cpp @@ -184,8 +184,8 @@ void IDEChannel::start_request(AsyncBlockDeviceRequest& request, bool use_dma, b void IDEChannel::complete_current_request(AsyncDeviceRequest::RequestResult result) { // NOTE: this may be called from the interrupt handler! - ASSERT(m_current_request); - ASSERT(m_request_lock.is_locked()); + VERIFY(m_current_request); + VERIFY(m_request_lock.is_locked()); // Now schedule reading back the buffer as soon as we leave the irq handler. // This is important so that we can safely write the buffer back, @@ -193,7 +193,7 @@ void IDEChannel::complete_current_request(AsyncDeviceRequest::RequestResult resu // before Processor::deferred_call_queue returns! Processor::deferred_call_queue([this, result]() { dbgln_if(PATA_DEBUG, "IDEChannel::complete_current_request result: {}", (int)result); - ASSERT(m_current_request); + VERIFY(m_current_request); auto& request = *m_current_request; m_current_request = nullptr; @@ -334,7 +334,7 @@ void IDEChannel::handle_irq(const RegisterState&) dbgln_if(PATA_DEBUG, "IDEChannel: Wrote block {}/{}", m_current_request_block_index, m_current_request->block_count()); if (++m_current_request_block_index >= m_current_request->block_count()) { // We read the last block, flush cache - ASSERT(!m_current_request_flushing_cache); + VERIFY(!m_current_request_flushing_cache); m_current_request_flushing_cache = true; m_io_group.io_base().offset(ATA_REG_COMMAND).out(ATA_CMD_CACHE_FLUSH); } else { @@ -465,7 +465,7 @@ void IDEChannel::ata_access(Direction direction, bool slave_request, u32 lba, u8 u16 cylinder = 0; if (lba >= 0x10000000) { - ASSERT(capabilities & ATA_CAP_LBA); + VERIFY(capabilities & ATA_CAP_LBA); lba_mode = LBAMode::FortyEightBit; head = 0; } else if (capabilities & ATA_CAP_LBA) { @@ -532,7 +532,7 @@ void IDEChannel::ata_read_sectors_with_dma(bool slave_request, u16 capabilities) prdt().offset = m_dma_buffer_page->paddr(); prdt().size = 512 * request.block_count(); - ASSERT(prdt().size <= PAGE_SIZE); + VERIFY(prdt().size <= PAGE_SIZE); // Stop bus master m_io_group.bus_master_base().out(0); @@ -574,7 +574,7 @@ bool IDEChannel::ata_do_read_sector() void IDEChannel::ata_read_sectors(bool slave_request, u16 capabilities) { auto& request = *m_current_request; - ASSERT(request.block_count() <= 256); + VERIFY(request.block_count() <= 256); dbgln_if(PATA_DEBUG, "IDEChannel::ata_read_sectors"); auto lba = request.block_index(); @@ -597,7 +597,7 @@ void IDEChannel::ata_write_sectors_with_dma(bool slave_request, u16 capabilities return; } - ASSERT(prdt().size <= PAGE_SIZE); + VERIFY(prdt().size <= PAGE_SIZE); // Stop bus master m_io_group.bus_master_base().out(0); @@ -623,7 +623,7 @@ void IDEChannel::ata_do_write_sector() ; u8 status = m_io_group.control_base().in(); - ASSERT(status & ATA_SR_DRQ); + VERIFY(status & ATA_SR_DRQ); auto in_buffer = request.buffer().offset(m_current_request_block_index * 512); dbgln_if(PATA_DEBUG, "IDEChannel: Writing 512 bytes (part {}) (status={:#02x})...", m_current_request_block_index, status); @@ -641,7 +641,7 @@ void IDEChannel::ata_write_sectors(bool slave_request, u16 capabilities) { auto& request = *m_current_request; - ASSERT(request.block_count() <= 256); + VERIFY(request.block_count() <= 256); u32 start_sector = request.block_index(); u32 count = request.block_count(); dbgln_if(PATA_DEBUG, "IDEChannel: Writing {} sector(s) @ LBA {}", count, start_sector); diff --git a/Kernel/Storage/IDEController.cpp b/Kernel/Storage/IDEController.cpp index 5015d384a07..ff46722c5ad 100644 --- a/Kernel/Storage/IDEController.cpp +++ b/Kernel/Storage/IDEController.cpp @@ -59,12 +59,12 @@ size_t IDEController::devices_count() const void IDEController::start_request(const StorageDevice&, AsyncBlockDeviceRequest&) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void IDEController::complete_current_request(AsyncDeviceRequest::RequestResult) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } UNMAP_AFTER_INIT IDEController::IDEController(PCI::Address address, bool force_pio) @@ -108,7 +108,7 @@ RefPtr IDEController::device_by_channel_and_position(u32 index) c case 3: return m_channels[1].slave_device(); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } RefPtr IDEController::device(u32 index) const diff --git a/Kernel/Storage/Partition/DiskPartitionMetadata.cpp b/Kernel/Storage/Partition/DiskPartitionMetadata.cpp index aa2dbd6fb0b..1da3d59ae13 100644 --- a/Kernel/Storage/Partition/DiskPartitionMetadata.cpp +++ b/Kernel/Storage/Partition/DiskPartitionMetadata.cpp @@ -40,12 +40,12 @@ DiskPartitionMetadata::PartitionType::PartitionType(Array partition_type } UUID DiskPartitionMetadata::PartitionType::to_uuid() const { - ASSERT(is_uuid()); + VERIFY(is_uuid()); return m_partition_type; } u8 DiskPartitionMetadata::PartitionType::to_byte_indicator() const { - ASSERT(!is_uuid()); + VERIFY(!is_uuid()); return m_partition_type[0]; } bool DiskPartitionMetadata::PartitionType::is_uuid() const @@ -63,7 +63,7 @@ DiskPartitionMetadata::DiskPartitionMetadata(u64 start_block, u64 end_block, u8 , m_type(partition_type) { - ASSERT(m_type.is_valid()); + VERIFY(m_type.is_valid()); } DiskPartitionMetadata::DiskPartitionMetadata(u64 start_block, u64 end_block, Array partition_type) @@ -72,7 +72,7 @@ DiskPartitionMetadata::DiskPartitionMetadata(u64 start_block, u64 end_block, Arr , m_type(partition_type) { - ASSERT(m_type.is_valid()); + VERIFY(m_type.is_valid()); } DiskPartitionMetadata::DiskPartitionMetadata(u64 start_block, u64 end_block, Array partition_type, UUID unique_guid, u64 special_attributes, String name) @@ -83,8 +83,8 @@ DiskPartitionMetadata::DiskPartitionMetadata(u64 start_block, u64 end_block, Arr , m_attributes(special_attributes) , m_name(name) { - ASSERT(m_type.is_valid()); - ASSERT(!m_unique_guid.is_zero()); + VERIFY(m_type.is_valid()); + VERIFY(!m_unique_guid.is_zero()); } DiskPartitionMetadata DiskPartitionMetadata::offset(u64 blocks_count) const diff --git a/Kernel/Storage/Partition/EBRPartitionTable.cpp b/Kernel/Storage/Partition/EBRPartitionTable.cpp index a61e305c8d8..d67f210600e 100644 --- a/Kernel/Storage/Partition/EBRPartitionTable.cpp +++ b/Kernel/Storage/Partition/EBRPartitionTable.cpp @@ -44,11 +44,11 @@ void EBRPartitionTable::search_extended_partition(const StorageDevice& device, M if (limit == 0) return; // EBRs should not carry more than 2 partitions (because they need to form a linked list) - ASSERT(checked_ebr.partitions_count() <= 2); + VERIFY(checked_ebr.partitions_count() <= 2); auto checked_logical_partition = checked_ebr.partition(0); // If we are pointed to an invalid logical partition, something is seriously wrong. - ASSERT(checked_logical_partition.has_value()); + VERIFY(checked_logical_partition.has_value()); m_partitions.append(checked_logical_partition.value().offset(current_block_offset)); if (!checked_ebr.contains_ebr()) return; @@ -66,7 +66,7 @@ EBRPartitionTable::EBRPartitionTable(const StorageDevice& device) return; m_valid = true; - ASSERT(partitions_count() == 0); + VERIFY(partitions_count() == 0); auto& header = this->header(); for (size_t index = 0; index < 4; index++) { diff --git a/Kernel/Storage/Partition/GUIDPartitionTable.cpp b/Kernel/Storage/Partition/GUIDPartitionTable.cpp index 9f7b787aa55..d4e1c2639e9 100644 --- a/Kernel/Storage/Partition/GUIDPartitionTable.cpp +++ b/Kernel/Storage/Partition/GUIDPartitionTable.cpp @@ -79,7 +79,7 @@ GUIDPartitionTable::GUIDPartitionTable(const StorageDevice& device) : MBRPartitionTable(device) { m_cached_header = ByteBuffer::create_zeroed(m_device->block_size()); - ASSERT(partitions_count() == 0); + VERIFY(partitions_count() == 0); if (!initialize()) m_valid = false; } @@ -91,7 +91,7 @@ const GUIDPartitionHeader& GUIDPartitionTable::header() const bool GUIDPartitionTable::initialize() { - ASSERT(m_cached_header.data() != nullptr); + VERIFY(m_cached_header.data() != nullptr); auto first_gpt_block = (m_device->block_size() == 512) ? 1 : 0; diff --git a/Kernel/Storage/RamdiskController.cpp b/Kernel/Storage/RamdiskController.cpp index d0b800c1b27..0ffe1473647 100644 --- a/Kernel/Storage/RamdiskController.cpp +++ b/Kernel/Storage/RamdiskController.cpp @@ -53,12 +53,12 @@ size_t RamdiskController::devices_count() const void RamdiskController::start_request(const StorageDevice&, AsyncBlockDeviceRequest&) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void RamdiskController::complete_current_request(AsyncDeviceRequest::RequestResult) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } RamdiskController::RamdiskController() diff --git a/Kernel/Storage/StorageDevice.cpp b/Kernel/Storage/StorageDevice.cpp index 98b3d084212..2de967e2709 100644 --- a/Kernel/Storage/StorageDevice.cpp +++ b/Kernel/Storage/StorageDevice.cpp @@ -100,7 +100,7 @@ KResultOr StorageDevice::read(FileDescription&, size_t offset, UserOrKer return EIO; case AsyncDeviceRequest::MemoryFault: // This should never happen, we're writing to a kernel buffer! - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); default: break; } @@ -172,7 +172,7 @@ KResultOr StorageDevice::write(FileDescription&, size_t offset, const Us return EIO; case AsyncDeviceRequest::MemoryFault: // This should never happen, we're writing to a kernel buffer! - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); default: break; } @@ -193,7 +193,7 @@ KResultOr StorageDevice::write(FileDescription&, size_t offset, const Us return EIO; case AsyncDeviceRequest::MemoryFault: // This should never happen, we're writing to a kernel buffer! - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); default: break; } diff --git a/Kernel/Storage/StorageManagement.cpp b/Kernel/Storage/StorageManagement.cpp index 2584a6938f9..9211ce97f59 100644 --- a/Kernel/Storage/StorageManagement.cpp +++ b/Kernel/Storage/StorageManagement.cpp @@ -75,7 +75,7 @@ NonnullRefPtrVector StorageManagement::enumerate_controllers( NonnullRefPtrVector StorageManagement::enumerate_storage_devices() const { - ASSERT(!m_controllers.is_empty()); + VERIFY(!m_controllers.is_empty()); NonnullRefPtrVector devices; for (auto& controller : m_controllers) { for (size_t device_index = 0; device_index < controller.devices_count(); device_index++) { @@ -110,7 +110,7 @@ OwnPtr StorageManagement::try_to_initialize_partition_table(cons NonnullRefPtrVector StorageManagement::enumerate_disk_partitions() const { - ASSERT(!m_storage_devices.is_empty()); + VERIFY(!m_storage_devices.is_empty()); NonnullRefPtrVector partitions; size_t device_index = 0; for (auto& device : m_storage_devices) { @@ -133,7 +133,7 @@ NonnullRefPtrVector StorageManagement::enumerate_disk_partitions( void StorageManagement::determine_boot_device() { - ASSERT(!m_controllers.is_empty()); + VERIFY(!m_controllers.is_empty()); if (m_boot_argument.starts_with("/dev/")) { StringView device_name = m_boot_argument.substring_view(5); Device::for_each([&](Device& device) { @@ -153,8 +153,8 @@ void StorageManagement::determine_boot_device() void StorageManagement::determine_boot_device_with_partition_uuid() { - ASSERT(!m_disk_partitions.is_empty()); - ASSERT(m_boot_argument.starts_with("PARTUUID=")); + VERIFY(!m_disk_partitions.is_empty()); + VERIFY(m_boot_argument.starts_with("PARTUUID=")); auto partition_uuid = UUID(m_boot_argument.substring_view(strlen("PARTUUID="))); @@ -197,7 +197,7 @@ bool StorageManagement::initialized() UNMAP_AFTER_INIT void StorageManagement::initialize(String root_device, bool force_pio) { - ASSERT(!StorageManagement::initialized()); + VERIFY(!StorageManagement::initialized()); s_the = new StorageManagement(root_device, force_pio); } diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp index a470bced455..fbf14b1cb97 100644 --- a/Kernel/Syscall.cpp +++ b/Kernel/Syscall.cpp @@ -87,7 +87,7 @@ static Handler s_syscall_table[] = { int handle(RegisterState& regs, u32 function, u32 arg1, u32 arg2, u32 arg3) { - ASSERT_INTERRUPTS_ENABLED(); + VERIFY_INTERRUPTS_ENABLED(); auto current_thread = Thread::current(); auto& process = current_thread->process(); current_thread->did_syscall(); @@ -106,7 +106,7 @@ int handle(RegisterState& regs, u32 function, u32 arg1, u32 arg2, u32 arg3) process.sys$exit((int)arg1); else process.sys$exit_thread(arg1); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return 0; } @@ -138,7 +138,7 @@ void syscall_handler(TrapFrame* trap) { auto& regs = *trap->regs; auto current_thread = Thread::current(); - ASSERT(current_thread->previous_mode() == Thread::PreviousMode::UserMode); + VERIFY(current_thread->previous_mode() == Thread::PreviousMode::UserMode); auto& process = current_thread->process(); if (auto tracer = process.tracer(); tracer && tracer->is_tracing_syscalls()) { @@ -211,12 +211,12 @@ void syscall_handler(TrapFrame* trap) current_thread->check_dispatch_pending_signal(); // If the previous mode somehow changed something is seriously messed up... - ASSERT(current_thread->previous_mode() == Thread::PreviousMode::UserMode); + VERIFY(current_thread->previous_mode() == Thread::PreviousMode::UserMode); // Check if we're supposed to return to userspace or just die. current_thread->die_if_needed(); - ASSERT(!g_scheduler_lock.own_lock()); + VERIFY(!g_scheduler_lock.own_lock()); } } diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp index 82e8ba2748e..41c76a8b85e 100644 --- a/Kernel/Syscalls/execve.cpp +++ b/Kernel/Syscalls/execve.cpp @@ -195,7 +195,7 @@ static KResultOr get_required_load_range(FileDescription& pro return IterationDecision::Continue; }); - ASSERT(range.end > range.start); + VERIFY(range.end > range.start); return range; }; @@ -283,15 +283,15 @@ static KResultOr load_elf_object(NonnullOwnPtr new_space, Fil FlatPtr load_base_address = 0; String elf_name = object_description.absolute_path(); - ASSERT(!Processor::current().in_critical()); + VERIFY(!Processor::current().in_critical()); MemoryManager::enter_space(*new_space); KResult ph_load_result = KSuccess; elf_image.for_each_program_header([&](const ELF::Image::ProgramHeader& program_header) { if (program_header.type() == PT_TLS) { - ASSERT(should_allocate_tls == ShouldAllocateTls::Yes); - ASSERT(program_header.size_in_memory()); + VERIFY(should_allocate_tls == ShouldAllocateTls::Yes); + VERIFY(program_header.size_in_memory()); if (!elf_image.is_within_image(program_header.raw_data(), program_header.size_in_image())) { dbgln("Shenanigans! ELF PT_TLS header sneaks outside of executable."); @@ -325,8 +325,8 @@ static KResultOr load_elf_object(NonnullOwnPtr new_space, Fil if (program_header.is_writable()) { // Writable section: create a copy in memory. - ASSERT(program_header.size_in_memory()); - ASSERT(program_header.alignment() == PAGE_SIZE); + VERIFY(program_header.size_in_memory()); + VERIFY(program_header.alignment() == PAGE_SIZE); if (!elf_image.is_within_image(program_header.raw_data(), program_header.size_in_image())) { dbgln("Shenanigans! Writable ELF PT_LOAD header sneaks outside of executable."); @@ -368,8 +368,8 @@ static KResultOr load_elf_object(NonnullOwnPtr new_space, Fil } // Non-writable section: map the executable itself in memory. - ASSERT(program_header.size_in_memory()); - ASSERT(program_header.alignment() == PAGE_SIZE); + VERIFY(program_header.size_in_memory()); + VERIFY(program_header.alignment() == PAGE_SIZE); int prot = 0; if (program_header.is_readable()) prot |= PROT_READ; @@ -454,17 +454,17 @@ KResultOr Process::load(NonnullRefPtr main_program_ return interpreter_load_result.error(); // TLS allocation will be done in userspace by the loader - ASSERT(!interpreter_load_result.value().tls_region); - ASSERT(!interpreter_load_result.value().tls_alignment); - ASSERT(!interpreter_load_result.value().tls_size); + VERIFY(!interpreter_load_result.value().tls_region); + VERIFY(!interpreter_load_result.value().tls_alignment); + VERIFY(!interpreter_load_result.value().tls_size); return interpreter_load_result; } KResult Process::do_exec(NonnullRefPtr main_program_description, Vector arguments, Vector environment, RefPtr interpreter_description, Thread*& new_main_thread, u32& prev_flags, const Elf32_Ehdr& main_program_header) { - ASSERT(is_user_process()); - ASSERT(!Processor::current().in_critical()); + VERIFY(is_user_process()); + VERIFY(!Processor::current().in_critical()); auto path = main_program_description->absolute_path(); dbgln_if(EXEC_DEBUG, "do_exec: {}", path); @@ -522,7 +522,7 @@ KResult Process::do_exec(NonnullRefPtr main_program_description auto signal_trampoline_region = m_space->allocate_region_with_vmobject(signal_trampoline_range.value(), g_signal_trampoline_region->vmobject(), 0, "Signal trampoline", PROT_READ | PROT_EXEC, true); if (signal_trampoline_region.is_error()) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } signal_trampoline_region.value()->set_syscall_region(true); @@ -557,7 +557,7 @@ KResult Process::do_exec(NonnullRefPtr main_program_description int main_program_fd = -1; if (interpreter_description) { main_program_fd = alloc_fd(); - ASSERT(main_program_fd >= 0); + VERIFY(main_program_fd >= 0); main_program_description->seek(0, SEEK_SET); main_program_description->set_readable(true); m_fds[main_program_fd].set(move(main_program_description), FD_CLOEXEC); @@ -572,7 +572,7 @@ KResult Process::do_exec(NonnullRefPtr main_program_description return IterationDecision::Break; }); } - ASSERT(new_main_thread); + VERIFY(new_main_thread); auto auxv = generate_auxiliary_vector(load_result.load_base, load_result.entry_eip, m_uid, m_euid, m_gid, m_egid, path, main_program_fd); @@ -604,7 +604,7 @@ KResult Process::do_exec(NonnullRefPtr main_program_description auto tsr_result = new_main_thread->make_thread_specific_region({}); if (tsr_result.is_error()) { // FIXME: We cannot fail this late. Refactor this so the allocation happens before we commit to the new executable. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } new_main_thread->reset_fpu_state(); @@ -630,8 +630,8 @@ KResult Process::do_exec(NonnullRefPtr main_program_description } u32 lock_count_to_restore; [[maybe_unused]] auto rc = big_lock().force_unlock_if_locked(lock_count_to_restore); - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(Processor::current().in_critical()); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(Processor::current().in_critical()); return KSuccess; } @@ -727,7 +727,7 @@ KResultOr> Process::find_elf_interpreter_for_executable( auto interpreter_description = interp_result.value(); auto interp_metadata = interpreter_description->metadata(); - ASSERT(interpreter_description->inode()); + VERIFY(interpreter_description->inode()); // Validate the program interpreter as a valid elf binary. // If your program interpreter is a #! file or something, it's time to stop playing games :) @@ -805,7 +805,7 @@ KResult Process::exec(String path, Vector arguments, Vector envi if (metadata.size < 3) return ENOEXEC; - ASSERT(description->inode()); + VERIFY(description->inode()); // Read the first page of the program into memory so we can validate the binfmt of it char first_page[PAGE_SIZE]; @@ -856,20 +856,20 @@ KResult Process::exec(String path, Vector arguments, Vector envi if (result.is_error()) return result; - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(Processor::current().in_critical()); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(Processor::current().in_critical()); auto current_thread = Thread::current(); if (current_thread == new_main_thread) { // We need to enter the scheduler lock before changing the state // and it will be released after the context switch into that // thread. We should also still be in our critical section - ASSERT(!g_scheduler_lock.own_lock()); - ASSERT(Processor::current().in_critical() == 1); + VERIFY(!g_scheduler_lock.own_lock()); + VERIFY(Processor::current().in_critical() == 1); g_scheduler_lock.lock(); current_thread->set_state(Thread::State::Running); Processor::assume_context(*current_thread, prev_flags); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Processor::current().leave_critical(prev_flags); @@ -926,7 +926,7 @@ int Process::sys$execve(Userspace user_params) return -EFAULT; auto result = exec(move(path), move(arguments), move(environment)); - ASSERT(result.is_error()); // We should never continue after a successful exec! + VERIFY(result.is_error()); // We should never continue after a successful exec! return result.error(); } diff --git a/Kernel/Syscalls/exit.cpp b/Kernel/Syscalls/exit.cpp index 37d058fdab9..cd127649d75 100644 --- a/Kernel/Syscalls/exit.cpp +++ b/Kernel/Syscalls/exit.cpp @@ -37,7 +37,7 @@ void Process::sys$exit(int status) m_termination_signal = 0; die(); Thread::current()->die_if_needed(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Kernel/Syscalls/futex.cpp b/Kernel/Syscalls/futex.cpp index 61c64dd3b87..1240c7ee3ee 100644 --- a/Kernel/Syscalls/futex.cpp +++ b/Kernel/Syscalls/futex.cpp @@ -62,7 +62,7 @@ FutexQueue::~FutexQueue() void FutexQueue::vmobject_deleted(VMObject& vmobject) { - ASSERT(m_is_global); // If we got called we must be a global futex + VERIFY(m_is_global); // If we got called we must be a global futex // Because we're taking ourselves out of the global queue, we need // to make sure we have at last a reference until we're done NonnullRefPtr own_ref(*this); @@ -88,7 +88,7 @@ void FutexQueue::vmobject_deleted(VMObject& vmobject) dbgln("Futex @ {} unblocked {} waiters due to vmobject free", this, wake_count); } - ASSERT(did_wake_all); // No one should be left behind... + VERIFY(did_wake_all); // No one should be left behind... } void Process::clear_futex_queues_on_exec() @@ -97,7 +97,7 @@ void Process::clear_futex_queues_on_exec() for (auto& it : m_futex_queues) { bool did_wake_all; it.value->wake_all(did_wake_all); - ASSERT(did_wake_all); // No one should be left behind... + VERIFY(did_wake_all); // No one should be left behind... } m_futex_queues.clear(); } @@ -172,16 +172,16 @@ int Process::sys$futex(Userspace user_params) if (create_if_not_found) { // TODO: is there a better way than setting and finding it again? auto result = global_queues.set(&vmobject, {}); - ASSERT(result == AK::HashSetResult::InsertedNewEntry); + VERIFY(result == AK::HashSetResult::InsertedNewEntry); it = global_queues.find(&vmobject); - ASSERT(it != global_queues.end()); + VERIFY(it != global_queues.end()); return &it->value; } return nullptr; }; auto find_futex_queue = [&](VMObject* vmobject, FlatPtr user_address_or_offset, bool create_if_not_found) -> RefPtr { - ASSERT(is_private || vmobject); + VERIFY(is_private || vmobject); auto* queues = is_private ? &m_futex_queues : find_global_futex_queues(*vmobject, create_if_not_found); if (!queues) return {}; @@ -191,7 +191,7 @@ int Process::sys$futex(Userspace user_params) if (create_if_not_found) { auto futex_queue = adopt(*new FutexQueue(user_address_or_offset, vmobject)); auto result = queues->set(user_address_or_offset, futex_queue); - ASSERT(result == AK::HashSetResult::InsertedNewEntry); + VERIFY(result == AK::HashSetResult::InsertedNewEntry); return futex_queue; } return {}; @@ -234,7 +234,7 @@ int Process::sys$futex(Userspace user_params) atomic_thread_fence(AK::MemoryOrder::memory_order_acquire); auto futex_queue = find_futex_queue(vmobject.ptr(), user_address_or_offset, true); - ASSERT(futex_queue); + VERIFY(futex_queue); // We need to release the lock before blocking. But we have a reference // to the FutexQueue so that we can keep it alive. @@ -358,13 +358,13 @@ int Process::sys$futex(Userspace user_params) return do_requeue(params.val3); case FUTEX_WAIT_BITSET: - ASSERT(params.val3 != FUTEX_BITSET_MATCH_ANY); // we should have turned it into FUTEX_WAIT + VERIFY(params.val3 != FUTEX_BITSET_MATCH_ANY); // we should have turned it into FUTEX_WAIT if (params.val3 == 0) return -EINVAL; return do_wait(params.val3); case FUTEX_WAKE_BITSET: - ASSERT(params.val3 != FUTEX_BITSET_MATCH_ANY); // we should have turned it into FUTEX_WAKE + VERIFY(params.val3 != FUTEX_BITSET_MATCH_ANY); // we should have turned it into FUTEX_WAKE if (params.val3 == 0) return -EINVAL; return do_wake(vmobject.ptr(), user_address_or_offset, params.val, params.val3); diff --git a/Kernel/Syscalls/get_stack_bounds.cpp b/Kernel/Syscalls/get_stack_bounds.cpp index b72939220d6..f187fdf6678 100644 --- a/Kernel/Syscalls/get_stack_bounds.cpp +++ b/Kernel/Syscalls/get_stack_bounds.cpp @@ -36,7 +36,7 @@ int Process::sys$get_stack_bounds(FlatPtr* user_stack_base, size_t* user_stack_s auto* stack_region = space().find_region_containing(Range { VirtualAddress(stack_pointer), 1 }); // The syscall handler should have killed us if we had an invalid stack pointer. - ASSERT(stack_region); + VERIFY(stack_region); FlatPtr stack_base = stack_region->range().base().get(); size_t stack_size = stack_region->size(); diff --git a/Kernel/Syscalls/kill.cpp b/Kernel/Syscalls/kill.cpp index 33d8c1643c1..e8b89787994 100644 --- a/Kernel/Syscalls/kill.cpp +++ b/Kernel/Syscalls/kill.cpp @@ -47,7 +47,7 @@ KResult Process::do_killpg(ProcessGroupID pgrp, int signal) { InterruptDisabler disabler; - ASSERT(pgrp >= 0); + VERIFY(pgrp >= 0); // Send the signal to all processes in the given group. if (pgrp == 0) { @@ -136,7 +136,7 @@ int Process::sys$kill(pid_t pid_or_pgid, int signal) if (pid_or_pgid == m_pid.value()) { return do_killself(signal); } - ASSERT(pid_or_pgid >= 0); + VERIFY(pid_or_pgid >= 0); ScopedSpinLock lock(g_processes_lock); auto peer = Process::from_pid(pid_or_pgid); if (!peer) diff --git a/Kernel/Syscalls/mmap.cpp b/Kernel/Syscalls/mmap.cpp index fa39188769d..2ee5f5409e6 100644 --- a/Kernel/Syscalls/mmap.cpp +++ b/Kernel/Syscalls/mmap.cpp @@ -465,7 +465,7 @@ int Process::sys$munmap(void* addr, size_t size) if (!whole_region->is_mmap()) return -EPERM; bool success = space().deallocate_region(*whole_region); - ASSERT(success); + VERIFY(success); return 0; } @@ -557,7 +557,7 @@ void* Process::sys$allocate_tls(size_t size) main_thread = &thread; return IterationDecision::Break; }); - ASSERT(main_thread); + VERIFY(main_thread); auto range = space().allocate_range({}, size); if (!range.has_value()) diff --git a/Kernel/Syscalls/module.cpp b/Kernel/Syscalls/module.cpp index c404d4970e2..6582d3782dd 100644 --- a/Kernel/Syscalls/module.cpp +++ b/Kernel/Syscalls/module.cpp @@ -80,7 +80,7 @@ int Process::sys$module_load(Userspace user_path, size_t path_lengt if (!section.size()) return IterationDecision::Continue; auto* section_storage = section_storage_by_name.get(section.name()).value_or(nullptr); - ASSERT(section_storage); + VERIFY(section_storage); section.relocations().for_each_relocation([&](const ELF::Image::Relocation& relocation) { auto& patch_ptr = *reinterpret_cast(section_storage + relocation.offset()); switch (relocation.type()) { @@ -100,7 +100,7 @@ int Process::sys$module_load(Userspace user_path, size_t path_lengt if (relocation.symbol().bind() == STB_LOCAL) { auto* section_storage_containing_symbol = section_storage_by_name.get(relocation.symbol().section().name()).value_or(nullptr); - ASSERT(section_storage_containing_symbol); + VERIFY(section_storage_containing_symbol); u32 symbol_address = (ptrdiff_t)(section_storage_containing_symbol + relocation.symbol().value()); if (symbol_address == 0) missing_symbols = true; @@ -113,7 +113,7 @@ int Process::sys$module_load(Userspace user_path, size_t path_lengt dbgln(" Symbol address: {:p}", symbol_address); patch_ptr += symbol_address; } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } break; } diff --git a/Kernel/Syscalls/ptrace.cpp b/Kernel/Syscalls/ptrace.cpp index 1382998279b..e882b02dcd8 100644 --- a/Kernel/Syscalls/ptrace.cpp +++ b/Kernel/Syscalls/ptrace.cpp @@ -205,7 +205,7 @@ KResult Process::poke_user_data(Userspace address, u32 data) if (region->is_shared()) { // If the region is shared, we change its vmobject to a PrivateInodeVMObject // to prevent the write operation from changing any shared inode data - ASSERT(region->vmobject().is_shared_inode()); + VERIFY(region->vmobject().is_shared_inode()); region->set_vmobject(PrivateInodeVMObject::create_with_inode(static_cast(region->vmobject()).inode())); region->set_shared(false); } diff --git a/Kernel/Syscalls/select.cpp b/Kernel/Syscalls/select.cpp index 6d464d1f58d..0009fdf37f5 100644 --- a/Kernel/Syscalls/select.cpp +++ b/Kernel/Syscalls/select.cpp @@ -226,15 +226,15 @@ int Process::sys$poll(Userspace user_params) pfd.revents |= POLLNVAL; } else { if ((u32)fds_entry.unblocked_flags & (u32)Thread::FileBlocker::BlockFlags::Read) { - ASSERT(pfd.events & POLLIN); + VERIFY(pfd.events & POLLIN); pfd.revents |= POLLIN; } if ((u32)fds_entry.unblocked_flags & (u32)Thread::FileBlocker::BlockFlags::ReadPriority) { - ASSERT(pfd.events & POLLPRI); + VERIFY(pfd.events & POLLPRI); pfd.revents |= POLLPRI; } if ((u32)fds_entry.unblocked_flags & (u32)Thread::FileBlocker::BlockFlags::Write) { - ASSERT(pfd.events & POLLOUT); + VERIFY(pfd.events & POLLOUT); pfd.revents |= POLLOUT; } } diff --git a/Kernel/Syscalls/socket.cpp b/Kernel/Syscalls/socket.cpp index 960aa7a8ece..6529edef432 100644 --- a/Kernel/Syscalls/socket.cpp +++ b/Kernel/Syscalls/socket.cpp @@ -122,7 +122,7 @@ int Process::sys$accept(int accepting_socket_fd, Userspace user_addre } } auto accepted_socket = socket.accept(); - ASSERT(accepted_socket); + VERIFY(accepted_socket); if (user_address) { u8 address_buffer[sizeof(sockaddr_un)]; @@ -263,7 +263,7 @@ ssize_t Process::sys$recvmsg(int sockfd, Userspace user_msg, int int msg_flags = 0; if (result.value() > iovs[0].iov_len) { - ASSERT(socket.type() != SOCK_STREAM); + VERIFY(socket.type() != SOCK_STREAM); msg_flags |= MSG_TRUNC; } diff --git a/Kernel/Syscalls/thread.cpp b/Kernel/Syscalls/thread.cpp index fc24d2d7310..6ad8e266c71 100644 --- a/Kernel/Syscalls/thread.cpp +++ b/Kernel/Syscalls/thread.cpp @@ -102,7 +102,7 @@ void Process::sys$exit_thread(Userspace exit_value) } Thread::current()->exit(reinterpret_cast(exit_value.ptr())); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int Process::sys$detach_thread(pid_t tid) diff --git a/Kernel/Syscalls/unveil.cpp b/Kernel/Syscalls/unveil.cpp index 8657ecfee08..20a91edb69f 100644 --- a/Kernel/Syscalls/unveil.cpp +++ b/Kernel/Syscalls/unveil.cpp @@ -125,7 +125,7 @@ int Process::sys$unveil(Userspace user_params) lexical_path.parts().end(), { new_unveiled_path, (UnveilAccess)new_permissions, true }, [](auto& parent, auto& it) -> Optional { return UnveilMetadata { String::formatted("{}/{}", parent.path(), *it), parent.permissions(), false, parent.permissions_inherited_from_root() }; }); - ASSERT(m_veil_state != VeilState::Locked); + VERIFY(m_veil_state != VeilState::Locked); m_veil_state = VeilState::Dropped; return 0; } diff --git a/Kernel/Syscalls/waitid.cpp b/Kernel/Syscalls/waitid.cpp index d9dc09f509a..c2ca611a895 100644 --- a/Kernel/Syscalls/waitid.cpp +++ b/Kernel/Syscalls/waitid.cpp @@ -34,7 +34,7 @@ KResultOr Process::do_waitid(idtype_t idtype, int id, int options) KResultOr result = KResult(KSuccess); if (Thread::current()->block({}, options, idtype, id, result).was_interrupted()) return EINTR; - ASSERT(!result.is_error() || (options & WNOHANG) || result.error() != KSuccess); + VERIFY(!result.is_error() || (options & WNOHANG) || result.error() != KSuccess); return result; } diff --git a/Kernel/Syscalls/write.cpp b/Kernel/Syscalls/write.cpp index b80f6c6912d..e1006163aba 100644 --- a/Kernel/Syscalls/write.cpp +++ b/Kernel/Syscalls/write.cpp @@ -91,7 +91,7 @@ ssize_t Process::do_write(FileDescription& description, const UserOrKernelBuffer if (!description.can_write()) { if (!description.is_blocking()) { // Short write: We can no longer write to this non-blocking description. - ASSERT(total_nwritten > 0); + VERIFY(total_nwritten > 0); return total_nwritten; } auto unblock_flags = Thread::FileBlocker::BlockFlags::None; diff --git a/Kernel/TTY/VirtualConsole.cpp b/Kernel/TTY/VirtualConsole.cpp index 5fa2e52141c..4f136ab069c 100644 --- a/Kernel/TTY/VirtualConsole.cpp +++ b/Kernel/TTY/VirtualConsole.cpp @@ -68,7 +68,7 @@ UNMAP_AFTER_INIT VirtualConsole::VirtualConsole(const unsigned index) , m_index(index) , m_terminal(*this) { - ASSERT(index < s_max_virtual_consoles); + VERIFY(index < s_max_virtual_consoles); m_tty_name = String::formatted("/dev/tty{}", m_index); m_terminal.set_size(80, 25); @@ -78,15 +78,15 @@ UNMAP_AFTER_INIT VirtualConsole::VirtualConsole(const unsigned index) UNMAP_AFTER_INIT VirtualConsole::~VirtualConsole() { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void VirtualConsole::switch_to(unsigned index) { if ((int)index == s_active_console) return; - ASSERT(index < s_max_virtual_consoles); - ASSERT(s_consoles[index]); + VERIFY(index < s_max_virtual_consoles); + VERIFY(s_consoles[index]); ScopedSpinLock lock(s_lock); if (s_active_console != -1) { @@ -200,7 +200,7 @@ static inline VGAColor ansi_color_to_vga(ANSIColor color) case ANSIColor::White: return VGAColor::White; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -322,8 +322,8 @@ void VirtualConsole::set_window_progress(int, int) void VirtualConsole::terminal_did_resize(u16 columns, u16 rows) { - ASSERT(columns == 80); - ASSERT(rows == 25); + VERIFY(columns == 80); + VERIFY(rows == 25); set_size(columns, rows); } diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index c7f2b6cb49d..38d359180af 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -80,7 +80,7 @@ Thread::Thread(NonnullRefPtr process, NonnullOwnPtr kernel_stac { ScopedSpinLock lock(g_tid_map_lock); auto result = g_tid_map->set(m_tid, this); - ASSERT(result == AK::HashSetResult::InsertedNewEntry); + VERIFY(result == AK::HashSetResult::InsertedNewEntry); } if constexpr (THREAD_DEBUG) dbgln("Created new thread {}({}:{})", m_process->name(), m_process->pid().value(), m_tid.value()); @@ -141,15 +141,15 @@ Thread::~Thread() // block conditions would access m_process, which would be in // the middle of being destroyed. ScopedSpinLock lock(g_scheduler_lock); - ASSERT(!m_process_thread_list_node.is_in_list()); + VERIFY(!m_process_thread_list_node.is_in_list()); // We shouldn't be queued - ASSERT(m_runnable_priority < 0); + VERIFY(m_runnable_priority < 0); } { ScopedSpinLock lock(g_tid_map_lock); auto result = g_tid_map->remove(m_tid); - ASSERT(result); + VERIFY(result); } } @@ -175,12 +175,12 @@ void Thread::unblock_from_blocker(Blocker& blocker) void Thread::unblock(u8 signal) { - ASSERT(!Processor::current().in_irq()); - ASSERT(g_scheduler_lock.own_lock()); - ASSERT(m_block_lock.own_lock()); + VERIFY(!Processor::current().in_irq()); + VERIFY(g_scheduler_lock.own_lock()); + VERIFY(m_block_lock.own_lock()); if (m_state != Thread::Blocked) return; - ASSERT(m_blocker); + VERIFY(m_blocker); if (signal != 0) { if (is_handling_page_fault()) { // Don't let signals unblock threads that are blocked inside a page fault handler. @@ -197,7 +197,7 @@ void Thread::unblock(u8 signal) set_state(Thread::Running); return; } - ASSERT(m_state != Thread::Runnable && m_state != Thread::Running); + VERIFY(m_state != Thread::Runnable && m_state != Thread::Running); set_state(Thread::Runnable); } @@ -222,7 +222,7 @@ void Thread::set_should_die() // If we were stopped, we need to briefly resume so that // the kernel stacks can clean up. We won't ever return back // to user mode, though - ASSERT(!process().is_stopped()); + VERIFY(!process().is_stopped()); resume_from_stopped(); } if (is_blocked()) { @@ -237,7 +237,7 @@ void Thread::set_should_die() void Thread::die_if_needed() { - ASSERT(Thread::current() == this); + VERIFY(Thread::current() == this); if (!m_should_die) return; @@ -260,12 +260,12 @@ void Thread::die_if_needed() dbgln("die_if_needed returned from clear_critical!!! in irq: {}", Processor::current().in_irq()); // We should never get here, but the scoped scheduler lock // will be released by Scheduler::context_switch again - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Thread::exit(void* exit_value) { - ASSERT(Thread::current() == this); + VERIFY(Thread::current() == this); m_join_condition.thread_did_exit(exit_value); set_should_die(); u32 unlock_count; @@ -275,7 +275,7 @@ void Thread::exit(void* exit_value) void Thread::yield_while_not_holding_big_lock() { - ASSERT(!g_scheduler_lock.own_lock()); + VERIFY(!g_scheduler_lock.own_lock()); u32 prev_flags; u32 prev_crit = Processor::current().clear_critical(prev_flags, true); Scheduler::yield(); @@ -285,7 +285,7 @@ void Thread::yield_while_not_holding_big_lock() void Thread::yield_without_holding_big_lock() { - ASSERT(!g_scheduler_lock.own_lock()); + VERIFY(!g_scheduler_lock.own_lock()); u32 lock_count_to_restore = 0; auto previous_locked = unlock_process_if_locked(lock_count_to_restore); // NOTE: Even though we call Scheduler::yield here, unless we happen @@ -297,7 +297,7 @@ void Thread::yield_without_holding_big_lock() void Thread::donate_without_holding_big_lock(RefPtr& thread, const char* reason) { - ASSERT(!g_scheduler_lock.own_lock()); + VERIFY(!g_scheduler_lock.own_lock()); u32 lock_count_to_restore = 0; auto previous_locked = unlock_process_if_locked(lock_count_to_restore); // NOTE: Even though we call Scheduler::yield here, unless we happen @@ -334,13 +334,13 @@ void Thread::relock_process(LockMode previous_locked, u32 lock_count_to_restore) auto Thread::sleep(clockid_t clock_id, const timespec& duration, timespec* remaining_time) -> BlockResult { - ASSERT(state() == Thread::Running); + VERIFY(state() == Thread::Running); return Thread::current()->block({}, Thread::BlockTimeout(false, &duration, nullptr, clock_id), remaining_time); } auto Thread::sleep_until(clockid_t clock_id, const timespec& deadline) -> BlockResult { - ASSERT(state() == Thread::Running); + VERIFY(state() == Thread::Running); return Thread::current()->block({}, Thread::BlockTimeout(true, &deadline, nullptr, clock_id)); } @@ -361,28 +361,28 @@ const char* Thread::state_string() const return "Stopped"; case Thread::Blocked: { ScopedSpinLock block_lock(m_block_lock); - ASSERT(m_blocker != nullptr); + VERIFY(m_blocker != nullptr); return m_blocker->state_string(); } } klog() << "Thread::state_string(): Invalid state: " << state(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return nullptr; } void Thread::finalize() { - ASSERT(Thread::current() == g_finalizer); - ASSERT(Thread::current() != this); + VERIFY(Thread::current() == g_finalizer); + VERIFY(Thread::current() != this); #if LOCK_DEBUG - ASSERT(!m_lock.own_lock()); + VERIFY(!m_lock.own_lock()); if (lock_count() > 0) { dbgln("Thread {} leaking {} Locks!", *this, lock_count()); ScopedSpinLock list_lock(m_holding_locks_lock); for (auto& info : m_holding_locks_list) dbgln(" - {} @ {} locked at {}:{} count: {}", info.lock->name(), info.lock, info.file, info.line, info.count); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } #endif @@ -410,7 +410,7 @@ void Thread::drop_thread_count(bool initializing_first_thread) void Thread::finalize_dying_threads() { - ASSERT(Thread::current() == g_finalizer); + VERIFY(Thread::current() == g_finalizer); Vector dying_threads; { ScopedSpinLock lock(g_scheduler_lock); @@ -473,7 +473,7 @@ u32 Thread::pending_signals() const u32 Thread::pending_signals_for_state() const { - ASSERT(g_scheduler_lock.own_lock()); + VERIFY(g_scheduler_lock.own_lock()); constexpr u32 stopped_signal_mask = (1 << (SIGCONT - 1)) | (1 << (SIGKILL - 1)) | (1 << (SIGTRAP - 1)); if (is_handling_page_fault()) return 0; @@ -482,7 +482,7 @@ u32 Thread::pending_signals_for_state() const void Thread::send_signal(u8 signal, [[maybe_unused]] Process* sender) { - ASSERT(signal < 32); + VERIFY(signal < 32); ScopedSpinLock scheduler_lock(g_scheduler_lock); // FIXME: Figure out what to do for masked signals. Should we also ignore them here? @@ -558,7 +558,7 @@ void Thread::clear_signals() // the appropriate signal handler. void Thread::send_urgent_signal_to_self(u8 signal) { - ASSERT(Thread::current() == this); + VERIFY(Thread::current() == this); DispatchSignalResult result; { ScopedSpinLock lock(g_scheduler_lock); @@ -570,7 +570,7 @@ void Thread::send_urgent_signal_to_self(u8 signal) DispatchSignalResult Thread::dispatch_one_pending_signal() { - ASSERT(m_lock.own_lock()); + VERIFY(m_lock.own_lock()); u32 signal_candidates = pending_signals_for_state() & ~m_signal_mask; if (signal_candidates == 0) return DispatchSignalResult::Continue; @@ -586,7 +586,7 @@ DispatchSignalResult Thread::dispatch_one_pending_signal() DispatchSignalResult Thread::try_dispatch_one_pending_signal(u8 signal) { - ASSERT(signal != 0); + VERIFY(signal != 0); ScopedSpinLock scheduler_lock(g_scheduler_lock); ScopedSpinLock lock(m_lock); u32 signal_candidates = pending_signals_for_state() & ~m_signal_mask; @@ -605,7 +605,7 @@ enum class DefaultSignalAction { static DefaultSignalAction default_signal_action(u8 signal) { - ASSERT(signal && signal < NSIG); + VERIFY(signal && signal < NSIG); switch (signal) { case SIGHUP: @@ -645,12 +645,12 @@ static DefaultSignalAction default_signal_action(u8 signal) case SIGTTOU: return DefaultSignalAction::Stop; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool Thread::should_ignore_signal(u8 signal) const { - ASSERT(signal < 32); + VERIFY(signal < 32); auto& action = m_signal_action_data[signal]; if (action.handler_or_sigaction.is_null()) return default_signal_action(signal) == DefaultSignalAction::Ignore; @@ -661,7 +661,7 @@ bool Thread::should_ignore_signal(u8 signal) const bool Thread::has_signal_handler(u8 signal) const { - ASSERT(signal < 32); + VERIFY(signal < 32); auto& action = m_signal_action_data[signal]; return !action.handler_or_sigaction.is_null(); } @@ -674,9 +674,9 @@ static bool push_value_on_user_stack(u32* stack, u32 data) void Thread::resume_from_stopped() { - ASSERT(is_stopped()); - ASSERT(m_stop_state != State::Invalid); - ASSERT(g_scheduler_lock.own_lock()); + VERIFY(is_stopped()); + VERIFY(m_stop_state != State::Invalid); + VERIFY(g_scheduler_lock.own_lock()); if (m_stop_state == Blocked) { ScopedSpinLock block_lock(m_block_lock); if (m_blocker) { @@ -693,11 +693,11 @@ void Thread::resume_from_stopped() DispatchSignalResult Thread::dispatch_signal(u8 signal) { - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(g_scheduler_lock.own_lock()); - ASSERT(signal > 0 && signal <= 32); - ASSERT(process().is_user_process()); - ASSERT(this == Thread::current()); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(g_scheduler_lock.own_lock()); + VERIFY(signal > 0 && signal <= 32); + VERIFY(process().is_user_process()); + VERIFY(this == Thread::current()); #if SIGNAL_DEBUG klog() << "signal: dispatch signal " << signal << " to " << *this << " state: " << state_string(); @@ -711,11 +711,11 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal) return DispatchSignalResult::Deferred; } - ASSERT(previous_mode() == PreviousMode::UserMode); + VERIFY(previous_mode() == PreviousMode::UserMode); auto& action = m_signal_action_data[signal]; // FIXME: Implement SA_SIGINFO signal handlers. - ASSERT(!(action.flags & SA_SIGINFO)); + VERIFY(!(action.flags & SA_SIGINFO)); // Mark this signal as handled. m_pending_signals &= ~(1 << (signal - 1)); @@ -762,11 +762,11 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal) m_process->terminate_due_to_signal(signal); return DispatchSignalResult::Terminate; case DefaultSignalAction::Ignore: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case DefaultSignalAction::Continue: return DispatchSignalResult::Continue; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (handler_vaddr.as_ptr() == SIG_IGN) { @@ -776,8 +776,8 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal) return DispatchSignalResult::Continue; } - ASSERT(previous_mode() == PreviousMode::UserMode); - ASSERT(current_trap()); + VERIFY(previous_mode() == PreviousMode::UserMode); + VERIFY(current_trap()); ProcessPagingScope paging_scope(m_process); @@ -826,7 +826,7 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal) push_value_on_user_stack(stack, handler_vaddr.get()); push_value_on_user_stack(stack, 0); //push fake return address - ASSERT((*stack % 16) == 0); + VERIFY((*stack % 16) == 0); }; // We now place the thread state on the userspace stack. @@ -850,7 +850,7 @@ RegisterState& Thread::get_register_dump_from_stack() // We should *always* have a trap. If we don't we're probably a kernel // thread that hasn't been pre-empted. If we want to support this, we // need to capture the registers probably into m_tss and return it - ASSERT(trap); + VERIFY(trap); while (trap) { if (!trap->next_trap) @@ -877,7 +877,7 @@ RefPtr Thread::clone(Process& process) void Thread::set_state(State new_state, u8 stop_signal) { State previous_state; - ASSERT(g_scheduler_lock.own_lock()); + VERIFY(g_scheduler_lock.own_lock()); if (new_state == m_state) return; @@ -931,7 +931,7 @@ void Thread::set_state(State new_state, u8 stop_signal) process.unblock_waiters(Thread::WaitBlocker::UnblockFlags::Stopped, stop_signal); } } else if (m_state == Dying) { - ASSERT(previous_state != Blocked); + VERIFY(previous_state != Blocked); if (this != Thread::current() && is_finalizable()) { // Some other thread set this thread to Dying, notify the // finalizer right away as it can be cleaned up now @@ -974,7 +974,7 @@ String Thread::backtrace() auto& process = const_cast(this->process()); auto stack_trace = Processor::capture_stack_trace(*this); - ASSERT(!g_scheduler_lock.own_lock()); + VERIFY(!g_scheduler_lock.own_lock()); ProcessPagingScope paging_scope(process); for (auto& frame : stack_trace) { if (is_user_range(VirtualAddress(frame), sizeof(FlatPtr) * 2)) { diff --git a/Kernel/Thread.h b/Kernel/Thread.h index 462a7e3dcf0..3f73e2591eb 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -317,7 +317,7 @@ public: } void do_set_interrupted_by_signal(u8 signal) { - ASSERT(signal != 0); + VERIFY(signal != 0); m_was_interrupted_by_signal = signal; } void do_clear_interrupted_by_signal() @@ -340,7 +340,7 @@ public: ScopedSpinLock lock(m_lock); if (m_is_blocking) { m_is_blocking = false; - ASSERT(m_blocked_thread); + VERIFY(m_blocked_thread); thread = m_blocked_thread; } } @@ -377,7 +377,7 @@ public: virtual ~BlockCondition() { ScopedSpinLock lock(m_lock); - ASSERT(m_blockers.is_empty()); + VERIFY(m_blockers.is_empty()); } bool add_blocker(Blocker& blocker, void* data) @@ -415,7 +415,7 @@ public: template bool do_unblock(UnblockOne unblock_one) { - ASSERT(m_lock.is_locked()); + VERIFY(m_lock.is_locked()); bool stop_iterating = false; bool did_unblock = false; for (size_t i = 0; i < m_blockers.size() && !stop_iterating;) { @@ -433,7 +433,7 @@ public: bool is_empty_locked() const { - ASSERT(m_lock.is_locked()); + VERIFY(m_lock.is_locked()); return m_blockers.is_empty(); } @@ -450,7 +450,7 @@ public: return move(m_blockers); size_t move_count = (count <= m_blockers.size()) ? count : m_blockers.size(); - ASSERT(move_count > 0); + VERIFY(move_count > 0); Vector taken_blockers; taken_blockers.ensure_capacity(move_count); @@ -817,10 +817,10 @@ public: template [[nodiscard]] BlockResult block(const BlockTimeout& timeout, Args&&... args) { - ASSERT(!Processor::current().in_irq()); - ASSERT(this == Thread::current()); + VERIFY(!Processor::current().in_irq()); + VERIFY(this == Thread::current()); ScopedCritical critical; - ASSERT(!s_mm_lock.own_lock()); + VERIFY(!s_mm_lock.own_lock()); ScopedSpinLock block_lock(m_block_lock); // We need to hold m_block_lock so that nobody can unblock a blocker as soon @@ -839,10 +839,10 @@ public: // It's possible that we were requested to be stopped! break; case Thread::Running: - ASSERT(m_blocker == nullptr); + VERIFY(m_blocker == nullptr); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_blocker = &t; @@ -859,9 +859,9 @@ public: // Process::kill_all_threads may be called at any time, which will mark all // threads to die. In that case timer = TimerQueue::the().add_timer_without_id(block_timeout.clock_id(), block_timeout.absolute_time(), [&]() { - ASSERT(!Processor::current().in_irq()); - ASSERT(!g_scheduler_lock.own_lock()); - ASSERT(!m_block_lock.own_lock()); + VERIFY(!Processor::current().in_irq()); + VERIFY(!g_scheduler_lock.own_lock()); + VERIFY(!m_block_lock.own_lock()); // NOTE: this may execute on the same or any other processor! ScopedSpinLock scheduler_lock(g_scheduler_lock); ScopedSpinLock block_lock(m_block_lock); @@ -891,10 +891,10 @@ public: auto previous_locked = unlock_process_if_locked(lock_count_to_restore); for (;;) { // Yield to the scheduler, and wait for us to resume unblocked. - ASSERT(!g_scheduler_lock.own_lock()); - ASSERT(Processor::current().in_critical()); + VERIFY(!g_scheduler_lock.own_lock()); + VERIFY(Processor::current().in_critical()); yield_while_not_holding_big_lock(); - ASSERT(Processor::current().in_critical()); + VERIFY(Processor::current().in_critical()); ScopedSpinLock block_lock2(m_block_lock); if (should_be_stopped() || state() == Stopped) { @@ -913,7 +913,7 @@ public: did_timeout |= timeout_unblocked.exchange(true); if (m_blocker) { // Remove ourselves... - ASSERT(m_blocker == &t); + VERIFY(m_blocker == &t); m_blocker = nullptr; } dbgln_if(THREAD_DEBUG, "<-- Thread {} unblocked from {} ({})", *this, &t, t.state_string()); @@ -951,7 +951,7 @@ public: template Thread::BlockResult wait_on(WaitQueue& wait_queue, const Thread::BlockTimeout& timeout, Args&&... args) { - ASSERT(this == Thread::current()); + VERIFY(this == Thread::current()); return block(timeout, wait_queue, forward(args)...); } @@ -1107,7 +1107,7 @@ public: #if LOCK_DEBUG void holding_lock(Lock& lock, int refs_delta, const char* file = nullptr, int line = 0) { - ASSERT(refs_delta != 0); + VERIFY(refs_delta != 0); m_holding_locks.fetch_add(refs_delta, AK::MemoryOrder::memory_order_relaxed); ScopedSpinLock list_lock(m_holding_locks_lock); if (refs_delta > 0) { @@ -1123,12 +1123,12 @@ public: if (!have_existing) m_holding_locks_list.append({ &lock, file ? file : "unknown", line, 1 }); } else { - ASSERT(refs_delta < 0); + VERIFY(refs_delta < 0); bool found = false; for (size_t i = 0; i < m_holding_locks_list.size(); i++) { auto& info = m_holding_locks_list[i]; if (info.lock == &lock) { - ASSERT(info.count >= (unsigned)-refs_delta); + VERIFY(info.count >= (unsigned)-refs_delta); info.count -= (unsigned)-refs_delta; if (info.count == 0) m_holding_locks_list.remove(i); @@ -1136,7 +1136,7 @@ public: break; } } - ASSERT(found); + VERIFY(found); } } u32 lock_count() const @@ -1164,7 +1164,7 @@ private: void thread_did_exit(void* exit_value) { ScopedSpinLock lock(m_lock); - ASSERT(!m_thread_did_exit); + VERIFY(!m_thread_did_exit); m_thread_did_exit = true; m_exit_value.store(exit_value, AK::MemoryOrder::memory_order_release); do_unblock_joiner(); @@ -1176,7 +1176,7 @@ private: } void* exit_value() const { - ASSERT(m_thread_did_exit); + VERIFY(m_thread_did_exit); return m_exit_value.load(AK::MemoryOrder::memory_order_acquire); } @@ -1190,7 +1190,7 @@ private: protected: virtual bool should_add_blocker(Blocker& b, void*) override { - ASSERT(b.blocker_type() == Blocker::Type::Join); + VERIFY(b.blocker_type() == Blocker::Type::Join); auto& blocker = static_cast(b); // NOTE: m_lock is held already! @@ -1205,7 +1205,7 @@ private: void do_unblock_joiner() { do_unblock([&](Blocker& b, void*, bool&) { - ASSERT(b.blocker_type() == Blocker::Type::Join); + VERIFY(b.blocker_type() == Blocker::Type::Join); auto& blocker = static_cast(b); return blocker.unblock(exit_value(), false); }); diff --git a/Kernel/ThreadBlockers.cpp b/Kernel/ThreadBlockers.cpp index 68ab7a60d66..3d56052c499 100644 --- a/Kernel/ThreadBlockers.cpp +++ b/Kernel/ThreadBlockers.cpp @@ -35,7 +35,7 @@ namespace Kernel { bool Thread::Blocker::set_block_condition(Thread::BlockCondition& block_condition, void* data) { - ASSERT(!m_block_condition); + VERIFY(!m_block_condition); if (block_condition.add_blocker(*this, data)) { m_block_condition = &block_condition; m_block_data = data; @@ -54,8 +54,8 @@ Thread::Blocker::~Blocker() void Thread::Blocker::begin_blocking(Badge) { ScopedSpinLock lock(m_lock); - ASSERT(!m_is_blocking); - ASSERT(!m_blocked_thread); + VERIFY(!m_is_blocking); + VERIFY(!m_blocked_thread); m_blocked_thread = Thread::current(); m_is_blocking = true; } @@ -66,7 +66,7 @@ auto Thread::Blocker::end_blocking(Badge, bool did_timeout) -> BlockResu // if m_is_blocking is false here, some thread forced to // unblock us when we get here. This is only called from the // thread that was blocked. - ASSERT(Thread::current() == m_blocked_thread); + VERIFY(Thread::current() == m_blocked_thread); m_is_blocking = false; m_blocked_thread = nullptr; @@ -96,14 +96,14 @@ void Thread::JoinBlocker::not_blocking(bool timeout_in_past) { if (!m_should_block) { // set_block_condition returned false, so unblock was already called - ASSERT(!timeout_in_past); + VERIFY(!timeout_in_past); return; } // If we should have blocked but got here it must have been that the // timeout was already in the past. So we need to ask the BlockCondition // to supply us the information. We cannot hold the lock as unblock // could be called by the BlockCondition at any time! - ASSERT(timeout_in_past); + VERIFY(timeout_in_past); m_joinee->m_join_condition.try_unblock(*this); } @@ -160,7 +160,7 @@ Thread::FutexBlocker::~FutexBlocker() void Thread::FutexBlocker::finish_requeue(FutexQueue& futex_queue) { - ASSERT(m_lock.own_lock()); + VERIFY(m_lock.own_lock()); set_block_condition_raw_locked(&futex_queue); // We can now release the lock m_lock.unlock(m_relock_flags); @@ -226,14 +226,14 @@ void Thread::FileDescriptionBlocker::not_blocking(bool timeout_in_past) { if (!m_should_block) { // set_block_condition returned false, so unblock was already called - ASSERT(!timeout_in_past); + VERIFY(!timeout_in_past); return; } // If we should have blocked but got here it must have been that the // timeout was already in the past. So we need to ask the BlockCondition // to supply us the information. We cannot hold the lock as unblock // could be called by the BlockCondition at any time! - ASSERT(timeout_in_past); + VERIFY(timeout_in_past); // Just call unblock here because we will query the file description // for the data and don't need any input from the FileBlockCondition. @@ -305,7 +305,7 @@ Thread::SleepBlocker::SleepBlocker(const BlockTimeout& deadline, timespec* remai auto Thread::SleepBlocker::override_timeout(const BlockTimeout& timeout) -> const BlockTimeout& { - ASSERT(timeout.is_infinite()); // A timeout should not be provided + VERIFY(timeout.is_infinite()); // A timeout should not be provided // To simplify things only use the sleep deadline. return m_deadline; } @@ -314,7 +314,7 @@ void Thread::SleepBlocker::not_blocking(bool timeout_in_past) { // SleepBlocker::should_block should always return true, so timeout // in the past is the only valid case when this function is called - ASSERT(timeout_in_past); + VERIFY(timeout_in_past); calculate_remaining(); } @@ -366,20 +366,20 @@ Thread::SelectBlocker::~SelectBlocker() void Thread::SelectBlocker::not_blocking(bool timeout_in_past) { // Either the timeout was in the past or we didn't add all blockers - ASSERT(timeout_in_past || !m_should_block); + VERIFY(timeout_in_past || !m_should_block); ScopedSpinLock lock(m_lock); if (!m_did_unblock) { m_did_unblock = true; if (!timeout_in_past) { auto count = collect_unblocked_flags(); - ASSERT(count > 0); + VERIFY(count > 0); } } } bool Thread::SelectBlocker::unblock(bool from_add_blocker, void* data) { - ASSERT(data); // data is a pointer to an entry in the m_fds vector + VERIFY(data); // data is a pointer to an entry in the m_fds vector auto& fd_info = *static_cast(data); { @@ -409,7 +409,7 @@ size_t Thread::SelectBlocker::collect_unblocked_flags() { size_t count = 0; for (auto& fd_entry : m_fds) { - ASSERT(fd_entry.block_flags != FileBlocker::BlockFlags::None); + VERIFY(fd_entry.block_flags != FileBlocker::BlockFlags::None); // unblock will have set at least the first descriptor's unblock // flags that triggered the unblock. Make sure we don't discard that @@ -429,11 +429,11 @@ void Thread::SelectBlocker::was_unblocked(bool did_timeout) if (!did_timeout && !was_interrupted()) { { ScopedSpinLock lock(m_lock); - ASSERT(m_did_unblock); + VERIFY(m_did_unblock); } size_t count = collect_unblocked_flags(); // If we were blocked and didn't time out, we should have at least one unblocked fd! - ASSERT(count > 0); + VERIFY(count > 0); } } @@ -482,10 +482,10 @@ void Thread::WaitBlockCondition::disowned_by_waiter(Process& process) auto& info = m_processes[i]; if (info.process == &process) { do_unblock([&](Blocker& b, void*, bool&) { - ASSERT(b.blocker_type() == Blocker::Type::Wait); + VERIFY(b.blocker_type() == Blocker::Type::Wait); auto& blocker = static_cast(b); bool did_unblock = blocker.unblock(info.process, WaitBlocker::UnblockFlags::Disowned, 0, false); - ASSERT(did_unblock); // disowning must unblock everyone + VERIFY(did_unblock); // disowning must unblock everyone return true; }); dbgln_if(WAITBLOCK_DEBUG, "WaitBlockCondition[{}] disowned {}", m_process, *info.process); @@ -499,7 +499,7 @@ void Thread::WaitBlockCondition::disowned_by_waiter(Process& process) bool Thread::WaitBlockCondition::unblock(Process& process, WaitBlocker::UnblockFlags flags, u8 signal) { - ASSERT(flags != WaitBlocker::UnblockFlags::Disowned); + VERIFY(flags != WaitBlocker::UnblockFlags::Disowned); bool did_unblock_any = false; bool did_wait = false; @@ -519,7 +519,7 @@ bool Thread::WaitBlockCondition::unblock(Process& process, WaitBlocker::UnblockF } do_unblock([&](Blocker& b, void*, bool&) { - ASSERT(b.blocker_type() == Blocker::Type::Wait); + VERIFY(b.blocker_type() == Blocker::Type::Wait); auto& blocker = static_cast(b); if (was_waited_already && blocker.is_wait()) return false; // This state was already waited on, do not unblock @@ -537,7 +537,7 @@ bool Thread::WaitBlockCondition::unblock(Process& process, WaitBlocker::UnblockF bool updated_existing = false; for (auto& info : m_processes) { if (info.process == &process) { - ASSERT(info.flags != WaitBlocker::UnblockFlags::Terminated); + VERIFY(info.flags != WaitBlocker::UnblockFlags::Terminated); info.flags = flags; info.signal = signal; info.was_waited = did_wait; @@ -559,7 +559,7 @@ bool Thread::WaitBlockCondition::should_add_blocker(Blocker& b, void*) // NOTE: m_lock is held already! if (m_finalized) return false; - ASSERT(b.blocker_type() == Blocker::Type::Wait); + VERIFY(b.blocker_type() == Blocker::Type::Wait); auto& blocker = static_cast(b); // See if we can match any process immediately for (size_t i = 0; i < m_processes.size(); i++) { @@ -577,7 +577,7 @@ bool Thread::WaitBlockCondition::should_add_blocker(Blocker& b, void*) void Thread::WaitBlockCondition::finalize() { ScopedSpinLock lock(m_lock); - ASSERT(!m_finalized); + VERIFY(!m_finalized); m_finalized = true; // Clear the list of threads here so we can drop the references to them @@ -585,7 +585,7 @@ void Thread::WaitBlockCondition::finalize() // No more waiters, drop the last reference immediately. This may // cause us to be destructed ourselves! - ASSERT(m_process.ref_count() > 0); + VERIFY(m_process.ref_count() > 0); m_process.unref(); } @@ -618,7 +618,7 @@ Thread::WaitBlocker::WaitBlocker(int wait_options, idtype_t id_type, pid_t id, K case P_ALL: break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // NOTE: unblock may be called within set_block_condition, in which @@ -630,7 +630,7 @@ Thread::WaitBlocker::WaitBlocker(int wait_options, idtype_t id_type, pid_t id, K void Thread::WaitBlocker::not_blocking(bool timeout_in_past) { - ASSERT(timeout_in_past || !m_should_block); + VERIFY(timeout_in_past || !m_should_block); if (!m_error) Process::current()->wait_block_condition().try_unblock(*this); } @@ -657,14 +657,14 @@ void Thread::WaitBlocker::was_unblocked(bool) void Thread::WaitBlocker::do_was_disowned() { - ASSERT(!m_did_unblock); + VERIFY(!m_did_unblock); m_did_unblock = true; m_result = ECHILD; } void Thread::WaitBlocker::do_set_result(const siginfo_t& result) { - ASSERT(!m_did_unblock); + VERIFY(!m_did_unblock); m_did_unblock = true; m_result = result; @@ -681,16 +681,16 @@ void Thread::WaitBlocker::do_set_result(const siginfo_t& result) bool Thread::WaitBlocker::unblock(Process& process, UnblockFlags flags, u8 signal, bool from_add_blocker) { - ASSERT(flags != UnblockFlags::Terminated || signal == 0); // signal argument should be ignored for Terminated + VERIFY(flags != UnblockFlags::Terminated || signal == 0); // signal argument should be ignored for Terminated switch (m_id_type) { case P_PID: - ASSERT(m_waitee); + VERIFY(m_waitee); if (process.pid() != m_waitee_id) return false; break; case P_PGID: - ASSERT(m_waitee_group); + VERIFY(m_waitee_group); if (process.pgid() != m_waitee_group->pgid()) return false; break; @@ -701,7 +701,7 @@ bool Thread::WaitBlocker::unblock(Process& process, UnblockFlags flags, u8 signa } break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } switch (flags) { @@ -730,7 +730,7 @@ bool Thread::WaitBlocker::unblock(Process& process, UnblockFlags flags, u8 signa } if (flags == UnblockFlags::Terminated) { - ASSERT(process.is_dead()); + VERIFY(process.is_dead()); ScopedSpinLock lock(m_lock); if (m_did_unblock) @@ -751,7 +751,7 @@ bool Thread::WaitBlocker::unblock(Process& process, UnblockFlags flags, u8 signa switch (flags) { case UnblockFlags::Terminated: case UnblockFlags::Disowned: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case UnblockFlags::Stopped: siginfo.si_code = CLD_STOPPED; break; @@ -771,7 +771,7 @@ bool Thread::WaitBlocker::unblock(Process& process, UnblockFlags flags, u8 signa if (!from_add_blocker) { // Only call unblock if we weren't called from within set_block_condition! - ASSERT(flags != UnblockFlags::Disowned); + VERIFY(flags != UnblockFlags::Disowned); unblock_from_blocker(); } // Because this may be called from add_blocker, in which case we should diff --git a/Kernel/ThreadTracer.h b/Kernel/ThreadTracer.h index 63ae7303aef..39d70c4b0b6 100644 --- a/Kernel/ThreadTracer.h +++ b/Kernel/ThreadTracer.h @@ -50,7 +50,7 @@ public: bool has_regs() const { return m_regs.has_value(); } const PtraceRegisters& regs() const { - ASSERT(m_regs.has_value()); + VERIFY(m_regs.has_value()); return m_regs.value(); } diff --git a/Kernel/Time/APICTimer.cpp b/Kernel/Time/APICTimer.cpp index a7bf3052a66..fb81ba0435c 100644 --- a/Kernel/Time/APICTimer.cpp +++ b/Kernel/Time/APICTimer.cpp @@ -54,7 +54,7 @@ UNMAP_AFTER_INIT APICTimer::APICTimer(u8 interrupt_number, Functionfind_table("HPET"); if (hpet.is_null()) @@ -142,7 +142,7 @@ UNMAP_AFTER_INIT bool HPET::test_and_initialize() auto sdt = map_typed(hpet); // Note: HPET is only usable from System Memory - ASSERT(sdt->event_timer_block.address_space == (u8)ACPI::GenericAddressStructure::AddressSpace::SystemMemory); + VERIFY(sdt->event_timer_block.address_space == (u8)ACPI::GenericAddressStructure::AddressSpace::SystemMemory); if (TimeManagement::is_hpet_periodic_mode_allowed()) { if (!check_for_exisiting_periodic_timers()) { @@ -161,7 +161,7 @@ UNMAP_AFTER_INIT bool HPET::check_for_exisiting_periodic_timers() return false; auto sdt = map_typed(hpet); - ASSERT(sdt->event_timer_block.address_space == 0); + VERIFY(sdt->event_timer_block.address_space == 0); auto registers = map_typed(PhysicalAddress(sdt->event_timer_block.address)); size_t timers_count = ((registers->capabilities.attributes >> 8) & 0x1f) + 1; @@ -232,9 +232,9 @@ void HPET::update_periodic_comparator_value() void HPET::update_non_periodic_comparator_value(const HPETComparator& comparator) { - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(!comparator.is_periodic()); - ASSERT(comparator.comparator_number() <= m_comparators.size()); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(!comparator.is_periodic()); + VERIFY(comparator.comparator_number() <= m_comparators.size()); auto& regs = registers(); auto& timer = regs.timers[comparator.comparator_number()]; u64 value = frequency() / comparator.ticks_per_second(); @@ -283,10 +283,10 @@ void HPET::enable_periodic_interrupt(const HPETComparator& comparator) klog() << "HPET: Set comparator " << comparator.comparator_number() << " to be periodic."; #endif disable(comparator); - ASSERT(comparator.comparator_number() <= m_comparators.size()); + VERIFY(comparator.comparator_number() <= m_comparators.size()); auto& timer = registers().timers[comparator.comparator_number()]; auto capabilities = timer.capabilities; - ASSERT(capabilities & (u32)HPETFlags::TimerConfiguration::PeriodicInterruptCapable); + VERIFY(capabilities & (u32)HPETFlags::TimerConfiguration::PeriodicInterruptCapable); timer.capabilities = capabilities | (u32)HPETFlags::TimerConfiguration::GeneratePeriodicInterrupt; if (comparator.is_enabled()) enable(comparator); @@ -297,10 +297,10 @@ void HPET::disable_periodic_interrupt(const HPETComparator& comparator) klog() << "HPET: Disable periodic interrupt in comparator " << comparator.comparator_number() << "."; #endif disable(comparator); - ASSERT(comparator.comparator_number() <= m_comparators.size()); + VERIFY(comparator.comparator_number() <= m_comparators.size()); auto& timer = registers().timers[comparator.comparator_number()]; auto capabilities = timer.capabilities; - ASSERT(capabilities & (u32)HPETFlags::TimerConfiguration::PeriodicInterruptCapable); + VERIFY(capabilities & (u32)HPETFlags::TimerConfiguration::PeriodicInterruptCapable); timer.capabilities = capabilities & ~(u32)HPETFlags::TimerConfiguration::GeneratePeriodicInterrupt; if (comparator.is_enabled()) enable(comparator); @@ -311,7 +311,7 @@ void HPET::disable(const HPETComparator& comparator) #if HPET_DEBUG klog() << "HPET: Disable comparator " << comparator.comparator_number() << "."; #endif - ASSERT(comparator.comparator_number() <= m_comparators.size()); + VERIFY(comparator.comparator_number() <= m_comparators.size()); auto& timer = registers().timers[comparator.comparator_number()]; timer.capabilities = timer.capabilities & ~(u32)HPETFlags::TimerConfiguration::InterruptEnable; } @@ -320,14 +320,14 @@ void HPET::enable(const HPETComparator& comparator) #if HPET_DEBUG klog() << "HPET: Enable comparator " << comparator.comparator_number() << "."; #endif - ASSERT(comparator.comparator_number() <= m_comparators.size()); + VERIFY(comparator.comparator_number() <= m_comparators.size()); auto& timer = registers().timers[comparator.comparator_number()]; timer.capabilities = timer.capabilities | (u32)HPETFlags::TimerConfiguration::InterruptEnable; } Vector HPET::capable_interrupt_numbers(const HPETComparator& comparator) { - ASSERT(comparator.comparator_number() <= m_comparators.size()); + VERIFY(comparator.comparator_number() <= m_comparators.size()); Vector capable_interrupts; auto& comparator_registers = registers().timers[comparator.comparator_number()]; u32 interrupt_bitfield = comparator_registers.interrupt_routing; @@ -341,7 +341,7 @@ Vector HPET::capable_interrupt_numbers(const HPETComparator& comparato Vector HPET::capable_interrupt_numbers(u8 comparator_number) { - ASSERT(comparator_number <= m_comparators.size()); + VERIFY(comparator_number <= m_comparators.size()); Vector capable_interrupts; auto& comparator_registers = registers().timers[comparator_number]; u32 interrupt_bitfield = comparator_registers.interrupt_routing; @@ -355,14 +355,14 @@ Vector HPET::capable_interrupt_numbers(u8 comparator_number) void HPET::set_comparator_irq_vector(u8 comparator_number, u8 irq_vector) { - ASSERT(comparator_number <= m_comparators.size()); + VERIFY(comparator_number <= m_comparators.size()); auto& comparator_registers = registers().timers[comparator_number]; comparator_registers.capabilities = comparator_registers.capabilities | (irq_vector << 9); } bool HPET::is_periodic_capable(u8 comparator_number) const { - ASSERT(comparator_number <= m_comparators.size()); + VERIFY(comparator_number <= m_comparators.size()); auto& comparator_registers = registers().timers[comparator_number]; return comparator_registers.capabilities & (u32)HPETFlags::TimerConfiguration::PeriodicInterruptCapable; } @@ -370,13 +370,13 @@ bool HPET::is_periodic_capable(u8 comparator_number) const void HPET::set_comparators_to_optimal_interrupt_state(size_t) { // FIXME: Implement this method for allowing to use HPET timers 2-31... - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } PhysicalAddress HPET::find_acpi_hpet_registers_block() { auto sdt = map_typed(m_physical_acpi_hpet_table); - ASSERT(sdt->event_timer_block.address_space == (u8)ACPI::GenericAddressStructure::AddressSpace::SystemMemory); + VERIFY(sdt->event_timer_block.address_space == (u8)ACPI::GenericAddressStructure::AddressSpace::SystemMemory); return PhysicalAddress(sdt->event_timer_block.address); } @@ -418,13 +418,13 @@ UNMAP_AFTER_INIT HPET::HPET(PhysicalAddress acpi_hpet) bool capable_64_bit = regs.timers[i].capabilities & (u32)HPETFlags::TimerConfiguration::Timer64BitsCapable; klog() << "HPET: Timer[" << i << "] comparator size: " << (capable_64_bit ? "64 bit" : "32 bit") << " mode: " << ((!capable_64_bit || (regs.timers[i].capabilities & (u32)HPETFlags::TimerConfiguration::Force32BitMode)) ? "32 bit" : "64 bit"); } - ASSERT(timers_count >= 2); + VERIFY(timers_count >= 2); global_disable(); m_frequency = NANOSECOND_PERIOD_TO_HERTZ(calculate_ticks_in_nanoseconds()); klog() << "HPET: frequency " << m_frequency << " Hz (" << MEGAHERTZ_TO_HERTZ(m_frequency) << " MHz) resolution: " << calculate_ticks_in_nanoseconds() << "ns"; - ASSERT(regs.capabilities.main_counter_tick_period <= ABSOLUTE_MAXIMUM_COUNTER_TICK_PERIOD); + VERIFY(regs.capabilities.main_counter_tick_period <= ABSOLUTE_MAXIMUM_COUNTER_TICK_PERIOD); // Reset the counter, just in case... (needs to match m_main_counter_last_read) regs.main_counter_value.high = 0; diff --git a/Kernel/Time/HPETComparator.cpp b/Kernel/Time/HPETComparator.cpp index 6179ae2b85f..78d438bb193 100644 --- a/Kernel/Time/HPETComparator.cpp +++ b/Kernel/Time/HPETComparator.cpp @@ -55,14 +55,14 @@ void HPETComparator::disable() void HPETComparator::set_periodic() { - ASSERT(m_periodic_capable); + VERIFY(m_periodic_capable); m_periodic = true; m_enabled = true; HPET::the().enable_periodic_interrupt(*this); } void HPETComparator::set_non_periodic() { - ASSERT(m_periodic_capable); + VERIFY(m_periodic_capable); m_periodic = false; m_enabled = true; HPET::the().disable_periodic_interrupt(*this); @@ -77,8 +77,8 @@ void HPETComparator::handle_irq(const RegisterState& regs) void HPETComparator::set_new_countdown() { - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(m_frequency <= HPET::the().frequency()); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(m_frequency <= HPET::the().frequency()); HPET::the().update_non_periodic_comparator_value(*this); } @@ -105,7 +105,7 @@ bool HPETComparator::try_to_set_frequency(size_t frequency) } auto hpet_frequency = HPET::the().frequency(); - ASSERT(frequency <= hpet_frequency); + VERIFY(frequency <= hpet_frequency); m_frequency = frequency; m_enabled = true; diff --git a/Kernel/Time/PIT.cpp b/Kernel/Time/PIT.cpp index 0a1f15c6531..7cf2e11be55 100644 --- a/Kernel/Time/PIT.cpp +++ b/Kernel/Time/PIT.cpp @@ -66,19 +66,19 @@ size_t PIT::ticks_per_second() const void PIT::set_periodic() { // FIXME: Implement it... - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void PIT::set_non_periodic() { // FIXME: Implement it... - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void PIT::reset_to_default_ticks_per_second() { InterruptDisabler disabler; bool success = try_to_set_frequency(OPTIMAL_TICKS_PER_SECOND_RATE); - ASSERT(success); + VERIFY(success); } bool PIT::try_to_set_frequency(size_t frequency) @@ -96,12 +96,12 @@ bool PIT::try_to_set_frequency(size_t frequency) } bool PIT::is_capable_of_frequency(size_t frequency) const { - ASSERT(frequency != 0); + VERIFY(frequency != 0); return frequency <= BASE_FREQUENCY; } size_t PIT::calculate_nearest_possible_frequency(size_t frequency) const { - ASSERT(frequency != 0); + VERIFY(frequency != 0); return frequency; } diff --git a/Kernel/Time/RTC.cpp b/Kernel/Time/RTC.cpp index 86cfcafb856..38e39f8b88b 100644 --- a/Kernel/Time/RTC.cpp +++ b/Kernel/Time/RTC.cpp @@ -62,7 +62,7 @@ void RealTimeClock::reset_to_default_ticks_per_second() { InterruptDisabler disabler; bool success = try_to_set_frequency(1024); - ASSERT(success); + VERIFY(success); } // FIXME: This is a quick & dirty log base 2 with a parameter. Please provide something better in the future. @@ -91,7 +91,7 @@ bool RealTimeClock::try_to_set_frequency(size_t frequency) } bool RealTimeClock::is_capable_of_frequency(size_t frequency) const { - ASSERT(frequency != 0); + VERIFY(frequency != 0); if (frequency > MAX_FREQUENCY) return false; if (32768 % frequency) @@ -102,7 +102,7 @@ bool RealTimeClock::is_capable_of_frequency(size_t frequency) const } size_t RealTimeClock::calculate_nearest_possible_frequency(size_t frequency) const { - ASSERT(frequency != 0); + VERIFY(frequency != 0); return frequency; } diff --git a/Kernel/Time/TimeManagement.cpp b/Kernel/Time/TimeManagement.cpp index aaf336b833b..ee4515091f6 100644 --- a/Kernel/Time/TimeManagement.cpp +++ b/Kernel/Time/TimeManagement.cpp @@ -118,10 +118,10 @@ timespec TimeManagement::monotonic_time(TimePrecision precision) const } } while (update_iteration != m_update2.load(AK::MemoryOrder::memory_order_acquire)); - ASSERT(m_time_ticks_per_second > 0); - ASSERT(ticks < m_time_ticks_per_second); + VERIFY(m_time_ticks_per_second > 0); + VERIFY(ticks < m_time_ticks_per_second); u64 ns = ((u64)ticks * 1000000000ull) / m_time_ticks_per_second; - ASSERT(ns < 1000000000ull); + VERIFY(ns < 1000000000ull); return { (long)seconds, (long)ns }; } @@ -148,7 +148,7 @@ u64 TimeManagement::uptime_ms() const UNMAP_AFTER_INIT void TimeManagement::initialize(u32 cpu) { if (cpu == 0) { - ASSERT(!s_the.is_initialized()); + VERIFY(!s_the.is_initialized()); s_the.ensure_instance(); // Initialize the APIC timers after the other timers as the @@ -160,7 +160,7 @@ UNMAP_AFTER_INIT void TimeManagement::initialize(u32 cpu) s_the->set_system_timer(*apic_timer); } } else { - ASSERT(s_the.is_initialized()); + VERIFY(s_the.is_initialized()); if (auto* apic_timer = APIC::the().get_timer()) { klog() << "Time: Enable APIC timer on CPU #" << cpu; apic_timer->enable_local_timer(); @@ -170,7 +170,7 @@ UNMAP_AFTER_INIT void TimeManagement::initialize(u32 cpu) void TimeManagement::set_system_timer(HardwareTimerBase& timer) { - ASSERT(Processor::id() == 0); // This should only be called on the BSP! + VERIFY(Processor::id() == 0); // This should only be called on the BSP! auto original_callback = m_system_timer->set_callback(nullptr); m_system_timer->disable(); timer.set_callback(move(original_callback)); @@ -205,9 +205,9 @@ UNMAP_AFTER_INIT TimeManagement::TimeManagement() if (probe_non_legacy_hardware_timers) { if (!probe_and_set_non_legacy_hardware_timers()) if (!probe_and_set_legacy_hardware_timers()) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else if (!probe_and_set_legacy_hardware_timers()) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -252,7 +252,7 @@ bool TimeManagement::is_hpet_periodic_mode_allowed() return true; if (hpet_mode == "nonperiodic") return false; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } UNMAP_AFTER_INIT bool TimeManagement::probe_and_set_non_legacy_hardware_timers() @@ -274,9 +274,9 @@ UNMAP_AFTER_INIT bool TimeManagement::probe_and_set_non_legacy_hardware_timers() auto non_periodic_timers = scan_for_non_periodic_timers(); if (is_hpet_periodic_mode_allowed()) - ASSERT(!periodic_timers.is_empty()); + VERIFY(!periodic_timers.is_empty()); - ASSERT(periodic_timers.size() + non_periodic_timers.size() > 0); + VERIFY(periodic_timers.size() + non_periodic_timers.size() > 0); if (periodic_timers.size() > 0) m_system_timer = periodic_timers[0]; @@ -337,8 +337,8 @@ void TimeManagement::update_time(const RegisterState&) void TimeManagement::increment_time_since_boot_hpet() { - ASSERT(!m_time_keeper_timer.is_null()); - ASSERT(m_time_keeper_timer->timer_type() == HardwareTimerType::HighPrecisionEventTimer); + VERIFY(!m_time_keeper_timer.is_null()); + VERIFY(m_time_keeper_timer->timer_type() == HardwareTimerType::HighPrecisionEventTimer); // NOTE: m_seconds_since_boot and m_ticks_this_second are only ever // updated here! So we can safely read that information, query the clock, @@ -359,7 +359,7 @@ void TimeManagement::increment_time_since_boot_hpet() void TimeManagement::increment_time_since_boot() { - ASSERT(!m_time_keeper_timer.is_null()); + VERIFY(!m_time_keeper_timer.is_null()); // Compute time adjustment for adjtime. Let the clock run up to 1% fast or slow. // That way, adjtime can adjust up to 36 seconds per hour, without time getting very jumpy. diff --git a/Kernel/TimerQueue.cpp b/Kernel/TimerQueue.cpp index 60ff468d63c..54f31d216f2 100644 --- a/Kernel/TimerQueue.cpp +++ b/Kernel/TimerQueue.cpp @@ -112,7 +112,7 @@ TimerId TimerQueue::add_timer(NonnullRefPtr&& timer) ScopedSpinLock lock(g_timerqueue_lock); timer->m_id = ++m_timer_id_count; - ASSERT(timer->m_id != 0); // wrapped + VERIFY(timer->m_id != 0); // wrapped add_timer_locked(move(timer)); return m_timer_id_count; } @@ -121,7 +121,7 @@ void TimerQueue::add_timer_locked(NonnullRefPtr timer) { u64 timer_expiration = timer->m_expires; - ASSERT(!timer->is_queued()); + VERIFY(!timer->is_queued()); auto& queue = queue_for_timer(*timer); if (queue.list.is_empty()) { @@ -202,8 +202,8 @@ bool TimerQueue::cancel_timer(TimerId id) return false; } - ASSERT(found_timer); - ASSERT(timer_queue); + VERIFY(found_timer); + VERIFY(timer_queue); remove_timer_locked(*timer_queue, *found_timer); return true; } @@ -231,7 +231,7 @@ bool TimerQueue::cancel_timer(Timer& timer) return false; } - ASSERT(timer.ref_count() > 1); + VERIFY(timer.ref_count() > 1); remove_timer_locked(timer_queue, timer); return true; } @@ -259,8 +259,8 @@ void TimerQueue::fire() auto fire_timers = [&](Queue& queue) { auto* timer = queue.list.head(); - ASSERT(timer); - ASSERT(queue.next_timer_due == timer->m_expires); + VERIFY(timer); + VERIFY(queue.next_timer_due == timer->m_expires); while (timer && timer->now(true) > timer->m_expires) { queue.list.remove(timer); @@ -294,7 +294,7 @@ void TimerQueue::fire() void TimerQueue::update_next_timer_due(Queue& queue) { - ASSERT(g_timerqueue_lock.is_locked()); + VERIFY(g_timerqueue_lock.is_locked()); if (auto* next_timer = queue.list.head()) queue.next_timer_due = next_timer->m_expires; diff --git a/Kernel/TimerQueue.h b/Kernel/TimerQueue.h index 87f73af7f8b..7c5040bc5bf 100644 --- a/Kernel/TimerQueue.h +++ b/Kernel/TimerQueue.h @@ -51,7 +51,7 @@ public: } ~Timer() { - ASSERT(!is_queued()); + VERIFY(!is_queued()); } timespec remaining() const; @@ -121,7 +121,7 @@ private: case CLOCK_REALTIME_COARSE: return m_timer_queue_realtime; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Kernel/UserOrKernelBuffer.h b/Kernel/UserOrKernelBuffer.h index 9bbbfc21aa6..fd49ae88552 100644 --- a/Kernel/UserOrKernelBuffer.h +++ b/Kernel/UserOrKernelBuffer.h @@ -42,7 +42,7 @@ public: static UserOrKernelBuffer for_kernel_buffer(u8* kernel_buffer) { - ASSERT(!kernel_buffer || !is_user_address(VirtualAddress(kernel_buffer))); + VERIFY(!kernel_buffer || !is_user_address(VirtualAddress(kernel_buffer))); return UserOrKernelBuffer(kernel_buffer); } @@ -70,7 +70,7 @@ public: return *this; UserOrKernelBuffer offset_buffer = *this; offset_buffer.m_buffer += offset; - ASSERT(offset_buffer.is_kernel_buffer() == is_kernel_buffer()); + VERIFY(offset_buffer.is_kernel_buffer() == is_kernel_buffer()); return offset_buffer; } @@ -120,7 +120,7 @@ public: ssize_t copied = f(buffer, to_copy); if (copied < 0) return copied; - ASSERT((size_t)copied <= to_copy); + VERIFY((size_t)copied <= to_copy); if (!write(buffer, nwritten, (size_t)copied)) return -EFAULT; nwritten += (size_t)copied; @@ -156,7 +156,7 @@ public: ssize_t copied = f(buffer, to_copy); if (copied < 0) return copied; - ASSERT((size_t)copied <= to_copy); + VERIFY((size_t)copied <= to_copy); nread += (size_t)copied; if ((size_t)copied < to_copy) break; diff --git a/Kernel/VM/AnonymousVMObject.cpp b/Kernel/VM/AnonymousVMObject.cpp index 0f8b0549d9f..1c99d47b1db 100644 --- a/Kernel/VM/AnonymousVMObject.cpp +++ b/Kernel/VM/AnonymousVMObject.cpp @@ -114,7 +114,7 @@ AnonymousVMObject::AnonymousVMObject(PhysicalAddress paddr, size_t size) : VMObject(size) , m_volatile_ranges_cache({ 0, page_count() }) { - ASSERT(paddr.page_base() == paddr); + VERIFY(paddr.page_base() == paddr); for (size_t i = 0; i < page_count(); ++i) physical_pages()[i] = PhysicalPage::create(paddr.offset(i * PAGE_SIZE), false, false); } @@ -136,7 +136,7 @@ AnonymousVMObject::AnonymousVMObject(const AnonymousVMObject& other) , m_shared_committed_cow_pages(other.m_shared_committed_cow_pages) // share the pool { // We can't really "copy" a spinlock. But we're holding it. Clear in the clone - ASSERT(other.m_lock.is_locked()); + VERIFY(other.m_lock.is_locked()); m_lock.initialize(); // The clone also becomes COW @@ -154,7 +154,7 @@ AnonymousVMObject::AnonymousVMObject(const AnonymousVMObject& other) break; } } - ASSERT(m_unused_committed_pages == 0); + VERIFY(m_unused_committed_pages == 0); } } @@ -173,7 +173,7 @@ int AnonymousVMObject::purge() int AnonymousVMObject::purge_with_interrupts_disabled(Badge) { - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); if (m_paging_lock.is_locked()) return 0; return purge_impl(); @@ -181,7 +181,7 @@ int AnonymousVMObject::purge_with_interrupts_disabled(Badge) void AnonymousVMObject::set_was_purged(const VolatilePageRange& range) { - ASSERT(m_lock.is_locked()); + VERIFY(m_lock.is_locked()); for (auto* purgeable_ranges : m_purgeable_ranges) purgeable_ranges->set_was_purged(range); } @@ -196,7 +196,7 @@ int AnonymousVMObject::purge_impl() for (size_t i = range.base; i < range_end; i++) { auto& phys_page = m_physical_pages[i]; if (phys_page && !phys_page->is_shared_zero_page()) { - ASSERT(!phys_page->is_lazy_committed_page()); + VERIFY(!phys_page->is_lazy_committed_page()); ++purged_in_range; } phys_page = MM.shared_zero_page(); @@ -226,7 +226,7 @@ void AnonymousVMObject::register_purgeable_page_ranges(PurgeablePageRanges& purg { ScopedSpinLock lock(m_lock); purgeable_page_ranges.set_vmobject(this); - ASSERT(!m_purgeable_ranges.contains_slow(&purgeable_page_ranges)); + VERIFY(!m_purgeable_ranges.contains_slow(&purgeable_page_ranges)); m_purgeable_ranges.append(&purgeable_page_ranges); } @@ -240,7 +240,7 @@ void AnonymousVMObject::unregister_purgeable_page_ranges(PurgeablePageRanges& pu m_purgeable_ranges.remove(i); return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool AnonymousVMObject::is_any_volatile() const @@ -256,7 +256,7 @@ bool AnonymousVMObject::is_any_volatile() const size_t AnonymousVMObject::remove_lazy_commit_pages(const VolatilePageRange& range) { - ASSERT(m_lock.is_locked()); + VERIFY(m_lock.is_locked()); size_t removed_count = 0; auto range_end = range.base + range.count; @@ -265,7 +265,7 @@ size_t AnonymousVMObject::remove_lazy_commit_pages(const VolatilePageRange& rang if (phys_page && phys_page->is_lazy_committed_page()) { phys_page = MM.shared_zero_page(); removed_count++; - ASSERT(m_unused_committed_pages > 0); + VERIFY(m_unused_committed_pages > 0); if (--m_unused_committed_pages == 0) break; } @@ -275,8 +275,8 @@ size_t AnonymousVMObject::remove_lazy_commit_pages(const VolatilePageRange& rang void AnonymousVMObject::update_volatile_cache() { - ASSERT(m_lock.is_locked()); - ASSERT(m_volatile_ranges_cache_dirty); + VERIFY(m_lock.is_locked()); + VERIFY(m_volatile_ranges_cache_dirty); m_volatile_ranges_cache.clear(); for_each_nonvolatile_range([&](const VolatilePageRange& range) { @@ -289,7 +289,7 @@ void AnonymousVMObject::update_volatile_cache() void AnonymousVMObject::range_made_volatile(const VolatilePageRange& range) { - ASSERT(m_lock.is_locked()); + VERIFY(m_lock.is_locked()); if (m_unused_committed_pages == 0) return; @@ -322,14 +322,14 @@ void AnonymousVMObject::range_made_volatile(const VolatilePageRange& range) void AnonymousVMObject::range_made_nonvolatile(const VolatilePageRange&) { - ASSERT(m_lock.is_locked()); + VERIFY(m_lock.is_locked()); m_volatile_ranges_cache_dirty = true; } size_t AnonymousVMObject::count_needed_commit_pages_for_nonvolatile_range(const VolatilePageRange& range) { - ASSERT(m_lock.is_locked()); - ASSERT(!range.is_empty()); + VERIFY(m_lock.is_locked()); + VERIFY(!range.is_empty()); size_t need_commit_pages = 0; auto range_end = range.base + range.count; @@ -346,9 +346,9 @@ size_t AnonymousVMObject::count_needed_commit_pages_for_nonvolatile_range(const size_t AnonymousVMObject::mark_committed_pages_for_nonvolatile_range(const VolatilePageRange& range, size_t mark_total) { - ASSERT(m_lock.is_locked()); - ASSERT(!range.is_empty()); - ASSERT(mark_total > 0); + VERIFY(m_lock.is_locked()); + VERIFY(!range.is_empty()); + VERIFY(mark_total > 0); size_t pages_updated = 0; auto range_end = range.base + range.count; @@ -376,10 +376,10 @@ RefPtr AnonymousVMObject::allocate_committed_page(size_t page_inde { ScopedSpinLock lock(m_lock); - ASSERT(m_unused_committed_pages > 0); + VERIFY(m_unused_committed_pages > 0); // We shouldn't have any committed page tags in volatile regions - ASSERT([&]() { + VERIFY([&]() { for (auto* purgeable_ranges : m_purgeable_ranges) { if (purgeable_ranges->is_volatile(page_index)) return false; @@ -438,7 +438,7 @@ bool AnonymousVMObject::is_nonvolatile(size_t page_index) PageFaultResponse AnonymousVMObject::handle_cow_fault(size_t page_index, VirtualAddress vaddr) { - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); ScopedSpinLock lock(m_lock); auto& page_slot = physical_pages()[page_index]; bool have_committed = m_shared_committed_cow_pages && is_nonvolatile(page_index); @@ -484,7 +484,7 @@ PageFaultResponse AnonymousVMObject::handle_cow_fault(size_t page_index, Virtual dbgln(" >> COW: error copying page {}/{} to {}/{}: failed to read from page at {}", page_slot->paddr(), vaddr, page->paddr(), VirtualAddress(dest_ptr), VirtualAddress(fault_at)); else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } page_slot = move(page); diff --git a/Kernel/VM/AnonymousVMObject.h b/Kernel/VM/AnonymousVMObject.h index 0e0cd983116..ead937dd52c 100644 --- a/Kernel/VM/AnonymousVMObject.h +++ b/Kernel/VM/AnonymousVMObject.h @@ -62,7 +62,7 @@ public: template IterationDecision for_each_volatile_range(F f) const { - ASSERT(m_lock.is_locked()); + VERIFY(m_lock.is_locked()); // This is a little ugly. Basically, we're trying to find the // volatile ranges that all share, because those are the only // pages we can actually purge diff --git a/Kernel/VM/ContiguousVMObject.cpp b/Kernel/VM/ContiguousVMObject.cpp index c382942fb94..8d8109913c9 100644 --- a/Kernel/VM/ContiguousVMObject.cpp +++ b/Kernel/VM/ContiguousVMObject.cpp @@ -56,7 +56,7 @@ ContiguousVMObject::~ContiguousVMObject() RefPtr ContiguousVMObject::clone() { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Kernel/VM/InodeVMObject.cpp b/Kernel/VM/InodeVMObject.cpp index 4f8799142e4..77f02d0af5c 100644 --- a/Kernel/VM/InodeVMObject.cpp +++ b/Kernel/VM/InodeVMObject.cpp @@ -53,7 +53,7 @@ InodeVMObject::~InodeVMObject() size_t InodeVMObject::amount_clean() const { size_t count = 0; - ASSERT(page_count() == m_dirty_pages.size()); + VERIFY(page_count() == m_dirty_pages.size()); for (size_t i = 0; i < page_count(); ++i) { if (!m_dirty_pages.get(i) && m_physical_pages[i]) ++count; @@ -91,7 +91,7 @@ void InodeVMObject::inode_size_changed(Badge, size_t old_size, size_t new void InodeVMObject::inode_contents_changed(Badge, off_t offset, [[maybe_unused]] ssize_t size, [[maybe_unused]] const UserOrKernelBuffer& data) { InterruptDisabler disabler; - ASSERT(offset >= 0); + VERIFY(offset >= 0); // FIXME: Only invalidate the parts that actually changed. for (auto& physical_page : m_physical_pages) diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index 90e764575d4..ac7c7964ff2 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -91,7 +91,7 @@ UNMAP_AFTER_INIT MemoryManager::MemoryManager() // We're temporarily "committing" to two pages that we need to allocate below if (!commit_user_physical_pages(2)) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); m_shared_zero_page = allocate_committed_user_physical_page(); @@ -158,7 +158,7 @@ void MemoryManager::unmap_memory_after_init() UNMAP_AFTER_INIT void MemoryManager::register_reserved_ranges() { - ASSERT(!m_physical_memory_ranges.is_empty()); + VERIFY(!m_physical_memory_ranges.is_empty()); ContiguousReservedMemoryRange range; for (auto& current_range : m_physical_memory_ranges) { if (current_range.type != PhysicalMemoryRangeType::Reserved) { @@ -182,7 +182,7 @@ UNMAP_AFTER_INIT void MemoryManager::register_reserved_ranges() bool MemoryManager::is_allowed_to_mmap_to_userspace(PhysicalAddress start_address, const Range& range) const { - ASSERT(!m_reserved_memory_ranges.is_empty()); + VERIFY(!m_reserved_memory_ranges.is_empty()); for (auto& current_range : m_reserved_memory_ranges) { if (!(current_range.start <= start_address)) continue; @@ -310,8 +310,8 @@ UNMAP_AFTER_INIT void MemoryManager::parse_memory_map() dmesgln("MM: User physical region: {} - {}", region.lower(), region.upper()); } - ASSERT(m_super_physical_pages > 0); - ASSERT(m_user_physical_pages > 0); + VERIFY(m_super_physical_pages > 0); + VERIFY(m_user_physical_pages > 0); // We start out with no committed pages m_user_physical_pages_uncommitted = m_user_physical_pages.load(); @@ -323,9 +323,9 @@ UNMAP_AFTER_INIT void MemoryManager::parse_memory_map() PageTableEntry* MemoryManager::pte(PageDirectory& page_directory, VirtualAddress vaddr) { - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(s_mm_lock.own_lock()); - ASSERT(page_directory.get_lock().own_lock()); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(s_mm_lock.own_lock()); + VERIFY(page_directory.get_lock().own_lock()); u32 page_directory_table_index = (vaddr.get() >> 30) & 0x3; u32 page_directory_index = (vaddr.get() >> 21) & 0x1ff; u32 page_table_index = (vaddr.get() >> 12) & 0x1ff; @@ -340,9 +340,9 @@ PageTableEntry* MemoryManager::pte(PageDirectory& page_directory, VirtualAddress PageTableEntry* MemoryManager::ensure_pte(PageDirectory& page_directory, VirtualAddress vaddr) { - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(s_mm_lock.own_lock()); - ASSERT(page_directory.get_lock().own_lock()); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(s_mm_lock.own_lock()); + VERIFY(page_directory.get_lock().own_lock()); u32 page_directory_table_index = (vaddr.get() >> 30) & 0x3; u32 page_directory_index = (vaddr.get() >> 21) & 0x1ff; u32 page_table_index = (vaddr.get() >> 12) & 0x1ff; @@ -361,9 +361,9 @@ PageTableEntry* MemoryManager::ensure_pte(PageDirectory& page_directory, Virtual // of the purging process. So we need to re-map the pd in this case to ensure // we're writing to the correct underlying physical page pd = quickmap_pd(page_directory, page_directory_table_index); - ASSERT(&pde == &pd[page_directory_index]); // Sanity check + VERIFY(&pde == &pd[page_directory_index]); // Sanity check - ASSERT(!pde.is_present()); // Should have not changed + VERIFY(!pde.is_present()); // Should have not changed } pde.set_page_table_base(page_table->paddr().get()); pde.set_user_allowed(true); @@ -373,7 +373,7 @@ PageTableEntry* MemoryManager::ensure_pte(PageDirectory& page_directory, Virtual // Use page_directory_table_index and page_directory_index as key // This allows us to release the page table entry when no longer needed auto result = page_directory.m_page_tables.set(vaddr.get() & ~0x1fffff, move(page_table)); - ASSERT(result == AK::HashSetResult::InsertedNewEntry); + VERIFY(result == AK::HashSetResult::InsertedNewEntry); } return &quickmap_pt(PhysicalAddress((FlatPtr)pde.page_table_base()))[page_table_index]; @@ -381,9 +381,9 @@ PageTableEntry* MemoryManager::ensure_pte(PageDirectory& page_directory, Virtual void MemoryManager::release_pte(PageDirectory& page_directory, VirtualAddress vaddr, bool is_last_release) { - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(s_mm_lock.own_lock()); - ASSERT(page_directory.get_lock().own_lock()); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(s_mm_lock.own_lock()); + VERIFY(page_directory.get_lock().own_lock()); u32 page_directory_table_index = (vaddr.get() >> 30) & 0x3; u32 page_directory_index = (vaddr.get() >> 21) & 0x1ff; u32 page_table_index = (vaddr.get() >> 12) & 0x1ff; @@ -409,7 +409,7 @@ void MemoryManager::release_pte(PageDirectory& page_directory, VirtualAddress va pde.clear(); auto result = page_directory.m_page_tables.remove(vaddr.get() & ~0x1fffff); - ASSERT(result); + VERIFY(result); } } } @@ -463,13 +463,13 @@ Region* MemoryManager::find_region_from_vaddr(VirtualAddress vaddr) auto page_directory = PageDirectory::find_by_cr3(read_cr3()); if (!page_directory) return nullptr; - ASSERT(page_directory->space()); + VERIFY(page_directory->space()); return user_region_from_vaddr(*page_directory->space(), vaddr); } PageFaultResponse MemoryManager::handle_page_fault(const PageFault& fault) { - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); ScopedSpinLock lock(s_mm_lock); if (Processor::current().in_irq()) { dbgln("CPU[{}] BUG! Page fault while handling IRQ! code={}, vaddr={}, irq level: {}", @@ -491,7 +491,7 @@ PageFaultResponse MemoryManager::handle_page_fault(const PageFault& fault) OwnPtr MemoryManager::allocate_contiguous_kernel_region(size_t size, String name, u8 access, size_t physical_alignment, Region::Cacheable cacheable) { - ASSERT(!(size % PAGE_SIZE)); + VERIFY(!(size % PAGE_SIZE)); ScopedSpinLock lock(s_mm_lock); auto range = kernel_page_directory().range_allocator().allocate_anywhere(size); if (!range.has_value()) @@ -502,7 +502,7 @@ OwnPtr MemoryManager::allocate_contiguous_kernel_region(size_t size, Str OwnPtr MemoryManager::allocate_kernel_region(size_t size, String name, u8 access, AllocationStrategy strategy, Region::Cacheable cacheable) { - ASSERT(!(size % PAGE_SIZE)); + VERIFY(!(size % PAGE_SIZE)); ScopedSpinLock lock(s_mm_lock); auto range = kernel_page_directory().range_allocator().allocate_anywhere(size); if (!range.has_value()) @@ -515,7 +515,7 @@ OwnPtr MemoryManager::allocate_kernel_region(size_t size, String name, u OwnPtr MemoryManager::allocate_kernel_region(PhysicalAddress paddr, size_t size, String name, u8 access, Region::Cacheable cacheable) { - ASSERT(!(size % PAGE_SIZE)); + VERIFY(!(size % PAGE_SIZE)); ScopedSpinLock lock(s_mm_lock); auto range = kernel_page_directory().range_allocator().allocate_anywhere(size); if (!range.has_value()) @@ -528,7 +528,7 @@ OwnPtr MemoryManager::allocate_kernel_region(PhysicalAddress paddr, size OwnPtr MemoryManager::allocate_kernel_region_identity(PhysicalAddress paddr, size_t size, String name, u8 access, Region::Cacheable cacheable) { - ASSERT(!(size % PAGE_SIZE)); + VERIFY(!(size % PAGE_SIZE)); ScopedSpinLock lock(s_mm_lock); auto range = kernel_page_directory().identity_range_allocator().allocate_specific(VirtualAddress(paddr.get()), size); if (!range.has_value()) @@ -550,7 +550,7 @@ OwnPtr MemoryManager::allocate_kernel_region_with_vmobject(const Range& OwnPtr MemoryManager::allocate_kernel_region_with_vmobject(VMObject& vmobject, size_t size, String name, u8 access, Region::Cacheable cacheable) { - ASSERT(!(size % PAGE_SIZE)); + VERIFY(!(size % PAGE_SIZE)); ScopedSpinLock lock(s_mm_lock); auto range = kernel_page_directory().range_allocator().allocate_anywhere(size); if (!range.has_value()) @@ -560,7 +560,7 @@ OwnPtr MemoryManager::allocate_kernel_region_with_vmobject(VMObject& vmo bool MemoryManager::commit_user_physical_pages(size_t page_count) { - ASSERT(page_count > 0); + VERIFY(page_count > 0); ScopedSpinLock lock(s_mm_lock); if (m_user_physical_pages_uncommitted < page_count) return false; @@ -572,9 +572,9 @@ bool MemoryManager::commit_user_physical_pages(size_t page_count) void MemoryManager::uncommit_user_physical_pages(size_t page_count) { - ASSERT(page_count > 0); + VERIFY(page_count > 0); ScopedSpinLock lock(s_mm_lock); - ASSERT(m_user_physical_pages_committed >= page_count); + VERIFY(m_user_physical_pages_committed >= page_count); m_user_physical_pages_uncommitted += page_count; m_user_physical_pages_committed -= page_count; @@ -598,16 +598,16 @@ void MemoryManager::deallocate_user_physical_page(const PhysicalPage& page) } dmesgln("MM: deallocate_user_physical_page couldn't figure out region for user page @ {}", page.paddr()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } RefPtr MemoryManager::find_free_user_physical_page(bool committed) { - ASSERT(s_mm_lock.is_locked()); + VERIFY(s_mm_lock.is_locked()); RefPtr page; if (committed) { // Draw from the committed pages pool. We should always have these pages available - ASSERT(m_user_physical_pages_committed > 0); + VERIFY(m_user_physical_pages_committed > 0); m_user_physical_pages_committed--; } else { // We need to make sure we don't touch pages that we have committed to @@ -622,7 +622,7 @@ RefPtr MemoryManager::find_free_user_physical_page(bool committed) break; } } - ASSERT(!committed || !page.is_null()); + VERIFY(!committed || !page.is_null()); return page; } @@ -655,7 +655,7 @@ RefPtr MemoryManager::allocate_user_physical_page(ShouldZeroFill s dbgln("MM: Purge saved the day! Purged {} pages from AnonymousVMObject", purged_page_count); page = find_free_user_physical_page(false); purged_pages = true; - ASSERT(page); + VERIFY(page); return IterationDecision::Break; } return IterationDecision::Continue; @@ -692,12 +692,12 @@ void MemoryManager::deallocate_supervisor_physical_page(const PhysicalPage& page } dbgln("MM: deallocate_supervisor_physical_page couldn't figure out region for super page @ {}", page.paddr()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } NonnullRefPtrVector MemoryManager::allocate_contiguous_supervisor_physical_pages(size_t size, size_t physical_alignment) { - ASSERT(!(size % PAGE_SIZE)); + VERIFY(!(size % PAGE_SIZE)); ScopedSpinLock lock(s_mm_lock); size_t count = ceil_div(size, PAGE_SIZE); NonnullRefPtrVector physical_pages; @@ -714,7 +714,7 @@ NonnullRefPtrVector MemoryManager::allocate_contiguous_supervisor_ } dmesgln("MM: no super physical pages available"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } @@ -741,7 +741,7 @@ RefPtr MemoryManager::allocate_supervisor_physical_page() } dmesgln("MM: no super physical pages available"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } @@ -758,7 +758,7 @@ void MemoryManager::enter_process_paging_scope(Process& process) void MemoryManager::enter_space(Space& space) { auto current_thread = Thread::current(); - ASSERT(current_thread != nullptr); + VERIFY(current_thread != nullptr); ScopedSpinLock lock(s_mm_lock); current_thread->tss().cr3 = space.page_directory().cr3(); @@ -779,7 +779,7 @@ extern "C" PageTableEntry boot_pd3_pt1023[1024]; PageDirectoryEntry* MemoryManager::quickmap_pd(PageDirectory& directory, size_t pdpt_index) { - ASSERT(s_mm_lock.own_lock()); + VERIFY(s_mm_lock.own_lock()); auto& mm_data = get_data(); auto& pte = boot_pd3_pt1023[4]; auto pd_paddr = directory.m_directory_pages[pdpt_index]->paddr(); @@ -805,7 +805,7 @@ PageDirectoryEntry* MemoryManager::quickmap_pd(PageDirectory& directory, size_t PageTableEntry* MemoryManager::quickmap_pt(PhysicalAddress pt_paddr) { - ASSERT(s_mm_lock.own_lock()); + VERIFY(s_mm_lock.own_lock()); auto& mm_data = get_data(); auto& pte = boot_pd3_pt1023[0]; if (pte.physical_page_base() != pt_paddr.as_ptr()) { @@ -830,7 +830,7 @@ PageTableEntry* MemoryManager::quickmap_pt(PhysicalAddress pt_paddr) u8* MemoryManager::quickmap_page(PhysicalPage& physical_page) { - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); auto& mm_data = get_data(); mm_data.m_quickmap_prev_flags = mm_data.m_quickmap_in_use.lock(); ScopedSpinLock lock(s_mm_lock); @@ -851,10 +851,10 @@ u8* MemoryManager::quickmap_page(PhysicalPage& physical_page) void MemoryManager::unquickmap_page() { - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); ScopedSpinLock lock(s_mm_lock); auto& mm_data = get_data(); - ASSERT(mm_data.m_quickmap_in_use.is_locked()); + VERIFY(mm_data.m_quickmap_in_use.is_locked()); u32 pte_idx = 8 + Processor::id(); VirtualAddress vaddr(0xffe00000 + pte_idx * PAGE_SIZE); auto& pte = boot_pd3_pt1023[pte_idx]; diff --git a/Kernel/VM/MemoryManager.h b/Kernel/VM/MemoryManager.h index 5e9491e8be7..be1fe34840c 100644 --- a/Kernel/VM/MemoryManager.h +++ b/Kernel/VM/MemoryManager.h @@ -48,7 +48,7 @@ constexpr FlatPtr page_round_up(FlatPtr x) { FlatPtr rounded = (((FlatPtr)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1)); // Rounding up >0xffff0000 wraps back to 0. That's never what we want. - ASSERT(x == 0 || rounded != 0); + VERIFY(x == 0 || rounded != 0); return rounded; } diff --git a/Kernel/VM/PageDirectory.cpp b/Kernel/VM/PageDirectory.cpp index 5bc207c7615..83d59ddb58d 100644 --- a/Kernel/VM/PageDirectory.cpp +++ b/Kernel/VM/PageDirectory.cpp @@ -40,7 +40,7 @@ static AK::Singleton> s_cr3_map; static HashMap& cr3_map() { - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); return *s_cr3_map; } @@ -125,10 +125,10 @@ PageDirectory::PageDirectory(const RangeAllocator* parent_range_allocator) // when writing out the PDPT pointer to CR3. // The reason we're not checking the page directory's physical address directly is because // we're checking for sign extension when putting it into a PDPTE. See issue #4584. - ASSERT((table.raw[0] & ~pdpte_bit_flags) <= max_physical_address); - ASSERT((table.raw[1] & ~pdpte_bit_flags) <= max_physical_address); - ASSERT((table.raw[2] & ~pdpte_bit_flags) <= max_physical_address); - ASSERT((table.raw[3] & ~pdpte_bit_flags) <= max_physical_address); + VERIFY((table.raw[0] & ~pdpte_bit_flags) <= max_physical_address); + VERIFY((table.raw[1] & ~pdpte_bit_flags) <= max_physical_address); + VERIFY((table.raw[2] & ~pdpte_bit_flags) <= max_physical_address); + VERIFY((table.raw[3] & ~pdpte_bit_flags) <= max_physical_address); MM.unquickmap_page(); } diff --git a/Kernel/VM/PhysicalPage.cpp b/Kernel/VM/PhysicalPage.cpp index 957ab9007d7..66c23db9924 100644 --- a/Kernel/VM/PhysicalPage.cpp +++ b/Kernel/VM/PhysicalPage.cpp @@ -44,7 +44,7 @@ PhysicalPage::PhysicalPage(PhysicalAddress paddr, bool supervisor, bool may_retu void PhysicalPage::return_to_freelist() const { - ASSERT((paddr().get() & ~PAGE_MASK) == 0); + VERIFY((paddr().get() & ~PAGE_MASK) == 0); if (m_supervisor) MM.deallocate_supervisor_physical_page(*this); diff --git a/Kernel/VM/PhysicalRegion.cpp b/Kernel/VM/PhysicalRegion.cpp index 0df7cd4049c..b83a9d42140 100644 --- a/Kernel/VM/PhysicalRegion.cpp +++ b/Kernel/VM/PhysicalRegion.cpp @@ -49,7 +49,7 @@ PhysicalRegion::PhysicalRegion(PhysicalAddress lower, PhysicalAddress upper) void PhysicalRegion::expand(PhysicalAddress lower, PhysicalAddress upper) { - ASSERT(!m_pages); + VERIFY(!m_pages); m_lower = lower; m_upper = upper; @@ -57,7 +57,7 @@ void PhysicalRegion::expand(PhysicalAddress lower, PhysicalAddress upper) unsigned PhysicalRegion::finalize_capacity() { - ASSERT(!m_pages); + VERIFY(!m_pages); m_pages = (m_upper.get() - m_lower.get()) / PAGE_SIZE; m_bitmap.grow(m_pages, false); @@ -67,8 +67,8 @@ unsigned PhysicalRegion::finalize_capacity() NonnullRefPtrVector PhysicalRegion::take_contiguous_free_pages(size_t count, bool supervisor, size_t physical_alignment) { - ASSERT(m_pages); - ASSERT(m_used != m_pages); + VERIFY(m_pages); + VERIFY(m_used != m_pages); NonnullRefPtrVector physical_pages; physical_pages.ensure_capacity(count); @@ -82,11 +82,11 @@ NonnullRefPtrVector PhysicalRegion::take_contiguous_free_pages(siz unsigned PhysicalRegion::find_contiguous_free_pages(size_t count, size_t physical_alignment) { - ASSERT(count != 0); - ASSERT(physical_alignment % PAGE_SIZE == 0); + VERIFY(count != 0); + VERIFY(physical_alignment % PAGE_SIZE == 0); // search from the last page we allocated auto range = find_and_allocate_contiguous_range(count, physical_alignment / PAGE_SIZE); - ASSERT(range.has_value()); + VERIFY(range.has_value()); return range.value(); } @@ -100,8 +100,8 @@ Optional PhysicalRegion::find_one_free_page() Checked local_offset = m_recently_returned[index].get(); local_offset -= m_lower.get(); m_recently_returned.remove(index); - ASSERT(!local_offset.has_overflow()); - ASSERT(local_offset.value() < (FlatPtr)(m_pages * PAGE_SIZE)); + VERIFY(!local_offset.has_overflow()); + VERIFY(local_offset.value() < (FlatPtr)(m_pages * PAGE_SIZE)); return local_offset.value() / PAGE_SIZE; } return {}; @@ -121,7 +121,7 @@ Optional PhysicalRegion::find_one_free_page() Optional PhysicalRegion::find_and_allocate_contiguous_range(size_t count, unsigned alignment) { - ASSERT(count != 0); + VERIFY(count != 0); size_t found_pages_count = 0; // TODO: Improve how we deal with alignment != 1 auto first_index = m_bitmap.find_longest_range_of_unset_bits(count + alignment - 1, found_pages_count); @@ -146,7 +146,7 @@ Optional PhysicalRegion::find_and_allocate_contiguous_range(size_t cou RefPtr PhysicalRegion::take_free_page(bool supervisor) { - ASSERT(m_pages); + VERIFY(m_pages); auto free_index = find_one_free_page(); if (!free_index.has_value()) @@ -157,16 +157,16 @@ RefPtr PhysicalRegion::take_free_page(bool supervisor) void PhysicalRegion::free_page_at(PhysicalAddress addr) { - ASSERT(m_pages); + VERIFY(m_pages); if (m_used == 0) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Checked local_offset = addr.get(); local_offset -= m_lower.get(); - ASSERT(!local_offset.has_overflow()); - ASSERT(local_offset.value() < (FlatPtr)(m_pages * PAGE_SIZE)); + VERIFY(!local_offset.has_overflow()); + VERIFY(local_offset.value() < (FlatPtr)(m_pages * PAGE_SIZE)); auto page = local_offset.value() / PAGE_SIZE; m_bitmap.set(page, false); diff --git a/Kernel/VM/ProcessPagingScope.cpp b/Kernel/VM/ProcessPagingScope.cpp index cd9d9efe9b1..abc8de0a5d3 100644 --- a/Kernel/VM/ProcessPagingScope.cpp +++ b/Kernel/VM/ProcessPagingScope.cpp @@ -31,7 +31,7 @@ namespace Kernel { ProcessPagingScope::ProcessPagingScope(Process& process) { - ASSERT(Thread::current() != nullptr); + VERIFY(Thread::current() != nullptr); m_previous_cr3 = read_cr3(); MM.enter_process_paging_scope(process); } diff --git a/Kernel/VM/PurgeablePageRanges.cpp b/Kernel/VM/PurgeablePageRanges.cpp index 0782daef5b3..3e3407286b2 100644 --- a/Kernel/VM/PurgeablePageRanges.cpp +++ b/Kernel/VM/PurgeablePageRanges.cpp @@ -165,7 +165,7 @@ bool VolatilePageRanges::remove(const VolatilePageRange& range, bool& was_purged m_ranges.remove(nearby_index); } else { // See if we need to remove any of the following ranges - ASSERT(existing_range == &m_ranges[nearby_index]); // sanity check + VERIFY(existing_range == &m_ranges[nearby_index]); // sanity check while (nearby_index < m_ranges.size()) { existing_range = &m_ranges[nearby_index]; if (!existing_range->intersects(range)) @@ -228,7 +228,7 @@ auto PurgeablePageRanges::remove_volatile_range(const VolatilePageRange& range, } ScopedSpinLock vmobject_lock(m_vmobject->m_lock); // see comment in add_volatile_range ScopedSpinLock lock(m_volatile_ranges_lock); - ASSERT(m_vmobject); + VERIFY(m_vmobject); // Before we actually remove this range, we need to check if we need // to commit any pages, which may fail. If it fails, we don't actually @@ -259,7 +259,7 @@ auto PurgeablePageRanges::remove_volatile_range(const VolatilePageRange& range, return RemoveVolatileError::Success; } - ASSERT(need_commit_pages == 0); // We should have not touched anything + VERIFY(need_commit_pages == 0); // We should have not touched anything return RemoveVolatileError::SuccessNoChange; } @@ -287,10 +287,10 @@ void PurgeablePageRanges::set_vmobject(AnonymousVMObject* vmobject) { // No lock needed here if (vmobject) { - ASSERT(!m_vmobject); + VERIFY(!m_vmobject); m_vmobject = vmobject; } else { - ASSERT(m_vmobject); + VERIFY(m_vmobject); m_vmobject = nullptr; } } @@ -309,7 +309,7 @@ CommittedCowPages::~CommittedCowPages() NonnullRefPtr CommittedCowPages::allocate_one() { - ASSERT(m_committed_pages > 0); + VERIFY(m_committed_pages > 0); m_committed_pages--; return MM.allocate_committed_user_physical_page(MemoryManager::ShouldZeroFill::Yes); @@ -317,7 +317,7 @@ NonnullRefPtr CommittedCowPages::allocate_one() bool CommittedCowPages::return_one() { - ASSERT(m_committed_pages > 0); + VERIFY(m_committed_pages > 0); m_committed_pages--; MM.uncommit_user_physical_pages(1); diff --git a/Kernel/VM/PurgeablePageRanges.h b/Kernel/VM/PurgeablePageRanges.h index f372c5bed57..a37a84cc41d 100644 --- a/Kernel/VM/PurgeablePageRanges.h +++ b/Kernel/VM/PurgeablePageRanges.h @@ -65,7 +65,7 @@ struct VolatilePageRange { void combine_intersecting_or_adjacent(const VolatilePageRange& other) { - ASSERT(intersects_or_adjacent(other)); + VERIFY(intersects_or_adjacent(other)); if (base <= other.base) { count = (other.base - base) + other.count; } else { @@ -165,7 +165,7 @@ public: if (existing_range->range_equals(r)) return f(r); - ASSERT(existing_range == &m_ranges[nearby_index]); // sanity check + VERIFY(existing_range == &m_ranges[nearby_index]); // sanity check while (nearby_index < m_ranges.size()) { existing_range = &m_ranges[nearby_index]; if (!existing_range->intersects(range)) diff --git a/Kernel/VM/RangeAllocator.cpp b/Kernel/VM/RangeAllocator.cpp index c481ddfa4a4..1675e6946a7 100644 --- a/Kernel/VM/RangeAllocator.cpp +++ b/Kernel/VM/RangeAllocator.cpp @@ -59,7 +59,7 @@ RangeAllocator::~RangeAllocator() void RangeAllocator::dump() const { - ASSERT(m_lock.is_locked()); + VERIFY(m_lock.is_locked()); dbgln("RangeAllocator({})", this); for (auto& range : m_available_ranges) { dbgln(" {:x} -> {:x}", range.base().get(), range.end().get() - 1); @@ -68,7 +68,7 @@ void RangeAllocator::dump() const Vector Range::carve(const Range& taken) { - ASSERT((taken.size() % PAGE_SIZE) == 0); + VERIFY((taken.size() % PAGE_SIZE) == 0); Vector parts; if (taken == *this) @@ -82,13 +82,13 @@ Vector Range::carve(const Range& taken) void RangeAllocator::carve_at_index(int index, const Range& range) { - ASSERT(m_lock.is_locked()); + VERIFY(m_lock.is_locked()); 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])); } } @@ -98,8 +98,8 @@ Optional 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; @@ -122,8 +122,8 @@ Optional 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. @@ -151,7 +151,7 @@ Optional 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); @@ -169,14 +169,14 @@ Optional 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); ScopedSpinLock lock(m_lock); 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) { @@ -192,11 +192,11 @@ Optional RangeAllocator::allocate_specific(VirtualAddress base, size_t si void RangeAllocator::deallocate(const Range& range) { ScopedSpinLock lock(m_lock); - 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/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index 375acd11278..1b8ef0d8ee7 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -49,9 +49,9 @@ Region::Region(const Range& range, NonnullRefPtr vmobject, size_t offs , m_shared(shared) , m_cacheable(cacheable == Cacheable::Yes) { - ASSERT(m_range.base().is_page_aligned()); - ASSERT(m_range.size()); - ASSERT((m_range.size() % PAGE_SIZE) == 0); + VERIFY(m_range.base().is_page_aligned()); + VERIFY(m_range.size()); + VERIFY((m_range.size() % PAGE_SIZE) == 0); m_vmobject->ref_region(); register_purgeable_page_ranges(); @@ -69,7 +69,7 @@ Region::~Region() ScopedSpinLock lock(s_mm_lock); if (m_page_directory) { unmap(ShouldDeallocateVirtualMemoryRange::Yes); - ASSERT(!m_page_directory); + VERIFY(!m_page_directory); } MM.unregister_region(*this); @@ -93,14 +93,14 @@ void Region::unregister_purgeable_page_ranges() OwnPtr Region::clone(Process& new_owner) { - ASSERT(Process::current()); + VERIFY(Process::current()); ScopedSpinLock lock(s_mm_lock); if (m_shared) { - ASSERT(!m_stack); + VERIFY(!m_stack); if (vmobject().is_inode()) - ASSERT(vmobject().is_shared_inode()); + VERIFY(vmobject().is_shared_inode()); // Create a new region backed by the same VMObject. auto region = Region::create_user_accessible( @@ -114,7 +114,7 @@ OwnPtr Region::clone(Process& new_owner) } if (vmobject().is_inode()) - ASSERT(vmobject().is_private_inode()); + VERIFY(vmobject().is_private_inode()); auto vmobject_clone = vmobject().clone(); if (!vmobject_clone) @@ -127,9 +127,9 @@ OwnPtr Region::clone(Process& new_owner) if (m_vmobject->is_anonymous()) clone_region->copy_purgeable_page_ranges(*this); if (m_stack) { - ASSERT(is_readable()); - ASSERT(is_writable()); - ASSERT(vmobject().is_anonymous()); + VERIFY(is_readable()); + VERIFY(is_writable()); + VERIFY(vmobject().is_anonymous()); clone_region->set_stack(true); } clone_region->set_syscall_region(is_syscall_region()); @@ -250,14 +250,14 @@ bool Region::should_cow(size_t page_index) const void Region::set_should_cow(size_t page_index, bool cow) { - ASSERT(!m_shared); + VERIFY(!m_shared); if (vmobject().is_anonymous()) static_cast(vmobject()).set_should_cow(first_page_index() + page_index, cow); } bool Region::map_individual_page_impl(size_t page_index) { - ASSERT(m_page_directory->get_lock().own_lock()); + VERIFY(m_page_directory->get_lock().own_lock()); auto page_vaddr = vaddr_from_page_index(page_index); bool user_allowed = page_vaddr.get() >= 0x00800000 && is_user_address(page_vaddr); @@ -289,7 +289,7 @@ bool Region::map_individual_page_impl(size_t page_index) bool Region::do_remap_vmobject_page_range(size_t page_index, size_t page_count) { bool success = true; - ASSERT(s_mm_lock.own_lock()); + VERIFY(s_mm_lock.own_lock()); if (!m_page_directory) return success; // not an error, region may have not yet mapped it if (!translate_vmobject_page_range(page_index, page_count)) @@ -333,7 +333,7 @@ bool Region::do_remap_vmobject_page(size_t page_index, bool with_flush) if (!translate_vmobject_page(page_index)) return true; // not an error, region doesn't map this page ScopedSpinLock page_lock(m_page_directory->get_lock()); - ASSERT(physical_page(page_index)); + VERIFY(physical_page(page_index)); bool success = map_individual_page_impl(page_index); if (with_flush) MM.flush_tlb(m_page_directory, vaddr_from_page_index(page_index)); @@ -380,8 +380,8 @@ void Region::unmap(ShouldDeallocateVirtualMemoryRange deallocate_range) void Region::set_page_directory(PageDirectory& page_directory) { - ASSERT(!m_page_directory || m_page_directory == &page_directory); - ASSERT(s_mm_lock.own_lock()); + VERIFY(!m_page_directory || m_page_directory == &page_directory); + VERIFY(s_mm_lock.own_lock()); m_page_directory = page_directory; } @@ -392,7 +392,7 @@ bool Region::map(PageDirectory& page_directory) // FIXME: Find a better place for this sanity check(?) if (is_user() && !is_shared()) { - ASSERT(!vmobject().is_shared_inode()); + VERIFY(!vmobject().is_shared_inode()); } set_page_directory(page_directory); @@ -411,7 +411,7 @@ bool Region::map(PageDirectory& page_directory) void Region::remap() { - ASSERT(m_page_directory); + VERIFY(m_page_directory); map(*m_page_directory); } @@ -451,7 +451,7 @@ PageFaultResponse Region::handle_fault(const PageFault& fault, ScopedSpinLockdid_cow_fault(); @@ -526,18 +526,18 @@ PageFaultResponse Region::handle_cow_fault(size_t page_index_in_region) PageFaultResponse Region::handle_inode_fault(size_t page_index_in_region, ScopedSpinLock& mm_lock) { - ASSERT_INTERRUPTS_DISABLED(); - ASSERT(vmobject().is_inode()); + VERIFY_INTERRUPTS_DISABLED(); + VERIFY(vmobject().is_inode()); mm_lock.unlock(); - ASSERT(!s_mm_lock.own_lock()); - ASSERT(!g_scheduler_lock.own_lock()); + VERIFY(!s_mm_lock.own_lock()); + VERIFY(!g_scheduler_lock.own_lock()); LOCKER(vmobject().m_paging_lock); mm_lock.lock(); - ASSERT_INTERRUPTS_DISABLED(); + VERIFY_INTERRUPTS_DISABLED(); auto& inode_vmobject = static_cast(vmobject()); auto page_index_in_vmobject = translate_to_vmobject_page(page_index_in_region); auto& vmobject_physical_page_entry = inode_vmobject.physical_pages()[page_index_in_vmobject]; @@ -589,7 +589,7 @@ PageFaultResponse Region::handle_inode_fault(size_t page_index_in_region, Scoped VirtualAddress(dest_ptr), VirtualAddress(fault_at)); else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } MM.unquickmap_page(); diff --git a/Kernel/VM/Region.h b/Kernel/VM/Region.h index 5d8b7464a21..5e2308ec577 100644 --- a/Kernel/VM/Region.h +++ b/Kernel/VM/Region.h @@ -181,13 +181,13 @@ public: const PhysicalPage* physical_page(size_t index) const { - ASSERT(index < page_count()); + VERIFY(index < page_count()); return vmobject().physical_pages()[first_page_index() + index]; } RefPtr& physical_page_slot(size_t index) { - ASSERT(index < page_count()); + VERIFY(index < page_count()); return vmobject().physical_pages()[first_page_index() + index]; } diff --git a/Kernel/VM/Space.cpp b/Kernel/VM/Space.cpp index bf429c240b2..4489ca17f79 100644 --- a/Kernel/VM/Space.cpp +++ b/Kernel/VM/Space.cpp @@ -80,7 +80,7 @@ Region& Space::allocate_split_region(const Region& source_region, const Range& r KResultOr Space::allocate_region(const Range& range, const String& name, int prot, AllocationStrategy strategy) { - ASSERT(range.is_valid()); + VERIFY(range.is_valid()); auto vmobject = AnonymousVMObject::create_with_size(range.size(), strategy); if (!vmobject) return ENOMEM; @@ -92,7 +92,7 @@ KResultOr Space::allocate_region(const Range& range, const String& name KResultOr Space::allocate_region_with_vmobject(const Range& range, NonnullRefPtr vmobject, size_t offset_in_vmobject, const String& name, int prot, bool shared) { - ASSERT(range.is_valid()); + VERIFY(range.is_valid()); size_t end_in_vmobject = offset_in_vmobject + range.size(); if (end_in_vmobject <= offset_in_vmobject) { dbgln("allocate_region_with_vmobject: Overflow (offset + size)"); @@ -172,9 +172,9 @@ Vector Space::split_region_around_range(const Region& source_region, Range old_region_range = source_region.range(); auto remaining_ranges_after_unmap = old_region_range.carve(desired_range); - ASSERT(!remaining_ranges_after_unmap.is_empty()); + VERIFY(!remaining_ranges_after_unmap.is_empty()); auto make_replacement_region = [&](const Range& new_range) -> Region& { - ASSERT(old_region_range.contains(new_range)); + VERIFY(old_region_range.contains(new_range)); size_t new_range_offset_in_vmobject = source_region.offset_in_vmobject() + (new_range.base().get() - old_region_range.base().get()); return allocate_split_region(source_region, new_range, new_range_offset_in_vmobject); }; diff --git a/Kernel/VM/VMObject.cpp b/Kernel/VM/VMObject.cpp index bcd5fbf73f9..71da13de1e7 100644 --- a/Kernel/VM/VMObject.cpp +++ b/Kernel/VM/VMObject.cpp @@ -51,7 +51,7 @@ VMObject::~VMObject() } MM.unregister_vmobject(*this); - ASSERT(m_regions_count.load(AK::MemoryOrder::memory_order_relaxed) == 0); + VERIFY(m_regions_count.load(AK::MemoryOrder::memory_order_relaxed) == 0); } } diff --git a/Kernel/WaitQueue.cpp b/Kernel/WaitQueue.cpp index 53834461b83..77aed8106d5 100644 --- a/Kernel/WaitQueue.cpp +++ b/Kernel/WaitQueue.cpp @@ -32,9 +32,9 @@ namespace Kernel { bool WaitQueue::should_add_blocker(Thread::Blocker& b, void* data) { - ASSERT(data != nullptr); // Thread that is requesting to be blocked - ASSERT(m_lock.is_locked()); - ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue); + VERIFY(data != nullptr); // Thread that is requesting to be blocked + VERIFY(m_lock.is_locked()); + VERIFY(b.blocker_type() == Thread::Blocker::Type::Queue); if (m_wake_requested || !m_should_block) { m_wake_requested = false; dbgln_if(WAITQUEUE_DEBUG, "WaitQueue @ {}: do not block thread {}, {}", this, data, m_should_block ? "wake was pending" : "not blocking"); @@ -50,8 +50,8 @@ u32 WaitQueue::wake_one() ScopedSpinLock lock(m_lock); dbgln_if(WAITQUEUE_DEBUG, "WaitQueue @ {}: wake_one", this); bool did_unblock_one = do_unblock([&](Thread::Blocker& b, void* data, bool& stop_iterating) { - ASSERT(data); - ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue); + VERIFY(data); + VERIFY(b.blocker_type() == Thread::Blocker::Type::Queue); auto& blocker = static_cast(b); dbgln_if(WAITQUEUE_DEBUG, "WaitQueue @ {}: wake_one unblocking {}", this, data); if (blocker.unblock()) { @@ -75,11 +75,11 @@ u32 WaitQueue::wake_n(u32 wake_count) u32 did_wake = 0; bool did_unblock_some = do_unblock([&](Thread::Blocker& b, void* data, bool& stop_iterating) { - ASSERT(data); - ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue); + VERIFY(data); + VERIFY(b.blocker_type() == Thread::Blocker::Type::Queue); auto& blocker = static_cast(b); dbgln_if(WAITQUEUE_DEBUG, "WaitQueue @ {}: wake_n unblocking {}", this, data); - ASSERT(did_wake < wake_count); + VERIFY(did_wake < wake_count); if (blocker.unblock()) { if (++did_wake >= wake_count) stop_iterating = true; @@ -100,8 +100,8 @@ u32 WaitQueue::wake_all() u32 did_wake = 0; bool did_unblock_any = do_unblock([&](Thread::Blocker& b, void* data, bool&) { - ASSERT(data); - ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue); + VERIFY(data); + VERIFY(b.blocker_type() == Thread::Blocker::Type::Queue); auto& blocker = static_cast(b); dbgln_if(WAITQUEUE_DEBUG, "WaitQueue @ {}: wake_all unblocking {}", this, data); diff --git a/Kernel/init.cpp b/Kernel/init.cpp index da56ae12db8..65cb35b8524 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -141,8 +141,8 @@ extern "C" UNMAP_AFTER_INIT [[noreturn]] void init() MemoryManager::initialize(0); // Ensure that the safemem sections are not empty. This could happen if the linker accidentally discards the sections. - ASSERT(&start_of_safemem_text != &end_of_safemem_text); - ASSERT(&start_of_safemem_atomic_text != &end_of_safemem_atomic_text); + VERIFY(&start_of_safemem_text != &end_of_safemem_text); + VERIFY(&start_of_safemem_atomic_text != &end_of_safemem_atomic_text); // Invoke all static global constructors in the kernel. // Note that we want to do this as early as possible. @@ -190,7 +190,7 @@ extern "C" UNMAP_AFTER_INIT [[noreturn]] void init() } Scheduler::start(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // @@ -208,7 +208,7 @@ extern "C" UNMAP_AFTER_INIT [[noreturn]] void init_ap(u32 cpu, Processor* proces Scheduler::set_idle_thread(APIC::the().get_idle_thread(cpu)); Scheduler::start(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // @@ -322,7 +322,7 @@ void init_stage2(void*) NetworkTask::spawn(); Process::current()->sys$exit(0); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } UNMAP_AFTER_INIT void setup_serial_debug() diff --git a/Meta/Lagom/Fuzzers/FuzzHttpRequest.cpp b/Meta/Lagom/Fuzzers/FuzzHttpRequest.cpp index 78620d8cdb0..52fbdc889e2 100644 --- a/Meta/Lagom/Fuzzers/FuzzHttpRequest.cpp +++ b/Meta/Lagom/Fuzzers/FuzzHttpRequest.cpp @@ -35,7 +35,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) return 1; auto request = request_wrapper.value(); - ASSERT(request.method() != HTTP::HttpRequest::Method::Invalid); + VERIFY(request.method() != HTTP::HttpRequest::Method::Invalid); return 0; } diff --git a/Meta/Lagom/Fuzzers/FuzzilliJs.cpp b/Meta/Lagom/Fuzzers/FuzzilliJs.cpp index b06be95c7bb..a23ac722250 100644 --- a/Meta/Lagom/Fuzzers/FuzzilliJs.cpp +++ b/Meta/Lagom/Fuzzers/FuzzilliJs.cpp @@ -173,7 +173,7 @@ JS_DEFINE_NATIVE_FUNCTION(TestRunnerGlobalObject::fuzzilli) *((int*)0x41414141) = 0x1337; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } else if (operation == "FUZZILLI_PRINT") { @@ -206,28 +206,28 @@ int main(int, char**) char helo[] = "HELO"; if (write(REPRL_CWFD, helo, 4) != 4 || read(REPRL_CRFD, helo, 4) != 4) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(memcmp(helo, "HELO", 4) == 0); + VERIFY(memcmp(helo, "HELO", 4) == 0); reprl_input = (char*)mmap(0, REPRL_MAX_DATA_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, REPRL_DRFD, 0); - ASSERT(reprl_input != MAP_FAILED); + VERIFY(reprl_input != MAP_FAILED); auto vm = JS::VM::create(); auto interpreter = JS::Interpreter::create(*vm); while (true) { unsigned action; - ASSERT(read(REPRL_CRFD, &action, 4) == 4); - ASSERT(action == 'cexe'); + VERIFY(read(REPRL_CRFD, &action, 4) == 4); + VERIFY(action == 'cexe'); size_t script_size; - ASSERT(read(REPRL_CRFD, &script_size, 8) == 8); - ASSERT(script_size < REPRL_MAX_DATA_SIZE); + VERIFY(read(REPRL_CRFD, &script_size, 8) == 8); + VERIFY(script_size < REPRL_MAX_DATA_SIZE); ByteBuffer data_buffer; if (data_buffer.size() < script_size) data_buffer.grow(script_size - data_buffer.size()); - ASSERT(data_buffer.size() >= script_size); + VERIFY(data_buffer.size() >= script_size); memcpy(data_buffer.data(), reprl_input, script_size); int result = 0; @@ -251,7 +251,7 @@ int main(int, char**) fflush(stderr); int status = (result & 0xff) << 8; - ASSERT(write(REPRL_CWFD, &status, 4) == 4); + VERIFY(write(REPRL_CWFD, &status, 4) == 4); __sanitizer_cov_reset_edgeguards(); } diff --git a/Meta/Lagom/TestJson.cpp b/Meta/Lagom/TestJson.cpp index e149daddf62..293069e4c24 100644 --- a/Meta/Lagom/TestJson.cpp +++ b/Meta/Lagom/TestJson.cpp @@ -31,7 +31,7 @@ int main(int, char**) { auto value = JsonValue::from_string("{\"property\": \"value\"}"); - ASSERT(value.has_value()); + VERIFY(value.has_value()); printf("parsed: _%s_\n", value.value().to_string().characters()); printf("object.property = '%s'\n", value.value().as_object().get("property").to_string().characters()); return 0; diff --git a/Userland/Applications/Browser/DownloadWidget.cpp b/Userland/Applications/Browser/DownloadWidget.cpp index 85482f4a235..3f4acbd57c6 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 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 cecf28477ce..9bc6608736e 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 984882d2d92..e150fe38bf7 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 ca0b12bd849..35eb205c1c4 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 c79eeefad9d..0440597caea 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("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(active_widget); diff --git a/Userland/Applications/Calculator/Calculator.cpp b/Userland/Applications/Calculator/Calculator.cpp index c324fb84b9d..89e29e2b01c 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 582c6fc14f2..559981e03bd 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 dbb70d33c1c..84937840b34 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 145f71a995f..aab45b43e87 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 f553fc49b64..db60aa3233b 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 2dbcd68b547..39cc184f6cb 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 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 a72b63aaf55..b4121e01e4a 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 04603268c43..53c86f425ed 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(); main_widget.set_layout(); @@ -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 568ef53f949..a9a1200794c 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& 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 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 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 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 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 bb4c822dcb5..beb26beac3c 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 18e22979b19..8d5ca7eb7cc 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 f6bf6adc754..02089b1d59d 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 5c52f5738be..b24cc026600 100644 --- a/Userland/Applications/HexEditor/FindDialog.cpp +++ b/Userland/Applications/HexEditor/FindDialog.cpp @@ -101,7 +101,7 @@ Result 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 a4652866c1b..392ddb2d4bf 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(m_buffer.size())); + VERIFY(m_position >= 0); + VERIFY(m_position < static_cast(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(m_buffer.size())); + VERIFY(m_position >= 0); + VERIFY(m_position < static_cast(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 726bba39b47..4e9706da152 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 22cdcd710fd..d39a9526814 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 ef8338b9a19..2eb7c037051 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 06f7e59289f..f009743323c 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&); diff --git a/Userland/Applications/IRCClient/IRCWindowListModel.cpp b/Userland/Applications/IRCClient/IRCWindowListModel.cpp index 7ee68c429ee..11cd37eee9a 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 180b2a48377..e3ef6cd2594 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 4fcd1d81234..5c5c6cb8b15 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 fd372cf4335..cc099d598ad 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 65fcdc39b5f..4d5079c2767 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 4b9e4360c26..1989247293d 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 61d4351d061..b5608893395 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::max()); - ASSERT(m_power[note] >= 0); + VERIFY(m_note_on[note] != NumericLimits::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 6cffddac20e..da788f3c8c0 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 0501e2fb963..ec7a5f54d49 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 78eebc2b2dd..248ccc1bb06 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) { 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 f29551c0508..829210e39ce 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 756772bb87f..e12ac673a71 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 a5b023f18b8..3ac941ba728 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 9997c296743..a5d0a176d81 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 0680b055834..e7c88d38498 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 95644d00d6c..fb1892656cf 100644 --- a/Userland/Applications/SpaceAnalyzer/main.cpp +++ b/Userland/Applications/SpaceAnalyzer/main.cpp @@ -99,7 +99,7 @@ static void fill_mounts(Vector& 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& mounts, HashMap& error_accumulator) { - ASSERT(!root.m_name.ends_with("/")); + VERIFY(!root.m_name.ends_with("/")); Queue queue; queue.enqueue(QueueEntry(root.m_name, &root)); @@ -247,7 +247,7 @@ static void analyze(RefPtr 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 d2f511753f1..25788ed580a 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 cd64e8f2393..659f47929ca 100644 --- a/Userland/Applications/Spreadsheet/CellType/Type.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Type.cpp @@ -56,7 +56,7 @@ Vector 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 68c801ebb4b..8f1dcf8cb97 100644 --- a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp +++ b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp @@ -52,7 +52,7 @@ namespace Spreadsheet { CellTypeDialog::CellTypeDialog(const Vector& 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& 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& 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* formats) { - ASSERT(!m_formats); + VERIFY(!m_formats); m_formats = formats; @@ -454,7 +454,7 @@ void ConditionsView::set_formats(Vector* 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 eecd0bbb458..dcfb85b4c94 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(); 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 99a61b0abc1..fca9742acee 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 0b32ca767da..a3fab2edd3d 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 6a86c016bca..be176029554 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 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 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 bbef6c81163..66c87f6a454 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 70193e4b630..1ea04f2f607 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp @@ -132,7 +132,7 @@ RefPtr 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 9762f77578c..45dbf275a25 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 4dea8369267..036bd5a6c03 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -96,7 +96,7 @@ SpreadsheetWidget::SpreadsheetWidget(NonnullRefPtrVector&& 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) { - ASSERT(m_workbook == &sheet->workbook()); + VERIFY(m_workbook == &sheet->workbook()); NonnullRefPtrVector new_sheets; new_sheets.append(move(sheet)); diff --git a/Userland/Applications/Spreadsheet/Writers/XSV.h b/Userland/Applications/Spreadsheet/Writers/XSV.h index 7a065f87d1b..27d1e7e34f5 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 d77b48c68c2..1f6539f3246 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 source_positions, target_positions; diff --git a/Userland/Applications/SystemMonitor/DevicesModel.cpp b/Userland/Applications/SystemMonitor/DevicesModel.cpp index 2efc4a117d6..44a05fb5507 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 e1ad40afe15..54676143c3a 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 6675ea8c4ab..787ff57ba61 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 62df60c9518..90f40b85062 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 a028b23956f..2cee462db43 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()); } 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 bc282835f49..7b3a6ef1821 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 7238b2c0a70..cc0c9576f8e 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(window_id, true); diff --git a/Userland/Demos/Eyes/EyesWidget.cpp b/Userland/Demos/Eyes/EyesWidget.cpp index c31d4782e17..6372c9e137e 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(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 cf461797014..9a60b911d17 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 e94072146a8..ab4782cdf17 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 fe0f6a31f59..748ba707814 100644 --- a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp @@ -68,7 +68,7 @@ Vector 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 20527e379de..55bc4faef36 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(address.value().address)); - ASSERT(success); + VERIFY(success); } else { bool success = session->remove_breakpoint(reinterpret_cast(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(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 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(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 cb7822c60a6..4ede317691a 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 92199a4c6f1..33310d422f8 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 425129046c3..e010fa997c1 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(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 692804def00..d9f09c9d3e0 100644 --- a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp @@ -135,7 +135,7 @@ RefPtr 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 a2dd21e0b1a..ba948d3f86f 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 52952fbe1f8..f865ffef2c8 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(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 8347e73c818..2d24f9c2b21 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 a913eed01eb..0a78681106b 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 8e81b6ce4fe..39785998fcb 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 76aa3abda8c..0a7afa3c99d 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 ea68c88ff65..971febbaee6 100644 --- a/Userland/DevTools/HackStudio/Git/GitRepo.cpp +++ b/Userland/DevTools/HackStudio/Git/GitRepo.cpp @@ -49,7 +49,7 @@ RefPtr 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 8be825760f7..e15583ff8da 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 13ebbd51655..69a734c3c92 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 cc54bc5d71e..07a234bb198 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 846e24f8fc3..8ec45ede126 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 f354a2beb89..5c289d80149 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 721b6de953e..14031432a68 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/LexerAutoComplete.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/LexerAutoComplete.cpp @@ -65,8 +65,8 @@ Vector LexerAutoComplete::get_suggestions(cons StringView LexerAutoComplete::text_of_token(const Vector& 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 8257bc667c8..50bc03ba8b7 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::create_document_data_for(const String& file) { auto document = filedb().get(file); - ASSERT(document); + VERIFY(document); auto content = document->text(); auto document_data = make(document->text(), file); auto root = document_data->parser.parse(); @@ -107,7 +107,7 @@ Vector 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 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 42d91cfc911..0488352970d 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 c0f8b403dce..5dbf7f5232d 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 d6541912098..bacee6e0ba1 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 32caac30ec8..cc1aed80136 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 6c9e82f3a70..a01b3bf502f 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 da3fd14a0d9..c2670d09dcc 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 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(); remote_object->address = object.get("address").to_number(); @@ -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 4195f103cd7..c9bf70ab2c1 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 0acf3e917fa..18a93c75a97 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 caf18194462..d9798069f12 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 7a40897f927..732c18f27a1 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& 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(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(*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(*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 f946803db21..f2a0a989353 100644 --- a/Userland/DevTools/UserspaceEmulator/MallocTracer.cpp +++ b/Userland/DevTools/UserspaceEmulator/MallocTracer.cpp @@ -60,8 +60,8 @@ void MallocTracer::target_did_malloc(Badge, 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(*region)); + VERIFY(region); + VERIFY(is(*region)); auto& mmap_region = static_cast(*region); // Mark the containing mmap region as a malloc block! @@ -71,7 +71,7 @@ void MallocTracer::target_did_malloc(Badge, 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, 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(*region)); + VERIFY(region); + VERIFY(is(*region)); auto& mmap_region = static_cast(*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 53da97acf10..473f4bf2ea2 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 a5686cf273b..70ea7ab2b36 100644 --- a/Userland/DevTools/UserspaceEmulator/MmapRegion.cpp +++ b/Userland/DevTools/UserspaceEmulator/MmapRegion.cpp @@ -48,7 +48,7 @@ NonnullOwnPtr 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 MmapRegion::read8(FlatPtr offset) tracer->audit_read(*this, base() + offset, 1); } - ASSERT(offset < size()); + VERIFY(offset < size()); return { *reinterpret_cast(m_data + offset), *reinterpret_cast(m_shadow_data + offset) }; } @@ -99,7 +99,7 @@ ValueWithShadow MmapRegion::read16(u32 offset) tracer->audit_read(*this, base() + offset, 2); } - ASSERT(offset + 1 < size()); + VERIFY(offset + 1 < size()); return { *reinterpret_cast(m_data + offset), *reinterpret_cast(m_shadow_data + offset) }; } @@ -116,7 +116,7 @@ ValueWithShadow MmapRegion::read32(u32 offset) tracer->audit_read(*this, base() + offset, 4); } - ASSERT(offset + 3 < size()); + VERIFY(offset + 3 < size()); return { *reinterpret_cast(m_data + offset), *reinterpret_cast(m_shadow_data + offset) }; } @@ -133,7 +133,7 @@ ValueWithShadow MmapRegion::read64(u32 offset) tracer->audit_read(*this, base() + offset, 8); } - ASSERT(offset + 7 < size()); + VERIFY(offset + 7 < size()); return { *reinterpret_cast(m_data + offset), *reinterpret_cast(m_shadow_data + offset) }; } @@ -150,7 +150,7 @@ void MmapRegion::write8(u32 offset, ValueWithShadow value) tracer->audit_write(*this, base() + offset, 1); } - ASSERT(offset < size()); + VERIFY(offset < size()); *reinterpret_cast(m_data + offset) = value.value(); *reinterpret_cast(m_shadow_data + offset) = value.shadow(); } @@ -168,7 +168,7 @@ void MmapRegion::write16(u32 offset, ValueWithShadow value) tracer->audit_write(*this, base() + offset, 2); } - ASSERT(offset + 1 < size()); + VERIFY(offset + 1 < size()); *reinterpret_cast(m_data + offset) = value.value(); *reinterpret_cast(m_shadow_data + offset) = value.shadow(); } @@ -186,8 +186,8 @@ void MmapRegion::write32(u32 offset, ValueWithShadow 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(m_data + offset) = value.value(); *reinterpret_cast(m_shadow_data + offset) = value.shadow(); } @@ -205,8 +205,8 @@ void MmapRegion::write64(u32 offset, ValueWithShadow 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(m_data + offset) = value.value(); *reinterpret_cast(m_shadow_data + offset) = value.shadow(); } diff --git a/Userland/DevTools/UserspaceEmulator/Range.cpp b/Userland/DevTools/UserspaceEmulator/Range.cpp index af6b09d19dd..635e8cf8c62 100644 --- a/Userland/DevTools/UserspaceEmulator/Range.cpp +++ b/Userland/DevTools/UserspaceEmulator/Range.cpp @@ -31,7 +31,7 @@ namespace UserspaceEmulator { Vector Range::carve(const Range& taken) { - ASSERT((taken.size() % PAGE_SIZE) == 0); + VERIFY((taken.size() % PAGE_SIZE) == 0); Vector parts; if (taken == *this) return {}; diff --git a/Userland/DevTools/UserspaceEmulator/RangeAllocator.cpp b/Userland/DevTools/UserspaceEmulator/RangeAllocator.cpp index f4f6fc1341f..78135d923be 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 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 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 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 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 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 173efd0e329..cdfb299c46c 100644 --- a/Userland/DevTools/UserspaceEmulator/SimpleRegion.cpp +++ b/Userland/DevTools/UserspaceEmulator/SimpleRegion.cpp @@ -45,52 +45,52 @@ SimpleRegion::~SimpleRegion() ValueWithShadow SimpleRegion::read8(FlatPtr offset) { - ASSERT(offset < size()); + VERIFY(offset < size()); return { *reinterpret_cast(m_data + offset), *reinterpret_cast(m_shadow_data + offset) }; } ValueWithShadow SimpleRegion::read16(u32 offset) { - ASSERT(offset + 1 < size()); + VERIFY(offset + 1 < size()); return { *reinterpret_cast(m_data + offset), *reinterpret_cast(m_shadow_data + offset) }; } ValueWithShadow SimpleRegion::read32(u32 offset) { - ASSERT(offset + 3 < size()); + VERIFY(offset + 3 < size()); return { *reinterpret_cast(m_data + offset), *reinterpret_cast(m_shadow_data + offset) }; } ValueWithShadow SimpleRegion::read64(u32 offset) { - ASSERT(offset + 7 < size()); + VERIFY(offset + 7 < size()); return { *reinterpret_cast(m_data + offset), *reinterpret_cast(m_shadow_data + offset) }; } void SimpleRegion::write8(u32 offset, ValueWithShadow value) { - ASSERT(offset < size()); + VERIFY(offset < size()); *reinterpret_cast(m_data + offset) = value.value(); *reinterpret_cast(m_shadow_data + offset) = value.shadow(); } void SimpleRegion::write16(u32 offset, ValueWithShadow value) { - ASSERT(offset + 1 < size()); + VERIFY(offset + 1 < size()); *reinterpret_cast(m_data + offset) = value.value(); *reinterpret_cast(m_shadow_data + offset) = value.shadow(); } void SimpleRegion::write32(u32 offset, ValueWithShadow value) { - ASSERT(offset + 3 < size()); + VERIFY(offset + 3 < size()); *reinterpret_cast(m_data + offset) = value.value(); *reinterpret_cast(m_shadow_data + offset) = value.shadow(); } void SimpleRegion::write64(u32 offset, ValueWithShadow value) { - ASSERT(offset + 7 < size()); + VERIFY(offset + 7 < size()); *reinterpret_cast(m_data + offset) = value.value(); *reinterpret_cast(m_shadow_data + offset) = value.shadow(); } diff --git a/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp b/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp index 17a03900d92..3ab0509ba0a 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 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 SoftCPU::read_memory8(X86::LogicalAddress address) ValueWithShadow 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 SoftCPU::read_memory16(X86::LogicalAddress address) ValueWithShadow 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 SoftCPU::read_memory32(X86::LogicalAddress address) ValueWithShadow 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 SoftCPU::read_memory64(X86::LogicalAddress address) void SoftCPU::write_memory8(X86::LogicalAddress address, ValueWithShadow 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 val void SoftCPU::write_memory16(X86::LogicalAddress address, ValueWithShadow 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 v void SoftCPU::write_memory32(X86::LogicalAddress address, ValueWithShadow 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 v void SoftCPU::write_memory64(X86::LogicalAddress address, ValueWithShadow 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::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::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(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(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(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(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(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(sign_extended_to(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 89ece8976db..21619c0c0dd 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 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 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 1822cb36d21..af835347e63 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) { - 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) { - 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 d1c7a2d029d..43545dcd483 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 230c1eedc56..5730c494d6c 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 c3c083f8d00..ec622f012f9 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 f02a4a5f5bd..a0ccc72ba7a 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(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 83823eca92a..52105fe4474 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 2bec8dcc27d..a859486884b 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 23c3473632d..1887393bb0a 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(image->height()); auto target_size = Gfx::IntSize(static_cast(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 bb2b1bade5b..4e5953420b3 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& 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 d6497db677e..fbf1cc7eb13 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 213251715de..e32cf05a248 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 7ee2c883432..274f01af906 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::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 d456c91dfde..23c013ef50c 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 e60c5ccfd9c..84eb7e8b2b6 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 055553514be..7b8d26de9da 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 cfb5283e353..073956c1896 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 504fa703673..e727c5ec1cf 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 49cd5b3930f..95652464067 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(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 a8142262d71..f12032a5ec9 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(m_arg_index)); + VERIFY(optind == static_cast(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 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(m_arg_index)); + VERIFY(optind <= static_cast(m_arg_index)); if (optind == static_cast(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 13b6e668b85..7d198a802c1 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 e06412c3bb2..a340e04c9f9 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 f428948dd65..881e1beffef 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(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 1d104e29c93..932b265d13a 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 145cb1b19f7..f2270c2e7bf 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(a.data()); const auto b_data = reinterpret_cast(b.data()); diff --git a/Userland/Libraries/LibC/scanf.cpp b/Userland/Libraries/LibC/scanf.cpp index bb51aad92d9..7ec13da4eef 100644 --- a/Userland/Libraries/LibC/scanf.cpp +++ b/Userland/Libraries/LibC/scanf.cpp @@ -104,7 +104,7 @@ struct read_element_concrete { 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 { 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 { 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 { 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 {}(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 {}(length_modifier, input_lexer, &ap)) format_lexer.consume_all(); diff --git a/Userland/Libraries/LibC/semaphore.cpp b/Userland/Libraries/LibC/semaphore.cpp index 165c14eddc7..618c3335f02 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 cea5e149f49..661a3b371e8 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 cecb0aef2ab..1ff78cc4136 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(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(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::multiplication_would_overflow(size, nmemb)); + VERIFY(stream); + VERIFY(!Checked::multiplication_would_overflow(size, nmemb)); size_t nread = stream->read(reinterpret_cast(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::multiplication_would_overflow(size, nmemb)); + VERIFY(stream); + VERIFY(!Checked::multiplication_would_overflow(size, nmemb)); size_t nwritten = stream->write(reinterpret_cast(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 049733dc6ba..0b599202a83 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 2cde5e28219..70b1bb90e98 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 650347da967..b2242f6212d 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 034663af9f8..b21423ea122 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 s_tgoto_buffer; diff --git a/Userland/Libraries/LibC/time.cpp b/Userland/Libraries/LibC/time.cpp index df7010c646e..56ef7a36631 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 64eadb14faa..e6a29bc41ba 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 fae0c1e5131..3bce22f6477 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 af4294c8df7..f84f71a6395 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 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 5e9066aacce..4c094b80fe5 100644 --- a/Userland/Libraries/LibChess/UCIEndpoint.cpp +++ b/Userland/Libraries/LibChess/UCIEndpoint.cpp @@ -125,7 +125,7 @@ NonnullOwnPtr 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 184fe58e1e8..f1749868bc9 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& distance_code) @@ -401,7 +401,7 @@ void DeflateDecompressor::decode_codes(CanonicalCode& literal_code, Optional> 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 5a71b1e0538..2b2e5d28c09 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 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(nwritten) == new_passwd_file_content.length()); + VERIFY(static_cast(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(nwritten) == new_shadow_file_content.length()); + VERIFY(static_cast(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 8f6b1bedad9..e30d229c7cb 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 121272e38ba..ae94b3a39ee 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 23f9560c467..d75a6457777 100644 --- a/Userland/Libraries/LibCore/Command.cpp +++ b/Userland/Libraries/LibCore/Command.cpp @@ -56,11 +56,11 @@ String command(const String& program, const Vector& 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& arguments, Optional< pid_t pid; if ((errno = posix_spawnp(&pid, program.characters(), &action, nullptr, const_cast(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& 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 9d0fc953782..35a4aff3d03 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 f05e9ba1263..c74482f2417 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&& 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 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 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 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(); 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 f5522ed14de..d04a8982b03 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 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 0c8774d28af..03247aa2c2d 100644 --- a/Userland/Libraries/LibCore/FileStream.h +++ b/Userland/Libraries/LibCore/FileStream.h @@ -42,7 +42,7 @@ public: static Result 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, 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 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, 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 19bb73eb8aa..70ed9928bc6 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 dfcff215836..88bb27345a3 100644 --- a/Userland/Libraries/LibCore/GetPassword.cpp +++ b/Userland/Libraries/LibCore/GetPassword.cpp @@ -58,7 +58,7 @@ Result 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 25c88bb15c6..4dcdbe39f16 100644 --- a/Userland/Libraries/LibCore/Gzip.cpp +++ b/Userland/Libraries/LibCore/Gzip.cpp @@ -46,7 +46,7 @@ static Optional 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 get_gzip_payload(const ByteBuffer& data) Optional 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 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 0339c30272f..bae5815d821 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 ec99d513178..46d7d3ddd24 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 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 a2884d5a54c..a25273a86f5 100644 --- a/Userland/Libraries/LibCore/NetworkJob.cpp +++ b/Userland/Libraries/LibCore/NetworkJob.cpp @@ -55,7 +55,7 @@ void NetworkJob::did_finish(NonnullRefPtr&& 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 55cd1024097..800f5573841 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(event)); case Core::Event::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; case Core::Event::Custom: return custom_event(static_cast(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 06c30c31f5d..3ebe1a9d936 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(nsent) == data.size()); + VERIFY(static_cast(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 1ecb32010b3..e0bf33fee74 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 4a5334225b5..695fa361aa6 100644 --- a/Userland/Libraries/LibCore/SocketAddress.h +++ b/Userland/Libraries/LibCore/SocketAddress.h @@ -84,7 +84,7 @@ public: Optional 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 1b577bd6c4c..9fd8009c8be 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 9a715f1ed89..79fe6f468eb 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 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 33d3609c702..fd68490b771 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 f041248832d..24a97293fc9 100644 --- a/Userland/Libraries/LibCoreDump/Reader.cpp +++ b/Userland/Libraries/LibCoreDump/Reader.cpp @@ -53,7 +53,7 @@ Reader::Reader(NonnullRefPtr 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(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 48752055d01..87b61c63409 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 = ""; } - 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 830b998870f..e01c1aeb9e5 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 0507f11ec35..c08a74bb9e3 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 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 3e7188f9aef..1fff2d146df 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 e44a31b854b..f3081ac0aed 100644 --- a/Userland/Libraries/LibCpp/Parser.cpp +++ b/Userland/Libraries/LibCpp/Parser.cpp @@ -657,7 +657,7 @@ void Parser::load_state() Optional 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 Parser::eof_node() const { - ASSERT(m_tokens.size()); + VERIFY(m_tokens.size()); return node_at(m_tokens.last().m_end); } RefPtr Parser::node_at(Position pos) const { - ASSERT(!m_tokens.is_empty()); + VERIFY(!m_tokens.is_empty()); RefPtr match_node; for (auto& node : m_nodes) { if (node.start() > pos || node.end() < pos) @@ -827,7 +827,7 @@ NonnullRefPtr 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 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 9ec7151aa4e..3094d2b97c2 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 96c9e1a65e8..c7fae1b6fb5 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 c0699018e68..5d548c23a55 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 (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 63021614bb2..ec622847c82 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(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 1ce0e122405..21107fbdc02 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 3b16c61cd95..a17db5a8c06 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 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 68358a05ca1..deec336f2fb 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 26895a8fca1..a2601956c44 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 4d034f5bac4..3a1d17b1d56 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 a34f6a4b98f..c7daba471bd 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 9b471496028..9da7c24526a 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 1b2a71d30a3..5cf717134f6 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 ecccd2c60e8..fd54602ae43 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= 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 dc6a042b837..b4b90c187bf 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 7f7b7a0d9f7..eb8ab79f14e 100644 --- a/Userland/Libraries/LibDebug/DebugInfo.cpp +++ b/Userland/Libraries/LibDebug/DebugInfo.cpp @@ -207,7 +207,7 @@ static Optional 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::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::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::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::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::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 243d05f400d..e35886a7341 100644 --- a/Userland/Libraries/LibDebug/DebugSession.cpp +++ b/Userland/Libraries/LibDebug/DebugSession.cpp @@ -73,7 +73,7 @@ OwnPtr 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(reinterpret_cast(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(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(&const_cast(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::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 re("(.+): \\.text"); diff --git a/Userland/Libraries/LibDebug/DebugSession.h b/Userland/Libraries/LibDebug/DebugSession.h index f30174a7402..50e9e963700 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 4ef58947bb3..5733b33fd55 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(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::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 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 09717cfc715..fb1fdc2f42b 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 fe50d1aed37..b8f78a1e823 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 649f0fe5471..447bcccc995 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 41958328f59..8951bf75b07 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 06e1caff010..c81eff8a465 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 d94bedfa03f..b6ee4fee22b 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 4e7842de3fb..da7596ecac4 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 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 d81a410221d..524253c0b8a 100644 --- a/Userland/Libraries/LibELF/DynamicLoader.cpp +++ b/Userland/Libraries/LibELF/DynamicLoader.cpp @@ -60,7 +60,7 @@ RefPtr DynamicLoader::try_create(int fd, String filename) return {}; } - ASSERT(stat.st_size >= 0); + VERIFY(stat.st_size >= 0); auto size = static_cast(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 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 9505a878091..5c290835051 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::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 07233f5e0d0..d40cea14e34 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(m_buffer) + offset; } const Elf32_Ehdr& Image::header() const { - ASSERT(m_size >= sizeof(Elf32_Ehdr)); + VERIFY(m_size >= sizeof(Elf32_Ehdr)); return *reinterpret_cast(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(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(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(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(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 b849e836b88..403353cdde4 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 99400b44d2e..f6601ee38d4 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 d735291e595..8ac69da2894 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 efafc3c9eee..4ed68896f71 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 818fe37cd6e..73e4caa9645 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(); 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 d136c17413c..007e136a19f 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 6987f3b0cae..6dd51864eed 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 b95e756c867..15fce14f53b 100644 --- a/Userland/Libraries/LibGUI/BreadcrumbBar.cpp +++ b/Userland/Libraries/LibGUI/BreadcrumbBar.cpp @@ -136,7 +136,7 @@ void BreadcrumbBar::set_selected_segment(Optional 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 9a18c4a5f30..c2d2747dcc7 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 510074df8cf..565ca3de1b2 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 e1988da5032..99228123333 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(); if (parent() && is(parent())) { auto& parent_window = *static_cast(parent()); diff --git a/Userland/Libraries/LibGUI/DisplayLink.cpp b/Userland/Libraries/LibGUI/DisplayLink.cpp index a2bf46e9212..b9663405d10 100644 --- a/Userland/Libraries/LibGUI/DisplayLink.cpp +++ b/Userland/Libraries/LibGUI/DisplayLink.cpp @@ -73,7 +73,7 @@ i32 DisplayLink::register_callback(Function 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 a1afb25cdc7..e6a3215303c 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) { - 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 3e16b1c3b1b..45c75b4f12a 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 9d2ec26ba02..ed585e9dc2b 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 3f9c5dae0c6..88672e9e36c 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(); if (!widget.load_from_gml(file_picker_dialog_gml)) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); auto& toolbar = *widget.find_descendant_of_type_named("toolbar"); toolbar.set_has_frame(false); diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp index 4c8d7b08af7..b504ae09e21 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(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& 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(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 de73560cc68..d4e14bbf862 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(); 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("family_list_view"); m_family_list_view->set_model(ItemListModel::create(m_families)); diff --git a/Userland/Libraries/LibGUI/GMLFormatter.cpp b/Userland/Libraries/LibGUI/GMLFormatter.cpp index 09c263bcc96..813247af48d 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 ede1272356c..05985b74263 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 0803747dd91..20bd137a39d 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 0b394b63d2d..c60dbc9e555 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 6410a58c03a..4b34800c01b 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 c4f4ba46d86..69c71c662ba 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 650b4408425..c927a5368d9 100644 --- a/Userland/Libraries/LibGUI/Icon.cpp +++ b/Userland/Libraries/LibGUI/Icon.cpp @@ -49,7 +49,7 @@ Icon::Icon(RefPtr&& 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&& bitmap1, RefPtr&& 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 d3ac1e84b72..d5108d3a262 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 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 c26d34b7661..71cf41b8ede 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 a77ca3d1b72..019994224e9 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 83846ff37a4..b31007d36d0 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&& 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 250b1c5ca45..e534a1d5a9a 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) void Layout::notify_disowned(Badge, 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 3e1a9c49519..1472b5879ea 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 4b304f67511..a1cd030f968 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 28844f055f3..805fc22165e 100644 --- a/Userland/Libraries/LibGUI/Menu.cpp +++ b/Userland/Libraries/LibGUI/Menu.cpp @@ -113,7 +113,7 @@ int Menu::realize_menu(RefPtr 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 ea8c9649b5c..1900aa046c1 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) { - 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(m_menubar_id, menu_id); } WindowServerConnection::the().send_sync(m_menubar_id); diff --git a/Userland/Libraries/LibGUI/MenuItem.cpp b/Userland/Libraries/LibGUI/MenuItem.cpp index 8c6e5a92ecc..af9522fb7e0 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 ea6a97c28fd..038974d1d49 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 2a223368554..27686f22ce9 100644 --- a/Userland/Libraries/LibGUI/ModelSelection.cpp +++ b/Userland/Libraries/LibGUI/ModelSelection.cpp @@ -47,7 +47,7 @@ void ModelSelection::remove_matching(Function 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& 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 0c50700b6db..1fcff6446fe 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) diff --git a/Userland/Libraries/LibGUI/MultiView.h b/Userland/Libraries/LibGUI/MultiView.h index e835bca6ebd..2c2406e86e5 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 d32002f4798..c92f59da10f 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 0e6cd4acbef..e2732a738c9 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 985586c10f7..b416873435a 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 ad8bf27e489..26b6816b4de 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 a0618ae410c..a3602de29e9 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(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(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(this)->build_mapping(source_parent); @@ -158,7 +158,7 @@ ModelIndex SortingProxyModel::index(int row, int column, const ModelIndex& paren const_cast(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(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(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 943497c9184..5673907ff15 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 5e46f267d0d..a5d2f000b33 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 a523b181571..132a0c79e8a 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 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 code_points; diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 106cc37edfb..799a0e21943 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(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 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 81c2cc07dfa..ab1192853c2 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 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 5d3ddac2b25..44a52d46d4f 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 a04f7b2e17c..90f747f8e52 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 60a6a2b21b4..52826ab01d2 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 85b521924e4..807bc1cbad1 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 a6be58c01b9..f4b23a06d51 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(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(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((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& 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 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 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, Function 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) 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) 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 79169345e0e..2d33b91dd13 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 be63d00fe18..4e43854fae2 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 5175dd100df..f8fd7cbf52d 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 d3197176d5c..7496f704b41 100644 --- a/Userland/Libraries/LibGemini/Line.cpp +++ b/Userland/Libraries/LibGemini/Line.cpp @@ -81,7 +81,7 @@ String Control::render_to_html() const return ""; 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 3d8203ad91c..65e7da62f49 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 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 6911f991642..ecf2808d607 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) diff --git a/Userland/Libraries/LibGfx/Bitmap.cpp b/Userland/Libraries/LibGfx/Bitmap.cpp index 2b7c207c7b6..2046fdcf74c 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::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::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 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= 0 && y < physical_height()); + VERIFY(y >= 0 && y < physical_height()); return reinterpret_cast(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(m_data) + (y * m_pitch); } @@ -297,21 +297,21 @@ inline const RGBA32* Bitmap::scanline(int y) const template<> inline Color Bitmap::get_pixel(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(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(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(x, y); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } template<> inline void Bitmap::set_pixel(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(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(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 492f9210538..09e080ec8e5 100644 --- a/Userland/Libraries/LibGfx/BitmapFont.cpp +++ b/Userland/Libraries/LibGfx/BitmapFont.cpp @@ -147,7 +147,7 @@ RefPtr 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::load_from_file(const StringView& path) diff --git a/Userland/Libraries/LibGfx/BitmapFont.h b/Userland/Libraries/LibGfx/BitmapFont.h index b43514fe0a1..88ada2a2b75 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 6227ecfc394..0f6f1ae684b 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 5e4af7a12b7..20265dc43fc 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 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 parse_rgb_color(const StringView& string) static Optional 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 c4a28ba323e..8070a712e2c 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 416f84321a6..93f325a28e7 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(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 c06fd0ebbaf..6aaaff246aa 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 750587e2072..3bec3d1ce91 100644 --- a/Userland/Libraries/LibGfx/GIFLoader.cpp +++ b/Userland/Libraries/LibGfx/GIFLoader.cpp @@ -232,14 +232,14 @@ public: Vector& 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 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 e0326f15806..51a2107e4bd 100644 --- a/Userland/Libraries/LibGfx/ICOLoader.cpp +++ b/Userland/Libraries/LibGfx/ICOLoader.cpp @@ -388,7 +388,7 @@ RefPtr 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 4b4b4be3113..0ec40055dba 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 aa9cf5e64ff..2913457d91d 100644 --- a/Userland/Libraries/LibGfx/Matrix.h +++ b/Userland/Libraries/LibGfx/Matrix.h @@ -39,7 +39,7 @@ public: Matrix() = default; Matrix(std::initializer_list 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 4040b09c97b..dda7c44da22 100644 --- a/Userland/Libraries/LibGfx/PBMLoader.cpp +++ b/Userland/Libraries/LibGfx/PBMLoader.cpp @@ -166,7 +166,7 @@ RefPtr 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 122a698a7b3..5cd2b7bed30 100644 --- a/Userland/Libraries/LibGfx/PGMLoader.cpp +++ b/Userland/Libraries/LibGfx/PGMLoader.cpp @@ -169,7 +169,7 @@ RefPtr 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 1f1ae6d066d..fbb4a4d8b93 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(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(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 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 80d99d89666..8f88a9ff8b2 100644 --- a/Userland/Libraries/LibGfx/PPMLoader.cpp +++ b/Userland/Libraries/LibGfx/PPMLoader.cpp @@ -171,7 +171,7 @@ RefPtr 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 ed075d83817..445f4eda358 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 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 @@ -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 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 draw_one_glyph, cons void Painter::draw_text(Function 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 draw_one_glyph, cons void Painter::draw_text(Function 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 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 36db4ddac6f..62b5c3de3be 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 2068e1a50f1..93ba1e28cfc 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 34ce928ba81..9d1c65bdbdf 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 5fe2bb2f63f..95812cf5323 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(cursor.value()); append_segment(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 7a8dfe95676..81ebf2ccfbb 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 6e2961a3f7f..7a5f61c10d6 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 ad7c423b92a..e0e97556ed4 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 76e7fcfbedc..3995e0ddb9f 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 68c751598ee..c2b73aa12af 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 8ea42a4e841..6d6a9ccce7b 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::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 9dd77f8c833..3f89c4b971e 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 ce3b7419fdc..7da8eee9473 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 bca77f3b58a..50f8bf0bbaa 100644 --- a/Userland/Libraries/LibIPC/ClientConnection.h +++ b/Userland/Libraries/LibIPC/ClientConnection.h @@ -43,7 +43,7 @@ public: : IPC::Connection(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 c6b281aa180..66bcab9a428 100644 --- a/Userland/Libraries/LibIPC/Connection.h +++ b/Userland/Libraries/LibIPC/Connection.h @@ -122,7 +122,7 @@ public: { post_message(RequestType(forward(args)...)); auto response = wait_for_specific_endpoint_message(); - 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 0eef0a005a5..67ed0b91fcc 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::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 a8752f7890f..d21781602ba 100644 --- a/Userland/Libraries/LibIPC/Decoder.h +++ b/Userland/Libraries/LibIPC/Decoder.h @@ -39,7 +39,7 @@ template inline bool decode(Decoder&, T&) { static_assert(DependentFalse, "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 da8416f5a51..97b02df312f 100644 --- a/Userland/Libraries/LibIPC/Encoder.h +++ b/Userland/Libraries/LibIPC/Encoder.h @@ -35,7 +35,7 @@ template bool encode(Encoder&, T&) { static_assert(DependentFalse, "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 6f655d4c5b0..493f0a0af96 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 7ff07f32af3..6d11821451d 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(*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(*this) && (is(callee.as_object()) && !static_cast(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(global_object, *object, interpreter.vm().call_frame().scope); TemporaryChange 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(node)) { auto& variable_declaration = static_cast(node); - ASSERT(!variable_declaration.declarations().is_empty()); + VERIFY(!variable_declaration.declarations().is_empty()); if (variable_declaration.declaration_kind() != DeclarationKind::Var) { wrapper = create_ast_node(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(node)) { variable_name = static_cast(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(*m_lhs) && !is(*m_lhs)) { // FIXME: Implement "for (foo.bar in baz)", "for (foo[0] in bar)" - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } RefPtr 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(*m_lhs) && !is(*m_lhs)) { // FIXME: Implement "for (foo.bar of baz)", "for (foo[0] of bar)" - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } RefPtr 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(class_constructor_value.as_function())); + VERIFY(class_constructor_value.is_function() && is(class_constructor_value.as_function())); ScriptFunction* class_constructor = static_cast(&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(*m_property)); + VERIFY(is(*m_property)); return static_cast(*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(*m_object).string(); if (is_computed()) return String::formatted("{}[]", object_string); - ASSERT(is(*m_property)); + VERIFY(is(*m_property)); return String::formatted("{}.{}", object_string, static_cast(*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 f24035a5f7b..b22c99dc4cd 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 03190382c47..fcbeeeaaa83 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, HeapBlock& block) void Allocator::block_did_become_usable(Badge, 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 7f4daae2e36..dd093c2b0bb 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& impl) { - ASSERT(!m_handles.contains(&impl)); + VERIFY(!m_handles.contains(&impl)); m_handles.set(&impl); } void Heap::did_destroy_handle(Badge, 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& 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& 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) void Heap::undefer_gc(Badge) { - 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 0341eeb243f..c2502114210 100644 --- a/Userland/Libraries/LibJS/Heap/HeapBlock.cpp +++ b/Userland/Libraries/LibJS/Heap/HeapBlock.cpp @@ -42,7 +42,7 @@ NonnullOwnPtr 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(NonnullOwnPtr::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 6cc3e5acb12..459ae5f80ad 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 69ec6e18b8c..5b14b8101c2 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(vm().call_frame().scope)); + VERIFY(is(vm().call_frame().scope)); return static_cast(vm().call_frame().scope); } diff --git a/Userland/Libraries/LibJS/MarkupGenerator.cpp b/Userland/Libraries/LibJS/MarkupGenerator.cpp index afdd3470986..6766b1b8589 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 ac8fbeb2e92..0eb7352a175 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(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 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 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 Parser::parse_secondary_expression(NonnullRefPtr Parser::parse_assignment_expression(AssignmentOp assignment_op, NonnullRefPtr 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 NonnullRefPtr 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 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 6d6c4a57a62..628c90803bf 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 c3cbd179b02..62c6c8cde03 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 440cc8a05e7..311ea3707b3 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 59a0951ff72..37d5c51c1e1 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 5bd828a4d9e..d38101c8a89 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 08c6f6bde97..b7769581a3a 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 577d7b9175a..6ed90ff166f 100644 --- a/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp +++ b/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp @@ -50,8 +50,8 @@ Optional 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 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 ee6a8ed057c..6dd92592034 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 b4959dc733c..c1bcfe0c0e2 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(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 94d1c97e2dc..72549ea8bba 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(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(global_object, ErrorType::ThisIsAlreadyInitialized); return; diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index 8aec832a2f3..a6d76f69036 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 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 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(*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 bbd6a0c6404..cad939cd81f 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 6386022b1ee..4bf111978b4 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(m_target).name(); } LexicalEnvironment* ProxyObject::create_environment() { - ASSERT(is_function()); + VERIFY(is_function()); return static_cast(m_target).create_environment(); } diff --git a/Userland/Libraries/LibJS/Runtime/Shape.cpp b/Userland/Libraries/LibJS/Runtime/Shape.cpp index 1f74b14471b..056837ef647 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(*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 38311b61b23..3ac5d3baeab 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(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(m_ptr); } diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.h b/Userland/Libraries/LibJS/Runtime/TypedArray.h index a0f6709a76a..0b580be39d6 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::multiplication_would_overflow(array_length, sizeof(T))); + VERIFY(!Checked::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 ee7c8c14ff3..6f923d67ce9 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 73842974c73..ea88e9fc012 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(current_scope())); + VERIFY(is(current_scope())); static_cast(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(find_this_scope())); + VERIFY(is(find_this_scope())); return static_cast(find_this_scope())->new_target(); } Value VM::call_internal(Function& function, Value this_value, Optional 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, Optionalthis_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 320ea53405b..571703ec93f 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 148d1834fcd..8362c832dff 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(*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(as_object()); } @@ -268,7 +268,7 @@ String Value::to_string_without_side_effects() const case Type::NativeProperty: return ""; 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(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(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(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 a24db800573..781d996c5d8 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 638d4b7931f..1a502b34767 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 ""; } } @@ -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 acab00433dc..4bb27d0ea2f 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 6523d403bea..083d3ceb913 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 e4e3be3be8e..fa8d95da5c2 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 742976abad3..d7036ebad5c 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 f7c0667e492..8978ac8a6b6 100644 --- a/Userland/Libraries/LibLine/SuggestionManager.cpp +++ b/Userland/Libraries/LibLine/SuggestionManager.cpp @@ -53,7 +53,7 @@ void SuggestionManager::set_suggestions(Vector&& 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 7e341854eea..03b52434162 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 9df74829b13..a17666af818 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 5628f68679d..5bb6e7c4b57 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 d9484cb0985..d80503efb19 100644 --- a/Userland/Libraries/LibMarkdown/List.cpp +++ b/Userland/Libraries/LibMarkdown/List.cpp @@ -116,7 +116,7 @@ OwnPtr List::parse(Vector::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::parse(Vector::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 065a0a48d91..b70c1f572c5 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(""); for (auto& column : m_columns) { - ASSERT(i < column.rows.size()); + VERIFY(i < column.rows.size()); builder.append(""); builder.append(column.rows[i].render_to_html()); builder.append(""); diff --git a/Userland/Libraries/LibMarkdown/Text.cpp b/Userland/Libraries/LibMarkdown/Text.cpp index 1fd83daed97..31631e96788 100644 --- a/Userland/Libraries/LibMarkdown/Text.cpp +++ b/Userland/Libraries/LibMarkdown/Text.cpp @@ -196,7 +196,7 @@ Optional Text::parse(const StringView& str) Vector 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::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 bb73c308eaa..b8a106d9eac 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 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 130a2371745..6f5b35015e4 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(fd()); m_should_buffer_all_input = true; diff --git a/Userland/Libraries/LibPthread/pthread.cpp b/Userland/Libraries/LibPthread/pthread.cpp index 4b28cde0e49..fa0f9e2ff01 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 88acb88f67d..6fdf1b5b8ec 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 b996c4b7caa..0987192af73 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 ""; } } @@ -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 ""; } } @@ -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 ""; } } @@ -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 ""; } } @@ -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 ""; } } @@ -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 f9a69c6d739..1909e36a91c 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(const OpCode& opcode) template ALWAYS_INLINE const T& to(const OpCode& opcode) { - ASSERT(is(opcode)); + VERIFY(is(opcode)); return static_cast(opcode); } template ALWAYS_INLINE T* to(OpCode* opcode) { - ASSERT(is(opcode)); + VERIFY(is(opcode)); return static_cast(opcode); } template ALWAYS_INLINE const T* to(const OpCode* opcode) { - ASSERT(is(opcode)); + VERIFY(is(opcode)); return static_cast(opcode); } template ALWAYS_INLINE T& to(OpCode& opcode) { - ASSERT(is(opcode)); + VERIFY(is(opcode)); return static_cast(opcode); } diff --git a/Userland/Libraries/LibRegex/RegexLexer.cpp b/Userland/Libraries/LibRegex/RegexLexer.cpp index e61708a4c4c..c7bd1194c5a 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 ""; } } @@ -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 d688dcab0f2..73b332ac3eb 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 7d6f6d8e92e..970db6bf1c4 100644 --- a/Userland/Libraries/LibRegex/RegexMatcher.cpp +++ b/Userland/Libraries/LibRegex/RegexMatcher.cpp @@ -104,7 +104,7 @@ RegexResult Matcher::match(const Vector 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::match(const Vector 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 Matcher::execute(const MatchInput& input, MatchState& sta } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } template diff --git a/Userland/Libraries/LibRegex/RegexParser.cpp b/Userland/Libraries/LibRegex/RegexParser.cpp index 6ed5e2e217f..eacc3069755 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& 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& 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 0a25ee18470..a17794a7e35 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 // import first, to prevent warning of ASSERT* redefinition +#include // import first, to prevent warning of VERIFY* redefinition #include #include diff --git a/Userland/Libraries/LibRegex/Tests/Regex.cpp b/Userland/Libraries/LibRegex/Tests/Regex.cpp index ffd585e8d39..93bab8d7057 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 // import first, to prevent warning of ASSERT* redefinition +#include // import first, to prevent warning of VERIFY* redefinition #include #include diff --git a/Userland/Libraries/LibSyntax/Highlighter.cpp b/Userland/Libraries/LibSyntax/Highlighter.cpp index c1463e6537e..0fe7706a0f0 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 39f2193a8eb..60512918809 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 9f3ea55eb91..26f71e26977 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 1fa0f01fca6..88395b4e27f 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 4bdf6f0e9b9..f9822dc377f 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 3022b5e17d0..3e8b712eaad 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 2994ed27abc..98c3fcf2d91 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 ce651e53859..5a4993fbaf9 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(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 be649dc1714..03c6c92cdd7 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 7ad25cd4e14..bf3c01177e9 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::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 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 c7beb436445..2568001afdc 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 70f1764344b..3ca46b3ca26 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 533a01e932a..30654dc607e 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 a2880dfb3fe..6bf7d561ba4 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 7ab63162c79..5d92c7c3040 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 7d8fea4af42..41796046475 100644 --- a/Userland/Libraries/LibThread/Thread.cpp +++ b/Userland/Libraries/LibThread/Thread.cpp @@ -59,10 +59,10 @@ void LibThread::Thread::start() }, static_cast(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 56f776e9cb3..6818220e62c 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 6a25ccccfbe..6d61c1853f9 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 a1e383d1094..50090f7dfad 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 b315d4185b8..ba17011f98e 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(position.row()) < m_terminal.line_count()); + VERIFY(position.row() >= 0 && static_cast(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(position.row()) < m_terminal.line_count()); + VERIFY(position.row() >= 0 && static_cast(position.row()) < m_terminal.line_count()); auto& line = m_terminal.line(position.row()); if (position.column() == line.length()) { if (static_cast(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(position.row()) < m_terminal.line_count()); + VERIFY(position.row() >= 0 && static_cast(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 2abd1f54f25..1a7bfb27195 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 b257a378a60..13d3f662fda 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 08b2ca500f9..a2a55c81ba0 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 bce76a059cd..78ee24f5de4 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 ad5ab287453..87fcde8d6e3 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp @@ -33,11 +33,11 @@ #include #include -#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 5f553e2be08..a1db87f78fe 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(*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(*element.parent())) return false; return matches(selector, component_list_index - 1, downcast(*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 da6f2a6fd93..2ced865baa9 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 c6d6b503bf2..65905b54d59 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 2b7b2218c7e..1fde66eee35 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 e2f235db626..6391df70f4d 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 4991a4040ab..0fb443bcc67 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 7c85ade83f4..03b474908c7 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 5b257c1b0da..7a7449ed0b6 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 d4f2170f1b1..242b2924b8d 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) void Document::detach_from_frame(Badge, 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 e789df05a31..30c4c17b320 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 10e2bda733a..24b063d5cd4 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -131,7 +131,7 @@ RefPtr 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 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 e45b42c23e1..1ec7f8b96be 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 target, NonnullRefPtr< return !entry.shadow_adjusted_target.is_null(); }); - ASSERT(clear_targets_struct.has_value()); + VERIFY(clear_targets_struct.has_value()); if (is(clear_targets_struct.value().shadow_adjusted_target.ptr())) { auto& shadow_adjusted_target_node = downcast(*clear_targets_struct.value().shadow_adjusted_target); diff --git a/Userland/Libraries/LibWeb/DOM/EventListener.cpp b/Userland/Libraries/LibWeb/DOM/EventListener.cpp index eb64bfa503d..ad9f0cd3e76 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 26204538bcd..d66c33e1389 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 b6fae82ebf5..0b7f66afc41 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) { // 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 76c0e397690..ad732548d54 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 46585e80d99..c41be830a88 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(function)))); } if (listener) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp index d2f071314d8..4b6462417e5 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 9144211b07f..259f88083d5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp @@ -65,7 +65,7 @@ RefPtr 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 36fff8b52c7..73113dd242a 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 d4fe2cb37f1..06b942e0761 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 d2005bb4b09..8fcf9edaff0 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 9eeaa8b9ecf..e3a64bcbb97 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 8320416d20d..fd7a1655a3e 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(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 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 53a2357be58..38652bdb4eb 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 c2246229c64..fcfad6e34be 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 6aa94b1163f..2b35432a19f 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 787bc12b464..e0c84271c45 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 2406711bff4..502e8e0c6b9 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 b74cc8828ca..7f664b39209 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(*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()); } diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index bb7def7bb58..2f1c1e96b4a 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 190340f13c7..0cea9f0b3f4 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(*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 11d0c6b7b09..b96fa7d0395 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 f3210ad941b..d0c8b432c65 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()); } diff --git a/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp b/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp index 587c9198c84..fa74a76ddaa 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(box, parent_context)); return IterationDecision::Continue; }); diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp index 50430ce8433..0e57f6a184e 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(child) && child.is_absolutely_positioned()) { layout_absolutely_positioned_element(downcast(child)); return; diff --git a/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp b/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp index c1f6aa1db98..c7c1d3995bb 100644 --- a/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp +++ b/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp @@ -55,7 +55,7 @@ LayoutRange LayoutRange::normalized() const NonnullRefPtr 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 e62a6885134..5c708f42eb9 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(*this)) return downcast(*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 23fa3eaf6ea..79c5e58784f 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 static void wrap_in_anonymous(NonnullRefPtrVector& 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(computed_values).set_display(WrapperBoxType::static_display()); diff --git a/Userland/Libraries/LibWeb/LayoutTreeModel.cpp b/Userland/Libraries/LibWeb/LayoutTreeModel.cpp index 440b2fce52f..b2caa2d6ca3 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 6dcbaa54348..956fa31295a 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 and