diff options
Diffstat (limited to 'Userland/Libraries')
310 files changed, 1284 insertions, 1284 deletions
diff --git a/Userland/Libraries/LibAudio/Buffer.cpp b/Userland/Libraries/LibAudio/Buffer.cpp index 7ee2c88343..274f01af90 100644 --- a/Userland/Libraries/LibAudio/Buffer.cpp +++ b/Userland/Libraries/LibAudio/Buffer.cpp @@ -70,7 +70,7 @@ static void read_samples_from_stream(InputMemoryStream& stream, SampleReader rea } break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -127,13 +127,13 @@ RefPtr<Buffer> Buffer::from_pcm_stream(InputMemoryStream& stream, ResampleHelper read_samples_from_stream(stream, read_norm_sample_24, fdata, resampler, num_channels); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // We should handle this in a better way above, but for now -- // just make sure we're good. Worst case we just write some 0s where they // don't belong. - ASSERT(!stream.handle_any_error()); + VERIFY(!stream.handle_any_error()); return Buffer::create_with_samples(move(fdata)); } diff --git a/Userland/Libraries/LibAudio/WavLoader.cpp b/Userland/Libraries/LibAudio/WavLoader.cpp index d456c91dfd..23c013ef50 100644 --- a/Userland/Libraries/LibAudio/WavLoader.cpp +++ b/Userland/Libraries/LibAudio/WavLoader.cpp @@ -174,7 +174,7 @@ bool WavLoaderPlugin::parse_header() u32 sz = read_u32(); ok = ok && sz < 1024 * 1024 * 1024; // arbitrary CHECK_OK("File size"); - ASSERT(sz < 1024 * 1024 * 1024); + VERIFY(sz < 1024 * 1024 * 1024); u32 wave = read_u32(); ok = ok && wave == 0x45564157; // "WAVE" @@ -187,12 +187,12 @@ bool WavLoaderPlugin::parse_header() u32 fmt_size = read_u32(); ok = ok && fmt_size == 16; CHECK_OK("FMT size"); - ASSERT(fmt_size == 16); + VERIFY(fmt_size == 16); u16 audio_format = read_u16(); CHECK_OK("Audio format"); // incomplete read check ok = ok && audio_format == 1; // WAVE_FORMAT_PCM - ASSERT(audio_format == 1); + VERIFY(audio_format == 1); CHECK_OK("Audio format"); // value check m_num_channels = read_u16(); @@ -211,7 +211,7 @@ bool WavLoaderPlugin::parse_header() m_bits_per_sample = read_u16(); CHECK_OK("Bits per sample"); // incomplete read check ok = ok && (m_bits_per_sample == 8 || m_bits_per_sample == 16 || m_bits_per_sample == 24); - ASSERT(m_bits_per_sample == 8 || m_bits_per_sample == 16 || m_bits_per_sample == 24); + VERIFY(m_bits_per_sample == 8 || m_bits_per_sample == 16 || m_bits_per_sample == 24); CHECK_OK("Bits per sample"); // value check // Read chunks until we find DATA @@ -241,7 +241,7 @@ bool WavLoaderPlugin::parse_header() ok = ok && found_data; CHECK_OK("Found no data chunk"); - ASSERT(found_data); + VERIFY(found_data); ok = ok && data_sz < INT32_MAX; CHECK_OK("Data was too large"); diff --git a/Userland/Libraries/LibAudio/WavWriter.cpp b/Userland/Libraries/LibAudio/WavWriter.cpp index e60c5ccfd9..84eb7e8b2b 100644 --- a/Userland/Libraries/LibAudio/WavWriter.cpp +++ b/Userland/Libraries/LibAudio/WavWriter.cpp @@ -68,7 +68,7 @@ void WavWriter::write_samples(const u8* samples, size_t size) void WavWriter::finalize() { - ASSERT(!m_finalized); + VERIFY(!m_finalized); m_finalized = true; if (m_file) { m_file->seek(0); diff --git a/Userland/Libraries/LibC/assert.h b/Userland/Libraries/LibC/assert.h index 055553514b..7b8d26de9d 100644 --- a/Userland/Libraries/LibC/assert.h +++ b/Userland/Libraries/LibC/assert.h @@ -39,18 +39,18 @@ __attribute__((noreturn)) void __assertion_failed(const char* msg); if (__builtin_expect(!(expr), 0)) \ __assertion_failed(#expr "\n" __FILE__ ":" __stringify(__LINE__)); \ } while (0) -# define ASSERT_NOT_REACHED() assert(false) +# define VERIFY_NOT_REACHED() assert(false) #else # define assert(expr) ((void)(0)) -# define ASSERT_NOT_REACHED() CRASH() +# define VERIFY_NOT_REACHED() CRASH() #endif #define CRASH() \ do { \ asm volatile("ud2"); \ } while (0) -#define ASSERT assert +#define VERIFY assert #define RELEASE_ASSERT assert -#define TODO ASSERT_NOT_REACHED +#define TODO VERIFY_NOT_REACHED __END_DECLS diff --git a/Userland/Libraries/LibC/cxxabi.cpp b/Userland/Libraries/LibC/cxxabi.cpp index cfb5283e35..073956c189 100644 --- a/Userland/Libraries/LibC/cxxabi.cpp +++ b/Userland/Libraries/LibC/cxxabi.cpp @@ -110,7 +110,7 @@ void __cxa_finalize(void* dso_handle) [[noreturn]] void __cxa_pure_virtual() { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } // extern "C" diff --git a/Userland/Libraries/LibC/dirent.cpp b/Userland/Libraries/LibC/dirent.cpp index 504fa70367..e727c5ec1c 100644 --- a/Userland/Libraries/LibC/dirent.cpp +++ b/Userland/Libraries/LibC/dirent.cpp @@ -194,7 +194,7 @@ int readdir_r(DIR* dirp, struct dirent* entry, struct dirent** result) int dirfd(DIR* dirp) { - ASSERT(dirp); + VERIFY(dirp); return dirp->fd; } } diff --git a/Userland/Libraries/LibC/dlfcn.cpp b/Userland/Libraries/LibC/dlfcn.cpp index 49cd5b3930..9565246406 100644 --- a/Userland/Libraries/LibC/dlfcn.cpp +++ b/Userland/Libraries/LibC/dlfcn.cpp @@ -104,7 +104,7 @@ void* dlopen(const char* filename, int flags) void* dlsym(void* handle, const char* symbol_name) { // FIXME: When called with a NULL handle we're supposed to search every dso in the process... that'll get expensive - ASSERT(handle); + VERIFY(handle); auto* dso = reinterpret_cast<ELF::DynamicLoader*>(handle); void* symbol = dso->symbol_for_name(symbol_name); if (!symbol) { diff --git a/Userland/Libraries/LibC/getopt.cpp b/Userland/Libraries/LibC/getopt.cpp index a8142262d7..f12032a5ec 100644 --- a/Userland/Libraries/LibC/getopt.cpp +++ b/Userland/Libraries/LibC/getopt.cpp @@ -142,7 +142,7 @@ int OptionParser::getopt() if (should_reorder_argv) shift_argv(); else - ASSERT(optind == static_cast<int>(m_arg_index)); + VERIFY(optind == static_cast<int>(m_arg_index)); optind += m_consumed_args; return res; @@ -152,7 +152,7 @@ bool OptionParser::lookup_short_option(char option, int& needs_value) const { Vector<StringView> parts = m_short_options.split_view(option, true); - ASSERT(parts.size() <= 2); + VERIFY(parts.size() <= 2); if (parts.size() < 2) { // Haven't found the option in the spec. return false; @@ -175,7 +175,7 @@ bool OptionParser::lookup_short_option(char option, int& needs_value) const int OptionParser::handle_short_option() { StringView arg = m_argv[m_arg_index]; - ASSERT(arg.starts_with('-')); + VERIFY(arg.starts_with('-')); if (s_index_into_multioption_argument == 0) { // Just starting to parse this argument, skip the "-". @@ -245,7 +245,7 @@ const option* OptionParser::lookup_long_option(char* raw) const optarg = nullptr; return &option; } - ASSERT(arg.length() > name.length()); + VERIFY(arg.length() > name.length()); if (arg[name.length()] == '=') { optarg = raw + name.length() + 1; return &option; @@ -257,7 +257,7 @@ const option* OptionParser::lookup_long_option(char* raw) const int OptionParser::handle_long_option() { - ASSERT(StringView(m_argv[m_arg_index]).starts_with("--")); + VERIFY(StringView(m_argv[m_arg_index]).starts_with("--")); // We cannot set optopt to anything sensible for long options, so set it to 0. optopt = 0; @@ -298,7 +298,7 @@ int OptionParser::handle_long_option() } break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // Now that we've figured the value out, see about reporting this option to @@ -314,7 +314,7 @@ void OptionParser::shift_argv() { // We've just parsed an option (which perhaps has a value). // Put the option (along with it value, if any) in front of other arguments. - ASSERT(optind <= static_cast<int>(m_arg_index)); + VERIFY(optind <= static_cast<int>(m_arg_index)); if (optind == static_cast<int>(m_arg_index) || m_consumed_args == 0) { // Nothing to do! diff --git a/Userland/Libraries/LibC/libgen.cpp b/Userland/Libraries/LibC/libgen.cpp index 13b6e668b8..7d198a802c 100644 --- a/Userland/Libraries/LibC/libgen.cpp +++ b/Userland/Libraries/LibC/libgen.cpp @@ -75,8 +75,8 @@ char* basename(char* path) return path; if (len == 1) { - ASSERT(last_slash == path); - ASSERT(path[0] == '/'); + VERIFY(last_slash == path); + VERIFY(path[0] == '/'); return slash; } diff --git a/Userland/Libraries/LibC/malloc.cpp b/Userland/Libraries/LibC/malloc.cpp index e06412c3bb..a340e04c9f 100644 --- a/Userland/Libraries/LibC/malloc.cpp +++ b/Userland/Libraries/LibC/malloc.cpp @@ -156,7 +156,7 @@ extern "C" { static void* os_alloc(size_t size, const char* name) { auto* ptr = serenity_mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0, ChunkedBlock::block_size, name); - ASSERT(ptr != MAP_FAILED); + VERIFY(ptr != MAP_FAILED); return ptr; } @@ -192,11 +192,11 @@ static void* malloc_impl(size_t size) bool this_block_was_purged = rc == 1; if (rc < 0) { perror("madvise"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (mprotect(block, real_size, PROT_READ | PROT_WRITE) < 0) { perror("mprotect"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (this_block_was_purged) { g_malloc_stats.number_of_big_allocator_purge_hits++; @@ -229,12 +229,12 @@ static void* malloc_impl(size_t size) bool this_block_was_purged = rc == 1; if (rc < 0) { perror("madvise"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } rc = mprotect(block, ChunkedBlock::block_size, PROT_READ | PROT_WRITE); if (rc < 0) { perror("mprotect"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (this_block_was_purged) { g_malloc_stats.number_of_empty_block_purge_hits++; @@ -255,7 +255,7 @@ static void* malloc_impl(size_t size) --block->m_free_chunks; void* ptr = block->m_freelist; - ASSERT(ptr); + VERIFY(ptr); block->m_freelist = block->m_freelist->next; if (block->is_full()) { g_malloc_stats.number_of_blocks_full++; @@ -296,11 +296,11 @@ static void free_impl(void* ptr) size_t this_block_size = block->m_size; if (mprotect(block, this_block_size, PROT_NONE) < 0) { perror("mprotect"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (madvise(block, this_block_size, MADV_SET_VOLATILE) != 0) { perror("madvise"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return; } @@ -390,7 +390,7 @@ size_t malloc_size(void* ptr) if (header->m_magic == MAGIC_BIGALLOC_HEADER) size -= sizeof(CommonHeader); else - ASSERT(header->m_magic == MAGIC_PAGE_HEADER); + VERIFY(header->m_magic == MAGIC_PAGE_HEADER); return size; } diff --git a/Userland/Libraries/LibC/netdb.cpp b/Userland/Libraries/LibC/netdb.cpp index f428948dd6..881e1beffe 100644 --- a/Userland/Libraries/LibC/netdb.cpp +++ b/Userland/Libraries/LibC/netdb.cpp @@ -142,13 +142,13 @@ hostent* gethostbyname(const char* name) perror("write"); return nullptr; } - ASSERT((size_t)nsent == sizeof(request_header)); + VERIFY((size_t)nsent == sizeof(request_header)); nsent = write(fd, name, name_length); if (nsent < 0) { perror("write"); return nullptr; } - ASSERT((size_t)nsent == name_length); + VERIFY((size_t)nsent == name_length); struct [[gnu::packed]] { u32 message_size; @@ -163,7 +163,7 @@ hostent* gethostbyname(const char* name) perror("recv"); return nullptr; } - ASSERT((size_t)nrecv == sizeof(response_header)); + VERIFY((size_t)nrecv == sizeof(response_header)); if (response_header.endpoint_magic != lookup_server_endpoint_magic || response_header.message_id != 2) { dbgln("Received an unexpected message"); return nullptr; @@ -172,7 +172,7 @@ hostent* gethostbyname(const char* name) // TODO: return a specific error. return nullptr; } - ASSERT(response_header.addresses_count > 0); + VERIFY(response_header.addresses_count > 0); i32 response_length; nrecv = read(fd, &response_length, sizeof(response_length)); @@ -180,15 +180,15 @@ hostent* gethostbyname(const char* name) perror("recv"); return nullptr; } - ASSERT((size_t)nrecv == sizeof(response_length)); - ASSERT(response_length == sizeof(__gethostbyname_address)); + VERIFY((size_t)nrecv == sizeof(response_length)); + VERIFY(response_length == sizeof(__gethostbyname_address)); nrecv = read(fd, &__gethostbyname_address, response_length); if (nrecv < 0) { perror("recv"); return nullptr; } - ASSERT(nrecv == response_length); + VERIFY(nrecv == response_length); gethostbyname_name_buffer = name; __gethostbyname_buffer.h_name = const_cast<char*>(gethostbyname_name_buffer.characters()); @@ -243,13 +243,13 @@ hostent* gethostbyaddr(const void* addr, socklen_t addr_size, int type) perror("write"); return nullptr; } - ASSERT((size_t)nsent == sizeof(request_header)); + VERIFY((size_t)nsent == sizeof(request_header)); nsent = write(fd, &in_addr, sizeof(in_addr)); if (nsent < 0) { perror("write"); return nullptr; } - ASSERT((size_t)nsent == sizeof(in_addr)); + VERIFY((size_t)nsent == sizeof(in_addr)); struct [[gnu::packed]] { u32 message_size; @@ -264,7 +264,7 @@ hostent* gethostbyaddr(const void* addr, socklen_t addr_size, int type) perror("recv"); return nullptr; } - ASSERT((size_t)nrecv == sizeof(response_header)); + VERIFY((size_t)nrecv == sizeof(response_header)); if (response_header.endpoint_magic != lookup_server_endpoint_magic || response_header.message_id != 4) { dbgln("Received an unexpected message"); return nullptr; @@ -281,7 +281,7 @@ hostent* gethostbyaddr(const void* addr, socklen_t addr_size, int type) perror("recv"); return nullptr; } - ASSERT(nrecv == response_header.name_length); + VERIFY(nrecv == response_header.name_length); gethostbyaddr_name_buffer = move(string_impl); __gethostbyaddr_buffer.h_name = buffer; @@ -661,12 +661,12 @@ int getaddrinfo(const char* __restrict node, const char* __restrict service, con (void)service; (void)hints; (void)res; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void freeaddrinfo(struct addrinfo* res) { (void)res; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } const char* gai_strerror(int errcode) { diff --git a/Userland/Libraries/LibC/pwd.cpp b/Userland/Libraries/LibC/pwd.cpp index 1d104e29c9..932b265d13 100644 --- a/Userland/Libraries/LibC/pwd.cpp +++ b/Userland/Libraries/LibC/pwd.cpp @@ -178,7 +178,7 @@ static void construct_pwd(struct passwd* pwd, char* buf, struct passwd** result) ok = ok || s_dir.copy_characters_to_buffer(buf_dir, s_dir.length() + 1); ok = ok || s_shell.copy_characters_to_buffer(buf_shell, s_shell.length() + 1); - ASSERT(ok); + VERIFY(ok); *result = pwd; pwd->pw_name = buf_name; diff --git a/Userland/Libraries/LibC/qsort.cpp b/Userland/Libraries/LibC/qsort.cpp index 145cb1b19f..f2270c2e7b 100644 --- a/Userland/Libraries/LibC/qsort.cpp +++ b/Userland/Libraries/LibC/qsort.cpp @@ -50,7 +50,7 @@ namespace AK { template<> inline void swap(const SizedObject& a, const SizedObject& b) { - ASSERT(a.size() == b.size()); + VERIFY(a.size() == b.size()); const size_t size = a.size(); const auto a_data = reinterpret_cast<char*>(a.data()); const auto b_data = reinterpret_cast<char*>(b.data()); diff --git a/Userland/Libraries/LibC/scanf.cpp b/Userland/Libraries/LibC/scanf.cpp index bb51aad92d..7ec13da4ee 100644 --- a/Userland/Libraries/LibC/scanf.cpp +++ b/Userland/Libraries/LibC/scanf.cpp @@ -104,7 +104,7 @@ struct read_element_concrete<int, ApT, kind> { return false; auto diff = endptr - nptr; - ASSERT(diff > 0); + VERIFY(diff > 0); lexer.ignore((size_t)diff); *ptr = value; @@ -155,7 +155,7 @@ struct read_element_concrete<unsigned, ApT, kind> { return false; auto diff = endptr - nptr; - ASSERT(diff > 0); + VERIFY(diff > 0); lexer.ignore((size_t)diff); *ptr = value; @@ -189,7 +189,7 @@ struct read_element_concrete<unsigned long long, ApT, kind> { return false; auto diff = endptr - nptr; - ASSERT(diff > 0); + VERIFY(diff > 0); lexer.ignore((size_t)diff); *ptr = value; @@ -220,7 +220,7 @@ struct read_element_concrete<float, ApT, kind> { return false; auto diff = endptr - nptr; - ASSERT(diff > 0); + VERIFY(diff > 0); lexer.ignore((size_t)diff); *ptr = value; @@ -235,7 +235,7 @@ struct read_element { switch (length_modifier) { default: case None: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case Default: return read_element_concrete<T, T, kind> {}(input_lexer, ap); case Char: @@ -510,7 +510,7 @@ extern "C" int vsscanf(const char* input, const char* format, va_list ap) default: // "undefined behaviour", let's be nice and crash. dbgln("Invalid conversion specifier {} in scanf!", (int)conversion_specifier); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case Decimal: if (!read_element<int, ReadKind::Normal> {}(length_modifier, input_lexer, &ap)) format_lexer.consume_all(); diff --git a/Userland/Libraries/LibC/semaphore.cpp b/Userland/Libraries/LibC/semaphore.cpp index 165c14eddc..618c3335f0 100644 --- a/Userland/Libraries/LibC/semaphore.cpp +++ b/Userland/Libraries/LibC/semaphore.cpp @@ -29,37 +29,37 @@ int sem_close(sem_t*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int sem_destroy(sem_t*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int sem_getvalue(sem_t*, int*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int sem_init(sem_t*, int, unsigned int) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } sem_t* sem_open(const char*, int, ...) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int sem_post(sem_t*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int sem_trywait(sem_t*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int sem_unlink(const char*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int sem_wait(sem_t*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } diff --git a/Userland/Libraries/LibC/signal.cpp b/Userland/Libraries/LibC/signal.cpp index cea5e149f4..661a3b371e 100644 --- a/Userland/Libraries/LibC/signal.cpp +++ b/Userland/Libraries/LibC/signal.cpp @@ -227,7 +227,7 @@ static_assert(sizeof(signal_names) == sizeof(const char*) * NSIG); int getsignalbyname(const char* name) { - ASSERT(name); + VERIFY(name); for (size_t i = 0; i < NSIG; ++i) { auto* signal_name = signal_names[i]; if (!strcmp(signal_name, name)) diff --git a/Userland/Libraries/LibC/stdio.cpp b/Userland/Libraries/LibC/stdio.cpp index cecb0aef2a..1ff78cc413 100644 --- a/Userland/Libraries/LibC/stdio.cpp +++ b/Userland/Libraries/LibC/stdio.cpp @@ -141,7 +141,7 @@ private: FILE::~FILE() { bool already_closed = m_fd == -1; - ASSERT(already_closed); + VERIFY(already_closed); } FILE* FILE::create(int fd, int mode) @@ -222,7 +222,7 @@ bool FILE::read_into_buffer() size_t available_size; u8* data = m_buffer.begin_enqueue(available_size); // If we want to read, the buffer must have some space! - ASSERT(available_size); + VERIFY(available_size); ssize_t nread = do_read(data, available_size); @@ -238,7 +238,7 @@ bool FILE::write_from_buffer() size_t size; const u8* data = m_buffer.begin_dequeue(size); // If we want to write, the buffer must have something in it! - ASSERT(size); + VERIFY(size); ssize_t nwritten = do_write(data, size); @@ -378,7 +378,7 @@ bool FILE::gets(u8* data, size_t size) *data = 0; return total_read > 0; } - ASSERT(nread == 1); + VERIFY(nread == 1); *data = byte; total_read++; data++; @@ -508,17 +508,17 @@ const u8* FILE::Buffer::begin_dequeue(size_t& available_size) const void FILE::Buffer::did_dequeue(size_t actual_size) { - ASSERT(actual_size > 0); + VERIFY(actual_size > 0); if (m_ungotten) { - ASSERT(actual_size == 1); + VERIFY(actual_size == 1); m_ungotten = false; return; } m_begin += actual_size; - ASSERT(m_begin <= m_capacity); + VERIFY(m_begin <= m_capacity); if (m_begin == m_capacity) { // Wrap around. m_begin = 0; @@ -534,7 +534,7 @@ void FILE::Buffer::did_dequeue(size_t actual_size) u8* FILE::Buffer::begin_enqueue(size_t& available_size) const { - ASSERT(m_data != nullptr); + VERIFY(m_data != nullptr); if (m_begin < m_end || m_empty) available_size = m_capacity - m_end; @@ -546,12 +546,12 @@ u8* FILE::Buffer::begin_enqueue(size_t& available_size) const void FILE::Buffer::did_enqueue(size_t actual_size) { - ASSERT(m_data != nullptr); - ASSERT(actual_size > 0); + VERIFY(m_data != nullptr); + VERIFY(actual_size > 0); m_end += actual_size; - ASSERT(m_end <= m_capacity); + VERIFY(m_end <= m_capacity); if (m_end == m_capacity) { // Wrap around. m_end = 0; @@ -590,7 +590,7 @@ void __stdio_init() int setvbuf(FILE* stream, char* buf, int mode, size_t size) { - ASSERT(stream); + VERIFY(stream); if (mode != _IONBF && mode != _IOLBF && mode != _IOFBF) { errno = EINVAL; return -1; @@ -611,13 +611,13 @@ void setlinebuf(FILE* stream) int fileno(FILE* stream) { - ASSERT(stream); + VERIFY(stream); return stream->fileno(); } int feof(FILE* stream) { - ASSERT(stream); + VERIFY(stream); return stream->eof(); } @@ -632,14 +632,14 @@ int fflush(FILE* stream) char* fgets(char* buffer, int size, FILE* stream) { - ASSERT(stream); + VERIFY(stream); bool ok = stream->gets(reinterpret_cast<u8*>(buffer), size); return ok ? buffer : nullptr; } int fgetc(FILE* stream) { - ASSERT(stream); + VERIFY(stream); char ch; size_t nread = fread(&ch, sizeof(char), 1, stream); if (nread == 1) @@ -715,19 +715,19 @@ ssize_t getline(char** lineptr, size_t* n, FILE* stream) int ungetc(int c, FILE* stream) { - ASSERT(stream); + VERIFY(stream); bool ok = stream->ungetc(c); return ok ? c : EOF; } int fputc(int ch, FILE* stream) { - ASSERT(stream); + VERIFY(stream); u8 byte = ch; size_t nwritten = stream->write(&byte, 1); if (nwritten == 0) return EOF; - ASSERT(nwritten == 1); + VERIFY(nwritten == 1); return byte; } @@ -743,7 +743,7 @@ int putchar(int ch) int fputs(const char* s, FILE* stream) { - ASSERT(stream); + VERIFY(stream); size_t len = strlen(s); size_t nwritten = stream->write(reinterpret_cast<const u8*>(s), len); if (nwritten < len) @@ -761,20 +761,20 @@ int puts(const char* s) void clearerr(FILE* stream) { - ASSERT(stream); + VERIFY(stream); stream->clear_err(); } int ferror(FILE* stream) { - ASSERT(stream); + VERIFY(stream); return stream->error(); } size_t fread(void* ptr, size_t size, size_t nmemb, FILE* stream) { - ASSERT(stream); - ASSERT(!Checked<size_t>::multiplication_would_overflow(size, nmemb)); + VERIFY(stream); + VERIFY(!Checked<size_t>::multiplication_would_overflow(size, nmemb)); size_t nread = stream->read(reinterpret_cast<u8*>(ptr), size * nmemb); return nread / size; @@ -782,8 +782,8 @@ size_t fread(void* ptr, size_t size, size_t nmemb, FILE* stream) size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream) { - ASSERT(stream); - ASSERT(!Checked<size_t>::multiplication_would_overflow(size, nmemb)); + VERIFY(stream); + VERIFY(!Checked<size_t>::multiplication_would_overflow(size, nmemb)); size_t nwritten = stream->write(reinterpret_cast<const u8*>(ptr), size * nmemb); return nwritten / size; @@ -791,32 +791,32 @@ size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream) int fseek(FILE* stream, long offset, int whence) { - ASSERT(stream); + VERIFY(stream); return stream->seek(offset, whence); } int fseeko(FILE* stream, off_t offset, int whence) { - ASSERT(stream); + VERIFY(stream); return stream->seek(offset, whence); } long ftell(FILE* stream) { - ASSERT(stream); + VERIFY(stream); return stream->tell(); } off_t ftello(FILE* stream) { - ASSERT(stream); + VERIFY(stream); return stream->tell(); } int fgetpos(FILE* stream, fpos_t* pos) { - ASSERT(stream); - ASSERT(pos); + VERIFY(stream); + VERIFY(pos); off_t val = stream->tell(); if (val == -1L) @@ -828,17 +828,17 @@ int fgetpos(FILE* stream, fpos_t* pos) int fsetpos(FILE* stream, const fpos_t* pos) { - ASSERT(stream); - ASSERT(pos); + VERIFY(stream); + VERIFY(pos); return stream->seek(*pos, SEEK_SET); } void rewind(FILE* stream) { - ASSERT(stream); + VERIFY(stream); int rc = stream->seek(0, SEEK_SET); - ASSERT(rc == 0); + VERIFY(rc == 0); } ALWAYS_INLINE void stdout_putch(char*&, char ch) @@ -991,7 +991,7 @@ FILE* fopen(const char* pathname, const char* mode) FILE* freopen(const char* pathname, const char* mode, FILE* stream) { - ASSERT(stream); + VERIFY(stream); if (!pathname) { // FIXME: Someone should probably implement this path. TODO(); @@ -1022,7 +1022,7 @@ static inline bool is_default_stream(FILE* stream) int fclose(FILE* stream) { - ASSERT(stream); + VERIFY(stream); bool ok = stream->close(); ScopedValueRollback errno_restorer(errno); @@ -1124,8 +1124,8 @@ FILE* popen(const char* command, const char* type) int pclose(FILE* stream) { - ASSERT(stream); - ASSERT(stream->popen_child() != 0); + VERIFY(stream); + VERIFY(stream->popen_child() != 0); int wstatus = 0; int rc = waitpid(stream->popen_child(), &wstatus, 0); diff --git a/Userland/Libraries/LibC/stdlib.cpp b/Userland/Libraries/LibC/stdlib.cpp index 049733dc6b..0b599202a8 100644 --- a/Userland/Libraries/LibC/stdlib.cpp +++ b/Userland/Libraries/LibC/stdlib.cpp @@ -289,7 +289,7 @@ int unsetenv(const char* name) for (; environ[environ_size]; ++environ_size) { char* old_var = environ[environ_size]; char* old_eq = strchr(old_var, '='); - ASSERT(old_eq); + VERIFY(old_eq); size_t old_var_len = old_eq - old_var; if (new_var_len != old_var_len) @@ -343,7 +343,7 @@ int putenv(char* new_var) for (; environ[environ_size]; ++environ_size) { char* old_var = environ[environ_size]; char* old_eq = strchr(old_var, '='); - ASSERT(old_eq); + VERIFY(old_eq); auto old_var_len = old_eq - old_var; if (new_var_len != old_var_len) @@ -491,7 +491,7 @@ double strtod(const char* str, char** endptr) is_a_digit = false; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -547,7 +547,7 @@ double strtod(const char* str, char** endptr) is_a_digit = false; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -955,7 +955,7 @@ long long strtoll(const char* str, char** endptr, int base) is_a_digit = false; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -1039,7 +1039,7 @@ unsigned long long strtoull(const char* str, char** endptr, int base) is_a_digit = false; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibC/sys/wait.cpp b/Userland/Libraries/LibC/sys/wait.cpp index 2cde5e2821..70b1bb90e9 100644 --- a/Userland/Libraries/LibC/sys/wait.cpp +++ b/Userland/Libraries/LibC/sys/wait.cpp @@ -86,7 +86,7 @@ pid_t waitpid(pid_t waitee, int* wstatus, int options) *wstatus = 0; return 0; // return 0 if running default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibC/syslog.cpp b/Userland/Libraries/LibC/syslog.cpp index 650347da96..b2242f6212 100644 --- a/Userland/Libraries/LibC/syslog.cpp +++ b/Userland/Libraries/LibC/syslog.cpp @@ -66,7 +66,7 @@ static const char* get_syslog_ident(struct syslog_data* data) else if (program_name_set) return program_name_buffer; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void openlog_r(const char* ident, int logopt, int facility, struct syslog_data* data) diff --git a/Userland/Libraries/LibC/termcap.cpp b/Userland/Libraries/LibC/termcap.cpp index 034663af9f..b21423ea12 100644 --- a/Userland/Libraries/LibC/termcap.cpp +++ b/Userland/Libraries/LibC/termcap.cpp @@ -137,7 +137,7 @@ int tgetnum(const char* id) auto it = caps->find(id); if (it != caps->end()) return atoi((*it).value); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static Vector<char> s_tgoto_buffer; diff --git a/Userland/Libraries/LibC/time.cpp b/Userland/Libraries/LibC/time.cpp index df7010c646..56ef7a3663 100644 --- a/Userland/Libraries/LibC/time.cpp +++ b/Userland/Libraries/LibC/time.cpp @@ -84,7 +84,7 @@ static void time_to_tm(struct tm* tm, time_t t) t += days_in_year(year - 1) * __seconds_per_day; tm->tm_year = year - 1900; - ASSERT(t >= 0); + VERIFY(t >= 0); int days = t / __seconds_per_day; tm->tm_yday = days; int remaining = t % __seconds_per_day; diff --git a/Userland/Libraries/LibC/unistd.cpp b/Userland/Libraries/LibC/unistd.cpp index 64eadb14fa..e6a29bc41b 100644 --- a/Userland/Libraries/LibC/unistd.cpp +++ b/Userland/Libraries/LibC/unistd.cpp @@ -592,7 +592,7 @@ long fpathconf([[maybe_unused]] int fd, [[maybe_unused]] int name) return _POSIX_VDISABLE; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } long pathconf([[maybe_unused]] const char* path, int name) @@ -604,13 +604,13 @@ long pathconf([[maybe_unused]] const char* path, int name) return PIPE_BUF; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void _exit(int status) { syscall(SC_exit, status); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void sync() diff --git a/Userland/Libraries/LibChess/Chess.cpp b/Userland/Libraries/LibChess/Chess.cpp index fae0c1e513..3bce22f647 100644 --- a/Userland/Libraries/LibChess/Chess.cpp +++ b/Userland/Libraries/LibChess/Chess.cpp @@ -79,7 +79,7 @@ Color opposing_color(Color color) Square::Square(const StringView& name) { - ASSERT(name.length() == 2); + VERIFY(name.length() == 2); char filec = name[0]; char rankc = name[1]; @@ -88,13 +88,13 @@ Square::Square(const StringView& name) } else if (filec >= 'A' && filec <= 'H') { file = filec - 'A'; } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (rankc >= '1' && rankc <= '8') { rank = rankc - '1'; } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -312,7 +312,7 @@ String Board::to_fen() const } // 2. Active color - ASSERT(m_turn != Color::None); + VERIFY(m_turn != Color::None); builder.append(m_turn == Color::White ? " w " : " b "); // 3. Castling availability @@ -349,15 +349,15 @@ String Board::to_fen() const Piece Board::get_piece(const Square& square) const { - ASSERT(square.rank < 8); - ASSERT(square.file < 8); + VERIFY(square.rank < 8); + VERIFY(square.file < 8); return m_board[square.rank][square.file]; } Piece Board::set_piece(const Square& square, const Piece& piece) { - ASSERT(square.rank < 8); - ASSERT(square.file < 8); + VERIFY(square.rank < 8); + VERIFY(square.file < 8); return m_board[square.rank][square.file] = piece; } @@ -913,7 +913,7 @@ String Board::result_to_string(Result result, Color turn) { switch (result) { case Result::CheckMate: - ASSERT(turn != Chess::Color::None); + VERIFY(turn != Chess::Color::None); return turn == Chess::Color::White ? "Black wins by Checkmate" : "White wins by Checkmate"; case Result::WhiteResign: return "Black wins by Resignation"; @@ -934,7 +934,7 @@ String Board::result_to_string(Result result, Color turn) case Chess::Board::Result::NotFinished: return "Game not finished"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -942,7 +942,7 @@ String Board::result_to_points(Result result, Color turn) { switch (result) { case Result::CheckMate: - ASSERT(turn != Chess::Color::None); + VERIFY(turn != Chess::Color::None); return turn == Chess::Color::White ? "0-1" : "1-0"; case Result::WhiteResign: return "0-1"; @@ -963,7 +963,7 @@ String Board::result_to_points(Result result, Color turn) case Chess::Board::Result::NotFinished: return "*"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibChess/UCICommand.cpp b/Userland/Libraries/LibChess/UCICommand.cpp index af4294c8df..f84f71a639 100644 --- a/Userland/Libraries/LibChess/UCICommand.cpp +++ b/Userland/Libraries/LibChess/UCICommand.cpp @@ -32,8 +32,8 @@ namespace Chess::UCI { UCICommand UCICommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "uci"); - ASSERT(tokens.size() == 1); + VERIFY(tokens[0] == "uci"); + VERIFY(tokens.size() == 1); return UCICommand(); } @@ -45,14 +45,14 @@ String UCICommand::to_string() const DebugCommand DebugCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "debug"); - ASSERT(tokens.size() == 2); + VERIFY(tokens[0] == "debug"); + VERIFY(tokens.size() == 2); if (tokens[1] == "on") return DebugCommand(Flag::On); if (tokens[1] == "off") return DebugCommand(Flag::On); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } String DebugCommand::to_string() const @@ -67,8 +67,8 @@ String DebugCommand::to_string() const IsReadyCommand IsReadyCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "isready"); - ASSERT(tokens.size() == 1); + VERIFY(tokens[0] == "isready"); + VERIFY(tokens.size() == 1); return IsReadyCommand(); } @@ -80,9 +80,9 @@ String IsReadyCommand::to_string() const SetOptionCommand SetOptionCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "setoption"); - ASSERT(tokens[1] == "name"); - ASSERT(tokens.size() > 2); + VERIFY(tokens[0] == "setoption"); + VERIFY(tokens[1] == "name"); + VERIFY(tokens.size() > 2); StringBuilder name; StringBuilder value; @@ -110,7 +110,7 @@ SetOptionCommand SetOptionCommand::from_string(const StringView& command) } } - ASSERT(!name.is_empty()); + VERIFY(!name.is_empty()); return SetOptionCommand(name.to_string().trim_whitespace(), value.to_string().trim_whitespace()); } @@ -131,9 +131,9 @@ String SetOptionCommand::to_string() const PositionCommand PositionCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens.size() >= 3); - ASSERT(tokens[0] == "position"); - ASSERT(tokens[2] == "moves"); + VERIFY(tokens.size() >= 3); + VERIFY(tokens[0] == "position"); + VERIFY(tokens[2] == "moves"); Optional<String> fen; if (tokens[1] != "startpos") @@ -167,40 +167,40 @@ String PositionCommand::to_string() const GoCommand GoCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "go"); + VERIFY(tokens[0] == "go"); GoCommand go_command; for (size_t i = 1; i < tokens.size(); ++i) { if (tokens[i] == "searchmoves") { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else if (tokens[i] == "ponder") { go_command.ponder = true; } else if (tokens[i] == "wtime") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.wtime = tokens[i].to_int().value(); } else if (tokens[i] == "btime") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.btime = tokens[i].to_int().value(); } else if (tokens[i] == "winc") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.winc = tokens[i].to_int().value(); } else if (tokens[i] == "binc") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.binc = tokens[i].to_int().value(); } else if (tokens[i] == "movestogo") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.movestogo = tokens[i].to_int().value(); } else if (tokens[i] == "depth") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.depth = tokens[i].to_int().value(); } else if (tokens[i] == "nodes") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.nodes = tokens[i].to_int().value(); } else if (tokens[i] == "mate") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.mate = tokens[i].to_int().value(); } else if (tokens[i] == "movetime") { - ASSERT(i++ < tokens.size()); + VERIFY(i++ < tokens.size()); go_command.movetime = tokens[i].to_int().value(); } else if (tokens[i] == "infinite") { go_command.infinite = true; @@ -253,8 +253,8 @@ String GoCommand::to_string() const StopCommand StopCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "stop"); - ASSERT(tokens.size() == 1); + VERIFY(tokens[0] == "stop"); + VERIFY(tokens.size() == 1); return StopCommand(); } @@ -266,7 +266,7 @@ String StopCommand::to_string() const IdCommand IdCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "id"); + VERIFY(tokens[0] == "id"); StringBuilder value; for (size_t i = 2; i < tokens.size(); ++i) { if (i != 2) @@ -280,7 +280,7 @@ IdCommand IdCommand::from_string(const StringView& command) } else if (tokens[1] == "author") { return IdCommand(Type::Author, value.build()); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } String IdCommand::to_string() const @@ -300,8 +300,8 @@ String IdCommand::to_string() const UCIOkCommand UCIOkCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "uciok"); - ASSERT(tokens.size() == 1); + VERIFY(tokens[0] == "uciok"); + VERIFY(tokens.size() == 1); return UCIOkCommand(); } @@ -313,8 +313,8 @@ String UCIOkCommand::to_string() const ReadyOkCommand ReadyOkCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "readyok"); - ASSERT(tokens.size() == 1); + VERIFY(tokens[0] == "readyok"); + VERIFY(tokens.size() == 1); return ReadyOkCommand(); } @@ -326,8 +326,8 @@ String ReadyOkCommand::to_string() const BestMoveCommand BestMoveCommand::from_string(const StringView& command) { auto tokens = command.split_view(' '); - ASSERT(tokens[0] == "bestmove"); - ASSERT(tokens.size() == 2); + VERIFY(tokens[0] == "bestmove"); + VERIFY(tokens.size() == 2); return BestMoveCommand(Move(tokens[1])); } @@ -343,13 +343,13 @@ String BestMoveCommand::to_string() const InfoCommand InfoCommand::from_string([[maybe_unused]] const StringView& command) { // FIXME: Implement this. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } String InfoCommand::to_string() const { // FIXME: Implement this. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "info"; } diff --git a/Userland/Libraries/LibChess/UCIEndpoint.cpp b/Userland/Libraries/LibChess/UCIEndpoint.cpp index 5e9066aacc..4c094b80fe 100644 --- a/Userland/Libraries/LibChess/UCIEndpoint.cpp +++ b/Userland/Libraries/LibChess/UCIEndpoint.cpp @@ -125,7 +125,7 @@ NonnullOwnPtr<Command> Endpoint::read_command() } dbgln("command line: {}", line); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }; diff --git a/Userland/Libraries/LibCompress/Deflate.cpp b/Userland/Libraries/LibCompress/Deflate.cpp index 184fe58e1e..f1749868bc 100644 --- a/Userland/Libraries/LibCompress/Deflate.cpp +++ b/Userland/Libraries/LibCompress/Deflate.cpp @@ -109,7 +109,7 @@ u32 CanonicalCode::read_symbol(InputBitStream& stream) const for (;;) { code_bits = code_bits << 1 | stream.read_bits(1); - ASSERT(code_bits < (1 << 16)); + VERIFY(code_bits < (1 << 16)); // FIXME: This is very inefficient and could greatly be improved by implementing this // algorithm: https://www.hanshq.net/zip.html#huffdec @@ -273,7 +273,7 @@ size_t DeflateDecompressor::read(Bytes bytes) return nread + read(bytes.slice(nread)); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool DeflateDecompressor::read_or_error(Bytes bytes) @@ -338,7 +338,7 @@ u32 DeflateDecompressor::decode_length(u32 symbol) if (symbol == 285) return 258; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } u32 DeflateDecompressor::decode_distance(u32 symbol) @@ -353,7 +353,7 @@ u32 DeflateDecompressor::decode_distance(u32 symbol) return ((symbol % 2 + 2) << extra_bits) + 1 + m_input_stream.read_bits(extra_bits); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void DeflateDecompressor::decode_codes(CanonicalCode& literal_code, Optional<CanonicalCode>& distance_code) @@ -401,7 +401,7 @@ void DeflateDecompressor::decode_codes(CanonicalCode& literal_code, Optional<Can code_lengths.append(0); continue; } else { - ASSERT(symbol == 16); + VERIFY(symbol == 16); if (code_lengths.is_empty()) { set_fatal_error(); diff --git a/Userland/Libraries/LibCompress/Zlib.cpp b/Userland/Libraries/LibCompress/Zlib.cpp index dc2d112ad6..852e829935 100644 --- a/Userland/Libraries/LibCompress/Zlib.cpp +++ b/Userland/Libraries/LibCompress/Zlib.cpp @@ -47,10 +47,10 @@ Zlib::Zlib(ReadonlyBytes data) m_compression_level = (flags >> 6) & 0x3; m_checksum = 0; - ASSERT(m_compression_method == 8); - ASSERT(m_compression_info == 7); - ASSERT(!m_has_dictionary); - ASSERT((compression_info * 256 + flags) % 31 == 0); + VERIFY(m_compression_method == 8); + VERIFY(m_compression_info == 7); + VERIFY(!m_has_dictionary); + VERIFY((compression_info * 256 + flags) % 31 == 0); m_data_bytes = data.slice(2, data.size() - 2 - 4); } diff --git a/Userland/Libraries/LibCore/Account.cpp b/Userland/Libraries/LibCore/Account.cpp index 5a71b1e053..2b2e5d28c0 100644 --- a/Userland/Libraries/LibCore/Account.cpp +++ b/Userland/Libraries/LibCore/Account.cpp @@ -200,9 +200,9 @@ String Account::generate_passwd_file() const void Account::load_shadow_file() { auto file_or_error = Core::File::open("/etc/shadow", Core::File::ReadOnly); - ASSERT(!file_or_error.is_error()); + VERIFY(!file_or_error.is_error()); auto shadow_file = file_or_error.release_value(); - ASSERT(shadow_file->is_open()); + VERIFY(shadow_file->is_open()); Vector<ShadowEntry> entries; @@ -250,7 +250,7 @@ bool Account::sync() auto new_shadow_file_content = generate_shadow_file(); if (new_passwd_file_content.is_null() || new_shadow_file_content.is_null()) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } char new_passwd_name[] = "/etc/passwd.XXXXXX"; @@ -260,34 +260,34 @@ bool Account::sync() auto new_passwd_fd = mkstemp(new_passwd_name); if (new_passwd_fd < 0) { perror("mkstemp"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } ScopeGuard new_passwd_fd_guard = [new_passwd_fd] { close(new_passwd_fd); }; auto new_shadow_fd = mkstemp(new_shadow_name); if (new_shadow_fd < 0) { perror("mkstemp"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } ScopeGuard new_shadow_fd_guard = [new_shadow_fd] { close(new_shadow_fd); }; if (fchmod(new_passwd_fd, 0644) < 0) { perror("fchmod"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto nwritten = write(new_passwd_fd, new_passwd_file_content.characters(), new_passwd_file_content.length()); if (nwritten < 0) { perror("write"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(static_cast<size_t>(nwritten) == new_passwd_file_content.length()); + VERIFY(static_cast<size_t>(nwritten) == new_passwd_file_content.length()); nwritten = write(new_shadow_fd, new_shadow_file_content.characters(), new_shadow_file_content.length()); if (nwritten < 0) { perror("write"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(static_cast<size_t>(nwritten) == new_shadow_file_content.length()); + VERIFY(static_cast<size_t>(nwritten) == new_shadow_file_content.length()); } if (rename(new_passwd_name, "/etc/passwd") < 0) { diff --git a/Userland/Libraries/LibCore/AnonymousBuffer.cpp b/Userland/Libraries/LibCore/AnonymousBuffer.cpp index 8f6b1bedad..e30d229c7c 100644 --- a/Userland/Libraries/LibCore/AnonymousBuffer.cpp +++ b/Userland/Libraries/LibCore/AnonymousBuffer.cpp @@ -87,10 +87,10 @@ AnonymousBufferImpl::~AnonymousBufferImpl() { if (m_fd != -1) { auto rc = close(m_fd); - ASSERT(rc == 0); + VERIFY(rc == 0); } auto rc = munmap(m_data, round_up_to_power_of_two(m_size, PAGE_SIZE)); - ASSERT(rc == 0); + VERIFY(rc == 0); } AnonymousBuffer AnonymousBuffer::create_from_anon_fd(int fd, size_t size) diff --git a/Userland/Libraries/LibCore/ArgsParser.cpp b/Userland/Libraries/LibCore/ArgsParser.cpp index 121272e38b..ae94b3a39e 100644 --- a/Userland/Libraries/LibCore/ArgsParser.cpp +++ b/Userland/Libraries/LibCore/ArgsParser.cpp @@ -104,16 +104,16 @@ bool ArgsParser::parse(int argc, char** argv, bool exit_on_failure) Option* found_option = nullptr; if (c == 0) { // It was a long option. - ASSERT(index_of_found_long_option >= 0); + VERIFY(index_of_found_long_option >= 0); found_option = &m_options[index_of_found_long_option]; index_of_found_long_option = -1; } else { // It was a short option, look it up. auto it = m_options.find_if([c](auto& opt) { return c == opt.short_name; }); - ASSERT(!it.is_end()); + VERIFY(!it.is_end()); found_option = &*it; } - ASSERT(found_option); + VERIFY(found_option); const char* arg = found_option->requires_argument ? optarg : nullptr; if (!found_option->accept_value(arg)) { @@ -264,7 +264,7 @@ void ArgsParser::add_option(bool& value, const char* help_string, const char* lo short_name, nullptr, [&value](const char* s) { - ASSERT(s == nullptr); + VERIFY(s == nullptr); value = true; return true; } diff --git a/Userland/Libraries/LibCore/Command.cpp b/Userland/Libraries/LibCore/Command.cpp index 23f9560c46..d75a645777 100644 --- a/Userland/Libraries/LibCore/Command.cpp +++ b/Userland/Libraries/LibCore/Command.cpp @@ -56,11 +56,11 @@ String command(const String& program, const Vector<String>& arguments, Optional< int stderr_pipe[2] = {}; if (pipe2(stdout_pipe, O_CLOEXEC)) { perror("pipe2"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (pipe2(stderr_pipe, O_CLOEXEC)) { perror("pipe2"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto close_pipes = ScopeGuard([stderr_pipe, stdout_pipe] { @@ -88,7 +88,7 @@ String command(const String& program, const Vector<String>& arguments, Optional< pid_t pid; if ((errno = posix_spawnp(&pid, program.characters(), &action, nullptr, const_cast<char**>(argv), environ))) { perror("posix_spawn"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int wstatus; waitpid(pid, &wstatus, 0); @@ -102,7 +102,7 @@ String command(const String& program, const Vector<String>& arguments, Optional< auto result_file = Core::File::construct(); if (!result_file->open(pipe[0], Core::IODevice::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes)) { perror("open"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return String::copy(result_file->read_all()); }; diff --git a/Userland/Libraries/LibCore/ElapsedTimer.cpp b/Userland/Libraries/LibCore/ElapsedTimer.cpp index 9d0fc95378..35a4aff3d0 100644 --- a/Userland/Libraries/LibCore/ElapsedTimer.cpp +++ b/Userland/Libraries/LibCore/ElapsedTimer.cpp @@ -43,7 +43,7 @@ void ElapsedTimer::start() int ElapsedTimer::elapsed() const { - ASSERT(is_valid()); + VERIFY(is_valid()); struct timeval now; timespec now_spec; clock_gettime(m_precise ? CLOCK_MONOTONIC : CLOCK_MONOTONIC_COARSE, &now_spec); diff --git a/Userland/Libraries/LibCore/EventLoop.cpp b/Userland/Libraries/LibCore/EventLoop.cpp index f05e9ba126..c74482f241 100644 --- a/Userland/Libraries/LibCore/EventLoop.cpp +++ b/Userland/Libraries/LibCore/EventLoop.cpp @@ -160,7 +160,7 @@ public: shutdown(); return; } - ASSERT(nread == sizeof(length)); + VERIFY(nread == sizeof(length)); auto request = m_socket->read(length); auto request_json = JsonValue::from_string(request); @@ -296,7 +296,7 @@ EventLoop::EventLoop() fcntl(s_wake_pipe_fds[1], F_SETFD, FD_CLOEXEC); #endif - ASSERT(rc == 0); + VERIFY(rc == 0); s_event_loop_stack->append(this); #ifdef __serenity__ @@ -326,20 +326,20 @@ bool EventLoop::start_rpc_server() }; return s_rpc_server->listen(String::formatted("/tmp/rpc/{}", getpid())); #else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); #endif } EventLoop& EventLoop::main() { - ASSERT(s_main_event_loop); + VERIFY(s_main_event_loop); return *s_main_event_loop; } EventLoop& EventLoop::current() { EventLoop* event_loop = s_event_loop_stack->last(); - ASSERT(event_loop != nullptr); + VERIFY(event_loop != nullptr); return *event_loop; } @@ -391,7 +391,7 @@ int EventLoop::exec() return m_exit_code; pump(); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void EventLoop::pump(WaitMode mode) @@ -415,7 +415,7 @@ void EventLoop::pump(WaitMode mode) if (!receiver) { switch (event.type()) { case Event::Quit: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return; default: #if EVENTLOOP_DEBUG @@ -485,7 +485,7 @@ void SignalHandlers::dispatch() for (auto& handler : m_handlers_pending) { if (handler.value) { auto result = m_handlers.set(handler.key, move(handler.value)); - ASSERT(result == AK::HashSetResult::InsertedNewEntry); + VERIFY(result == AK::HashSetResult::InsertedNewEntry); } else { m_handlers.remove(handler.key); } @@ -506,7 +506,7 @@ int SignalHandlers::add(Function<void(int)>&& handler) bool SignalHandlers::remove(int handler_id) { - ASSERT(handler_id != 0); + VERIFY(handler_id != 0); if (m_calling_handlers) { auto it = m_handlers.find(handler_id); if (it != m_handlers.end()) { @@ -544,7 +544,7 @@ void EventLoop::dispatch_signal(int signo) void EventLoop::handle_signal(int signo) { - ASSERT(signo != 0); + VERIFY(signo != 0); // We MUST check if the current pid still matches, because there // is a window between fork() and exec() where a signal delivered // to our fork could be inadvertedly routed to the parent process! @@ -552,7 +552,7 @@ void EventLoop::handle_signal(int signo) int nwritten = write(s_wake_pipe_fds[1], &signo, sizeof(signo)); if (nwritten < 0) { perror("EventLoop::register_signal: write"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } else { // We're a fork who received a signal, reset s_pid @@ -562,7 +562,7 @@ void EventLoop::handle_signal(int signo) int EventLoop::register_signal(int signo, Function<void(int)> handler) { - ASSERT(signo != 0); + VERIFY(signo != 0); auto& info = *signals_info(); auto handlers = info.signal_handlers.find(signo); if (handlers == info.signal_handlers.end()) { @@ -577,7 +577,7 @@ int EventLoop::register_signal(int signo, Function<void(int)> handler) void EventLoop::unregister_signal(int handler_id) { - ASSERT(handler_id != 0); + VERIFY(handler_id != 0); int remove_signo = 0; auto& info = *signals_info(); for (auto& h : info.signal_handlers) { @@ -612,7 +612,7 @@ void EventLoop::notify_forked(ForkEvent event) return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void EventLoop::wait_for_event(WaitMode mode) @@ -639,7 +639,7 @@ retry: if (notifier->event_mask() & Notifier::Write) add_fd_to_set(notifier->fd(), wfds); if (notifier->event_mask() & Notifier::Exceptional) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool queued_events_is_empty; @@ -681,16 +681,16 @@ try_select_again: dbgln("Core::EventLoop::wait_for_event: {} ({}: {})", marked_fd_count, saved_errno, strerror(saved_errno)); #endif // Blow up, similar to Core::safe_syscall. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (FD_ISSET(s_wake_pipe_fds[0], &rfds)) { int wake_events[8]; auto nread = read(s_wake_pipe_fds[0], wake_events, sizeof(wake_events)); if (nread < 0) { perror("read from wake pipe"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(nread > 0); + VERIFY(nread > 0); bool wake_requested = false; int event_count = nread / sizeof(wake_events[0]); for (int i = 0; i < event_count; i++) { @@ -729,7 +729,7 @@ try_select_again: timer.reload(now); } else { // FIXME: Support removing expired timers that don't want to reload. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -778,7 +778,7 @@ Optional<struct timeval> EventLoop::get_next_timer_expiration() int EventLoop::register_timer(Object& object, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible fire_when_not_visible) { - ASSERT(milliseconds >= 0); + VERIFY(milliseconds >= 0); auto timer = make<EventLoopTimer>(); timer->owner = object; timer->interval = milliseconds; @@ -822,7 +822,7 @@ void EventLoop::wake() int nwritten = write(s_wake_pipe_fds[1], &wake_event, sizeof(wake_event)); if (nwritten < 0) { perror("EventLoop::wake: write"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibCore/File.cpp b/Userland/Libraries/LibCore/File.cpp index f5522ed14d..d04a8982b0 100644 --- a/Userland/Libraries/LibCore/File.cpp +++ b/Userland/Libraries/LibCore/File.cpp @@ -81,7 +81,7 @@ bool File::open(IODevice::OpenMode mode) bool File::open_impl(IODevice::OpenMode mode, mode_t permissions) { - ASSERT(!m_filename.is_null()); + VERIFY(!m_filename.is_null()); int flags = 0; if ((mode & IODevice::ReadWrite) == IODevice::ReadWrite) { flags |= O_RDWR | O_CREAT; @@ -144,7 +144,7 @@ String File::real_path_for(const String& filename) bool File::ensure_parent_directories(const String& path) { - ASSERT(path.starts_with("/")); + VERIFY(path.starts_with("/")); int saved_errno = 0; ScopeGuard restore_errno = [&saved_errno] { errno = saved_errno; }; @@ -365,7 +365,7 @@ Result<void, File::CopyError> File::copy_file(const String& dst_path, const stru if (nwritten < 0) return CopyError { OSError(errno), false }; - ASSERT(nwritten > 0); + VERIFY(nwritten > 0); remaining_to_write -= nwritten; bufptr += nwritten; } diff --git a/Userland/Libraries/LibCore/FileStream.h b/Userland/Libraries/LibCore/FileStream.h index 0c8774d28a..03247aa2c2 100644 --- a/Userland/Libraries/LibCore/FileStream.h +++ b/Userland/Libraries/LibCore/FileStream.h @@ -42,7 +42,7 @@ public: static Result<InputFileStream, String> open(StringView filename, IODevice::OpenMode mode = IODevice::OpenMode::ReadOnly, mode_t permissions = 0644) { - ASSERT((mode & 0xf) == IODevice::OpenMode::ReadOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); + VERIFY((mode & 0xf) == IODevice::OpenMode::ReadOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); auto file_result = File::open(filename, mode, permissions); @@ -54,7 +54,7 @@ public: static Result<Buffered<InputFileStream>, String> open_buffered(StringView filename, IODevice::OpenMode mode = IODevice::OpenMode::ReadOnly, mode_t permissions = 0644) { - ASSERT((mode & 0xf) == IODevice::OpenMode::ReadOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); + VERIFY((mode & 0xf) == IODevice::OpenMode::ReadOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); auto file_result = File::open(filename, mode, permissions); @@ -106,7 +106,7 @@ public: static Result<OutputFileStream, String> open(StringView filename, IODevice::OpenMode mode = IODevice::OpenMode::WriteOnly, mode_t permissions = 0644) { - ASSERT((mode & 0xf) == IODevice::OpenMode::WriteOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); + VERIFY((mode & 0xf) == IODevice::OpenMode::WriteOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); auto file_result = File::open(filename, mode, permissions); @@ -118,7 +118,7 @@ public: static Result<Buffered<OutputFileStream>, String> open_buffered(StringView filename, IODevice::OpenMode mode = IODevice::OpenMode::WriteOnly, mode_t permissions = 0644) { - ASSERT((mode & 0xf) == IODevice::OpenMode::WriteOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); + VERIFY((mode & 0xf) == IODevice::OpenMode::WriteOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite); auto file_result = File::open(filename, mode, permissions); diff --git a/Userland/Libraries/LibCore/FileWatcher.cpp b/Userland/Libraries/LibCore/FileWatcher.cpp index 19bb73eb8a..70ed9928bc 100644 --- a/Userland/Libraries/LibCore/FileWatcher.cpp +++ b/Userland/Libraries/LibCore/FileWatcher.cpp @@ -72,7 +72,7 @@ BlockingFileWatcher::BlockingFileWatcher(const String& path) : m_path(path) { m_watcher_fd = watch_file(path.characters(), path.length()); - ASSERT(m_watcher_fd != -1); + VERIFY(m_watcher_fd != -1); } BlockingFileWatcher::~BlockingFileWatcher() diff --git a/Userland/Libraries/LibCore/GetPassword.cpp b/Userland/Libraries/LibCore/GetPassword.cpp index dfcff21583..88bb27345a 100644 --- a/Userland/Libraries/LibCore/GetPassword.cpp +++ b/Userland/Libraries/LibCore/GetPassword.cpp @@ -58,7 +58,7 @@ Result<String, OSError> get_password(const StringView& prompt) if (line_length < 0) return OSError(saved_errno); - ASSERT(line_length != 0); + VERIFY(line_length != 0); // Remove trailing '\n' read by getline(). password[line_length - 1] = '\0'; diff --git a/Userland/Libraries/LibCore/Gzip.cpp b/Userland/Libraries/LibCore/Gzip.cpp index 25c88bb15c..4dcdbe39f1 100644 --- a/Userland/Libraries/LibCore/Gzip.cpp +++ b/Userland/Libraries/LibCore/Gzip.cpp @@ -46,7 +46,7 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data) size_t current = 0; auto read_byte = [&]() { if (current >= data.size()) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return (u8)0; } return data[current++]; @@ -108,7 +108,7 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data) Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data) { - ASSERT(is_compressed(data)); + VERIFY(is_compressed(data)); dbgln_if(GZIP_DEBUG, "Gzip::decompress: Decompressing gzip compressed data. size={}", data.size()); auto optional_payload = get_gzip_payload(data); @@ -150,7 +150,7 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data) destination.grow(destination.size() * 2); } else { dbgln("Gzip::decompress: Error. puff() returned: {}", puff_ret); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibCore/IODeviceStreamReader.h b/Userland/Libraries/LibCore/IODeviceStreamReader.h index 0339c30272..bae5815d82 100644 --- a/Userland/Libraries/LibCore/IODeviceStreamReader.h +++ b/Userland/Libraries/LibCore/IODeviceStreamReader.h @@ -47,7 +47,7 @@ public: IODeviceStreamReader& operator>>(T& value) { int nread = m_device.read((u8*)&value, sizeof(T)); - ASSERT(nread == sizeof(T)); + VERIFY(nread == sizeof(T)); if (nread != sizeof(T)) m_had_failure = true; return *this; diff --git a/Userland/Libraries/LibCore/LocalServer.cpp b/Userland/Libraries/LibCore/LocalServer.cpp index ec99d51317..46d7d3ddd2 100644 --- a/Userland/Libraries/LibCore/LocalServer.cpp +++ b/Userland/Libraries/LibCore/LocalServer.cpp @@ -112,12 +112,12 @@ bool LocalServer::listen(const String& address) ioctl(m_fd, FIONBIO, &option); fcntl(m_fd, F_SETFD, FD_CLOEXEC); #endif - ASSERT(m_fd >= 0); + VERIFY(m_fd >= 0); #ifndef __APPLE__ rc = fchmod(m_fd, 0600); if (rc < 0) { perror("fchmod"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } #endif @@ -147,7 +147,7 @@ bool LocalServer::listen(const String& address) RefPtr<LocalSocket> LocalServer::accept() { - ASSERT(m_listening); + VERIFY(m_listening); sockaddr_un un; socklen_t un_size = sizeof(un); int accepted_fd = ::accept(m_fd, (sockaddr*)&un, &un_size); diff --git a/Userland/Libraries/LibCore/NetworkJob.cpp b/Userland/Libraries/LibCore/NetworkJob.cpp index a2884d5a54..a25273a86f 100644 --- a/Userland/Libraries/LibCore/NetworkJob.cpp +++ b/Userland/Libraries/LibCore/NetworkJob.cpp @@ -55,7 +55,7 @@ void NetworkJob::did_finish(NonnullRefPtr<NetworkResponse>&& response) m_response = move(response); dbgln_if(CNETWORKJOB_DEBUG, "{} job did_finish", *this); - ASSERT(on_finish); + VERIFY(on_finish); on_finish(true); shutdown(); } @@ -68,7 +68,7 @@ void NetworkJob::did_fail(Error error) m_error = error; dbgln_if(CNETWORKJOB_DEBUG, "{}{{{:p}}} job did_fail! error: {} ({})", class_name(), this, (unsigned)error, to_string(error)); - ASSERT(on_finish); + VERIFY(on_finish); on_finish(false); shutdown(); } diff --git a/Userland/Libraries/LibCore/Object.cpp b/Userland/Libraries/LibCore/Object.cpp index 55cd102409..800f557384 100644 --- a/Userland/Libraries/LibCore/Object.cpp +++ b/Userland/Libraries/LibCore/Object.cpp @@ -84,7 +84,7 @@ void Object::event(Core::Event& event) case Core::Event::ChildRemoved: return child_event(static_cast<ChildEvent&>(event)); case Core::Event::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; case Core::Event::Custom: return custom_event(static_cast<CustomEvent&>(event)); @@ -96,7 +96,7 @@ void Object::event(Core::Event& event) void Object::add_child(Object& object) { // FIXME: Should we support reparenting objects? - ASSERT(!object.parent() || object.parent() == this); + VERIFY(!object.parent() || object.parent() == this); object.m_parent = this; m_children.append(object); Core::ChildEvent child_event(Core::Event::ChildAdded, object); @@ -106,7 +106,7 @@ void Object::add_child(Object& object) void Object::insert_child_before(Object& new_child, Object& before_child) { // FIXME: Should we support reparenting objects? - ASSERT(!new_child.parent() || new_child.parent() == this); + VERIFY(!new_child.parent() || new_child.parent() == this); new_child.m_parent = this; m_children.insert_before_matching(new_child, [&](auto& existing_child) { return existing_child.ptr() == &before_child; }); Core::ChildEvent child_event(Core::Event::ChildAdded, new_child, &before_child); @@ -126,7 +126,7 @@ void Object::remove_child(Object& object) return; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Object::remove_all_children() @@ -151,7 +151,7 @@ void Object::start_timer(int ms, TimerShouldFireWhenNotVisible fire_when_not_vis { if (m_timer_id) { dbgln("{} {:p} already has a timer!", class_name(), this); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_timer_id = Core::EventLoop::register_timer(*this, ms, true, fire_when_not_visible); @@ -162,7 +162,7 @@ void Object::stop_timer() if (!m_timer_id) return; bool success = Core::EventLoop::unregister_timer(m_timer_id); - ASSERT(success); + VERIFY(success); m_timer_id = 0; } @@ -224,7 +224,7 @@ bool Object::is_ancestor_of(const Object& other) const void Object::dispatch_event(Core::Event& e, Object* stay_within) { - ASSERT(!stay_within || stay_within == this || stay_within->is_ancestor_of(*this)); + VERIFY(!stay_within || stay_within == this || stay_within->is_ancestor_of(*this)); auto* target = this; do { target->event(e); diff --git a/Userland/Libraries/LibCore/Socket.cpp b/Userland/Libraries/LibCore/Socket.cpp index 06c30c31f5..3ebe1a9d93 100644 --- a/Userland/Libraries/LibCore/Socket.cpp +++ b/Userland/Libraries/LibCore/Socket.cpp @@ -86,21 +86,21 @@ bool Socket::connect(const String& hostname, int port) void Socket::set_blocking(bool blocking) { int flags = fcntl(fd(), F_GETFL, 0); - ASSERT(flags >= 0); + VERIFY(flags >= 0); if (blocking) flags = fcntl(fd(), F_SETFL, flags & ~O_NONBLOCK); else flags = fcntl(fd(), F_SETFL, flags | O_NONBLOCK); - ASSERT(flags == 0); + VERIFY(flags == 0); } bool Socket::connect(const SocketAddress& address, int port) { - ASSERT(!is_connected()); - ASSERT(address.type() == SocketAddress::Type::IPv4); + VERIFY(!is_connected()); + VERIFY(address.type() == SocketAddress::Type::IPv4); dbgln_if(CSOCKET_DEBUG, "{} connecting to {}...", *this, address); - ASSERT(port > 0 && port <= 65535); + VERIFY(port > 0 && port <= 65535); struct sockaddr_in addr; memset(&addr, 0, sizeof(addr)); @@ -117,8 +117,8 @@ bool Socket::connect(const SocketAddress& address, int port) bool Socket::connect(const SocketAddress& address) { - ASSERT(!is_connected()); - ASSERT(address.type() == SocketAddress::Type::Local); + VERIFY(!is_connected()); + VERIFY(address.type() == SocketAddress::Type::Local); dbgln_if(CSOCKET_DEBUG, "{} connecting to {}...", *this, address); sockaddr_un saddr; @@ -183,7 +183,7 @@ bool Socket::send(ReadonlyBytes data) set_error(errno); return false; } - ASSERT(static_cast<size_t>(nsent) == data.size()); + VERIFY(static_cast<size_t>(nsent) == data.size()); return true; } @@ -204,13 +204,13 @@ void Socket::did_update_fd(int fd) ensure_read_notifier(); } else { // I don't think it would be right if we updated the fd while not connected *but* while having a notifier.. - ASSERT(!m_read_notifier); + VERIFY(!m_read_notifier); } } void Socket::ensure_read_notifier() { - ASSERT(m_connected); + VERIFY(m_connected); m_read_notifier = Notifier::construct(fd(), Notifier::Event::Read, this); m_read_notifier->on_ready_to_read = [this] { if (!can_read()) diff --git a/Userland/Libraries/LibCore/Socket.h b/Userland/Libraries/LibCore/Socket.h index 1ecb32010b..e0bf33fee7 100644 --- a/Userland/Libraries/LibCore/Socket.h +++ b/Userland/Libraries/LibCore/Socket.h @@ -78,7 +78,7 @@ protected: virtual bool common_connect(const struct sockaddr*, socklen_t); private: - virtual bool open(IODevice::OpenMode) override { ASSERT_NOT_REACHED(); } + virtual bool open(IODevice::OpenMode) override { VERIFY_NOT_REACHED(); } void ensure_read_notifier(); Type m_type { Type::Invalid }; diff --git a/Userland/Libraries/LibCore/SocketAddress.h b/Userland/Libraries/LibCore/SocketAddress.h index 4a5334225b..695fa361aa 100644 --- a/Userland/Libraries/LibCore/SocketAddress.h +++ b/Userland/Libraries/LibCore/SocketAddress.h @@ -84,7 +84,7 @@ public: Optional<sockaddr_un> to_sockaddr_un() const { - ASSERT(type() == Type::Local); + VERIFY(type() == Type::Local); sockaddr_un address; address.sun_family = AF_LOCAL; bool fits = m_local_address.copy_characters_to_buffer(address.sun_path, sizeof(address.sun_path)); @@ -95,7 +95,7 @@ public: sockaddr_in to_sockaddr_in() const { - ASSERT(type() == Type::IPv4); + VERIFY(type() == Type::IPv4); sockaddr_in address {}; address.sin_family = AF_INET; address.sin_addr.s_addr = m_ipv4_address.to_in_addr_t(); diff --git a/Userland/Libraries/LibCore/SyscallUtils.h b/Userland/Libraries/LibCore/SyscallUtils.h index 1b577bd6c4..9fd8009c8b 100644 --- a/Userland/Libraries/LibCore/SyscallUtils.h +++ b/Userland/Libraries/LibCore/SyscallUtils.h @@ -49,7 +49,7 @@ inline int safe_syscall(Syscall syscall, Args&&... args) if (errno == EINTR) continue; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return sysret; } diff --git a/Userland/Libraries/LibCore/TCPServer.cpp b/Userland/Libraries/LibCore/TCPServer.cpp index 9a715f1ed8..79fe6f468e 100644 --- a/Userland/Libraries/LibCore/TCPServer.cpp +++ b/Userland/Libraries/LibCore/TCPServer.cpp @@ -49,7 +49,7 @@ TCPServer::TCPServer(Object* parent) ioctl(m_fd, FIONBIO, &option); fcntl(m_fd, F_SETFD, FD_CLOEXEC); #endif - ASSERT(m_fd >= 0); + VERIFY(m_fd >= 0); } TCPServer::~TCPServer() @@ -85,7 +85,7 @@ bool TCPServer::listen(const IPv4Address& address, u16 port) RefPtr<TCPSocket> TCPServer::accept() { - ASSERT(m_listening); + VERIFY(m_listening); sockaddr_in in; socklen_t in_size = sizeof(in); int accepted_fd = ::accept(m_fd, (sockaddr*)&in, &in_size); diff --git a/Userland/Libraries/LibCore/UDPServer.cpp b/Userland/Libraries/LibCore/UDPServer.cpp index 33d3609c70..fd68490b77 100644 --- a/Userland/Libraries/LibCore/UDPServer.cpp +++ b/Userland/Libraries/LibCore/UDPServer.cpp @@ -50,7 +50,7 @@ UDPServer::UDPServer(Object* parent) ioctl(m_fd, FIONBIO, &option); fcntl(m_fd, F_SETFD, FD_CLOEXEC); #endif - ASSERT(m_fd >= 0); + VERIFY(m_fd >= 0); } UDPServer::~UDPServer() diff --git a/Userland/Libraries/LibCoreDump/Reader.cpp b/Userland/Libraries/LibCoreDump/Reader.cpp index f041248832..24a97293fc 100644 --- a/Userland/Libraries/LibCoreDump/Reader.cpp +++ b/Userland/Libraries/LibCoreDump/Reader.cpp @@ -53,7 +53,7 @@ Reader::Reader(NonnullRefPtr<MappedFile> coredump_file) ++index; return IterationDecision::Continue; }); - ASSERT(m_notes_segment_index != -1); + VERIFY(m_notes_segment_index != -1); } Reader::~Reader() @@ -68,7 +68,7 @@ Reader::NotesEntryIterator::NotesEntryIterator(const u8* notes_data) ELF::Core::NotesEntryHeader::Type Reader::NotesEntryIterator::type() const { - ASSERT(m_current->header.type == ELF::Core::NotesEntryHeader::Type::ProcessInfo + VERIFY(m_current->header.type == ELF::Core::NotesEntryHeader::Type::ProcessInfo || m_current->header.type == ELF::Core::NotesEntryHeader::Type::MemoryRegionInfo || m_current->header.type == ELF::Core::NotesEntryHeader::Type::ThreadInfo || m_current->header.type == ELF::Core::NotesEntryHeader::Type::Metadata @@ -83,7 +83,7 @@ const ELF::Core::NotesEntry* Reader::NotesEntryIterator::current() const void Reader::NotesEntryIterator::next() { - ASSERT(!at_end()); + VERIFY(!at_end()); switch (type()) { case ELF::Core::NotesEntryHeader::Type::ProcessInfo: { const auto* current = reinterpret_cast<const ELF::Core::ProcessInfo*>(m_current); @@ -106,7 +106,7 @@ void Reader::NotesEntryIterator::next() break; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibCpp/AST.cpp b/Userland/Libraries/LibCpp/AST.cpp index 48752055d0..87b61c6340 100644 --- a/Userland/Libraries/LibCpp/AST.cpp +++ b/Userland/Libraries/LibCpp/AST.cpp @@ -192,7 +192,7 @@ void BinaryExpression::dump(size_t indent) const m_lhs->dump(indent + 1); print_indent(indent + 1); - ASSERT(op_string); + VERIFY(op_string); outln("{}", op_string); m_rhs->dump(indent + 1); } @@ -216,7 +216,7 @@ void AssignmentExpression::dump(size_t indent) const m_lhs->dump(indent + 1); print_indent(indent + 1); - ASSERT(op_string); + VERIFY(op_string); outln("{}", op_string); m_rhs->dump(indent + 1); } @@ -301,7 +301,7 @@ void UnaryExpression::dump(size_t indent) const op_string = "<invalid>"; } - ASSERT(op_string); + VERIFY(op_string); print_indent(indent + 1); outln("{}", op_string); m_lhs->dump(indent + 1); diff --git a/Userland/Libraries/LibCpp/AST.h b/Userland/Libraries/LibCpp/AST.h index 830b998870..e01c1aeb9e 100644 --- a/Userland/Libraries/LibCpp/AST.h +++ b/Userland/Libraries/LibCpp/AST.h @@ -53,12 +53,12 @@ public: ASTNode* parent() const { return m_parent; } Position start() const { - ASSERT(m_start.has_value()); + VERIFY(m_start.has_value()); return m_start.value(); } Position end() const { - ASSERT(m_end.has_value()); + VERIFY(m_end.has_value()); return m_end.value(); } const FlyString& filename() const diff --git a/Userland/Libraries/LibCpp/Lexer.cpp b/Userland/Libraries/LibCpp/Lexer.cpp index 0507f11ec3..c08a74bb9e 100644 --- a/Userland/Libraries/LibCpp/Lexer.cpp +++ b/Userland/Libraries/LibCpp/Lexer.cpp @@ -46,7 +46,7 @@ char Lexer::peek(size_t offset) const char Lexer::consume() { - ASSERT(m_index < m_input.length()); + VERIFY(m_index < m_input.length()); char ch = m_input[m_index++]; m_previous_position = m_position; if (ch == '\n') { @@ -660,8 +660,8 @@ Vector<Token> Lexer::lex() StringView prefix_string = m_input.substring_view(prefix_start, m_index - prefix_start); while (peek()) { if (consume() == '"') { - ASSERT(m_index >= prefix_string.length() + 2); - ASSERT(m_input[m_index - 1] == '"'); + VERIFY(m_index >= prefix_string.length() + 2); + VERIFY(m_input[m_index - 1] == '"'); if (m_input[m_index - 1 - prefix_string.length() - 1] == ')') { StringView suffix_string = m_input.substring_view(m_index - 1 - prefix_string.length(), prefix_string.length()); if (prefix_string == suffix_string) diff --git a/Userland/Libraries/LibCpp/Lexer.h b/Userland/Libraries/LibCpp/Lexer.h index 3e7188f9ae..1fff2d146d 100644 --- a/Userland/Libraries/LibCpp/Lexer.h +++ b/Userland/Libraries/LibCpp/Lexer.h @@ -124,7 +124,7 @@ struct Token { FOR_EACH_TOKEN_TYPE #undef __TOKEN } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } const char* to_string() const diff --git a/Userland/Libraries/LibCpp/Parser.cpp b/Userland/Libraries/LibCpp/Parser.cpp index e44a31b854..f3081ac0ae 100644 --- a/Userland/Libraries/LibCpp/Parser.cpp +++ b/Userland/Libraries/LibCpp/Parser.cpp @@ -657,7 +657,7 @@ void Parser::load_state() Optional<Parser::DeclarationType> Parser::match_declaration_in_function_definition() { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool Parser::done() @@ -667,8 +667,8 @@ bool Parser::done() StringView Parser::text_of_token(const Cpp::Token& token) const { - ASSERT(token.m_start.line == token.m_end.line); - ASSERT(token.m_start.column <= token.m_end.column); + VERIFY(token.m_start.line == token.m_end.line); + VERIFY(token.m_start.column <= token.m_end.column); return m_lines[token.m_start.line].substring_view(token.m_start.column, token.m_end.column - token.m_start.column + 1); } @@ -680,7 +680,7 @@ StringView Parser::text_of_node(const ASTNode& node) const StringView Parser::text_of_range(Position start, Position end) const { if (start.line == end.line) { - ASSERT(start.column <= end.column); + VERIFY(start.column <= end.column); return m_lines[start.line].substring_view(start.column, end.column - start.column + 1); } @@ -694,7 +694,7 @@ StringView Parser::text_of_range(Position start, Position end) const }); auto start_index = index_of_position(start); auto end_index = index_of_position(end); - ASSERT(end_index >= start_index); + VERIFY(end_index >= start_index); return m_program.substring_view(start_index, end_index - start_index); } @@ -741,13 +741,13 @@ Position Parser::position() const RefPtr<ASTNode> Parser::eof_node() const { - ASSERT(m_tokens.size()); + VERIFY(m_tokens.size()); return node_at(m_tokens.last().m_end); } RefPtr<ASTNode> Parser::node_at(Position pos) const { - ASSERT(!m_tokens.is_empty()); + VERIFY(!m_tokens.is_empty()); RefPtr<ASTNode> match_node; for (auto& node : m_nodes) { if (node.start() > pos || node.end() < pos) @@ -827,7 +827,7 @@ NonnullRefPtr<StringLiteral> Parser::parse_string_literal(ASTNode& parent) while (!eof()) { auto token = peek(); if (token.type() != Token::Type::DoubleQuotedString && token.type() != Token::Type::EscapeSequence) { - ASSERT(start_token_index.has_value()); + VERIFY(start_token_index.has_value()); end_token_index = m_state.token_index - 1; break; } @@ -841,8 +841,8 @@ NonnullRefPtr<StringLiteral> Parser::parse_string_literal(ASTNode& parent) end_token_index = m_tokens.size() - 1; } - ASSERT(start_token_index.has_value()); - ASSERT(end_token_index.has_value()); + VERIFY(start_token_index.has_value()); + VERIFY(end_token_index.has_value()); Token start_token = m_tokens[start_token_index.value()]; Token end_token = m_tokens[end_token_index.value()]; diff --git a/Userland/Libraries/LibCpp/Preprocessor.cpp b/Userland/Libraries/LibCpp/Preprocessor.cpp index 9ec7151aa4..3094d2b97c 100644 --- a/Userland/Libraries/LibCpp/Preprocessor.cpp +++ b/Userland/Libraries/LibCpp/Preprocessor.cpp @@ -75,7 +75,7 @@ void Preprocessor::handle_preprocessor_line(const StringView& line) } if (keyword == "else") { - ASSERT(m_current_depth > 0); + VERIFY(m_current_depth > 0); if (m_depths_of_not_taken_branches.contains_slow(m_current_depth - 1)) { m_depths_of_not_taken_branches.remove_all_matching([this](auto x) { return x == m_current_depth - 1; }); m_state = State::Normal; @@ -88,7 +88,7 @@ void Preprocessor::handle_preprocessor_line(const StringView& line) } if (keyword == "endif") { - ASSERT(m_current_depth > 0); + VERIFY(m_current_depth > 0); --m_current_depth; if (m_depths_of_not_taken_branches.contains_slow(m_current_depth)) { m_depths_of_not_taken_branches.remove_all_matching([this](auto x) { return x == m_current_depth; }); @@ -164,7 +164,7 @@ void Preprocessor::handle_preprocessor_line(const StringView& line) return; } dbgln("Unsupported preprocessor keyword: {}", keyword); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }; diff --git a/Userland/Libraries/LibCrypto/ASN1/PEM.cpp b/Userland/Libraries/LibCrypto/ASN1/PEM.cpp index 96c9e1a65e..c7fae1b6fb 100644 --- a/Userland/Libraries/LibCrypto/ASN1/PEM.cpp +++ b/Userland/Libraries/LibCrypto/ASN1/PEM.cpp @@ -62,7 +62,7 @@ ByteBuffer decode_pem(ReadonlyBytes data) lexer.consume_all(); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp index c0699018e6..5d548c23a5 100644 --- a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp +++ b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp @@ -40,7 +40,7 @@ size_t SignedBigInteger::export_data(Bytes data, bool remove_leading_zeros) cons { // FIXME: Support this: // m <0XX> -> m <XX> (if remove_leading_zeros) - ASSERT(!remove_leading_zeros); + VERIFY(!remove_leading_zeros); data[0] = m_sign; auto bytes_view = data.slice(1, data.size() - 1); diff --git a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp index 63021614bb..ec622847c8 100644 --- a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp +++ b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp @@ -106,7 +106,7 @@ String UnsignedBigInteger::to_base10() const while (temp != UnsignedBigInteger { 0 }) { divide_u16_without_allocation(temp, 10, quotient, remainder); - ASSERT(remainder.words()[0] < 10); + VERIFY(remainder.words()[0] < 10); builder.append(static_cast<char>(remainder.words()[0] + '0')); temp.set_to(quotient); } @@ -389,7 +389,7 @@ void UnsignedBigInteger::subtract_without_allocation( } // This assertion should not fail, because we verified that *this>=other at the beginning of the function - ASSERT(borrow == 0); + VERIFY(borrow == 0); } /** @@ -672,7 +672,7 @@ FLATTEN void UnsignedBigInteger::divide_u16_without_allocation( UnsignedBigInteger& quotient, UnsignedBigInteger& remainder) { - ASSERT(denominator < (1 << 16)); + VERIFY(denominator < (1 << 16)); u32 remainder_word = 0; auto numerator_length = numerator.trimmed_length(); quotient.set_to_0(); @@ -717,8 +717,8 @@ ALWAYS_INLINE u32 UnsignedBigInteger::shift_left_get_one_word( { // "<= length()" (rather than length() - 1) is intentional, // The result inedx of length() is used when calculating the carry word - ASSERT(result_word_index <= number.length()); - ASSERT(num_bits <= UnsignedBigInteger::BITS_IN_WORD); + VERIFY(result_word_index <= number.length()); + VERIFY(num_bits <= UnsignedBigInteger::BITS_IN_WORD); u32 result = 0; // we need to check for "num_bits != 0" since shifting right by 32 is apparently undefined behaviour! diff --git a/Userland/Libraries/LibCrypto/Cipher/AES.cpp b/Userland/Libraries/LibCrypto/Cipher/AES.cpp index 1ce0e12240..21107fbdc0 100644 --- a/Userland/Libraries/LibCrypto/Cipher/AES.cpp +++ b/Userland/Libraries/LibCrypto/Cipher/AES.cpp @@ -65,9 +65,9 @@ void AESCipherKey::expand_encrypt_key(ReadonlyBytes user_key, size_t bits) u32 temp; size_t i { 0 }; - ASSERT(!user_key.is_null()); - ASSERT(is_valid_key_size(bits)); - ASSERT(user_key.size() == bits / 8); + VERIFY(!user_key.is_null()); + VERIFY(is_valid_key_size(bits)); + VERIFY(user_key.size() == bits / 8); round_key = round_keys(); @@ -401,7 +401,7 @@ void AESCipherBlock::overwrite(ReadonlyBytes bytes) auto data = bytes.data(); auto length = bytes.size(); - ASSERT(length <= this->data_size()); + VERIFY(length <= this->data_size()); this->bytes().overwrite(0, data, length); if (length < this->data_size()) { switch (padding_mode()) { @@ -419,7 +419,7 @@ void AESCipherBlock::overwrite(ReadonlyBytes bytes) break; default: // FIXME: We should handle the rest of the common padding modes - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } diff --git a/Userland/Libraries/LibCrypto/Cipher/Cipher.h b/Userland/Libraries/LibCrypto/Cipher/Cipher.h index 3b16c61cd9..a17db5a8c0 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Cipher.h +++ b/Userland/Libraries/LibCrypto/Cipher/Cipher.h @@ -59,7 +59,7 @@ public: { } - static size_t block_size() { ASSERT_NOT_REACHED(); } + static size_t block_size() { VERIFY_NOT_REACHED(); } virtual ReadonlyBytes bytes() const = 0; @@ -74,11 +74,11 @@ public: template<typename T> void put(size_t offset, T value) { - ASSERT(offset + sizeof(T) <= bytes().size()); + VERIFY(offset + sizeof(T) <= bytes().size()); auto* ptr = bytes().offset_pointer(offset); auto index { 0 }; - ASSERT(sizeof(T) <= 4); + VERIFY(sizeof(T) <= 4); if constexpr (sizeof(T) > 3) ptr[index++] = (u8)(value >> 24); diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h b/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h index 68358a05ca..deec336f2f 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h @@ -66,7 +66,7 @@ public: // FIXME: We should have two of these encrypt/decrypt functions that // we SFINAE out based on whether the Cipher mode needs an ivec - ASSERT(!ivec.is_empty()); + VERIFY(!ivec.is_empty()); const auto* iv = ivec.data(); m_cipher_block.set_padding_mode(cipher.padding_mode()); @@ -77,7 +77,7 @@ public: m_cipher_block.overwrite(in.slice(offset, block_size)); m_cipher_block.apply_initialization_vector(iv); cipher.encrypt_block(m_cipher_block, m_cipher_block); - ASSERT(offset + block_size <= out.size()); + VERIFY(offset + block_size <= out.size()); __builtin_memcpy(out.offset(offset), m_cipher_block.bytes().data(), block_size); iv = out.offset(offset); length -= block_size; @@ -88,7 +88,7 @@ public: m_cipher_block.overwrite(in.slice(offset, length)); m_cipher_block.apply_initialization_vector(iv); cipher.encrypt_block(m_cipher_block, m_cipher_block); - ASSERT(offset + block_size <= out.size()); + VERIFY(offset + block_size <= out.size()); __builtin_memcpy(out.offset(offset), m_cipher_block.bytes().data(), block_size); iv = out.offset(offset); } @@ -105,14 +105,14 @@ public: auto& cipher = this->cipher(); - ASSERT(!ivec.is_empty()); + VERIFY(!ivec.is_empty()); const auto* iv = ivec.data(); auto block_size = cipher.block_size(); // if the data is not aligned, it's not correct encrypted data // FIXME (ponder): Should we simply decrypt as much as we can? - ASSERT(length % block_size == 0); + VERIFY(length % block_size == 0); m_cipher_block.set_padding_mode(cipher.padding_mode()); size_t offset { 0 }; @@ -123,7 +123,7 @@ public: cipher.decrypt_block(m_cipher_block, m_cipher_block); m_cipher_block.apply_initialization_vector(iv); auto decrypted = m_cipher_block.bytes(); - ASSERT(offset + decrypted.size() <= out.size()); + VERIFY(offset + decrypted.size() <= out.size()); __builtin_memcpy(out.offset(offset), decrypted.data(), decrypted.size()); iv = slice; length -= block_size; diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h b/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h index 26895a8fca..a2601956c4 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h @@ -160,7 +160,7 @@ protected: { size_t length; if (in) { - ASSERT(in->size() <= out.size()); + VERIFY(in->size() <= out.size()); length = in->size(); if (length == 0) return; @@ -172,8 +172,8 @@ protected: // FIXME: We should have two of these encrypt/decrypt functions that // we SFINAE out based on whether the Cipher mode needs an ivec - ASSERT(!ivec.is_empty()); - ASSERT(ivec.size() >= IV_length()); + VERIFY(!ivec.is_empty()); + VERIFY(ivec.size() >= IV_length()); m_cipher_block.set_padding_mode(cipher.padding_mode()); @@ -192,7 +192,7 @@ protected: } auto write_size = min(block_size, length); - ASSERT(offset + write_size <= out.size()); + VERIFY(offset + write_size <= out.size()); __builtin_memcpy(out.offset(offset), m_cipher_block.bytes().data(), write_size); increment(iv); diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h b/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h index 4d034f5bac..3a1d17b1d5 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h @@ -73,7 +73,7 @@ public: // FIXME: This overload throws away the auth stuff, think up a better way to return more than a single bytebuffer. virtual void encrypt(ReadonlyBytes in, Bytes& out, ReadonlyBytes ivec = {}, Bytes* = nullptr) override { - ASSERT(!ivec.is_empty()); + VERIFY(!ivec.is_empty()); static ByteBuffer dummy; diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h b/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h index a34f6a4b98..c7daba471b 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h @@ -98,7 +98,7 @@ protected: } default: // FIXME: support other padding modes - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } diff --git a/Userland/Libraries/LibCrypto/Hash/HashManager.h b/Userland/Libraries/LibCrypto/Hash/HashManager.h index 9b47149602..9da7c24526 100644 --- a/Userland/Libraries/LibCrypto/Hash/HashManager.h +++ b/Userland/Libraries/LibCrypto/Hash/HashManager.h @@ -85,7 +85,7 @@ struct MultiHashDigestVariant { return sha512.value().immutable_data(); default: case HashKind::None: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } @@ -103,7 +103,7 @@ struct MultiHashDigestVariant { return sha512.value().data_length(); default: case HashKind::None: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } @@ -179,7 +179,7 @@ public: inline void initialize(HashKind kind) { if (m_kind != HashKind::None) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_kind = kind; @@ -248,7 +248,7 @@ public: return { m_sha512->peek() }; default: case HashKind::None: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } diff --git a/Userland/Libraries/LibCrypto/Hash/MD5.cpp b/Userland/Libraries/LibCrypto/Hash/MD5.cpp index 1b2a71d30a..5cf717134f 100644 --- a/Userland/Libraries/LibCrypto/Hash/MD5.cpp +++ b/Userland/Libraries/LibCrypto/Hash/MD5.cpp @@ -88,7 +88,7 @@ void MD5::update(const u8* input, size_t length) index = 0; } - ASSERT(length < part_length || length - offset <= 64); + VERIFY(length < part_length || length - offset <= 64); m_buffer.overwrite(index, &input[offset], length - offset); } MD5::DigestType MD5::digest() diff --git a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp index ecccd2c60e..fd54602ae4 100644 --- a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp +++ b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp @@ -240,7 +240,7 @@ static bool MR_primality_test(UnsignedBigInteger n, const Vector<UnsignedBigInte { // Written using Wikipedia: // https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test#Miller%E2%80%93Rabin_test - ASSERT(!(n < 4)); + VERIFY(!(n < 4)); auto predecessor = n.minus({ 1 }); auto d = predecessor; size_t r = 0; @@ -259,8 +259,8 @@ static bool MR_primality_test(UnsignedBigInteger n, const Vector<UnsignedBigInte } for (auto& a : tests) { - // Technically: ASSERT(2 <= a && a <= n - 2) - ASSERT(a < n); + // Technically: VERIFY(2 <= a && a <= n - 2) + VERIFY(a < n); auto x = ModularPower(a, d, n); if (x == 1 || x == predecessor) continue; @@ -283,13 +283,13 @@ static bool MR_primality_test(UnsignedBigInteger n, const Vector<UnsignedBigInte UnsignedBigInteger random_number(const UnsignedBigInteger& min, const UnsignedBigInteger& max_excluded) { - ASSERT(min < max_excluded); + VERIFY(min < max_excluded); auto range = max_excluded.minus(min); UnsignedBigInteger base; auto size = range.trimmed_length() * sizeof(u32) + 2; // "+2" is intentional (see below). // Also, if we're about to crash anyway, at least produce a nice error: - ASSERT(size < 8 * MiB); + VERIFY(size < 8 * MiB); u8 buf[size]; AK::fill_with_random(buf, size); UnsignedBigInteger random { buf, size }; @@ -340,7 +340,7 @@ bool is_probably_prime(const UnsignedBigInteger& p) UnsignedBigInteger random_big_prime(size_t bits) { - ASSERT(bits >= 33); + VERIFY(bits >= 33); UnsignedBigInteger min = UnsignedBigInteger::from_base10("6074001000").shift_left(bits - 33); UnsignedBigInteger max = UnsignedBigInteger { 1 }.shift_left(bits).minus(1); for (;;) { diff --git a/Userland/Libraries/LibCrypto/PK/RSA.cpp b/Userland/Libraries/LibCrypto/PK/RSA.cpp index dc6a042b83..b4b90c187b 100644 --- a/Userland/Libraries/LibCrypto/PK/RSA.cpp +++ b/Userland/Libraries/LibCrypto/PK/RSA.cpp @@ -286,7 +286,7 @@ void RSA::import_private_key(ReadonlyBytes bytes, bool pem) auto key = parse_rsa_key(bytes); if (!key.private_key.length()) { dbgln("We expected to see a private key, but we found none"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_private_key = key.private_key; } @@ -302,7 +302,7 @@ void RSA::import_public_key(ReadonlyBytes bytes, bool pem) auto key = parse_rsa_key(bytes); if (!key.public_key.length()) { dbgln("We expected to see a public key, but we found none"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } m_public_key = key.public_key; } @@ -356,7 +356,7 @@ void RSA_PKCS1_EME::encrypt(ReadonlyBytes in, Bytes& out) u8 ps[ps_length]; // FIXME: Without this assertion, GCC refuses to compile due to a memcpy overflow(!?) - ASSERT(ps_length < 16384); + VERIFY(ps_length < 16384); AK::fill_with_random(ps, ps_length); // since arc4random can create zeros (shocking!) diff --git a/Userland/Libraries/LibDebug/DebugInfo.cpp b/Userland/Libraries/LibDebug/DebugInfo.cpp index 7f7b7a0d9f..eb8ab79f14 100644 --- a/Userland/Libraries/LibDebug/DebugInfo.cpp +++ b/Userland/Libraries/LibDebug/DebugInfo.cpp @@ -207,7 +207,7 @@ static Optional<Dwarf::DIE> parse_variable_type_die(const Dwarf::DIE& variable_d if (!type_die_offset.has_value()) return {}; - ASSERT(type_die_offset.value().type == Dwarf::DIE::AttributeValue::Type::DieReference); + VERIFY(type_die_offset.value().type == Dwarf::DIE::AttributeValue::Type::DieReference); auto type_die = variable_die.get_die_at_offset(type_die_offset.value().data.as_u32); auto type_name = type_die.get_attribute(Dwarf::Attribute::Name); @@ -241,7 +241,7 @@ static void parse_variable_location(const Dwarf::DIE& variable_die, DebugInfo::V auto value = Dwarf::Expression::evaluate(expression_bytes, regs); if (value.type != Dwarf::Expression::Type::None) { - ASSERT(value.type == Dwarf::Expression::Type::UnsignedIntetger); + VERIFY(value.type == Dwarf::Expression::Type::UnsignedIntetger); variable_info.location_type = DebugInfo::VariableInfo::LocationType::Address; variable_info.location_data.address = value.data.as_u32; } @@ -254,7 +254,7 @@ static void parse_variable_location(const Dwarf::DIE& variable_die, DebugInfo::V OwnPtr<DebugInfo::VariableInfo> DebugInfo::create_variable_info(const Dwarf::DIE& variable_die, const PtraceRegisters& regs) const { - ASSERT(variable_die.tag() == Dwarf::EntryTag::Variable + VERIFY(variable_die.tag() == Dwarf::EntryTag::Variable || variable_die.tag() == Dwarf::EntryTag::Member || variable_die.tag() == Dwarf::EntryTag::FormalParameter || variable_die.tag() == Dwarf::EntryTag::EnumerationType @@ -274,7 +274,7 @@ OwnPtr<DebugInfo::VariableInfo> DebugInfo::create_variable_info(const Dwarf::DIE if (variable_die.tag() == Dwarf::EntryTag::Enumerator) { auto constant = variable_die.get_attribute(Dwarf::Attribute::ConstValue); - ASSERT(constant.has_value()); + VERIFY(constant.has_value()); switch (constant.value().type) { case Dwarf::DIE::AttributeValue::Type::UnsignedNumber: variable_info->constant_data.as_u32 = constant.value().data.as_u32; @@ -286,7 +286,7 @@ OwnPtr<DebugInfo::VariableInfo> DebugInfo::create_variable_info(const Dwarf::DIE variable_info->constant_data.as_string = constant.value().data.as_string; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } else { parse_variable_location(variable_die, *variable_info, regs); @@ -302,7 +302,7 @@ OwnPtr<DebugInfo::VariableInfo> DebugInfo::create_variable_info(const Dwarf::DIE if (member.is_null()) return; auto member_variable = create_variable_info(member, regs); - ASSERT(member_variable); + VERIFY(member_variable); if (type_die.value().tag() == Dwarf::EntryTag::EnumerationType) { member_variable->parent = type_info.ptr(); @@ -311,7 +311,7 @@ OwnPtr<DebugInfo::VariableInfo> DebugInfo::create_variable_info(const Dwarf::DIE if (variable_info->location_type == DebugInfo::VariableInfo::LocationType::None) { return; } - ASSERT(variable_info->location_type == DebugInfo::VariableInfo::LocationType::Address); + VERIFY(variable_info->location_type == DebugInfo::VariableInfo::LocationType::Address); if (member_variable->location_type == DebugInfo::VariableInfo::LocationType::Address) member_variable->location_data.address += variable_info->location_data.address; diff --git a/Userland/Libraries/LibDebug/DebugSession.cpp b/Userland/Libraries/LibDebug/DebugSession.cpp index 243d05f400..e35886a734 100644 --- a/Userland/Libraries/LibDebug/DebugSession.cpp +++ b/Userland/Libraries/LibDebug/DebugSession.cpp @@ -73,7 +73,7 @@ OwnPtr<DebugSession> DebugSession::exec_and_attach(const String& command, String } auto parts = command.split(' '); - ASSERT(!parts.is_empty()); + VERIFY(!parts.is_empty()); const char** args = (const char**)calloc(parts.size() + 1, sizeof(const char*)); for (size_t i = 0; i < parts.size(); i++) { args[i] = parts[i].characters(); @@ -155,7 +155,7 @@ bool DebugSession::insert_breakpoint(void* address) if (!original_bytes.has_value()) return false; - ASSERT((original_bytes.value() & 0xff) != BREAKPOINT_INSTRUCTION); + VERIFY((original_bytes.value() & 0xff) != BREAKPOINT_INSTRUCTION); BreakPoint breakpoint { address, original_bytes.value(), BreakPointState::Disabled }; @@ -169,7 +169,7 @@ bool DebugSession::insert_breakpoint(void* address) bool DebugSession::disable_breakpoint(void* address) { auto breakpoint = m_breakpoints.get(address); - ASSERT(breakpoint.has_value()); + VERIFY(breakpoint.has_value()); if (!poke(reinterpret_cast<u32*>(reinterpret_cast<char*>(breakpoint.value().address)), breakpoint.value().original_first_word)) return false; @@ -182,9 +182,9 @@ bool DebugSession::disable_breakpoint(void* address) bool DebugSession::enable_breakpoint(void* address) { auto breakpoint = m_breakpoints.get(address); - ASSERT(breakpoint.has_value()); + VERIFY(breakpoint.has_value()); - ASSERT(breakpoint.value().state == BreakPointState::Disabled); + VERIFY(breakpoint.value().state == BreakPointState::Disabled); if (!poke(reinterpret_cast<u32*>(breakpoint.value().address), (breakpoint.value().original_first_word & ~(uint32_t)0xff) | BREAKPOINT_INSTRUCTION)) return false; @@ -214,7 +214,7 @@ PtraceRegisters DebugSession::get_registers() const PtraceRegisters regs; if (ptrace(PT_GETREGS, m_debuggee_pid, ®s, 0) < 0) { perror("PT_GETREGS"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return regs; } @@ -223,7 +223,7 @@ void DebugSession::set_registers(const PtraceRegisters& regs) { if (ptrace(PT_SETREGS, m_debuggee_pid, reinterpret_cast<void*>(&const_cast<PtraceRegisters&>(regs)), 0) < 0) { perror("PT_SETREGS"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -232,7 +232,7 @@ void DebugSession::continue_debuggee(ContinueType type) int command = (type == ContinueType::FreeRun) ? PT_CONTINUE : PT_SYSCALL; if (ptrace(command, m_debuggee_pid, 0, 0) < 0) { perror("continue"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -242,7 +242,7 @@ int DebugSession::continue_debuggee_and_wait(ContinueType type) int wstatus = 0; if (waitpid(m_debuggee_pid, &wstatus, WSTOPPED | WEXITED) != m_debuggee_pid) { perror("waitpid"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return wstatus; } @@ -264,7 +264,7 @@ void* DebugSession::single_step() if (waitpid(m_debuggee_pid, 0, WSTOPPED) != m_debuggee_pid) { perror("waitpid"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } regs = get_registers(); @@ -316,7 +316,7 @@ Optional<DebugSession::InsertBreakpointAtSourcePositionResult> DebugSession::ins return {}; auto lib = library_at(address); - ASSERT(lib); + VERIFY(lib); return InsertBreakpointAtSourcePositionResult { lib->name, address_and_source_position.value().file, address_and_source_position.value().line, address }; } @@ -325,11 +325,11 @@ void DebugSession::update_loaded_libs() { auto file = Core::File::construct(String::format("/proc/%u/vm", m_debuggee_pid)); bool rc = file->open(Core::IODevice::ReadOnly); - ASSERT(rc); + VERIFY(rc); auto file_contents = file->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); auto vm_entries = json.value().as_array(); Regex<PosixExtended> re("(.+): \\.text"); diff --git a/Userland/Libraries/LibDebug/DebugSession.h b/Userland/Libraries/LibDebug/DebugSession.h index f30174a740..50e9e96370 100644 --- a/Userland/Libraries/LibDebug/DebugSession.h +++ b/Userland/Libraries/LibDebug/DebugSession.h @@ -298,7 +298,7 @@ void DebugSession::run(DesiredInitialDebugeeState initial_debugee_state, Callbac break; } if (decision == DebugDecision::Kill) { - ASSERT_NOT_REACHED(); // TODO: implement + VERIFY_NOT_REACHED(); // TODO: implement } if (state == State::SingleStep && !did_single_step) { diff --git a/Userland/Libraries/LibDebug/Dwarf/DIE.cpp b/Userland/Libraries/LibDebug/Dwarf/DIE.cpp index 4ef58947bb..5733b33fd5 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DIE.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/DIE.cpp @@ -46,7 +46,7 @@ DIE::DIE(const CompilationUnit& unit, u32 offset) m_tag = EntryTag::None; } else { auto abbreviation_info = m_compilation_unit.abbreviations_map().get(m_abbreviation_code); - ASSERT(abbreviation_info.has_value()); + VERIFY(abbreviation_info.has_value()); m_tag = abbreviation_info.value().tag; m_has_children = abbreviation_info.value().has_children; @@ -76,7 +76,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::StringPointer: { u32 offset; debug_info_stream >> offset; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::String; auto strings_data = m_compilation_unit.dwarf_info().debug_strings_data(); @@ -86,7 +86,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Data1: { u8 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::UnsignedNumber; value.data.as_u32 = data; break; @@ -94,7 +94,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Data2: { u16 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::UnsignedNumber; value.data.as_u32 = data; break; @@ -102,7 +102,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Addr: { u32 address; debug_info_stream >> address; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::UnsignedNumber; value.data.as_u32 = address; break; @@ -110,7 +110,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::SData: { ssize_t data; debug_info_stream.read_LEB128_signed(data); - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::SignedNumber; value.data.as_i32 = data; break; @@ -118,7 +118,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::SecOffset: { u32 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::SecOffset; value.data.as_u32 = data; break; @@ -126,7 +126,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Data4: { u32 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::UnsignedNumber; value.data.as_u32 = data; break; @@ -134,7 +134,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Ref4: { u32 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::DieReference; value.data.as_u32 = data + m_compilation_unit.offset(); break; @@ -147,7 +147,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::ExprLoc: { size_t length; debug_info_stream.read_LEB128_unsigned(length); - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::DwarfExpression; assign_raw_bytes_value(length); break; @@ -156,7 +156,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, String str; u32 str_offset = debug_info_stream.offset(); debug_info_stream >> str; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::String; value.data.as_string = reinterpret_cast<const char*>(str_offset + m_compilation_unit.dwarf_info().debug_info_data().data()); break; @@ -165,7 +165,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, value.type = AttributeValue::Type::RawBytes; u8 length; debug_info_stream >> length; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); assign_raw_bytes_value(length); break; } @@ -173,7 +173,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, value.type = AttributeValue::Type::RawBytes; u16 length; debug_info_stream >> length; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); assign_raw_bytes_value(length); break; } @@ -181,7 +181,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, value.type = AttributeValue::Type::RawBytes; u32 length; debug_info_stream >> length; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); assign_raw_bytes_value(length); break; } @@ -189,13 +189,13 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, value.type = AttributeValue::Type::RawBytes; size_t length; debug_info_stream.read_LEB128_unsigned(length); - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); assign_raw_bytes_value(length); break; } default: dbgln("Unimplemented AttributeDataForm: {}", (u32)form); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return value; } @@ -206,7 +206,7 @@ Optional<DIE::AttributeValue> DIE::get_attribute(const Attribute& attribute) con stream.discard_or_error(m_data_offset); auto abbreviation_info = m_compilation_unit.abbreviations_map().get(m_abbreviation_code); - ASSERT(abbreviation_info.has_value()); + VERIFY(abbreviation_info.has_value()); for (const auto& attribute_spec : abbreviation_info.value().attribute_specifications) { auto value = get_attribute_value(attribute_spec.form, stream); @@ -251,7 +251,7 @@ void DIE::for_each_child(Function<void(const DIE& child)> callback) const DIE DIE::get_die_at_offset(u32 offset) const { - ASSERT(offset >= m_compilation_unit.offset() && offset < m_compilation_unit.offset() + m_compilation_unit.size()); + VERIFY(offset >= m_compilation_unit.offset() && offset < m_compilation_unit.offset() + m_compilation_unit.size()); return DIE(m_compilation_unit, offset); } diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp index 09717cfc71..fb1fdc2f42 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp @@ -59,8 +59,8 @@ void DwarfInfo::populate_compilation_units() CompilationUnitHeader compilation_unit_header {}; stream >> Bytes { &compilation_unit_header, sizeof(compilation_unit_header) }; - ASSERT(compilation_unit_header.address_size == sizeof(u32)); - ASSERT(compilation_unit_header.version <= 4); + VERIFY(compilation_unit_header.address_size == sizeof(u32)); + VERIFY(compilation_unit_header.version <= 4); u32 length_after_header = compilation_unit_header.length - (sizeof(CompilationUnitHeader) - offsetof(CompilationUnitHeader, version)); m_compilation_units.empend(*this, unit_offset, compilation_unit_header); diff --git a/Userland/Libraries/LibDebug/Dwarf/Expression.cpp b/Userland/Libraries/LibDebug/Dwarf/Expression.cpp index fe50d1aed3..b8f78a1e82 100644 --- a/Userland/Libraries/LibDebug/Dwarf/Expression.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/Expression.cpp @@ -55,10 +55,10 @@ Value evaluate(ReadonlyBytes bytes, const PtraceRegisters& regs) default: dbgln("DWARF expr addr: {}", (const void*)bytes.data()); dbgln("unsupported opcode: {}", (u8)opcode); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp b/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp index 649f0fe547..447bcccc99 100644 --- a/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp @@ -45,8 +45,8 @@ void LineProgram::parse_unit_header() { m_stream >> Bytes { &m_unit_header, sizeof(m_unit_header) }; - ASSERT(m_unit_header.version == DWARF_VERSION); - ASSERT(m_unit_header.opcode_base == SPECIAL_OPCODES_BASE); + VERIFY(m_unit_header.version == DWARF_VERSION); + VERIFY(m_unit_header.opcode_base == SPECIAL_OPCODES_BASE); #if DWARF_DEBUG dbgln("unit length: {}", m_unit_header.length); @@ -67,7 +67,7 @@ void LineProgram::parse_source_directories() } m_stream.handle_recoverable_error(); m_stream.discard_or_error(1); - ASSERT(!m_stream.has_any_error()); + VERIFY(!m_stream.has_any_error()); } void LineProgram::parse_source_files() @@ -87,7 +87,7 @@ void LineProgram::parse_source_files() m_source_files.append({ file_name, directory_index }); } m_stream.discard_or_error(1); - ASSERT(!m_stream.has_any_error()); + VERIFY(!m_stream.has_any_error()); } void LineProgram::append_to_line_info() @@ -131,7 +131,7 @@ void LineProgram::handle_extended_opcode() break; } case ExtendedOpcodes::SetAddress: { - ASSERT(length == sizeof(size_t) + 1); + VERIFY(length == sizeof(size_t) + 1); m_stream >> m_address; #if DWARF_DEBUG dbgln("SetAddress: {:p}", m_address); @@ -149,7 +149,7 @@ void LineProgram::handle_extended_opcode() #if DWARF_DEBUG dbgln("offset: {:p}", m_stream.offset()); #endif - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } void LineProgram::handle_standard_opcode(u8 opcode) @@ -191,7 +191,7 @@ void LineProgram::handle_standard_opcode(u8 opcode) case StandardOpcodes::AdvanceLine: { ssize_t line_delta; m_stream.read_LEB128_signed(line_delta); - ASSERT(line_delta >= 0 || m_line >= (size_t)(-line_delta)); + VERIFY(line_delta >= 0 || m_line >= (size_t)(-line_delta)); m_line += line_delta; #if DWARF_DEBUG dbgln("AdvanceLine: {}", m_line); @@ -223,7 +223,7 @@ void LineProgram::handle_standard_opcode(u8 opcode) } default: dbgln("Unhandled LineProgram opcode {}", opcode); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } void LineProgram::handle_sepcial_opcode(u8 opcode) diff --git a/Userland/Libraries/LibDesktop/AppFile.cpp b/Userland/Libraries/LibDesktop/AppFile.cpp index 41958328f5..8951bf75b0 100644 --- a/Userland/Libraries/LibDesktop/AppFile.cpp +++ b/Userland/Libraries/LibDesktop/AppFile.cpp @@ -82,14 +82,14 @@ bool AppFile::validate() const String AppFile::name() const { auto name = m_config->read_entry("App", "Name").trim_whitespace(); - ASSERT(!name.is_empty()); + VERIFY(!name.is_empty()); return name; } String AppFile::executable() const { auto executable = m_config->read_entry("App", "Executable").trim_whitespace(); - ASSERT(!executable.is_empty()); + VERIFY(!executable.is_empty()); return executable; } diff --git a/Userland/Libraries/LibDesktop/Launcher.cpp b/Userland/Libraries/LibDesktop/Launcher.cpp index 06e1caff01..c81eff8a46 100644 --- a/Userland/Libraries/LibDesktop/Launcher.cpp +++ b/Userland/Libraries/LibDesktop/Launcher.cpp @@ -38,7 +38,7 @@ auto Launcher::Details::from_details_str(const String& details_str) -> NonnullRe { auto details = adopt(*new Details); auto json = JsonValue::from_string(details_str); - ASSERT(json.has_value()); + VERIFY(json.has_value()); auto obj = json.value().as_object(); details->executable = obj.get("executable").to_string(); details->name = obj.get("name").to_string(); @@ -124,7 +124,7 @@ bool Launcher::open(const URL& url, const String& handler_name) bool Launcher::open(const URL& url, const Details& details) { - ASSERT(details.launcher_type != LauncherType::Application); // Launcher should not be used to execute arbitrary applications + VERIFY(details.launcher_type != LauncherType::Application); // Launcher should not be used to execute arbitrary applications return open(url, details.executable); } diff --git a/Userland/Libraries/LibDiff/Hunks.cpp b/Userland/Libraries/LibDiff/Hunks.cpp index d94bedfa03..b6ee4fee22 100644 --- a/Userland/Libraries/LibDiff/Hunks.cpp +++ b/Userland/Libraries/LibDiff/Hunks.cpp @@ -110,13 +110,13 @@ HunkLocation parse_hunk_location(const String& location_line) }; while (char_index < location_line.length() && location_line[char_index++] != '-') { } - ASSERT(char_index < location_line.length()); + VERIFY(char_index < location_line.length()); size_t original_location_start_index = char_index; while (char_index < location_line.length() && location_line[char_index++] != ' ') { } - ASSERT(char_index < location_line.length() && location_line[char_index] == '+'); + VERIFY(char_index < location_line.length() && location_line[char_index] == '+'); size_t original_location_end_index = char_index - 2; size_t target_location_start_index = char_index + 1; @@ -124,7 +124,7 @@ HunkLocation parse_hunk_location(const String& location_line) char_index += 1; while (char_index < location_line.length() && location_line[char_index++] != ' ') { } - ASSERT(char_index < location_line.length()); + VERIFY(char_index < location_line.length()); size_t target_location_end_index = char_index - 2; diff --git a/Userland/Libraries/LibELF/DynamicLinker.cpp b/Userland/Libraries/LibELF/DynamicLinker.cpp index 4e7842de3f..da7596ecac 100644 --- a/Userland/Libraries/LibELF/DynamicLinker.cpp +++ b/Userland/Libraries/LibELF/DynamicLinker.cpp @@ -87,7 +87,7 @@ static void map_library(const String& name, int fd) auto loader = ELF::DynamicLoader::try_create(fd, name); if (!loader) { dbgln("Failed to create ELF::DynamicLoader for fd={}, name={}", fd, name); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } loader->set_tls_offset(g_current_tls_offset); @@ -101,7 +101,7 @@ static void map_library(const String& name) // TODO: Do we want to also look for libs in other paths too? String path = String::formatted("/usr/lib/{}", name); int fd = open(path.characters(), O_RDONLY); - ASSERT(fd >= 0); + VERIFY(fd >= 0); map_library(name, fd); } @@ -162,19 +162,19 @@ static void initialize_libc(DynamicObject& libc) // Also, we can't just mark `__libc_init` with "__attribute__((constructor))" // because it uses getenv() internally, so `environ` has to be initialized before we call `__libc_init`. auto res = libc.lookup_symbol("environ"); - ASSERT(res.has_value()); + VERIFY(res.has_value()); *((char***)res.value().address.as_ptr()) = g_envp; res = libc.lookup_symbol("__environ_is_malloced"); - ASSERT(res.has_value()); + VERIFY(res.has_value()); *((bool*)res.value().address.as_ptr()) = false; res = libc.lookup_symbol("exit"); - ASSERT(res.has_value()); + VERIFY(res.has_value()); g_libc_exit = (LibCExitFunction)res.value().address.as_ptr(); res = libc.lookup_symbol("__libc_init"); - ASSERT(res.has_value()); + VERIFY(res.has_value()); typedef void libc_init_func(); ((libc_init_func*)res.value().address.as_ptr())(); } @@ -203,12 +203,12 @@ static void load_elf(const String& name) { for_each_dependency_of(name, [](auto& loader) { auto dynamic_object = loader.map(); - ASSERT(dynamic_object); + VERIFY(dynamic_object); g_global_objects.append(*dynamic_object); }); for_each_dependency_of(name, [](auto& loader) { bool success = loader.link(RTLD_GLOBAL | RTLD_LAZY, g_total_tls_size); - ASSERT(success); + VERIFY(success); }); } @@ -223,11 +223,11 @@ static NonnullRefPtr<DynamicLoader> commit_elf(const String& name) } auto object = loader->load_stage_3(RTLD_GLOBAL | RTLD_LAZY, g_total_tls_size); - ASSERT(object); + VERIFY(object); if (name == "libsystem.so") { if (syscall(SC_msyscall, object->base_address().as_ptr())) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -288,7 +288,7 @@ void ELF::DynamicLinker::linker_main(String&& main_program_name, int main_progra int rc = syscall(SC_msyscall, nullptr); if (rc < 0) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } rc = main_function(argc, argv, envp); @@ -299,7 +299,7 @@ void ELF::DynamicLinker::linker_main(String&& main_program_name, int main_progra _exit(rc); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibELF/DynamicLoader.cpp b/Userland/Libraries/LibELF/DynamicLoader.cpp index d81a410221..524253c0b8 100644 --- a/Userland/Libraries/LibELF/DynamicLoader.cpp +++ b/Userland/Libraries/LibELF/DynamicLoader.cpp @@ -60,7 +60,7 @@ RefPtr<DynamicLoader> DynamicLoader::try_create(int fd, String filename) return {}; } - ASSERT(stat.st_size >= 0); + VERIFY(stat.st_size >= 0); auto size = static_cast<size_t>(stat.st_size); if (size < sizeof(Elf32_Ehdr)) return {}; @@ -90,11 +90,11 @@ DynamicLoader::~DynamicLoader() { if (munmap(m_file_data, m_file_size) < 0) { perror("munmap"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (close(m_image_fd) < 0) { perror("close"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -109,7 +109,7 @@ const DynamicObject& DynamicLoader::dynamic_object() const } return IterationDecision::Continue; }); - ASSERT(!dynamic_section_address.is_null()); + VERIFY(!dynamic_section_address.is_null()); m_cached_dynamic_object = ELF::DynamicObject::create(VirtualAddress(m_elf_image.base_address()), dynamic_section_address); } @@ -154,7 +154,7 @@ void* DynamicLoader::symbol_for_name(const StringView& name) RefPtr<DynamicObject> DynamicLoader::map() { - ASSERT(!m_dynamic_object); + VERIFY(!m_dynamic_object); if (!m_valid) { dbgln("DynamicLoader::map failed: image is invalid"); @@ -177,10 +177,10 @@ bool DynamicLoader::link(unsigned flags, size_t total_tls_size) bool DynamicLoader::load_stage_2(unsigned flags, size_t total_tls_size) { - ASSERT(flags & RTLD_GLOBAL); + VERIFY(flags & RTLD_GLOBAL); if (m_dynamic_object->has_text_relocations()) { - ASSERT(m_text_segment_load_address.get() != 0); + VERIFY(m_text_segment_load_address.get() != 0); #ifndef AK_OS_MACOS // Remap this text region as private. @@ -205,7 +205,7 @@ void DynamicLoader::do_main_relocations(size_t total_tls_size) switch (do_relocation(total_tls_size, relocation)) { case RelocationResult::Failed: dbgln("Loader.so: {} unresolved symbol '{}'", m_filename, relocation.symbol().name()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case RelocationResult::ResolveLater: m_unresolved_relocations.append(relocation); break; @@ -254,7 +254,7 @@ void DynamicLoader::do_lazy_relocations(size_t total_tls_size) for (const auto& relocation : m_unresolved_relocations) { if (auto res = do_relocation(total_tls_size, relocation); res != RelocationResult::Success) { dbgln("Loader.so: {} unresolved symbol '{}'", m_filename, relocation.symbol().name()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } } @@ -272,27 +272,27 @@ void DynamicLoader::load_program_headers() ProgramHeaderRegion region {}; region.set_program_header(program_header.raw_header()); if (region.is_tls_template()) { - ASSERT(!tls_region.has_value()); + VERIFY(!tls_region.has_value()); tls_region = region; } else if (region.is_load()) { if (region.is_executable()) { - ASSERT(!text_region.has_value()); + VERIFY(!text_region.has_value()); text_region = region; } else { - ASSERT(!data_region.has_value()); + VERIFY(!data_region.has_value()); data_region = region; } } else if (region.is_dynamic()) { dynamic_region_desired_vaddr = region.desired_load_address(); } else if (region.is_relro()) { - ASSERT(!relro_region.has_value()); + VERIFY(!relro_region.has_value()); relro_region = region; } return IterationDecision::Continue; }); - ASSERT(text_region.has_value()); - ASSERT(data_region.has_value()); + VERIFY(text_region.has_value()); + VERIFY(data_region.has_value()); // Process regions in order: .text, .data, .tls void* requested_load_address = m_elf_image.is_dynamic() ? nullptr : text_region.value().desired_load_address().as_ptr(); @@ -303,7 +303,7 @@ void DynamicLoader::load_program_headers() else reservation_mmap_flags |= MAP_FIXED; - ASSERT(!text_region.value().is_writable()); + VERIFY(!text_region.value().is_writable()); // First, we make a dummy reservation mapping, in order to allocate enough VM // to hold both text+data contiguously in the address space. @@ -321,13 +321,13 @@ void DynamicLoader::load_program_headers() auto* reservation = mmap(requested_load_address, total_mapping_size, PROT_NONE, reservation_mmap_flags, 0, 0); if (reservation == MAP_FAILED) { perror("mmap reservation"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // Then we unmap the reservation. if (munmap(reservation, total_mapping_size) < 0) { perror("munmap reservation"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // Now we can map the text segment at the reserved address. @@ -342,10 +342,10 @@ void DynamicLoader::load_program_headers() if (text_segment_begin == MAP_FAILED) { perror("mmap text"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(requested_load_address == nullptr || requested_load_address == text_segment_begin); + VERIFY(requested_load_address == nullptr || requested_load_address == text_segment_begin); m_text_segment_size = text_segment_size; m_text_segment_load_address = VirtualAddress { (FlatPtr)text_segment_begin }; @@ -375,7 +375,7 @@ void DynamicLoader::load_program_headers() if (MAP_FAILED == data_segment) { perror("mmap data"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } VirtualAddress data_segment_start; @@ -409,7 +409,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si if (symbol.bind() == STB_WEAK) return RelocationResult::ResolveLater; dbgln("ERROR: symbol not found: {}.", symbol.name()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto symbol_address = res.value().address; *patch_ptr += symbol_address.get(); @@ -418,7 +418,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si case R_386_PC32: { auto symbol = relocation.symbol(); auto result = lookup_symbol(symbol); - ASSERT(result.has_value()); + VERIFY(result.has_value()); auto relative_offset = result.value().address - m_dynamic_object->base_address().offset(relocation.offset()); *patch_ptr += relative_offset.get(); break; @@ -440,7 +440,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si return RelocationResult::Failed; } auto symbol_location = res.value().address; - ASSERT(symbol_location != m_dynamic_object->base_address()); + VERIFY(symbol_location != m_dynamic_object->base_address()); *patch_ptr = symbol_location.get(); break; } @@ -462,7 +462,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si break; u32 symbol_value = res.value().value; auto* dynamic_object_of_symbol = res.value().dynamic_object; - ASSERT(dynamic_object_of_symbol); + VERIFY(dynamic_object_of_symbol); size_t offset_of_tls_end = dynamic_object_of_symbol->tls_offset().value() + dynamic_object_of_symbol->tls_size().value(); *patch_ptr = (offset_of_tls_end - total_tls_size - symbol_value - sizeof(Elf32_Addr)); break; @@ -484,7 +484,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si default: // Raise the alarm! Someone needs to implement this relocation type dbgln("Found a new exciting relocation type {}", relocation.type()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return RelocationResult::Success; } @@ -494,8 +494,8 @@ extern "C" void _plt_trampoline(void) __attribute__((visibility("hidden"))); void DynamicLoader::setup_plt_trampoline() { - ASSERT(m_dynamic_object); - ASSERT(m_dynamic_object->has_plt()); + VERIFY(m_dynamic_object); + VERIFY(m_dynamic_object->has_plt()); VirtualAddress got_address = m_dynamic_object->plt_got_base_address(); auto* got_ptr = (FlatPtr*)got_address.as_ptr(); diff --git a/Userland/Libraries/LibELF/DynamicObject.cpp b/Userland/Libraries/LibELF/DynamicObject.cpp index 9505a87809..5c29083505 100644 --- a/Userland/Libraries/LibELF/DynamicObject.cpp +++ b/Userland/Libraries/LibELF/DynamicObject.cpp @@ -129,7 +129,7 @@ void DynamicObject::parse() break; case DT_PLTREL: m_procedure_linkage_table_relocation_type = entry.val(); - ASSERT(m_procedure_linkage_table_relocation_type & (DT_REL | DT_RELA)); + VERIFY(m_procedure_linkage_table_relocation_type & (DT_REL | DT_RELA)); break; case DT_JMPREL: m_plt_relocation_offset_location = entry.ptr() - (FlatPtr)m_elf_base_address.as_ptr(); @@ -172,7 +172,7 @@ void DynamicObject::parse() break; default: dbgln("DynamicObject: DYNAMIC tag handling not implemented for DT_{}", name_for_dtag(entry.tag())); - ASSERT_NOT_REACHED(); // FIXME: Maybe just break out here and return false? + VERIFY_NOT_REACHED(); // FIXME: Maybe just break out here and return false? break; } return IterationDecision::Continue; @@ -193,7 +193,7 @@ void DynamicObject::parse() DynamicObject::Relocation DynamicObject::RelocationSection::relocation(unsigned index) const { - ASSERT(index < entry_count()); + VERIFY(index < entry_count()); unsigned offset_in_section = index * entry_size(); auto relocation_address = (Elf32_Rel*)address().offset(offset_in_section).as_ptr(); return Relocation(m_dynamic, *relocation_address, offset_in_section); @@ -201,7 +201,7 @@ DynamicObject::Relocation DynamicObject::RelocationSection::relocation(unsigned DynamicObject::Relocation DynamicObject::RelocationSection::relocation_at_offset(unsigned offset) const { - ASSERT(offset <= (m_section_size_bytes - m_entry_size)); + VERIFY(offset <= (m_section_size_bytes - m_entry_size)); auto relocation_address = (Elf32_Rel*)address().offset(offset).as_ptr(); return Relocation(m_dynamic, *relocation_address, offset); } @@ -323,7 +323,7 @@ const char* DynamicObject::raw_symbol_string_table_string(Elf32_Word index) cons DynamicObject::InitializationFunction DynamicObject::init_section_function() const { - ASSERT(has_init_section()); + VERIFY(has_init_section()); return (InitializationFunction)init_section().address().as_ptr(); } @@ -444,14 +444,14 @@ NonnullRefPtr<DynamicObject> DynamicObject::create(VirtualAddress base_address, VirtualAddress DynamicObject::patch_plt_entry(u32 relocation_offset) { auto relocation = plt_relocation_section().relocation_at_offset(relocation_offset); - ASSERT(relocation.type() == R_386_JMP_SLOT); + VERIFY(relocation.type() == R_386_JMP_SLOT); auto symbol = relocation.symbol(); u8* relocation_address = relocation.address().as_ptr(); auto result = DynamicLoader::lookup_symbol(symbol); if (!result.has_value()) { dbgln("did not find symbol: {}", symbol.name()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto symbol_location = result.value().address; diff --git a/Userland/Libraries/LibELF/Image.cpp b/Userland/Libraries/LibELF/Image.cpp index 07233f5e0d..d40cea14e3 100644 --- a/Userland/Libraries/LibELF/Image.cpp +++ b/Userland/Libraries/LibELF/Image.cpp @@ -74,7 +74,7 @@ static const char* object_file_type_to_string(Elf32_Half type) StringView Image::section_index_to_string(unsigned index) const { - ASSERT(m_valid); + VERIFY(m_valid); if (index == SHN_UNDEF) return "Undefined"; if (index >= SHN_LORESERVE) @@ -84,7 +84,7 @@ StringView Image::section_index_to_string(unsigned index) const unsigned Image::symbol_count() const { - ASSERT(m_valid); + VERIFY(m_valid); if (!section_count()) return 0; return section(m_symbol_table_section_index).entry_count(); @@ -146,13 +146,13 @@ void Image::dump() const unsigned Image::section_count() const { - ASSERT(m_valid); + VERIFY(m_valid); return header().e_shnum; } unsigned Image::program_header_count() const { - ASSERT(m_valid); + VERIFY(m_valid); return header().e_phnum; } @@ -191,7 +191,7 @@ bool Image::parse() StringView Image::table_string(unsigned table_index, unsigned offset) const { - ASSERT(m_valid); + VERIFY(m_valid); auto& sh = section_header(table_index); if (sh.sh_type != SHT_STRTAB) return nullptr; @@ -208,67 +208,67 @@ StringView Image::table_string(unsigned table_index, unsigned offset) const StringView Image::section_header_table_string(unsigned offset) const { - ASSERT(m_valid); + VERIFY(m_valid); return table_string(header().e_shstrndx, offset); } StringView Image::table_string(unsigned offset) const { - ASSERT(m_valid); + VERIFY(m_valid); return table_string(m_string_table_section_index, offset); } const char* Image::raw_data(unsigned offset) const { - ASSERT(offset < m_size); // Callers must check indices into raw_data()'s result are also in bounds. + VERIFY(offset < m_size); // Callers must check indices into raw_data()'s result are also in bounds. return reinterpret_cast<const char*>(m_buffer) + offset; } const Elf32_Ehdr& Image::header() const { - ASSERT(m_size >= sizeof(Elf32_Ehdr)); + VERIFY(m_size >= sizeof(Elf32_Ehdr)); return *reinterpret_cast<const Elf32_Ehdr*>(raw_data(0)); } const Elf32_Phdr& Image::program_header_internal(unsigned index) const { - ASSERT(m_valid); - ASSERT(index < header().e_phnum); + VERIFY(m_valid); + VERIFY(index < header().e_phnum); return *reinterpret_cast<const Elf32_Phdr*>(raw_data(header().e_phoff + (index * sizeof(Elf32_Phdr)))); } const Elf32_Shdr& Image::section_header(unsigned index) const { - ASSERT(m_valid); - ASSERT(index < header().e_shnum); + VERIFY(m_valid); + VERIFY(index < header().e_shnum); return *reinterpret_cast<const Elf32_Shdr*>(raw_data(header().e_shoff + (index * header().e_shentsize))); } Image::Symbol Image::symbol(unsigned index) const { - ASSERT(m_valid); - ASSERT(index < symbol_count()); + VERIFY(m_valid); + VERIFY(index < symbol_count()); auto* raw_syms = reinterpret_cast<const Elf32_Sym*>(raw_data(section(m_symbol_table_section_index).offset())); return Symbol(*this, index, raw_syms[index]); } Image::Section Image::section(unsigned index) const { - ASSERT(m_valid); - ASSERT(index < section_count()); + VERIFY(m_valid); + VERIFY(index < section_count()); return Section(*this, index); } Image::ProgramHeader Image::program_header(unsigned index) const { - ASSERT(m_valid); - ASSERT(index < program_header_count()); + VERIFY(m_valid); + VERIFY(index < program_header_count()); return ProgramHeader(*this, index); } Image::Relocation Image::RelocationSection::relocation(unsigned index) const { - ASSERT(index < relocation_count()); + VERIFY(index < relocation_count()); auto* rels = reinterpret_cast<const Elf32_Rel*>(m_image.raw_data(offset())); return Relocation(m_image, rels[index]); } @@ -291,7 +291,7 @@ Image::RelocationSection Image::Section::relocations() const Image::Section Image::lookup_section(const String& name) const { - ASSERT(m_valid); + VERIFY(m_valid); for (unsigned i = 0; i < section_count(); ++i) { auto section = this->section(i); if (section.name() == name) diff --git a/Userland/Libraries/LibELF/Validation.cpp b/Userland/Libraries/LibELF/Validation.cpp index b849e836b8..403353cdde 100644 --- a/Userland/Libraries/LibELF/Validation.cpp +++ b/Userland/Libraries/LibELF/Validation.cpp @@ -219,7 +219,7 @@ bool validate_program_headers(const Elf32_Ehdr& elf_header, size_t file_size, co if (file_size < buffer_size) { dbgln("We somehow read more from a file than was in the file in the first place!"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } size_t num_program_headers = elf_header.e_phnum; diff --git a/Userland/Libraries/LibGUI/AbstractSlider.cpp b/Userland/Libraries/LibGUI/AbstractSlider.cpp index 99400b44d2..f6601ee38d 100644 --- a/Userland/Libraries/LibGUI/AbstractSlider.cpp +++ b/Userland/Libraries/LibGUI/AbstractSlider.cpp @@ -65,7 +65,7 @@ void AbstractSlider::set_page_step(int page_step) void AbstractSlider::set_range(int min, int max) { - ASSERT(min <= max); + VERIFY(min <= max); if (m_min == min && m_max == max) return; m_min = min; diff --git a/Userland/Libraries/LibGUI/AbstractView.cpp b/Userland/Libraries/LibGUI/AbstractView.cpp index d735291e59..8ac69da289 100644 --- a/Userland/Libraries/LibGUI/AbstractView.cpp +++ b/Userland/Libraries/LibGUI/AbstractView.cpp @@ -140,8 +140,8 @@ void AbstractView::update_edit_widget_position() void AbstractView::begin_editing(const ModelIndex& index) { - ASSERT(is_editable()); - ASSERT(model()); + VERIFY(is_editable()); + VERIFY(model()); if (m_edit_index == index) return; if (!model()->is_editable(index)) @@ -152,7 +152,7 @@ void AbstractView::begin_editing(const ModelIndex& index) } m_edit_index = index; - ASSERT(aid_create_editing_delegate); + VERIFY(aid_create_editing_delegate); m_editing_delegate = aid_create_editing_delegate(index); m_editing_delegate->bind(*model(), index); m_editing_delegate->set_value(index.data()); @@ -164,12 +164,12 @@ void AbstractView::begin_editing(const ModelIndex& index) m_edit_widget->set_focus(true); m_editing_delegate->will_begin_editing(); m_editing_delegate->on_commit = [this] { - ASSERT(model()); + VERIFY(model()); model()->set_data(m_edit_index, m_editing_delegate->value()); stop_editing(); }; m_editing_delegate->on_rollback = [this] { - ASSERT(model()); + VERIFY(model()); stop_editing(); }; } @@ -298,7 +298,7 @@ void AbstractView::mousemove_event(MouseEvent& event) if (distance_travelled_squared <= drag_distance_threshold) return ScrollableWidget::mousemove_event(event); - ASSERT(!data_type.is_null()); + VERIFY(!data_type.is_null()); if (m_is_dragging) return; @@ -323,7 +323,7 @@ void AbstractView::mousemove_event(MouseEvent& event) dbgln("Drag was cancelled!"); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } diff --git a/Userland/Libraries/LibGUI/Action.h b/Userland/Libraries/LibGUI/Action.h index efafc3c9ee..4ed68896f7 100644 --- a/Userland/Libraries/LibGUI/Action.h +++ b/Userland/Libraries/LibGUI/Action.h @@ -105,7 +105,7 @@ public: bool is_checked() const { - ASSERT(is_checkable()); + VERIFY(is_checkable()); return m_checked; } void set_checked(bool); diff --git a/Userland/Libraries/LibGUI/Application.cpp b/Userland/Libraries/LibGUI/Application.cpp index 818fe37cd6..73e4caa964 100644 --- a/Userland/Libraries/LibGUI/Application.cpp +++ b/Userland/Libraries/LibGUI/Application.cpp @@ -82,7 +82,7 @@ Application* Application::the() Application::Application(int argc, char** argv) { - ASSERT(!*s_the); + VERIFY(!*s_the); *s_the = *this; m_event_loop = make<Core::EventLoop>(); WindowServerConnection::the(); @@ -212,7 +212,7 @@ Gfx::Palette Application::palette() const void Application::tooltip_show_timer_did_fire() { - ASSERT(m_tooltip_window); + VERIFY(m_tooltip_window); Gfx::IntRect desktop_rect = Desktop::the().rect(); const int margin = 30; diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp index d136c17413..007e136a19 100644 --- a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp +++ b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp @@ -196,7 +196,7 @@ void AutocompleteBox::apply_suggestion() auto suggestion = suggestion_index.data().to_string(); size_t partial_length = suggestion_index.data((GUI::ModelRole)AutocompleteSuggestionModel::InternalRole::PartialInputLength).to_i64(); - ASSERT(suggestion.length() >= partial_length); + VERIFY(suggestion.length() >= partial_length); auto completion = suggestion.substring_view(partial_length, suggestion.length() - partial_length); m_editor->insert_at_cursor_or_replace_selection(completion); } diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.h b/Userland/Libraries/LibGUI/AutocompleteProvider.h index 6987f3b0ca..6dd51864ee 100644 --- a/Userland/Libraries/LibGUI/AutocompleteProvider.h +++ b/Userland/Libraries/LibGUI/AutocompleteProvider.h @@ -59,7 +59,7 @@ public: void attach(TextEditor& editor) { - ASSERT(!m_editor); + VERIFY(!m_editor); m_editor = editor; } void detach() { m_editor.clear(); } diff --git a/Userland/Libraries/LibGUI/BreadcrumbBar.cpp b/Userland/Libraries/LibGUI/BreadcrumbBar.cpp index b95e756c86..15fce14f53 100644 --- a/Userland/Libraries/LibGUI/BreadcrumbBar.cpp +++ b/Userland/Libraries/LibGUI/BreadcrumbBar.cpp @@ -136,7 +136,7 @@ void BreadcrumbBar::set_selected_segment(Optional<size_t> index) } auto& segment = m_segments[index.value()]; - ASSERT(segment.button); + VERIFY(segment.button); segment.button->set_checked(true); } diff --git a/Userland/Libraries/LibGUI/ColumnsView.cpp b/Userland/Libraries/LibGUI/ColumnsView.cpp index 9a18c4a5f3..c2d2747dcc 100644 --- a/Userland/Libraries/LibGUI/ColumnsView.cpp +++ b/Userland/Libraries/LibGUI/ColumnsView.cpp @@ -69,7 +69,7 @@ void ColumnsView::select_all() return; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }); for (Column& column : columns_for_selection) { @@ -102,12 +102,12 @@ void ColumnsView::paint_event(PaintEvent& event) auto& column = m_columns[i]; auto* next_column = i + 1 == m_columns.size() ? nullptr : &m_columns[i + 1]; - ASSERT(column.width > 0); + VERIFY(column.width > 0); int row_count = model()->row_count(column.parent_index); for (int row = 0; row < row_count; row++) { ModelIndex index = model()->index(row, m_model_column, column.parent_index); - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); bool is_selected_row = selection().contains(index); @@ -180,7 +180,7 @@ void ColumnsView::paint_event(PaintEvent& event) void ColumnsView::push_column(const ModelIndex& parent_index) { - ASSERT(model()); + VERIFY(model()); // Drop columns at the end. ModelIndex grandparent = model()->parent_index(parent_index); @@ -216,7 +216,7 @@ void ColumnsView::update_column_sizes() column.width = 10; for (int row = 0; row < row_count; row++) { ModelIndex index = model()->index(row, m_model_column, column.parent_index); - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); auto text = index.data().to_string(); int row_width = icon_spacing() + icon_size() + icon_spacing() + font().width(text) + icon_spacing() + s_arrow_bitmap_width + icon_spacing(); if (row_width > column.width) diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp index 510074df8c..565ca3de1b 100644 --- a/Userland/Libraries/LibGUI/ComboBox.cpp +++ b/Userland/Libraries/LibGUI/ComboBox.cpp @@ -118,7 +118,7 @@ ComboBox::ComboBox() m_list_view->set_frame_thickness(1); m_list_view->set_frame_shadow(Gfx::FrameShadow::Plain); m_list_view->on_selection = [this](auto& index) { - ASSERT(model()); + VERIFY(model()); m_list_view->set_activates_on_selection(true); if (m_updating_model) selection_updated(index); diff --git a/Userland/Libraries/LibGUI/Dialog.cpp b/Userland/Libraries/LibGUI/Dialog.cpp index e1988da503..9922812333 100644 --- a/Userland/Libraries/LibGUI/Dialog.cpp +++ b/Userland/Libraries/LibGUI/Dialog.cpp @@ -43,7 +43,7 @@ Dialog::~Dialog() int Dialog::exec() { - ASSERT(!m_event_loop); + VERIFY(!m_event_loop); m_event_loop = make<Core::EventLoop>(); if (parent() && is<Window>(parent())) { auto& parent_window = *static_cast<Window*>(parent()); diff --git a/Userland/Libraries/LibGUI/DisplayLink.cpp b/Userland/Libraries/LibGUI/DisplayLink.cpp index a2bf46e921..b9663405d1 100644 --- a/Userland/Libraries/LibGUI/DisplayLink.cpp +++ b/Userland/Libraries/LibGUI/DisplayLink.cpp @@ -73,7 +73,7 @@ i32 DisplayLink::register_callback(Function<void(i32)> callback) bool DisplayLink::unregister_callback(i32 callback_id) { - ASSERT(callbacks().contains(callback_id)); + VERIFY(callbacks().contains(callback_id)); callbacks().remove(callback_id); if (callbacks().is_empty()) diff --git a/Userland/Libraries/LibGUI/DragOperation.cpp b/Userland/Libraries/LibGUI/DragOperation.cpp index a1afb25cdc..e6a3215303 100644 --- a/Userland/Libraries/LibGUI/DragOperation.cpp +++ b/Userland/Libraries/LibGUI/DragOperation.cpp @@ -46,9 +46,9 @@ DragOperation::~DragOperation() DragOperation::Outcome DragOperation::exec() { - ASSERT(!s_current_drag_operation); - ASSERT(!m_event_loop); - ASSERT(m_mime_data); + VERIFY(!s_current_drag_operation); + VERIFY(!m_event_loop); + VERIFY(m_mime_data); Gfx::ShareableBitmap drag_bitmap; if (m_mime_data->has_format("image/x-raw-bitmap")) { @@ -79,14 +79,14 @@ DragOperation::Outcome DragOperation::exec() void DragOperation::done(Outcome outcome) { - ASSERT(m_outcome == Outcome::None); + VERIFY(m_outcome == Outcome::None); m_outcome = outcome; m_event_loop->quit(0); } void DragOperation::notify_accepted(Badge<WindowServerConnection>) { - ASSERT(s_current_drag_operation); + VERIFY(s_current_drag_operation); s_current_drag_operation->done(Outcome::Accepted); } diff --git a/Userland/Libraries/LibGUI/EditingEngine.cpp b/Userland/Libraries/LibGUI/EditingEngine.cpp index 3e16b1c3b1..45c75b4f12 100644 --- a/Userland/Libraries/LibGUI/EditingEngine.cpp +++ b/Userland/Libraries/LibGUI/EditingEngine.cpp @@ -36,13 +36,13 @@ EditingEngine::~EditingEngine() void EditingEngine::attach(TextEditor& editor) { - ASSERT(!m_editor); + VERIFY(!m_editor); m_editor = editor; } void EditingEngine::detach() { - ASSERT(m_editor); + VERIFY(m_editor); m_editor = nullptr; } @@ -450,7 +450,7 @@ TextPosition EditingEngine::find_beginning_of_next_word() has_seen_whitespace = true; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void EditingEngine::move_to_beginning_of_next_word() @@ -516,7 +516,7 @@ TextPosition EditingEngine::find_end_of_next_word() is_first_iteration = false; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void EditingEngine::move_to_end_of_next_word() @@ -584,7 +584,7 @@ TextPosition EditingEngine::find_end_of_previous_word() has_seen_whitespace = true; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void EditingEngine::move_to_end_of_previous_word() @@ -648,7 +648,7 @@ TextPosition EditingEngine::find_beginning_of_previous_word() is_first_iteration = false; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void EditingEngine::move_to_beginning_of_previous_word() @@ -689,7 +689,7 @@ void EditingEngine::move_selected_lines_down() get_selection_line_boundaries(first_line, last_line); auto& lines = m_editor->document().lines(); - ASSERT(lines.size() != 0); + VERIFY(lines.size() != 0); if (last_line >= lines.size() - 1) return; diff --git a/Userland/Libraries/LibGUI/FileIconProvider.cpp b/Userland/Libraries/LibGUI/FileIconProvider.cpp index 9d2ec26ba0..ed585e9dc2 100644 --- a/Userland/Libraries/LibGUI/FileIconProvider.cpp +++ b/Userland/Libraries/LibGUI/FileIconProvider.cpp @@ -240,7 +240,7 @@ Icon FileIconProvider::icon_for_path(const String& path, mode_t mode) for (auto size : target_icon.sizes()) { auto& emblem = size < 32 ? *s_symlink_emblem_small : *s_symlink_emblem; auto original_bitmap = target_icon.bitmap_for_size(size); - ASSERT(original_bitmap); + VERIFY(original_bitmap); auto generated_bitmap = original_bitmap->clone(); if (!generated_bitmap) { dbgln("Failed to clone {}x{} icon for symlink variant", size, size); diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index 3f9c5dae0c..88672e9e36 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -99,7 +99,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& file_ auto& widget = set_main_widget<GUI::Widget>(); if (!widget.load_from_gml(file_picker_dialog_gml)) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); auto& toolbar = *widget.find_descendant_of_type_named<GUI::ToolBar>("toolbar"); toolbar.set_has_frame(false); diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp index 4c8d7b08af..b504ae09e2 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.cpp +++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp @@ -53,7 +53,7 @@ ModelIndex FileSystemModel::Node::index(int column) const if (&parent->children[row] == this) return m_model.create_index(row, column, const_cast<Node*>(this)); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool FileSystemModel::Node::fetch_data(const String& full_path, bool is_root) @@ -340,7 +340,7 @@ const FileSystemModel::Node& FileSystemModel::node(const ModelIndex& index) cons { if (!index.is_valid()) return *m_root; - ASSERT(index.internal_data()); + VERIFY(index.internal_data()); return *(Node*)index.internal_data(); } @@ -361,7 +361,7 @@ ModelIndex FileSystemModel::parent_index(const ModelIndex& index) const return {}; auto& node = this->node(index); if (!node.parent) { - ASSERT(&node == m_root); + VERIFY(&node == m_root); return {}; } return node.parent->index(index.column()); @@ -369,7 +369,7 @@ ModelIndex FileSystemModel::parent_index(const ModelIndex& index) const Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const { - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); if (role == ModelRole::TextAlignment) { switch (index.column()) { @@ -386,7 +386,7 @@ Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const case Column::SymlinkTarget: return Gfx::TextAlignment::CenterLeft; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -394,7 +394,7 @@ Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const if (role == ModelRole::Custom) { // For GUI::FileSystemModel, custom role means the full path. - ASSERT(index.column() == Column::Name); + VERIFY(index.column() == Column::Name); return node.full_path(); } @@ -429,7 +429,7 @@ Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const case Column::SymlinkTarget: return node.symlink_target; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (role == ModelRole::Display) { @@ -581,7 +581,7 @@ String FileSystemModel::column_name(int column) const case Column::SymlinkTarget: return "Symlink target"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool FileSystemModel::accepts_drag(const ModelIndex& index, const Vector<String>& mime_types) const @@ -611,7 +611,7 @@ bool FileSystemModel::is_editable(const ModelIndex& index) const void FileSystemModel::set_data(const ModelIndex& index, const Variant& data) { - ASSERT(is_editable(index)); + VERIFY(is_editable(index)); Node& node = const_cast<Node&>(this->node(index)); auto dirname = LexicalPath(node.full_path()).dirname(); auto new_full_path = String::formatted("{}/{}", dirname, data.to_string()); diff --git a/Userland/Libraries/LibGUI/FontPicker.cpp b/Userland/Libraries/LibGUI/FontPicker.cpp index de73560cc6..d4e14bbf86 100644 --- a/Userland/Libraries/LibGUI/FontPicker.cpp +++ b/Userland/Libraries/LibGUI/FontPicker.cpp @@ -96,7 +96,7 @@ FontPicker::FontPicker(Window* parent_window, const Gfx::Font* current_font, boo auto& widget = set_main_widget<GUI::Widget>(); if (!widget.load_from_gml(font_picker_dialog_gml)) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); m_family_list_view = *widget.find_descendant_of_type_named<ListView>("family_list_view"); m_family_list_view->set_model(ItemListModel<String>::create(m_families)); diff --git a/Userland/Libraries/LibGUI/GMLFormatter.cpp b/Userland/Libraries/LibGUI/GMLFormatter.cpp index 09c263bcc9..813247af48 100644 --- a/Userland/Libraries/LibGUI/GMLFormatter.cpp +++ b/Userland/Libraries/LibGUI/GMLFormatter.cpp @@ -113,7 +113,7 @@ String format_gml(const StringView& string) auto ast = parse_gml(string); if (ast.is_null()) return {}; - ASSERT(ast.is_object()); + VERIFY(ast.is_object()); return format_gml_object(ast.as_object()); } diff --git a/Userland/Libraries/LibGUI/GMLLexer.cpp b/Userland/Libraries/LibGUI/GMLLexer.cpp index ede1272356..05985b7426 100644 --- a/Userland/Libraries/LibGUI/GMLLexer.cpp +++ b/Userland/Libraries/LibGUI/GMLLexer.cpp @@ -44,7 +44,7 @@ char GMLLexer::peek(size_t offset) const char GMLLexer::consume() { - ASSERT(m_index < m_input.length()); + VERIFY(m_index < m_input.length()); char ch = m_input[m_index++]; m_previous_position = m_position; if (ch == '\n') { diff --git a/Userland/Libraries/LibGUI/GMLLexer.h b/Userland/Libraries/LibGUI/GMLLexer.h index 0803747dd9..20bd137a39 100644 --- a/Userland/Libraries/LibGUI/GMLLexer.h +++ b/Userland/Libraries/LibGUI/GMLLexer.h @@ -62,7 +62,7 @@ struct GMLToken { FOR_EACH_TOKEN_TYPE #undef __TOKEN } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Type m_type { Type::Unknown }; diff --git a/Userland/Libraries/LibGUI/HeaderView.cpp b/Userland/Libraries/LibGUI/HeaderView.cpp index 0b394b63d2..c60dbc9e55 100644 --- a/Userland/Libraries/LibGUI/HeaderView.cpp +++ b/Userland/Libraries/LibGUI/HeaderView.cpp @@ -153,7 +153,7 @@ void HeaderView::mousemove_event(MouseEvent& event) int new_size = m_section_resize_original_width + delta.primary_offset_for_orientation(m_orientation); if (new_size <= minimum_column_size) new_size = minimum_column_size; - ASSERT(m_resizing_section >= 0 && m_resizing_section < model()->column_count()); + VERIFY(m_resizing_section >= 0 && m_resizing_section < model()->column_count()); set_section_size(m_resizing_section, new_size); return; } @@ -317,7 +317,7 @@ Menu& HeaderView::ensure_context_menu() // FIXME: This menu needs to be rebuilt if the model is swapped out, // or if the column count/names change. if (!m_context_menu) { - ASSERT(model()); + VERIFY(model()); m_context_menu = Menu::construct(); if (m_orientation == Gfx::Orientation::Vertical) { diff --git a/Userland/Libraries/LibGUI/INILexer.cpp b/Userland/Libraries/LibGUI/INILexer.cpp index 6410a58c03..4b34800c01 100644 --- a/Userland/Libraries/LibGUI/INILexer.cpp +++ b/Userland/Libraries/LibGUI/INILexer.cpp @@ -44,7 +44,7 @@ char IniLexer::peek(size_t offset) const char IniLexer::consume() { - ASSERT(m_index < m_input.length()); + VERIFY(m_index < m_input.length()); char ch = m_input[m_index++]; m_previous_position = m_position; if (ch == '\n') { diff --git a/Userland/Libraries/LibGUI/INILexer.h b/Userland/Libraries/LibGUI/INILexer.h index c4f4ba46d8..69c71c662b 100644 --- a/Userland/Libraries/LibGUI/INILexer.h +++ b/Userland/Libraries/LibGUI/INILexer.h @@ -62,7 +62,7 @@ struct IniToken { FOR_EACH_TOKEN_TYPE #undef __TOKEN } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Type m_type { Type::Unknown }; diff --git a/Userland/Libraries/LibGUI/Icon.cpp b/Userland/Libraries/LibGUI/Icon.cpp index 650b440842..c927a5368d 100644 --- a/Userland/Libraries/LibGUI/Icon.cpp +++ b/Userland/Libraries/LibGUI/Icon.cpp @@ -49,7 +49,7 @@ Icon::Icon(RefPtr<Gfx::Bitmap>&& bitmap) : Icon() { if (bitmap) { - ASSERT(bitmap->width() == bitmap->height()); + VERIFY(bitmap->width() == bitmap->height()); int size = bitmap->width(); set_bitmap_for_size(size, move(bitmap)); } @@ -59,7 +59,7 @@ Icon::Icon(RefPtr<Gfx::Bitmap>&& bitmap1, RefPtr<Gfx::Bitmap>&& bitmap2) : Icon(move(bitmap1)) { if (bitmap2) { - ASSERT(bitmap2->width() == bitmap2->height()); + VERIFY(bitmap2->width() == bitmap2->height()); int size = bitmap2->width(); set_bitmap_for_size(size, move(bitmap2)); } diff --git a/Userland/Libraries/LibGUI/IconView.cpp b/Userland/Libraries/LibGUI/IconView.cpp index d3ac1e84b7..d5108d3a26 100644 --- a/Userland/Libraries/LibGUI/IconView.cpp +++ b/Userland/Libraries/LibGUI/IconView.cpp @@ -85,7 +85,7 @@ void IconView::reinit_item_cache() const for (size_t i = new_item_count; i < m_item_data_cache.size(); i++) { auto& item_data = m_item_data_cache[i]; if (item_data.selected) { - ASSERT(m_selected_count_cache > 0); + VERIFY(m_selected_count_cache > 0); m_selected_count_cache--; } } @@ -212,7 +212,7 @@ Gfx::IntRect IconView::item_rect(int item_index) const ModelIndex IconView::index_at_event_position(const Gfx::IntPoint& position) const { - ASSERT(model()); + VERIFY(model()); auto adjusted_position = to_content_position(position); if (auto item_data = item_data_from_content_position(adjusted_position)) { if (item_data->is_containing(adjusted_position)) @@ -603,7 +603,7 @@ void IconView::do_clear_selection() m_selected_count_cache--; } m_first_selected_hint = 0; - ASSERT(m_selected_count_cache == 0); + VERIFY(m_selected_count_cache == 0); } void IconView::clear_selection() @@ -661,7 +661,7 @@ void IconView::remove_selection(ItemData& item_data) TemporaryChange change(m_changing_selection, true); item_data.selected = false; - ASSERT(m_selected_count_cache > 0); + VERIFY(m_selected_count_cache > 0); m_selected_count_cache--; int item_index = &item_data - &m_item_data_cache[0]; if (m_first_selected_hint == item_index) { @@ -770,7 +770,7 @@ void IconView::set_flow_direction(FlowDirection flow_direction) template<typename Function> inline IterationDecision IconView::for_each_item_intersecting_rect(const Gfx::IntRect& rect, Function f) const { - ASSERT(model()); + VERIFY(model()); if (rect.is_empty()) return IterationDecision::Continue; int begin_row, begin_column; diff --git a/Userland/Libraries/LibGUI/IconView.h b/Userland/Libraries/LibGUI/IconView.h index c26d34b766..71cf41b8ed 100644 --- a/Userland/Libraries/LibGUI/IconView.h +++ b/Userland/Libraries/LibGUI/IconView.h @@ -100,13 +100,13 @@ private: bool is_intersecting(const Gfx::IntRect& rect) const { - ASSERT(valid); + VERIFY(valid); return icon_rect.intersects(rect) || text_rect.intersects(rect); } bool is_containing(const Gfx::IntPoint& point) const { - ASSERT(valid); + VERIFY(valid); return icon_rect.contains(point) || text_rect.contains(point); } }; @@ -135,7 +135,7 @@ private: void reinit_item_cache() const; int model_index_to_item_index(const ModelIndex& model_index) const { - ASSERT(model_index.row() < item_count()); + VERIFY(model_index.row() < item_count()); return model_index.row(); } diff --git a/Userland/Libraries/LibGUI/ImageWidget.cpp b/Userland/Libraries/LibGUI/ImageWidget.cpp index a77ca3d1b7..019994224e 100644 --- a/Userland/Libraries/LibGUI/ImageWidget.cpp +++ b/Userland/Libraries/LibGUI/ImageWidget.cpp @@ -99,7 +99,7 @@ void ImageWidget::load_from_file(const StringView& path) auto& mapped_file = *file_or_error.value(); m_image_decoder = Gfx::ImageDecoder::create((const u8*)mapped_file.data(), mapped_file.size()); auto bitmap = m_image_decoder->bitmap(); - ASSERT(bitmap); + VERIFY(bitmap); set_bitmap(bitmap); diff --git a/Userland/Libraries/LibGUI/JsonArrayModel.cpp b/Userland/Libraries/LibGUI/JsonArrayModel.cpp index 83846ff37a..b31007d36d 100644 --- a/Userland/Libraries/LibGUI/JsonArrayModel.cpp +++ b/Userland/Libraries/LibGUI/JsonArrayModel.cpp @@ -43,8 +43,8 @@ void JsonArrayModel::update() auto json = JsonValue::from_string(file->read_all()); - ASSERT(json.has_value()); - ASSERT(json.value().is_array()); + VERIFY(json.has_value()); + VERIFY(json.value().is_array()); m_array = json.value().as_array(); did_update(); @@ -65,7 +65,7 @@ bool JsonArrayModel::store() bool JsonArrayModel::add(const Vector<JsonValue>&& values) { - ASSERT(values.size() == m_fields.size()); + VERIFY(values.size() == m_fields.size()); JsonObject obj; for (size_t i = 0; i < m_fields.size(); ++i) { auto& field_spec = m_fields[i]; diff --git a/Userland/Libraries/LibGUI/Layout.cpp b/Userland/Libraries/LibGUI/Layout.cpp index 250b1c5ca4..e534a1d5a9 100644 --- a/Userland/Libraries/LibGUI/Layout.cpp +++ b/Userland/Libraries/LibGUI/Layout.cpp @@ -66,7 +66,7 @@ Layout::Layout() } else if (entry.type == Entry::Type::Spacer) { entry_object.set("type", "Spacer"); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } entries_array.append(move(entry_object)); } @@ -87,7 +87,7 @@ void Layout::notify_adopted(Badge<Widget>, Widget& widget) void Layout::notify_disowned(Badge<Widget>, Widget& widget) { - ASSERT(m_owner == &widget); + VERIFY(m_owner == &widget); m_owner.clear(); } diff --git a/Userland/Libraries/LibGUI/LazyWidget.cpp b/Userland/Libraries/LibGUI/LazyWidget.cpp index 3e1a9c4951..1472b5879e 100644 --- a/Userland/Libraries/LibGUI/LazyWidget.cpp +++ b/Userland/Libraries/LibGUI/LazyWidget.cpp @@ -42,7 +42,7 @@ void LazyWidget::show_event(ShowEvent&) return; m_has_been_shown = true; - ASSERT(on_first_show); + VERIFY(on_first_show); on_first_show(*this); } diff --git a/Userland/Libraries/LibGUI/ListView.cpp b/Userland/Libraries/LibGUI/ListView.cpp index 4b304f6751..a1cd030f96 100644 --- a/Userland/Libraries/LibGUI/ListView.cpp +++ b/Userland/Libraries/LibGUI/ListView.cpp @@ -96,7 +96,7 @@ Gfx::IntRect ListView::content_rect(const ModelIndex& index) const ModelIndex ListView::index_at_event_position(const Gfx::IntPoint& point) const { - ASSERT(model()); + VERIFY(model()); auto adjusted_position = this->adjusted_position(point); for (int row = 0, row_count = model()->row_count(); row < row_count; ++row) { diff --git a/Userland/Libraries/LibGUI/Menu.cpp b/Userland/Libraries/LibGUI/Menu.cpp index 28844f055f..805fc22165 100644 --- a/Userland/Libraries/LibGUI/Menu.cpp +++ b/Userland/Libraries/LibGUI/Menu.cpp @@ -113,7 +113,7 @@ int Menu::realize_menu(RefPtr<Action> default_action) #if MENU_DEBUG dbgln("GUI::Menu::realize_menu(): New menu ID: {}", m_menu_id); #endif - ASSERT(m_menu_id > 0); + VERIFY(m_menu_id > 0); for (size_t i = 0; i < m_items.size(); ++i) { auto& item = m_items[i]; item.set_menu_id({}, m_menu_id); diff --git a/Userland/Libraries/LibGUI/MenuBar.cpp b/Userland/Libraries/LibGUI/MenuBar.cpp index ea8c9649b5..1900aa046c 100644 --- a/Userland/Libraries/LibGUI/MenuBar.cpp +++ b/Userland/Libraries/LibGUI/MenuBar.cpp @@ -63,12 +63,12 @@ void MenuBar::unrealize_menubar() void MenuBar::notify_added_to_application(Badge<Application>) { - ASSERT(m_menubar_id == -1); + VERIFY(m_menubar_id == -1); m_menubar_id = realize_menubar(); - ASSERT(m_menubar_id != -1); + VERIFY(m_menubar_id != -1); for (auto& menu : m_menus) { int menu_id = menu.realize_menu(); - ASSERT(menu_id != -1); + VERIFY(menu_id != -1); WindowServerConnection::the().send_sync<Messages::WindowServer::AddMenuToMenubar>(m_menubar_id, menu_id); } WindowServerConnection::the().send_sync<Messages::WindowServer::SetApplicationMenubar>(m_menubar_id); diff --git a/Userland/Libraries/LibGUI/MenuItem.cpp b/Userland/Libraries/LibGUI/MenuItem.cpp index 8c6e5a92ec..af9522fb7e 100644 --- a/Userland/Libraries/LibGUI/MenuItem.cpp +++ b/Userland/Libraries/LibGUI/MenuItem.cpp @@ -72,7 +72,7 @@ void MenuItem::set_enabled(bool enabled) void MenuItem::set_checked(bool checked) { - ASSERT(is_checkable()); + VERIFY(is_checkable()); if (m_checked == checked) return; m_checked = checked; @@ -81,7 +81,7 @@ void MenuItem::set_checked(bool checked) void MenuItem::set_default(bool is_default) { - ASSERT(is_checkable()); + VERIFY(is_checkable()); if (m_default == is_default) return; m_default = is_default; diff --git a/Userland/Libraries/LibGUI/ModelIndex.cpp b/Userland/Libraries/LibGUI/ModelIndex.cpp index ea6a97c28f..038974d1d4 100644 --- a/Userland/Libraries/LibGUI/ModelIndex.cpp +++ b/Userland/Libraries/LibGUI/ModelIndex.cpp @@ -35,7 +35,7 @@ Variant ModelIndex::data(ModelRole role) const if (!is_valid()) return {}; - ASSERT(model()); + VERIFY(model()); return model()->data(*this, role); } diff --git a/Userland/Libraries/LibGUI/ModelSelection.cpp b/Userland/Libraries/LibGUI/ModelSelection.cpp index 2a22336855..27686f22ce 100644 --- a/Userland/Libraries/LibGUI/ModelSelection.cpp +++ b/Userland/Libraries/LibGUI/ModelSelection.cpp @@ -47,7 +47,7 @@ void ModelSelection::remove_matching(Function<bool(const ModelIndex&)> filter) void ModelSelection::set(const ModelIndex& index) { - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); if (m_indexes.size() == 1 && m_indexes.contains(index)) return; m_indexes.clear(); @@ -57,7 +57,7 @@ void ModelSelection::set(const ModelIndex& index) void ModelSelection::add(const ModelIndex& index) { - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); if (m_indexes.contains(index)) return; m_indexes.set(index); @@ -78,7 +78,7 @@ void ModelSelection::add_all(const Vector<ModelIndex>& indices) void ModelSelection::toggle(const ModelIndex& index) { - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); if (m_indexes.contains(index)) m_indexes.remove(index); else @@ -88,7 +88,7 @@ void ModelSelection::toggle(const ModelIndex& index) bool ModelSelection::remove(const ModelIndex& index) { - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); if (!m_indexes.contains(index)) return false; m_indexes.remove(index); diff --git a/Userland/Libraries/LibGUI/MultiView.cpp b/Userland/Libraries/LibGUI/MultiView.cpp index 0c50700b6d..1fcff6446f 100644 --- a/Userland/Libraries/LibGUI/MultiView.cpp +++ b/Userland/Libraries/LibGUI/MultiView.cpp @@ -94,7 +94,7 @@ void MultiView::set_view_mode(ViewMode mode) m_view_as_icons_action->set_checked(true); return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void MultiView::set_model(RefPtr<Model> model) diff --git a/Userland/Libraries/LibGUI/MultiView.h b/Userland/Libraries/LibGUI/MultiView.h index e835bca6eb..2c2406e86e 100644 --- a/Userland/Libraries/LibGUI/MultiView.h +++ b/Userland/Libraries/LibGUI/MultiView.h @@ -73,7 +73,7 @@ public: case ViewMode::Icon: return *m_icon_view; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibGUI/OpacitySlider.cpp b/Userland/Libraries/LibGUI/OpacitySlider.cpp index d32002f479..c92f59da10 100644 --- a/Userland/Libraries/LibGUI/OpacitySlider.cpp +++ b/Userland/Libraries/LibGUI/OpacitySlider.cpp @@ -37,7 +37,7 @@ OpacitySlider::OpacitySlider(Gfx::Orientation orientation) : AbstractSlider(orientation) { // FIXME: Implement vertical mode. - ASSERT(orientation == Gfx::Orientation::Horizontal); + VERIFY(orientation == Gfx::Orientation::Horizontal); set_min(0); set_max(100); diff --git a/Userland/Libraries/LibGUI/ProgressBar.cpp b/Userland/Libraries/LibGUI/ProgressBar.cpp index 0e6cd4acbe..e2732a738c 100644 --- a/Userland/Libraries/LibGUI/ProgressBar.cpp +++ b/Userland/Libraries/LibGUI/ProgressBar.cpp @@ -59,7 +59,7 @@ void ProgressBar::set_value(int value) void ProgressBar::set_range(int min, int max) { - ASSERT(min < max); + VERIFY(min < max); m_min = min; m_max = max; m_value = clamp(m_value, m_min, m_max); diff --git a/Userland/Libraries/LibGUI/RunningProcessesModel.cpp b/Userland/Libraries/LibGUI/RunningProcessesModel.cpp index 985586c10f..b416873435 100644 --- a/Userland/Libraries/LibGUI/RunningProcessesModel.cpp +++ b/Userland/Libraries/LibGUI/RunningProcessesModel.cpp @@ -85,7 +85,7 @@ String RunningProcessesModel::column_name(int column_index) const case Column::Name: return "Name"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } GUI::Variant RunningProcessesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const @@ -109,7 +109,7 @@ GUI::Variant RunningProcessesModel::data(const GUI::ModelIndex& index, GUI::Mode case Column::Name: return process.name; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return {}; } diff --git a/Userland/Libraries/LibGUI/ScrollBar.cpp b/Userland/Libraries/LibGUI/ScrollBar.cpp index ad8bf27e48..26b6816b4d 100644 --- a/Userland/Libraries/LibGUI/ScrollBar.cpp +++ b/Userland/Libraries/LibGUI/ScrollBar.cpp @@ -279,7 +279,7 @@ void ScrollBar::mousedown_event(MouseEvent& event) if (event.shift()) { scroll_to_position(event.position()); m_pressed_component = component_at_position(event.position()); - ASSERT(m_pressed_component == Component::Scrubber); + VERIFY(m_pressed_component == Component::Scrubber); } if (m_pressed_component == Component::Scrubber) { m_scrub_start_value = value(); @@ -287,9 +287,9 @@ void ScrollBar::mousedown_event(MouseEvent& event) update(); return; } - ASSERT(!event.shift()); + VERIFY(!event.shift()); - ASSERT(m_pressed_component == Component::Gutter); + VERIFY(m_pressed_component == Component::Gutter); set_automatic_scrolling_active(true, Component::Gutter); update(); } diff --git a/Userland/Libraries/LibGUI/SortingProxyModel.cpp b/Userland/Libraries/LibGUI/SortingProxyModel.cpp index a0618ae410..a3602de29e 100644 --- a/Userland/Libraries/LibGUI/SortingProxyModel.cpp +++ b/Userland/Libraries/LibGUI/SortingProxyModel.cpp @@ -83,12 +83,12 @@ ModelIndex SortingProxyModel::map_to_source(const ModelIndex& proxy_index) const if (!proxy_index.is_valid()) return {}; - ASSERT(proxy_index.model() == this); - ASSERT(proxy_index.internal_data()); + VERIFY(proxy_index.model() == this); + VERIFY(proxy_index.internal_data()); auto& index_mapping = *static_cast<Mapping*>(proxy_index.internal_data()); auto it = m_mappings.find(index_mapping.source_parent); - ASSERT(it != m_mappings.end()); + VERIFY(it != m_mappings.end()); auto& mapping = *it->value; if (static_cast<size_t>(proxy_index.row()) >= mapping.source_rows.size() || proxy_index.column() >= column_count()) @@ -103,7 +103,7 @@ ModelIndex SortingProxyModel::map_to_proxy(const ModelIndex& source_index) const if (!source_index.is_valid()) return {}; - ASSERT(source_index.model() == m_source); + VERIFY(source_index.model() == m_source); auto source_parent = source_index.parent(); auto it = const_cast<SortingProxyModel*>(this)->build_mapping(source_parent); @@ -158,7 +158,7 @@ ModelIndex SortingProxyModel::index(int row, int column, const ModelIndex& paren const_cast<SortingProxyModel*>(this)->build_mapping(source_parent); auto it = m_mappings.find(source_parent); - ASSERT(it != m_mappings.end()); + VERIFY(it != m_mappings.end()); auto& mapping = *it->value; if (row >= static_cast<int>(mapping.source_rows.size()) || column >= column_count()) return {}; @@ -170,12 +170,12 @@ ModelIndex SortingProxyModel::parent_index(const ModelIndex& proxy_index) const if (!proxy_index.is_valid()) return {}; - ASSERT(proxy_index.model() == this); - ASSERT(proxy_index.internal_data()); + VERIFY(proxy_index.model() == this); + VERIFY(proxy_index.internal_data()); auto& index_mapping = *static_cast<Mapping*>(proxy_index.internal_data()); auto it = m_mappings.find(index_mapping.source_parent); - ASSERT(it != m_mappings.end()); + VERIFY(it != m_mappings.end()); return map_to_proxy(it->value->source_parent); } diff --git a/Userland/Libraries/LibGUI/SpinBox.cpp b/Userland/Libraries/LibGUI/SpinBox.cpp index 943497c918..5673907ff1 100644 --- a/Userland/Libraries/LibGUI/SpinBox.cpp +++ b/Userland/Libraries/LibGUI/SpinBox.cpp @@ -83,7 +83,7 @@ void SpinBox::set_value(int value) void SpinBox::set_range(int min, int max) { - ASSERT(min <= max); + VERIFY(min <= max); if (m_min == min && m_max == max) return; diff --git a/Userland/Libraries/LibGUI/TabWidget.cpp b/Userland/Libraries/LibGUI/TabWidget.cpp index 5e46f267d0..a5d2f000b3 100644 --- a/Userland/Libraries/LibGUI/TabWidget.cpp +++ b/Userland/Libraries/LibGUI/TabWidget.cpp @@ -176,7 +176,7 @@ Gfx::IntRect TabWidget::bar_rect() const case TabPosition::Bottom: return { 0, height() - bar_height(), width(), bar_height() }; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Gfx::IntRect TabWidget::container_rect() const @@ -187,7 +187,7 @@ Gfx::IntRect TabWidget::container_rect() const case TabPosition::Bottom: return { 0, 0, width(), height() - bar_height() }; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void TabWidget::paint_event(PaintEvent& event) diff --git a/Userland/Libraries/LibGUI/TextDocument.cpp b/Userland/Libraries/LibGUI/TextDocument.cpp index a523b18157..132a0c79e8 100644 --- a/Userland/Libraries/LibGUI/TextDocument.cpp +++ b/Userland/Libraries/LibGUI/TextDocument.cpp @@ -210,7 +210,7 @@ void TextDocumentLine::remove(TextDocument& document, size_t index) void TextDocumentLine::remove_range(TextDocument& document, size_t start, size_t length) { - ASSERT(length <= m_text.size()); + VERIFY(length <= m_text.size()); Vector<u32> new_data; new_data.ensure_capacity(m_text.size() - length); @@ -332,7 +332,7 @@ String TextDocument::text_in_range(const TextRange& a_range) const u32 TextDocument::code_point_at(const TextPosition& position) const { - ASSERT(position.line() < line_count()); + VERIFY(position.line() < line_count()); auto& line = this->line(position.line()); if (position.column() == line.length()) return '\n'; @@ -814,7 +814,7 @@ void TextDocument::remove(const TextRange& unnormalized_range) } } else { // Delete across a newline, merging lines. - ASSERT(range.start().line() == range.end().line() - 1); + VERIFY(range.start().line() == range.end().line() - 1); auto& first_line = line(range.start().line()); auto& second_line = line(range.end().line()); Vector<u32> code_points; diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 106cc37edf..799a0e2194 100644 --- a/Userland/Libraries/LibGUI/TextEditor.cpp +++ b/Userland/Libraries/LibGUI/TextEditor.cpp @@ -199,11 +199,11 @@ TextPosition TextEditor::text_position_at_content_position(const Gfx::IntPoint& break; case Gfx::TextAlignment::CenterRight: // FIXME: Support right-aligned line wrapping, I guess. - ASSERT(!is_wrapping_enabled()); + VERIFY(!is_wrapping_enabled()); column_index = (position.x() - content_x_for_position({ line_index, 0 }) + fixed_glyph_width() / 2) / fixed_glyph_width(); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } column_index = max((size_t)0, min(column_index, line(line_index).length())); @@ -688,7 +688,7 @@ void TextEditor::keydown_event(KeyEvent& event) } } } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (m_editing_engine->on_key(event)) @@ -873,10 +873,10 @@ int TextEditor::content_x_for_position(const TextPosition& position) const return m_horizontal_content_padding + ((is_single_line() && icon()) ? (icon_size() + icon_padding()) : 0) + x_offset; case Gfx::TextAlignment::CenterRight: // FIXME - ASSERT(!is_wrapping_enabled()); + VERIFY(!is_wrapping_enabled()); return content_width() - m_horizontal_content_padding - (line.length() * fixed_glyph_width()) + (position.column() * fixed_glyph_width()); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -884,8 +884,8 @@ Gfx::IntRect TextEditor::content_rect_for_position(const TextPosition& position) { if (!position.is_valid()) return {}; - ASSERT(!lines().is_empty()); - ASSERT(position.column() <= (current_line().length() + 1)); + VERIFY(!lines().is_empty()); + VERIFY(position.column() <= (current_line().length() + 1)); int x = content_x_for_position(position); @@ -993,7 +993,7 @@ void TextEditor::set_cursor(size_t line, size_t column) void TextEditor::set_cursor(const TextPosition& a_position) { - ASSERT(!lines().is_empty()); + VERIFY(!lines().is_empty()); TextPosition position = a_position; @@ -1146,7 +1146,7 @@ void TextEditor::delete_text_range(TextRange range) void TextEditor::insert_at_cursor_or_replace_selection(const StringView& text) { ReflowDeferrer defer(*this); - ASSERT(is_editable()); + VERIFY(is_editable()); if (has_selection()) delete_selection(); execute<InsertTextCommand>(text, m_cursor); @@ -1188,7 +1188,7 @@ void TextEditor::defer_reflow() void TextEditor::undefer_reflow() { - ASSERT(m_reflow_deferred); + VERIFY(m_reflow_deferred); if (!--m_reflow_deferred) { if (m_reflow_requested) { recompute_all_visual_lines(); @@ -1268,7 +1268,7 @@ void TextEditor::set_mode(const Mode mode) set_accepts_emoji_input(false); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (!is_displayonly()) @@ -1637,7 +1637,7 @@ void TextEditor::set_editing_engine(OwnPtr<EditingEngine> editing_engine) m_editing_engine->detach(); m_editing_engine = move(editing_engine); - ASSERT(m_editing_engine); + VERIFY(m_editing_engine); m_editing_engine->attach(*this); m_cursor_state = true; @@ -1653,7 +1653,7 @@ int TextEditor::line_height() const int TextEditor::fixed_glyph_width() const { - ASSERT(font().is_fixed_width()); + VERIFY(font().is_fixed_width()); return font().glyph_width(' '); } @@ -1679,7 +1679,7 @@ void TextEditor::set_should_autocomplete_automatically(bool value) return; if (value) { - ASSERT(m_autocomplete_provider); + VERIFY(m_autocomplete_provider); m_autocomplete_timer = Core::Timer::create_single_shot(m_automatic_autocomplete_delay_ms, [this] { try_show_autocomplete(); }); return; } diff --git a/Userland/Libraries/LibGUI/TreeView.cpp b/Userland/Libraries/LibGUI/TreeView.cpp index 81c2cc07df..ab1192853c 100644 --- a/Userland/Libraries/LibGUI/TreeView.cpp +++ b/Userland/Libraries/LibGUI/TreeView.cpp @@ -43,7 +43,7 @@ struct TreeView::MetadataForIndex { TreeView::MetadataForIndex& TreeView::ensure_metadata_for_index(const ModelIndex& index) const { - ASSERT(index.is_valid()); + VERIFY(index.is_valid()); auto it = m_view_metadata.find(index.internal_data()); if (it != m_view_metadata.end()) return *it->value; @@ -165,7 +165,7 @@ void TreeView::collapse_tree(const ModelIndex& root) void TreeView::toggle_index(const ModelIndex& index) { - ASSERT(model()->row_count(index)); + VERIFY(model()->row_count(index)); auto& metadata = ensure_metadata_for_index(index); metadata.open = !metadata.open; if (on_toggle) @@ -178,7 +178,7 @@ void TreeView::toggle_index(const ModelIndex& index) template<typename Callback> void TreeView::traverse_in_paint_order(Callback callback) const { - ASSERT(model()); + VERIFY(model()); auto& model = *this->model(); int indent_level = 1; int y_offset = 0; diff --git a/Userland/Libraries/LibGUI/Variant.cpp b/Userland/Libraries/LibGUI/Variant.cpp index 5d3ddac2b2..44a52d46d4 100644 --- a/Userland/Libraries/LibGUI/Variant.cpp +++ b/Userland/Libraries/LibGUI/Variant.cpp @@ -65,7 +65,7 @@ const char* to_string(Variant::Type type) case Variant::Type::TextAlignment: return "TextAlignment"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Variant::Variant() @@ -195,7 +195,7 @@ Variant::Variant(const JsonValue& value) return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Variant::Variant(const Gfx::Bitmap& value) @@ -276,7 +276,7 @@ void Variant::move_from(Variant&& other) void Variant::copy_from(const Variant& other) { - ASSERT(!is_valid()); + VERIFY(!is_valid()); m_type = other.m_type; switch (m_type) { case Type::Bool: @@ -366,7 +366,7 @@ bool Variant::operator==(const Variant& other) const case Type::Invalid: return true; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool Variant::operator<(const Variant& other) const @@ -400,11 +400,11 @@ bool Variant::operator<(const Variant& other) const case Type::Font: case Type::TextAlignment: // FIXME: Figure out how to compare these. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case Type::Invalid: break; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } String Variant::to_string() const @@ -449,14 +449,14 @@ String Variant::to_string() const case Gfx::TextAlignment::TopRight: return "Gfx::TextAlignment::TopRight"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return ""; } case Type::Invalid: return "[null]"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibGUI/Variant.h b/Userland/Libraries/LibGUI/Variant.h index a04f7b2e17..90f747f8e5 100644 --- a/Userland/Libraries/LibGUI/Variant.h +++ b/Userland/Libraries/LibGUI/Variant.h @@ -100,7 +100,7 @@ public: bool as_bool() const { - ASSERT(type() == Type::Bool); + VERIFY(type() == Type::Bool); return m_value.as_bool; } @@ -127,19 +127,19 @@ public: int as_i32() const { - ASSERT(type() == Type::Int32); + VERIFY(type() == Type::Int32); return m_value.as_i32; } int as_i64() const { - ASSERT(type() == Type::Int64); + VERIFY(type() == Type::Int64); return m_value.as_i64; } unsigned as_uint() const { - ASSERT(type() == Type::UnsignedInt); + VERIFY(type() == Type::UnsignedInt); return m_value.as_uint; } @@ -155,7 +155,7 @@ public: if (is_float()) return (int)as_float(); if (is_uint()) { - ASSERT(as_uint() <= INT32_MAX); + VERIFY(as_uint() <= INT32_MAX); return (int)as_uint(); } if (is_string()) @@ -175,7 +175,7 @@ public: float as_float() const { - ASSERT(type() == Type::Float); + VERIFY(type() == Type::Float); return m_value.as_float; } @@ -196,31 +196,31 @@ public: String as_string() const { - ASSERT(type() == Type::String); + VERIFY(type() == Type::String); return m_value.as_string; } const Gfx::Bitmap& as_bitmap() const { - ASSERT(type() == Type::Bitmap); + VERIFY(type() == Type::Bitmap); return *m_value.as_bitmap; } GUI::Icon as_icon() const { - ASSERT(type() == Type::Icon); + VERIFY(type() == Type::Icon); return GUI::Icon(*m_value.as_icon); } Color as_color() const { - ASSERT(type() == Type::Color); + VERIFY(type() == Type::Color); return Color::from_rgba(m_value.as_color); } const Gfx::Font& as_font() const { - ASSERT(type() == Type::Font); + VERIFY(type() == Type::Font); return *m_value.as_font; } diff --git a/Userland/Libraries/LibGUI/VimEditingEngine.cpp b/Userland/Libraries/LibGUI/VimEditingEngine.cpp index 60a6a2b21b..52826ab01d 100644 --- a/Userland/Libraries/LibGUI/VimEditingEngine.cpp +++ b/Userland/Libraries/LibGUI/VimEditingEngine.cpp @@ -48,7 +48,7 @@ bool VimEditingEngine::on_key(const KeyEvent& event) case (VimMode::Normal): return on_key_in_normal_mode(event); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return false; diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp index 85b521924e..807bc1cbad 100644 --- a/Userland/Libraries/LibGUI/Widget.cpp +++ b/Userland/Libraries/LibGUI/Widget.cpp @@ -305,7 +305,7 @@ void Widget::handle_keydown_event(KeyEvent& event) void Widget::handle_paint_event(PaintEvent& event) { - ASSERT(is_visible()); + VERIFY(is_visible()); if (fill_with_background_color()) { Painter painter(*this); painter.fill_rect(event.rect(), palette().color(background_role())); diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index a6be58c01b..f4b23a06d5 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -228,7 +228,7 @@ String Window::title() const Gfx::IntRect Window::rect_in_menubar() const { - ASSERT(m_window_type == WindowType::MenuApplet); + VERIFY(m_window_type == WindowType::MenuApplet); return WindowServerConnection::the().send_sync<Messages::WindowServer::GetWindowRectInMenubar>(m_window_id)->rect(); } @@ -330,7 +330,7 @@ void Window::handle_drop_event(DropEvent& event) return; auto result = m_main_widget->hit_test(event.position()); auto local_event = make<DropEvent>(result.local_position, event.text(), event.mime_data()); - ASSERT(result.widget); + VERIFY(result.widget); result.widget->dispatch_event(*local_event, this); Application::the()->set_drag_hovered_widget({}, nullptr); @@ -358,7 +358,7 @@ void Window::handle_mouse_event(MouseEvent& event) return; auto result = m_main_widget->hit_test(event.position()); auto local_event = make<MouseEvent>((Event::Type)event.type(), result.local_position, event.buttons(), event.button(), event.modifiers(), event.wheel_delta()); - ASSERT(result.widget); + VERIFY(result.widget); set_hovered_widget(result.widget); if (event.buttons() != 0 && !m_automatic_cursor_tracking_widget) m_automatic_cursor_tracking_widget = *result.widget; @@ -374,7 +374,7 @@ void Window::handle_multi_paint_event(MultiPaintEvent& event) if (!m_main_widget) return; auto rects = event.rects(); - ASSERT(!rects.is_empty()); + VERIFY(!rects.is_empty()); if (m_back_store && m_back_store->size() != event.window_size()) { // Eagerly discard the backing store if we learn from this paint event that it needs to be bigger. // Otherwise we would have to wait for a resize event to tell us. This way we don't waste the @@ -384,12 +384,12 @@ void Window::handle_multi_paint_event(MultiPaintEvent& event) bool created_new_backing_store = !m_back_store; if (!m_back_store) { m_back_store = create_backing_store(event.window_size()); - ASSERT(m_back_store); + VERIFY(m_back_store); } else if (m_double_buffering_enabled) { bool still_has_pixels = m_back_store->bitmap().set_nonvolatile(); if (!still_has_pixels) { m_back_store = create_backing_store(event.window_size()); - ASSERT(m_back_store); + VERIFY(m_back_store); created_new_backing_store = true; } } @@ -497,7 +497,7 @@ void Window::handle_drag_move_event(DragEvent& event) if (!m_main_widget) return; auto result = m_main_widget->hit_test(event.position()); - ASSERT(result.widget); + VERIFY(result.widget); Application::the()->set_drag_hovered_widget({}, result.widget, result.local_position, event.mime_types()); @@ -688,7 +688,7 @@ void Window::set_has_alpha_channel(bool value) void Window::set_double_buffering_enabled(bool value) { - ASSERT(!is_visible()); + VERIFY(!is_visible()); m_double_buffering_enabled = value; } @@ -742,7 +742,7 @@ void Window::flip(const Vector<Gfx::IntRect, 32>& dirty_rects) if (!m_back_store || m_back_store->size() != m_front_store->size()) { m_back_store = create_backing_store(m_front_store->size()); - ASSERT(m_back_store); + VERIFY(m_back_store); memcpy(m_back_store->bitmap().scanline(0), m_front_store->bitmap().scanline(0), m_front_store->bitmap().size_in_bytes()); m_back_store->bitmap().set_volatile(); return; @@ -760,7 +760,7 @@ OwnPtr<WindowBackingStore> Window::create_backing_store(const Gfx::IntSize& size { auto format = m_has_alpha_channel ? Gfx::BitmapFormat::RGBA32 : Gfx::BitmapFormat::RGB32; - ASSERT(!size.is_empty()); + VERIFY(!size.is_empty()); size_t pitch = Gfx::Bitmap::minimum_pitch(size.width(), format); size_t size_in_bytes = size.height() * pitch; @@ -779,7 +779,7 @@ OwnPtr<WindowBackingStore> Window::create_backing_store(const Gfx::IntSize& size void Window::set_modal(bool modal) { - ASSERT(!is_visible()); + VERIFY(!is_visible()); m_modal = modal; } @@ -795,7 +795,7 @@ void Window::set_icon(const Gfx::Bitmap* icon) Gfx::IntSize icon_size = icon ? icon->size() : Gfx::IntSize(16, 16); m_icon = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, icon_size); - ASSERT(m_icon); + VERIFY(m_icon); if (icon) { Painter painter(*m_icon); painter.blit({ 0, 0 }, *icon, icon->rect()); @@ -910,7 +910,7 @@ void Window::refresh_system_theme() void Window::for_each_window(Badge<WindowServerConnection>, Function<void(Window&)> callback) { for (auto& e : *reified_windows) { - ASSERT(e.value); + VERIFY(e.value); callback(*e.value); } } @@ -1003,7 +1003,7 @@ void Window::did_remove_widget(Badge<Widget>, Widget& widget) void Window::set_progress(int progress) { - ASSERT(m_window_id); + VERIFY(m_window_id); WindowServerConnection::the().post_message(Messages::WindowServer::SetWindowProgress(m_window_id, progress)); } @@ -1040,7 +1040,7 @@ void Window::did_disable_focused_widget(Badge<Widget>) bool Window::is_active() const { - ASSERT(Application::the()); + VERIFY(Application::the()); return this == Application::the()->active_window(); } diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.cpp b/Userland/Libraries/LibGUI/WindowServerConnection.cpp index 79169345e0..2d33b91dd1 100644 --- a/Userland/Libraries/LibGUI/WindowServerConnection.cpp +++ b/Userland/Libraries/LibGUI/WindowServerConnection.cpp @@ -213,7 +213,7 @@ static MouseButton to_gmousebutton(u32 button) case 16: return MouseButton::Forward; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } diff --git a/Userland/Libraries/LibGemini/GeminiJob.cpp b/Userland/Libraries/LibGemini/GeminiJob.cpp index be63d00fe1..4e43854fae 100644 --- a/Userland/Libraries/LibGemini/GeminiJob.cpp +++ b/Userland/Libraries/LibGemini/GeminiJob.cpp @@ -36,7 +36,7 @@ namespace Gemini { void GeminiJob::start() { - ASSERT(!m_socket); + VERIFY(!m_socket); m_socket = TLS::TLSv12::construct(this); m_socket->set_root_certificates(m_override_ca_certificates ? *m_override_ca_certificates : DefaultRootCACertificates::the().certificates()); m_socket->on_tls_connected = [this] { @@ -98,7 +98,7 @@ void GeminiJob::set_certificate(String certificate, String private_key) if (!m_socket->add_client_key(certificate.bytes(), private_key.bytes())) { dbgln("LibGemini: Failed to set a client certificate"); // FIXME: Do something about this failure - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibGemini/Job.cpp b/Userland/Libraries/LibGemini/Job.cpp index 5175dd100d..f8fd7cbf52 100644 --- a/Userland/Libraries/LibGemini/Job.cpp +++ b/Userland/Libraries/LibGemini/Job.cpp @@ -53,7 +53,7 @@ void Job::flush_received_buffers() m_received_buffers.take_first(); continue; } - ASSERT(written < payload.size()); + VERIFY(written < payload.size()); payload = payload.slice(written, payload.size() - written); return; } @@ -124,7 +124,7 @@ void Job::on_socket_connected() return; } - ASSERT(m_state == State::InBody || m_state == State::Finished); + VERIFY(m_state == State::InBody || m_state == State::Finished); read_while_data_available([&] { auto read_size = 64 * KiB; diff --git a/Userland/Libraries/LibGemini/Line.cpp b/Userland/Libraries/LibGemini/Line.cpp index d3197176d5..7496f704b4 100644 --- a/Userland/Libraries/LibGemini/Line.cpp +++ b/Userland/Libraries/LibGemini/Line.cpp @@ -81,7 +81,7 @@ String Control::render_to_html() const return "</ul>"; default: dbgln("Unknown control kind _{}_", (int)m_kind); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return ""; } } diff --git a/Userland/Libraries/LibGfx/BMPLoader.cpp b/Userland/Libraries/LibGfx/BMPLoader.cpp index 3d8203ad91..65e7da62f4 100644 --- a/Userland/Libraries/LibGfx/BMPLoader.cpp +++ b/Userland/Libraries/LibGfx/BMPLoader.cpp @@ -180,7 +180,7 @@ struct BMPLoadingContext { return 124; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }; @@ -215,7 +215,7 @@ public: u8 read_u8() { - ASSERT(m_size_remaining >= 1); + VERIFY(m_size_remaining >= 1); m_size_remaining--; return *(m_data_ptr++); } @@ -242,7 +242,7 @@ public: void drop_bytes(u8 num_bytes) { - ASSERT(m_size_remaining >= num_bytes); + VERIFY(m_size_remaining >= num_bytes); m_size_remaining -= num_bytes; m_data_ptr += num_bytes; } @@ -355,7 +355,7 @@ static void populate_dib_mask_info_if_needed(BMPLoadingContext& context) if (!mask_shifts.is_empty() && !mask_sizes.is_empty()) return; - ASSERT(mask_shifts.is_empty() && mask_sizes.is_empty()); + VERIFY(mask_shifts.is_empty() && mask_sizes.is_empty()); mask_shifts.ensure_capacity(masks.size()); mask_sizes.ensure_capacity(masks.size()); @@ -896,7 +896,7 @@ static bool decode_bmp_color_table(BMPLoadingContext& context) auto bytes_per_color = context.dib_type == DIBType::Core ? 3 : 4; u32 max_colors = 1 << context.dib.core.bpp; - ASSERT(context.data_offset >= bmp_header_size + context.dib_size()); + VERIFY(context.data_offset >= bmp_header_size + context.dib_size()); auto size_of_color_table = context.data_offset - bmp_header_size - context.dib_size(); if (context.dib_type <= DIBType::OSV2) { @@ -1161,7 +1161,7 @@ static bool uncompress_bmp_rle_data(BMPLoadingContext& context, ByteBuffer& buff } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static bool decode_bmp_pixel_data(BMPLoadingContext& context) @@ -1302,7 +1302,7 @@ static bool decode_bmp_pixel_data(BMPLoadingContext& context) case 3: return 1; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }(); if (streamer.remaining() < bytes_to_drop) return false; @@ -1377,7 +1377,7 @@ RefPtr<Gfx::Bitmap> BMPImageDecoderPlugin::bitmap() if (m_context->state < BMPLoadingContext::State::PixelDataDecoded && !decode_bmp_pixel_data(*m_context)) return nullptr; - ASSERT(m_context->bitmap); + VERIFY(m_context->bitmap); return m_context->bitmap; } diff --git a/Userland/Libraries/LibGfx/BMPWriter.cpp b/Userland/Libraries/LibGfx/BMPWriter.cpp index 6911f99164..ecf2808d60 100644 --- a/Userland/Libraries/LibGfx/BMPWriter.cpp +++ b/Userland/Libraries/LibGfx/BMPWriter.cpp @@ -95,7 +95,7 @@ static ByteBuffer compress_pixel_data(const ByteBuffer& pixel_data, BMPWriter::C return pixel_data; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } ByteBuffer BMPWriter::dump(const RefPtr<Bitmap> bitmap) diff --git a/Userland/Libraries/LibGfx/Bitmap.cpp b/Userland/Libraries/LibGfx/Bitmap.cpp index 2b7c207c7b..2046fdcf74 100644 --- a/Userland/Libraries/LibGfx/Bitmap.cpp +++ b/Userland/Libraries/LibGfx/Bitmap.cpp @@ -69,7 +69,7 @@ size_t Bitmap::minimum_pitch(size_t physical_width, BitmapFormat format) element_size = 4; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return physical_width * element_size; @@ -127,10 +127,10 @@ Bitmap::Bitmap(BitmapFormat format, const IntSize& size, int scale_factor, Purge , m_format(format) , m_purgeable(purgeable == Purgeable::Yes) { - ASSERT(!m_size.is_empty()); - ASSERT(!size_would_overflow(format, size, scale_factor)); - ASSERT(m_data); - ASSERT(backing_store.size_in_bytes == size_in_bytes()); + VERIFY(!m_size.is_empty()); + VERIFY(!size_would_overflow(format, size, scale_factor)); + VERIFY(m_data); + VERIFY(backing_store.size_in_bytes == size_in_bytes()); allocate_palette_from_format(format, {}); m_needs_munmap = true; } @@ -160,8 +160,8 @@ RefPtr<Bitmap> Bitmap::load_from_file(const StringView& path, int scale_factor) ENUMERATE_IMAGE_FORMATS #undef __ENUMERATE_IMAGE_FORMAT if (bmp) { - ASSERT(bmp->width() % scale_factor == 0); - ASSERT(bmp->height() % scale_factor == 0); + VERIFY(bmp->width() % scale_factor == 0); + VERIFY(bmp->height() % scale_factor == 0); bmp->m_size.set_width(bmp->width() / scale_factor); bmp->m_size.set_height(bmp->height() / scale_factor); bmp->m_scale = scale_factor; @@ -185,8 +185,8 @@ Bitmap::Bitmap(BitmapFormat format, const IntSize& size, int scale_factor, size_ , m_pitch(pitch) , m_format(format) { - ASSERT(pitch >= minimum_pitch(size.width() * scale_factor, format)); - ASSERT(!size_would_overflow(format, size, scale_factor)); + VERIFY(pitch >= minimum_pitch(size.width() * scale_factor, format)); + VERIFY(!size_would_overflow(format, size, scale_factor)); // FIXME: assert that `data` is actually long enough! allocate_palette_from_format(format, {}); @@ -220,7 +220,7 @@ RefPtr<Bitmap> Bitmap::create_with_anon_fd(BitmapFormat format, int anon_fd, con ScopeGuard close_guard = [&] { if (should_close_anon_fd == ShouldCloseAnonymousFile::Yes) { int rc = close(anon_fd); - ASSERT(rc == 0); + VERIFY(rc == 0); anon_fd = -1; } }; @@ -321,7 +321,7 @@ ByteBuffer Bitmap::serialize_to_byte_buffer() const } auto size = size_in_bytes(); - ASSERT(stream.remaining() == size); + VERIFY(stream.remaining() == size); if (stream.write({ scanline(0), size }) != size) return {}; @@ -338,8 +338,8 @@ Bitmap::Bitmap(BitmapFormat format, int anon_fd, const IntSize& size, int scale_ , m_purgeable(true) , m_anon_fd(anon_fd) { - ASSERT(!is_indexed() || !palette.is_empty()); - ASSERT(!size_would_overflow(format, size, scale_factor)); + VERIFY(!is_indexed() || !palette.is_empty()); + VERIFY(!size_would_overflow(format, size, scale_factor)); if (is_indexed(m_format)) allocate_palette_from_format(m_format, palette); @@ -358,7 +358,7 @@ RefPtr<Gfx::Bitmap> Bitmap::clone() const return nullptr; } - ASSERT(size_in_bytes() == new_bitmap->size_in_bytes()); + VERIFY(size_in_bytes() == new_bitmap->size_in_bytes()); memcpy(new_bitmap->scanline(0), scanline(0), size_in_bytes()); return new_bitmap; @@ -428,11 +428,11 @@ Bitmap::~Bitmap() { if (m_needs_munmap) { int rc = munmap(m_data, size_in_bytes()); - ASSERT(rc == 0); + VERIFY(rc == 0); } if (m_anon_fd != -1) { int rc = close(m_anon_fd); - ASSERT(rc == 0); + VERIFY(rc == 0); } m_data = nullptr; delete[] m_palette; @@ -440,7 +440,7 @@ Bitmap::~Bitmap() void Bitmap::set_mmap_name([[maybe_unused]] const StringView& name) { - ASSERT(m_needs_munmap); + VERIFY(m_needs_munmap); #ifdef __serenity__ ::set_mmap_name(m_data, size_in_bytes(), name.to_string().characters()); #endif @@ -448,7 +448,7 @@ void Bitmap::set_mmap_name([[maybe_unused]] const StringView& name) void Bitmap::fill(Color color) { - ASSERT(!is_indexed(m_format)); + VERIFY(!is_indexed(m_format)); for (int y = 0; y < physical_height(); ++y) { auto* scanline = this->scanline(y); fast_u32_fill(scanline, color.value(), physical_width()); @@ -457,14 +457,14 @@ void Bitmap::fill(Color color) void Bitmap::set_volatile() { - ASSERT(m_purgeable); + VERIFY(m_purgeable); if (m_volatile) return; #ifdef __serenity__ int rc = madvise(m_data, size_in_bytes(), MADV_SET_VOLATILE); if (rc < 0) { perror("madvise(MADV_SET_VOLATILE)"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } #endif m_volatile = true; @@ -472,14 +472,14 @@ void Bitmap::set_volatile() [[nodiscard]] bool Bitmap::set_nonvolatile() { - ASSERT(m_purgeable); + VERIFY(m_purgeable); if (!m_volatile) return true; #ifdef __serenity__ int rc = madvise(m_data, size_in_bytes(), MADV_SET_NONVOLATILE); if (rc < 0) { perror("madvise(MADV_SET_NONVOLATILE)"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } #else int rc = 0; @@ -528,7 +528,7 @@ void Bitmap::allocate_palette_from_format(BitmapFormat format, const Vector<RGBA return; m_palette = new RGBA32[size]; if (!source_palette.is_empty()) { - ASSERT(source_palette.size() == size); + VERIFY(source_palette.size() == size); memcpy(m_palette, source_palette.data(), size * sizeof(RGBA32)); } } diff --git a/Userland/Libraries/LibGfx/Bitmap.h b/Userland/Libraries/LibGfx/Bitmap.h index 0dfbe82bcc..bcfb89fa96 100644 --- a/Userland/Libraries/LibGfx/Bitmap.h +++ b/Userland/Libraries/LibGfx/Bitmap.h @@ -90,7 +90,7 @@ static StorageFormat determine_storage_format(BitmapFormat format) case BitmapFormat::Indexed8: return StorageFormat::Indexed8; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -198,7 +198,7 @@ public: case BitmapFormat::RGBA32: return 32; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case BitmapFormat::Invalid: return 0; } @@ -274,13 +274,13 @@ private: inline u8* Bitmap::scanline_u8(int y) { - ASSERT(y >= 0 && y < physical_height()); + VERIFY(y >= 0 && y < physical_height()); return reinterpret_cast<u8*>(m_data) + (y * m_pitch); } inline const u8* Bitmap::scanline_u8(int y) const { - ASSERT(y >= 0 && y < physical_height()); + VERIFY(y >= 0 && y < physical_height()); return reinterpret_cast<const u8*>(m_data) + (y * m_pitch); } @@ -297,21 +297,21 @@ inline const RGBA32* Bitmap::scanline(int y) const template<> inline Color Bitmap::get_pixel<StorageFormat::RGB32>(int x, int y) const { - ASSERT(x >= 0 && x < physical_width()); + VERIFY(x >= 0 && x < physical_width()); return Color::from_rgb(scanline(y)[x]); } template<> inline Color Bitmap::get_pixel<StorageFormat::RGBA32>(int x, int y) const { - ASSERT(x >= 0 && x < physical_width()); + VERIFY(x >= 0 && x < physical_width()); return Color::from_rgba(scanline(y)[x]); } template<> inline Color Bitmap::get_pixel<StorageFormat::Indexed8>(int x, int y) const { - ASSERT(x >= 0 && x < physical_width()); + VERIFY(x >= 0 && x < physical_width()); return Color::from_rgb(m_palette[scanline_u8(y)[x]]); } @@ -325,20 +325,20 @@ inline Color Bitmap::get_pixel(int x, int y) const case StorageFormat::Indexed8: return get_pixel<StorageFormat::Indexed8>(x, y); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } template<> inline void Bitmap::set_pixel<StorageFormat::RGB32>(int x, int y, Color color) { - ASSERT(x >= 0 && x < physical_width()); + VERIFY(x >= 0 && x < physical_width()); scanline(y)[x] = color.value(); } template<> inline void Bitmap::set_pixel<StorageFormat::RGBA32>(int x, int y, Color color) { - ASSERT(x >= 0 && x < physical_width()); + VERIFY(x >= 0 && x < physical_width()); scanline(y)[x] = color.value(); // drop alpha } inline void Bitmap::set_pixel(int x, int y, Color color) @@ -351,9 +351,9 @@ inline void Bitmap::set_pixel(int x, int y, Color color) set_pixel<StorageFormat::RGBA32>(x, y, color); break; case StorageFormat::Indexed8: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibGfx/BitmapFont.cpp b/Userland/Libraries/LibGfx/BitmapFont.cpp index 492f921053..09e080ec8e 100644 --- a/Userland/Libraries/LibGfx/BitmapFont.cpp +++ b/Userland/Libraries/LibGfx/BitmapFont.cpp @@ -147,7 +147,7 @@ RefPtr<BitmapFont> BitmapFont::load_from_memory(const u8* data) else if (header.type == 1) type = FontTypes::LatinExtendedA; else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); size_t count = glyph_count_by_type(type); size_t bytes_per_glyph = sizeof(unsigned) * header.glyph_height; @@ -168,7 +168,7 @@ size_t BitmapFont::glyph_count_by_type(FontTypes type) return 384; dbgln("Unknown font type: {}", (int)type); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } RefPtr<BitmapFont> BitmapFont::load_from_file(const StringView& path) diff --git a/Userland/Libraries/LibGfx/BitmapFont.h b/Userland/Libraries/LibGfx/BitmapFont.h index b43514fe0a..88ada2a2b7 100644 --- a/Userland/Libraries/LibGfx/BitmapFont.h +++ b/Userland/Libraries/LibGfx/BitmapFont.h @@ -98,7 +98,7 @@ public: void set_glyph_width(size_t ch, u8 width) { - ASSERT(m_glyph_widths); + VERIFY(m_glyph_widths); m_glyph_widths[ch] = width; } diff --git a/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp b/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp index 6227ecfc39..0f6f1ae684 100644 --- a/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp +++ b/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp @@ -167,7 +167,7 @@ ClassicWindowTheme::FrameColors ClassicWindowTheme::compute_frame_colors(WindowS case WindowState::Inactive: return { palette.inactive_window_title(), palette.inactive_window_border1(), palette.inactive_window_border2(), palette.inactive_window_title_stripes(), palette.inactive_window_title_shadow() }; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibGfx/Color.cpp b/Userland/Libraries/LibGfx/Color.cpp index 5e4af7a12b..20265dc43f 100644 --- a/Userland/Libraries/LibGfx/Color.cpp +++ b/Userland/Libraries/LibGfx/Color.cpp @@ -50,8 +50,8 @@ String Color::to_string_without_alpha() const static Optional<Color> parse_rgb_color(const StringView& string) { - ASSERT(string.starts_with("rgb(")); - ASSERT(string.ends_with(")")); + VERIFY(string.starts_with("rgb(")); + VERIFY(string.ends_with(")")); auto substring = string.substring_view(4, string.length() - 5); auto parts = substring.split_view(','); @@ -71,8 +71,8 @@ static Optional<Color> parse_rgb_color(const StringView& string) static Optional<Color> parse_rgba_color(const StringView& string) { - ASSERT(string.starts_with("rgba(")); - ASSERT(string.ends_with(")")); + VERIFY(string.starts_with("rgba(")); + VERIFY(string.ends_with(")")); auto substring = string.substring_view(5, string.length() - 6); auto parts = substring.split_view(','); diff --git a/Userland/Libraries/LibGfx/Color.h b/Userland/Libraries/LibGfx/Color.h index c4a28ba323..8070a712e2 100644 --- a/Userland/Libraries/LibGfx/Color.h +++ b/Userland/Libraries/LibGfx/Color.h @@ -239,9 +239,9 @@ public: hsv.value = max; - ASSERT(hsv.hue >= 0.0 && hsv.hue < 360.0); - ASSERT(hsv.saturation >= 0.0 && hsv.saturation <= 1.0); - ASSERT(hsv.value >= 0.0 && hsv.value <= 1.0); + VERIFY(hsv.hue >= 0.0 && hsv.hue < 360.0); + VERIFY(hsv.saturation >= 0.0 && hsv.saturation <= 1.0); + VERIFY(hsv.value >= 0.0 && hsv.value <= 1.0); return hsv; } @@ -253,9 +253,9 @@ public: static Color from_hsv(const HSV& hsv) { - ASSERT(hsv.hue >= 0.0 && hsv.hue < 360.0); - ASSERT(hsv.saturation >= 0.0 && hsv.saturation <= 1.0); - ASSERT(hsv.value >= 0.0 && hsv.value <= 1.0); + VERIFY(hsv.hue >= 0.0 && hsv.hue < 360.0); + VERIFY(hsv.saturation >= 0.0 && hsv.saturation <= 1.0); + VERIFY(hsv.value >= 0.0 && hsv.value <= 1.0); double hue = hsv.hue; double saturation = hsv.saturation; @@ -397,7 +397,7 @@ inline constexpr Color::Color(NamedColor named) rgb = { 212, 208, 200 }; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } diff --git a/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h b/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h index 416f84321a..93f325a28e 100644 --- a/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h +++ b/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h @@ -85,7 +85,7 @@ public: virtual void apply(Bitmap& target_bitmap, const IntRect& target_rect, const Bitmap& source_bitmap, const IntRect& source_rect, const Filter::Parameters& parameters) override { - ASSERT(parameters.is_generic_convolution_filter()); + VERIFY(parameters.is_generic_convolution_filter()); auto& gcf_params = static_cast<const GenericConvolutionFilter::Parameters&>(parameters); ApplyCache apply_cache; @@ -98,10 +98,10 @@ public: // contained by the source area. source_rect should be describing // the pixels that can be accessed to apply this filter, while // target_rect should describe the area where to apply the filter on. - ASSERT(source_rect.contains(target_rect)); - ASSERT(source.size().contains(target.size())); - ASSERT(target.rect().contains(target_rect)); - ASSERT(source.rect().contains(source_rect)); + VERIFY(source_rect.contains(target_rect)); + VERIFY(source.size().contains(target.size())); + VERIFY(target.rect().contains(target_rect)); + VERIFY(source.rect().contains(source_rect)); // If source is different from target, it should still be describing // essentially the same bitmap. But it allows us to modify target diff --git a/Userland/Libraries/LibGfx/FontDatabase.cpp b/Userland/Libraries/LibGfx/FontDatabase.cpp index c06fd0ebba..6aaaff246a 100644 --- a/Userland/Libraries/LibGfx/FontDatabase.cpp +++ b/Userland/Libraries/LibGfx/FontDatabase.cpp @@ -50,7 +50,7 @@ Font& FontDatabase::default_font() static Font* font; if (!font) { font = FontDatabase::the().get_by_name("Katica 10 400"); - ASSERT(font); + VERIFY(font); } return *font; } @@ -60,7 +60,7 @@ Font& FontDatabase::default_fixed_width_font() static Font* font; if (!font) { font = FontDatabase::the().get_by_name("Csilla 10 400"); - ASSERT(font); + VERIFY(font); } return *font; } @@ -70,7 +70,7 @@ Font& FontDatabase::default_bold_fixed_width_font() static Font* font; if (!font) { font = FontDatabase::the().get_by_name("Csilla 10 700"); - ASSERT(font); + VERIFY(font); } return *font; } @@ -80,7 +80,7 @@ Font& FontDatabase::default_bold_font() static Font* font; if (!font) { font = FontDatabase::the().get_by_name("Katica 10 700"); - ASSERT(font); + VERIFY(font); } return *font; } diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp index 750587e207..3bec3d1ce9 100644 --- a/Userland/Libraries/LibGfx/GIFLoader.cpp +++ b/Userland/Libraries/LibGfx/GIFLoader.cpp @@ -232,14 +232,14 @@ public: Vector<u8>& get_output() { - ASSERT(m_current_code <= m_code_table.size()); + VERIFY(m_current_code <= m_code_table.size()); if (m_current_code < m_code_table.size()) { Vector<u8> new_entry = m_output; m_output = m_code_table.at(m_current_code); new_entry.append(m_output[0]); extend_code_table(new_entry); } else if (m_current_code == m_code_table.size()) { - ASSERT(!m_output.is_empty()); + VERIFY(!m_output.is_empty()); m_output.append(m_output[0]); extend_code_table(m_output); } @@ -285,7 +285,7 @@ private: static void copy_frame_buffer(Bitmap& dest, const Bitmap& src) { - ASSERT(dest.size_in_bytes() == src.size_in_bytes()); + VERIFY(dest.size_in_bytes() == src.size_in_bytes()); memcpy(dest.scanline(0), src.scanline(0), dest.size_in_bytes()); } @@ -294,7 +294,7 @@ static void clear_rect(Bitmap& bitmap, const IntRect& rect, Color color) if (rect.is_empty()) return; - ASSERT(bitmap.rect().contains(rect)); + VERIFY(bitmap.rect().contains(rect)); RGBA32* dst = bitmap.scanline(rect.top()) + rect.left(); const size_t dst_skip = bitmap.pitch() / sizeof(RGBA32); diff --git a/Userland/Libraries/LibGfx/ICOLoader.cpp b/Userland/Libraries/LibGfx/ICOLoader.cpp index e0326f1580..51a2107e4b 100644 --- a/Userland/Libraries/LibGfx/ICOLoader.cpp +++ b/Userland/Libraries/LibGfx/ICOLoader.cpp @@ -388,7 +388,7 @@ RefPtr<Gfx::Bitmap> ICOImageDecoderPlugin::bitmap() m_context->state = ICOLoadingContext::State::BitmapDecoded; } - ASSERT(m_context->images[m_context->largest_index].bitmap); + VERIFY(m_context->images[m_context->largest_index].bitmap); return m_context->images[m_context->largest_index].bitmap; } diff --git a/Userland/Libraries/LibGfx/JPGLoader.cpp b/Userland/Libraries/LibGfx/JPGLoader.cpp index 4b4b4be311..0ec40055db 100644 --- a/Userland/Libraries/LibGfx/JPGLoader.cpp +++ b/Userland/Libraries/LibGfx/JPGLoader.cpp @@ -661,7 +661,7 @@ static bool read_huffman_table(InputMemoryStream& stream, JPGLoadingContext& con auto& huffman_table = table.type == 0 ? context.dc_tables : context.ac_tables; huffman_table.set(table.destination_id, table); - ASSERT(huffman_table.size() <= 2); + VERIFY(huffman_table.size() <= 2); bytes_to_read -= 1 + 16 + total_codes; } @@ -1167,7 +1167,7 @@ static bool parse_header(InputMemoryStream& stream, JPGLoadingContext& context) } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static bool scan_huffman_stream(InputMemoryStream& stream, JPGLoadingContext& context) @@ -1213,7 +1213,7 @@ static bool scan_huffman_stream(InputMemoryStream& stream, JPGLoadingContext& co } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static bool decode_jpg(JPGLoadingContext& context) diff --git a/Userland/Libraries/LibGfx/Matrix.h b/Userland/Libraries/LibGfx/Matrix.h index aa9cf5e64f..2913457d91 100644 --- a/Userland/Libraries/LibGfx/Matrix.h +++ b/Userland/Libraries/LibGfx/Matrix.h @@ -39,7 +39,7 @@ public: Matrix() = default; Matrix(std::initializer_list<T> elements) { - ASSERT(elements.size() == N * N); + VERIFY(elements.size() == N * N); size_t i = 0; for (auto& element : elements) { m_elements[i / N][i % N] = element; diff --git a/Userland/Libraries/LibGfx/PBMLoader.cpp b/Userland/Libraries/LibGfx/PBMLoader.cpp index 4040b09c97..dda7c44da2 100644 --- a/Userland/Libraries/LibGfx/PBMLoader.cpp +++ b/Userland/Libraries/LibGfx/PBMLoader.cpp @@ -166,7 +166,7 @@ RefPtr<Gfx::Bitmap> PBMImageDecoderPlugin::bitmap() return nullptr; } - ASSERT(m_context->bitmap); + VERIFY(m_context->bitmap); return m_context->bitmap; } diff --git a/Userland/Libraries/LibGfx/PGMLoader.cpp b/Userland/Libraries/LibGfx/PGMLoader.cpp index 122a698a7b..5cd2b7bed3 100644 --- a/Userland/Libraries/LibGfx/PGMLoader.cpp +++ b/Userland/Libraries/LibGfx/PGMLoader.cpp @@ -169,7 +169,7 @@ RefPtr<Gfx::Bitmap> PGMImageDecoderPlugin::bitmap() return nullptr; } - ASSERT(m_context->bitmap); + VERIFY(m_context->bitmap); return m_context->bitmap; } diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp index 1f1ae6d066..fbb4a4d8b9 100644 --- a/Userland/Libraries/LibGfx/PNGLoader.cpp +++ b/Userland/Libraries/LibGfx/PNGLoader.cpp @@ -387,7 +387,7 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context) } } } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } break; case 4: @@ -396,7 +396,7 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context) } else if (context.bit_depth == 16) { unpack_grayscale_with_alpha<u16>(context); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } break; case 2: @@ -405,7 +405,7 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context) } else if (context.bit_depth == 16) { unpack_triplets_without_alpha<u16>(context); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } break; case 6: @@ -425,7 +425,7 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context) } } } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } break; case 3: @@ -468,11 +468,11 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context) } } } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } @@ -658,7 +658,7 @@ static int adam7_height(PNGLoadingContext& context, int pass) case 7: return context.height / 2; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -680,7 +680,7 @@ static int adam7_width(PNGLoadingContext& context, int pass) case 7: return context.width; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -809,7 +809,7 @@ static bool decode_png_bitmap(PNGLoadingContext& context) return false; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } munmap(context.decompression_buffer, context.decompression_buffer_size); @@ -1026,7 +1026,7 @@ RefPtr<Gfx::Bitmap> PNGImageDecoderPlugin::bitmap() return nullptr; } - ASSERT(m_context->bitmap); + VERIFY(m_context->bitmap); return m_context->bitmap; } diff --git a/Userland/Libraries/LibGfx/PPMLoader.cpp b/Userland/Libraries/LibGfx/PPMLoader.cpp index 80d99d8966..8f88a9ff8b 100644 --- a/Userland/Libraries/LibGfx/PPMLoader.cpp +++ b/Userland/Libraries/LibGfx/PPMLoader.cpp @@ -171,7 +171,7 @@ RefPtr<Gfx::Bitmap> PPMImageDecoderPlugin::bitmap() return nullptr; } - ASSERT(m_context->bitmap); + VERIFY(m_context->bitmap); return m_context->bitmap; } diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp index ed075d8381..445f4eda35 100644 --- a/Userland/Libraries/LibGfx/Painter.cpp +++ b/Userland/Libraries/LibGfx/Painter.cpp @@ -73,9 +73,9 @@ Painter::Painter(Gfx::Bitmap& bitmap) : m_target(bitmap) { int scale = bitmap.scale(); - ASSERT(bitmap.format() == Gfx::BitmapFormat::RGB32 || bitmap.format() == Gfx::BitmapFormat::RGBA32); - ASSERT(bitmap.physical_width() % scale == 0); - ASSERT(bitmap.physical_height() % scale == 0); + VERIFY(bitmap.format() == Gfx::BitmapFormat::RGB32 || bitmap.format() == Gfx::BitmapFormat::RGBA32); + VERIFY(bitmap.physical_width() % scale == 0); + VERIFY(bitmap.physical_height() % scale == 0); m_state_stack.append(State()); state().font = &FontDatabase::default_font(); state().clip_rect = { { 0, 0 }, bitmap.size() }; @@ -89,7 +89,7 @@ Painter::~Painter() void Painter::fill_rect_with_draw_op(const IntRect& a_rect, Color color) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. auto rect = a_rect.translated(translation()).intersected(clip_rect()); if (rect.is_empty()) @@ -111,7 +111,7 @@ void Painter::clear_rect(const IntRect& a_rect, Color color) if (rect.is_empty()) return; - ASSERT(m_target->rect().contains(rect)); + VERIFY(m_target->rect().contains(rect)); rect *= scale(); RGBA32* dst = m_target->scanline(rect.top()) + rect.left(); @@ -154,14 +154,14 @@ void Painter::fill_rect(const IntRect& a_rect, Color color) auto rect = a_rect.translated(translation()).intersected(clip_rect()); if (rect.is_empty()) return; - ASSERT(m_target->rect().contains(rect)); + VERIFY(m_target->rect().contains(rect)); fill_physical_rect(rect * scale(), color); } void Painter::fill_rect_with_dither_pattern(const IntRect& a_rect, Color color_a, Color color_b) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. auto rect = a_rect.translated(translation()).intersected(clip_rect()); if (rect.is_empty()) @@ -185,7 +185,7 @@ void Painter::fill_rect_with_dither_pattern(const IntRect& a_rect, Color color_a void Painter::fill_rect_with_checkerboard(const IntRect& a_rect, const IntSize& cell_size, Color color_dark, Color color_light) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. auto rect = a_rect.translated(translation()).intersected(clip_rect()); if (rect.is_empty()) @@ -264,13 +264,13 @@ void Painter::fill_rect_with_gradient(const IntRect& a_rect, Color gradient_star void Painter::fill_ellipse(const IntRect& a_rect, Color color) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. auto rect = a_rect.translated(translation()).intersected(clip_rect()); if (rect.is_empty()) return; - ASSERT(m_target->rect().contains(rect)); + VERIFY(m_target->rect().contains(rect)); RGBA32* dst = m_target->scanline(rect.top()) + rect.left() + rect.width() / 2; const size_t dst_skip = m_target->pitch() / sizeof(RGBA32); @@ -285,7 +285,7 @@ void Painter::fill_ellipse(const IntRect& a_rect, Color color) void Painter::draw_ellipse_intersecting(const IntRect& rect, Color color, int thickness) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. constexpr int number_samples = 100; // FIXME: dynamically work out the number of samples based upon the rect size double increment = M_PI / number_samples; @@ -324,7 +324,7 @@ static void for_each_pixel_around_rect_clockwise(const RectType& rect, Callback void Painter::draw_focus_rect(const IntRect& rect, Color color) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. if (rect.is_empty()) return; @@ -389,7 +389,7 @@ void Painter::draw_rect(const IntRect& a_rect, Color color, bool rough) void Painter::draw_bitmap(const IntPoint& p, const CharacterBitmap& bitmap, Color color) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. auto rect = IntRect(p, bitmap.size()).translated(translation()); auto clipped_rect = rect.intersected(clip_rect()); @@ -454,7 +454,7 @@ void Painter::draw_bitmap(const IntPoint& p, const GlyphBitmap& bitmap, Color co void Painter::draw_triangle(const IntPoint& a, const IntPoint& b, const IntPoint& c, Color color) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. RGBA32 rgba = color.value(); @@ -524,7 +524,7 @@ void Painter::draw_triangle(const IntPoint& a, const IntPoint& b, const IntPoint void Painter::blit_with_opacity(const IntPoint& position, const Gfx::Bitmap& source, const IntRect& a_src_rect, float opacity, bool apply_alpha) { - ASSERT(scale() >= source.scale() && "painter doesn't support downsampling scale factors"); + VERIFY(scale() >= source.scale() && "painter doesn't support downsampling scale factors"); if (opacity >= 1.0f && !(source.has_alpha_channel() && apply_alpha)) return blit(position, source, a_src_rect); @@ -581,7 +581,7 @@ void Painter::blit_with_opacity(const IntPoint& position, const Gfx::Bitmap& sou void Painter::blit_filtered(const IntPoint& position, const Gfx::Bitmap& source, const IntRect& src_rect, Function<Color(Color)> filter) { - ASSERT((source.scale() == 1 || source.scale() == scale()) && "blit_filtered only supports integer upsampling"); + VERIFY((source.scale() == 1 || source.scale() == scale()) && "blit_filtered only supports integer upsampling"); IntRect safe_src_rect = src_rect.intersected(source.rect()); auto dst_rect = IntRect(position, safe_src_rect.size()).translated(translation()); @@ -660,7 +660,7 @@ void Painter::blit_dimmed(const IntPoint& position, const Gfx::Bitmap& source, c void Painter::draw_tiled_bitmap(const IntRect& a_dst_rect, const Gfx::Bitmap& source) { - ASSERT((source.scale() == 1 || source.scale() == scale()) && "draw_tiled_bitmap only supports integer upsampling"); + VERIFY((source.scale() == 1 || source.scale() == scale()) && "draw_tiled_bitmap only supports integer upsampling"); auto dst_rect = a_dst_rect.translated(translation()); auto clipped_rect = dst_rect.intersected(clip_rect()); @@ -701,7 +701,7 @@ void Painter::draw_tiled_bitmap(const IntRect& a_dst_rect, const Gfx::Bitmap& so return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Painter::blit_offset(const IntPoint& a_position, const Gfx::Bitmap& source, const IntRect& a_src_rect, const IntPoint& offset) @@ -721,7 +721,7 @@ void Painter::blit_offset(const IntPoint& a_position, const Gfx::Bitmap& source, void Painter::blit(const IntPoint& position, const Gfx::Bitmap& source, const IntRect& a_src_rect, float opacity, bool apply_alpha) { - ASSERT(scale() >= source.scale() && "painter doesn't support downsampling scale factors"); + VERIFY(scale() >= source.scale() && "painter doesn't support downsampling scale factors"); if (opacity < 1.0f || (source.has_alpha_channel() && apply_alpha)) return blit_with_opacity(position, source, a_src_rect, opacity, apply_alpha); @@ -772,7 +772,7 @@ void Painter::blit(const IntPoint& position, const Gfx::Bitmap& source, const In return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } template<bool has_alpha_channel, typename GetPixel> @@ -1024,7 +1024,7 @@ void draw_text_line(const IntRect& a_rect, const TextType& text, const Font& fon break; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (is_vertically_centered_text_alignment(alignment)) { @@ -1117,7 +1117,7 @@ void do_draw_text(const IntRect& rect, const TextType& text, const Font& font, T bounding_rect.set_location({ (rect.right() + 1) - bounding_rect.width(), (rect.bottom() + 1) - bounding_rect.height() }); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } for (size_t i = 0; i < lines.size(); ++i) { @@ -1155,7 +1155,7 @@ void Painter::draw_text(const IntRect& rect, const Utf32View& text, const Font& void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, const IntRect& rect, const StringView& raw_text, const Font& font, TextAlignment alignment, TextElision elision) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. Utf8View text { raw_text }; do_draw_text(rect, text, font, alignment, elision, [&](const IntRect& r, u32 code_point) { @@ -1165,7 +1165,7 @@ void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, cons void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, const IntRect& rect, const Utf8View& text, const Font& font, TextAlignment alignment, TextElision elision) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. do_draw_text(rect, text, font, alignment, elision, [&](const IntRect& r, u32 code_point) { draw_one_glyph(r, code_point); @@ -1174,7 +1174,7 @@ void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, cons void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, const IntRect& rect, const Utf32View& text, const Font& font, TextAlignment alignment, TextElision elision) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. do_draw_text(rect, text, font, alignment, elision, [&](const IntRect& r, u32 code_point) { draw_one_glyph(r, code_point); @@ -1183,7 +1183,7 @@ void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, cons void Painter::set_pixel(const IntPoint& p, Color color) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. auto point = p; point.move_by(state().translation); @@ -1245,7 +1245,7 @@ void Painter::draw_physical_pixel(const IntPoint& physical_position, Color color // This always draws a single physical pixel, independent of scale(). // This should only be called by routines that already handle scale // (including scaling thickness). - ASSERT(draw_op() == DrawOp::Copy); + VERIFY(draw_op() == DrawOp::Copy); if (thickness == 1) { // Implies scale() == 1. auto& pixel = m_target->scanline(physical_position.y())[physical_position.x()]; @@ -1327,7 +1327,7 @@ void Painter::draw_line(const IntPoint& p1, const IntPoint& p2, Color color, int } // FIXME: Implement dotted/dashed diagonal lines. - ASSERT(style == LineStyle::Solid); + VERIFY(style == LineStyle::Solid); const double adx = abs(point2.x() - point1.x()); const double ady = abs(point2.y() - point1.y()); @@ -1462,7 +1462,7 @@ static bool can_approximate_elliptical_arc(const FloatPoint& p1, const FloatPoin void Painter::draw_quadratic_bezier_curve(const IntPoint& control_point, const IntPoint& p1, const IntPoint& p2, Color color, int thickness, LineStyle style) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. for_each_line_segment_on_bezier_curve(FloatPoint(control_point), FloatPoint(p1), FloatPoint(p2), [&](const FloatPoint& fp1, const FloatPoint& fp2) { draw_line(IntPoint(fp1.x(), fp1.y()), IntPoint(fp2.x(), fp2.y()), color, thickness, style); @@ -1487,7 +1487,7 @@ void Painter::for_each_line_segment_on_elliptical_arc(const FloatPoint& p1, cons void Painter::draw_elliptical_arc(const IntPoint& p1, const IntPoint& p2, const IntPoint& center, const FloatPoint& radii, float x_axis_rotation, float theta_1, float theta_delta, Color color, int thickness, LineStyle style) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. for_each_line_segment_on_elliptical_arc(FloatPoint(p1), FloatPoint(p2), FloatPoint(center), radii, x_axis_rotation, theta_1, theta_delta, [&](const FloatPoint& fp1, const FloatPoint& fp2) { draw_line(IntPoint(fp1.x(), fp1.y()), IntPoint(fp2.x(), fp2.y()), color, thickness, style); @@ -1518,14 +1518,14 @@ PainterStateSaver::~PainterStateSaver() void Painter::stroke_path(const Path& path, Color color, int thickness) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. FloatPoint cursor; for (auto& segment : path.segments()) { switch (segment.type()) { case Segment::Type::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; case Segment::Type::MoveTo: cursor = segment.point(); @@ -1573,7 +1573,7 @@ void Painter::stroke_path(const Path& path, Color color, int thickness) void Painter::fill_path(Path& path, Color color, WindingRule winding_rule) { - ASSERT(scale() == 1); // FIXME: Add scaling support. + VERIFY(scale() == 1); // FIXME: Add scaling support. const auto& segments = path.split_lines(); @@ -1604,7 +1604,7 @@ void Painter::fill_path(Path& path, Color color, WindingRule winding_rule) if (winding_rule == WindingRule::EvenOdd) return winding_number % 2 == 0; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }; auto increment_winding = [winding_rule](int& winding_number, const IntPoint& from, const IntPoint& to) { @@ -1621,7 +1621,7 @@ void Painter::fill_path(Path& path, Color color, WindingRule winding_rule) return; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }; while (scanline >= last_y) { diff --git a/Userland/Libraries/LibGfx/Painter.h b/Userland/Libraries/LibGfx/Painter.h index 36db4ddac6..62b5c3de3b 100644 --- a/Userland/Libraries/LibGfx/Painter.h +++ b/Userland/Libraries/LibGfx/Painter.h @@ -125,7 +125,7 @@ public: void save() { m_state_stack.append(m_state_stack.last()); } void restore() { - ASSERT(m_state_stack.size() > 1); + VERIFY(m_state_stack.size() > 1); m_state_stack.take_last(); } diff --git a/Userland/Libraries/LibGfx/Palette.cpp b/Userland/Libraries/LibGfx/Palette.cpp index 2068e1a50f..93ba1e28cf 100644 --- a/Userland/Libraries/LibGfx/Palette.cpp +++ b/Userland/Libraries/LibGfx/Palette.cpp @@ -51,13 +51,13 @@ Palette::~Palette() int PaletteImpl::metric(MetricRole role) const { - ASSERT((int)role < (int)MetricRole::__Count); + VERIFY((int)role < (int)MetricRole::__Count); return theme().metric[(int)role]; } String PaletteImpl::path(PathRole role) const { - ASSERT((int)role < (int)PathRole::__Count); + VERIFY((int)role < (int)PathRole::__Count); return theme().path[(int)role]; } diff --git a/Userland/Libraries/LibGfx/Palette.h b/Userland/Libraries/LibGfx/Palette.h index 34ce928ba8..9d1c65bdbd 100644 --- a/Userland/Libraries/LibGfx/Palette.h +++ b/Userland/Libraries/LibGfx/Palette.h @@ -46,7 +46,7 @@ public: Color color(ColorRole role) const { - ASSERT((int)role < (int)ColorRole::__Count); + VERIFY((int)role < (int)ColorRole::__Count); return Color::from_rgba(theme().color[(int)role]); } diff --git a/Userland/Libraries/LibGfx/Path.cpp b/Userland/Libraries/LibGfx/Path.cpp index 5fe2bb2f63..95812cf532 100644 --- a/Userland/Libraries/LibGfx/Path.cpp +++ b/Userland/Libraries/LibGfx/Path.cpp @@ -70,7 +70,7 @@ void Path::close_all_subpaths() // This is a move from a subpath to another // connect the two ends of this subpath before // moving on to the next one - ASSERT(start_of_subpath.has_value()); + VERIFY(start_of_subpath.has_value()); append_segment<MoveSegment>(cursor.value()); append_segment<LineSegment>(start_of_subpath.value()); @@ -89,7 +89,7 @@ void Path::close_all_subpaths() cursor = segment.point(); break; case Segment::Type::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } @@ -216,7 +216,7 @@ void Path::segmentize_path() break; } case Segment::Type::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } first = false; diff --git a/Userland/Libraries/LibGfx/Path.h b/Userland/Libraries/LibGfx/Path.h index 7a8dfe9567..81ebf2ccfb 100644 --- a/Userland/Libraries/LibGfx/Path.h +++ b/Userland/Libraries/LibGfx/Path.h @@ -177,7 +177,7 @@ public: { if (!m_split_lines.has_value()) { segmentize_path(); - ASSERT(m_split_lines.has_value()); + VERIFY(m_split_lines.has_value()); } return m_split_lines.value(); } @@ -186,7 +186,7 @@ public: { if (!m_bounding_box.has_value()) { segmentize_path(); - ASSERT(m_bounding_box.has_value()); + VERIFY(m_bounding_box.has_value()); } return m_bounding_box.value(); } diff --git a/Userland/Libraries/LibGfx/SystemTheme.cpp b/Userland/Libraries/LibGfx/SystemTheme.cpp index 6e2961a3f7..7a5f61c10d 100644 --- a/Userland/Libraries/LibGfx/SystemTheme.cpp +++ b/Userland/Libraries/LibGfx/SystemTheme.cpp @@ -36,13 +36,13 @@ static Core::AnonymousBuffer theme_buffer; const SystemTheme& current_system_theme() { - ASSERT(theme_page); + VERIFY(theme_page); return *theme_page; } Core::AnonymousBuffer& current_system_theme_buffer() { - ASSERT(theme_buffer.is_valid()); + VERIFY(theme_buffer.is_valid()); return theme_buffer; } diff --git a/Userland/Libraries/LibGfx/SystemTheme.h b/Userland/Libraries/LibGfx/SystemTheme.h index ad7c423b92..e0e97556ed 100644 --- a/Userland/Libraries/LibGfx/SystemTheme.h +++ b/Userland/Libraries/LibGfx/SystemTheme.h @@ -129,7 +129,7 @@ inline const char* to_string(ColorRole role) ENUMERATE_COLOR_ROLES(__ENUMERATE_COLOR_ROLE) #undef __ENUMERATE_COLOR_ROLE default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibGfx/Typeface.cpp b/Userland/Libraries/LibGfx/Typeface.cpp index 76e7fcfbed..3995e0ddb9 100644 --- a/Userland/Libraries/LibGfx/Typeface.cpp +++ b/Userland/Libraries/LibGfx/Typeface.cpp @@ -30,7 +30,7 @@ namespace Gfx { unsigned Typeface::weight() const { - ASSERT(m_ttf_font || m_bitmap_fonts.size() > 0); + VERIFY(m_ttf_font || m_bitmap_fonts.size() > 0); if (is_fixed_size()) return m_bitmap_fonts[0]->weight(); @@ -40,7 +40,7 @@ unsigned Typeface::weight() const bool Typeface::is_fixed_width() const { - ASSERT(m_ttf_font || m_bitmap_fonts.size() > 0); + VERIFY(m_ttf_font || m_bitmap_fonts.size() > 0); if (is_fixed_size()) return m_bitmap_fonts[0]->is_fixed_width(); diff --git a/Userland/Libraries/LibHTTP/HttpJob.cpp b/Userland/Libraries/LibHTTP/HttpJob.cpp index 68c751598e..c2b73aa12a 100644 --- a/Userland/Libraries/LibHTTP/HttpJob.cpp +++ b/Userland/Libraries/LibHTTP/HttpJob.cpp @@ -35,7 +35,7 @@ namespace HTTP { void HttpJob::start() { - ASSERT(!m_socket); + VERIFY(!m_socket); m_socket = Core::TCPSocket::construct(this); m_socket->on_connected = [this] { #if CHTTPJOB_DEBUG diff --git a/Userland/Libraries/LibHTTP/HttpRequest.cpp b/Userland/Libraries/LibHTTP/HttpRequest.cpp index 8ea42a4e84..6d6a9ccce7 100644 --- a/Userland/Libraries/LibHTTP/HttpRequest.cpp +++ b/Userland/Libraries/LibHTTP/HttpRequest.cpp @@ -48,7 +48,7 @@ String HttpRequest::method_name() const case Method::POST: return "POST"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -100,7 +100,7 @@ Optional<HttpRequest> HttpRequest::from_raw_request(ReadonlyBytes raw_request) }; auto consume = [&]() -> u8 { - ASSERT(index < raw_request.size()); + VERIFY(index < raw_request.size()); return raw_request[index++]; }; diff --git a/Userland/Libraries/LibHTTP/HttpsJob.cpp b/Userland/Libraries/LibHTTP/HttpsJob.cpp index 9dd77f8c83..3f89c4b971 100644 --- a/Userland/Libraries/LibHTTP/HttpsJob.cpp +++ b/Userland/Libraries/LibHTTP/HttpsJob.cpp @@ -37,7 +37,7 @@ namespace HTTP { void HttpsJob::start() { - ASSERT(!m_socket); + VERIFY(!m_socket); m_socket = TLS::TLSv12::construct(this); m_socket->set_root_certificates(m_override_ca_certificates ? *m_override_ca_certificates : DefaultRootCACertificates::the().certificates()); m_socket->on_tls_connected = [this] { @@ -91,7 +91,7 @@ void HttpsJob::set_certificate(String certificate, String private_key) if (!m_socket->add_client_key(certificate.bytes(), private_key.bytes())) { dbgln("LibHTTP: Failed to set a client certificate"); // FIXME: Do something about this failure - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibHTTP/Job.cpp b/Userland/Libraries/LibHTTP/Job.cpp index ce3b7419fd..7da8eee947 100644 --- a/Userland/Libraries/LibHTTP/Job.cpp +++ b/Userland/Libraries/LibHTTP/Job.cpp @@ -88,7 +88,7 @@ void Job::flush_received_buffers() --i; continue; } - ASSERT(written < payload.size()); + VERIFY(written < payload.size()); payload = payload.slice(written, payload.size() - written); break; } @@ -121,8 +121,8 @@ void Job::on_socket_connected() // and then get eof() == true. [[maybe_unused]] auto payload = receive(64); // These assertions are only correct if "Connection: close". - ASSERT(payload.is_empty()); - ASSERT(eof()); + VERIFY(payload.is_empty()); + VERIFY(eof()); return; } @@ -204,8 +204,8 @@ void Job::on_socket_connected() dbgln_if(JOB_DEBUG, "Job: [{}] = '{}'", name, value); return; } - ASSERT(m_state == State::InBody); - ASSERT(can_read()); + VERIFY(m_state == State::InBody); + VERIFY(can_read()); read_while_data_available([&] { auto read_size = 64 * KiB; diff --git a/Userland/Libraries/LibIPC/ClientConnection.h b/Userland/Libraries/LibIPC/ClientConnection.h index bca77f3b58..50f8bf0bba 100644 --- a/Userland/Libraries/LibIPC/ClientConnection.h +++ b/Userland/Libraries/LibIPC/ClientConnection.h @@ -43,7 +43,7 @@ public: : IPC::Connection<ServerEndpoint, ClientEndpoint>(endpoint, move(socket)) , m_client_id(client_id) { - ASSERT(this->socket().is_connected()); + VERIFY(this->socket().is_connected()); this->socket().on_ready_to_read = [this] { this->drain_messages_from_peer(); }; } diff --git a/Userland/Libraries/LibIPC/Connection.h b/Userland/Libraries/LibIPC/Connection.h index c6b281aa18..66bcab9a42 100644 --- a/Userland/Libraries/LibIPC/Connection.h +++ b/Userland/Libraries/LibIPC/Connection.h @@ -122,7 +122,7 @@ public: { post_message(RequestType(forward<Args>(args)...)); auto response = wait_for_specific_endpoint_message<typename RequestType::ResponseType, PeerEndpoint>(); - ASSERT(response); + VERIFY(response); return response; } @@ -171,8 +171,8 @@ protected: if (rc < 0) { perror("select"); } - ASSERT(rc > 0); - ASSERT(FD_ISSET(m_socket->fd(), &rfds)); + VERIFY(rc > 0); + VERIFY(FD_ISSET(m_socket->fd(), &rfds)); if (!drain_messages_from_peer()) break; } diff --git a/Userland/Libraries/LibIPC/Decoder.cpp b/Userland/Libraries/LibIPC/Decoder.cpp index 0eef0a005a..67ed0b91fc 100644 --- a/Userland/Libraries/LibIPC/Decoder.cpp +++ b/Userland/Libraries/LibIPC/Decoder.cpp @@ -152,7 +152,7 @@ bool Decoder::decode(Dictionary& dictionary) if (m_stream.handle_any_error()) return false; if (size >= (size_t)NumericLimits<i32>::max()) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } for (size_t i = 0; i < size; ++i) { diff --git a/Userland/Libraries/LibIPC/Decoder.h b/Userland/Libraries/LibIPC/Decoder.h index a8752f7890..d21781602b 100644 --- a/Userland/Libraries/LibIPC/Decoder.h +++ b/Userland/Libraries/LibIPC/Decoder.h @@ -39,7 +39,7 @@ template<typename T> inline bool decode(Decoder&, T&) { static_assert(DependentFalse<T>, "Base IPC::decoder() instantiated"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } class Decoder { diff --git a/Userland/Libraries/LibIPC/Encoder.h b/Userland/Libraries/LibIPC/Encoder.h index da8416f5a5..97b02df312 100644 --- a/Userland/Libraries/LibIPC/Encoder.h +++ b/Userland/Libraries/LibIPC/Encoder.h @@ -35,7 +35,7 @@ template<typename T> bool encode(Encoder&, T&) { static_assert(DependentFalse<T>, "Base IPC::encode() was instantiated"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } class Encoder { diff --git a/Userland/Libraries/LibIPC/ServerConnection.h b/Userland/Libraries/LibIPC/ServerConnection.h index 6f655d4c5b..493f0a0af9 100644 --- a/Userland/Libraries/LibIPC/ServerConnection.h +++ b/Userland/Libraries/LibIPC/ServerConnection.h @@ -41,10 +41,10 @@ public: if (!this->socket().connect(Core::SocketAddress::local(address))) { perror("connect"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(this->socket().is_connected()); + VERIFY(this->socket().is_connected()); } virtual void handshake() = 0; diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index 7ff07f32af..6d11821451 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -145,7 +145,7 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete if (is<SuperExpression>(*m_callee)) { // If we are calling super, |this| has not been initialized yet, and would not be meaningful to provide. auto new_target = vm.get_new_target(); - ASSERT(new_target.is_function()); + VERIFY(new_target.is_function()); return { js_undefined(), new_target }; } @@ -182,7 +182,7 @@ Value CallExpression::execute(Interpreter& interpreter, GlobalObject& global_obj if (vm.exception()) return {}; - ASSERT(!callee.is_empty()); + VERIFY(!callee.is_empty()); if (!callee.is_function() || (is<NewExpression>(*this) && (is<NativeFunction>(callee.as_object()) && !static_cast<NativeFunction&>(callee.as_object()).has_constructor()))) { @@ -301,7 +301,7 @@ Value WithStatement::execute(Interpreter& interpreter, GlobalObject& global_obje if (interpreter.exception()) return {}; - ASSERT(object); + VERIFY(object); auto* with_scope = interpreter.heap().allocate<WithScope>(global_object, *object, interpreter.vm().call_frame().scope); TemporaryChange<ScopeObject*> scope_change(interpreter.vm().call_frame().scope, with_scope); @@ -456,7 +456,7 @@ static FlyString variable_from_for_declaration(Interpreter& interpreter, GlobalO FlyString variable_name; if (is<VariableDeclaration>(node)) { auto& variable_declaration = static_cast<const VariableDeclaration&>(node); - ASSERT(!variable_declaration.declarations().is_empty()); + VERIFY(!variable_declaration.declarations().is_empty()); if (variable_declaration.declaration_kind() != DeclarationKind::Var) { wrapper = create_ast_node<BlockStatement>(node.source_range()); interpreter.enter_scope(*wrapper, ScopeType::Block, global_object); @@ -466,7 +466,7 @@ static FlyString variable_from_for_declaration(Interpreter& interpreter, GlobalO } else if (is<Identifier>(node)) { variable_name = static_cast<const Identifier&>(node).string(); } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return variable_name; } @@ -478,7 +478,7 @@ Value ForInStatement::execute(Interpreter& interpreter, GlobalObject& global_obj if (!is<VariableDeclaration>(*m_lhs) && !is<Identifier>(*m_lhs)) { // FIXME: Implement "for (foo.bar in baz)", "for (foo[0] in bar)" - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } RefPtr<BlockStatement> wrapper; auto variable_name = variable_from_for_declaration(interpreter, global_object, m_lhs, wrapper); @@ -525,7 +525,7 @@ Value ForOfStatement::execute(Interpreter& interpreter, GlobalObject& global_obj if (!is<VariableDeclaration>(*m_lhs) && !is<Identifier>(*m_lhs)) { // FIXME: Implement "for (foo.bar of baz)", "for (foo[0] of bar)" - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } RefPtr<BlockStatement> wrapper; auto variable_name = variable_from_for_declaration(interpreter, global_object, m_lhs, wrapper); @@ -621,7 +621,7 @@ Value BinaryExpression::execute(Interpreter& interpreter, GlobalObject& global_o return instance_of(global_object, lhs_result, rhs_result); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value LogicalExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const @@ -660,7 +660,7 @@ Value LogicalExpression::execute(Interpreter& interpreter, GlobalObject& global_ return lhs_result; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Reference Expression::to_reference(Interpreter&, GlobalObject&) const @@ -697,7 +697,7 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob if (reference.is_unresolvable()) return Value(true); // FIXME: Support deleting locals - ASSERT(!reference.is_local_variable()); + VERIFY(!reference.is_local_variable()); if (reference.is_global_variable()) return global_object.delete_property(reference.name()); auto* base_object = reference.base().to_object(global_object); @@ -737,7 +737,7 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob case UnaryOp::Typeof: switch (lhs_result.type()) { case Value::Type::Empty: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; case Value::Type::Undefined: return js_string(vm, "undefined"); @@ -760,15 +760,15 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob case Value::Type::BigInt: return js_string(vm, "bigint"); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } case UnaryOp::Void: return js_undefined(); case UnaryOp::Delete: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value SuperExpression::execute(Interpreter& interpreter, GlobalObject&) const @@ -777,7 +777,7 @@ Value SuperExpression::execute(Interpreter& interpreter, GlobalObject&) const ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } }; // The semantics for SuperExpressions are handled in CallExpression::compute_this_and_callee() - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value ClassMethod::execute(Interpreter& interpreter, GlobalObject& global_object) const @@ -800,7 +800,7 @@ Value ClassExpression::execute(Interpreter& interpreter, GlobalObject& global_ob update_function_name(class_constructor_value, m_name); - ASSERT(class_constructor_value.is_function() && is<ScriptFunction>(class_constructor_value.as_function())); + VERIFY(class_constructor_value.is_function() && is<ScriptFunction>(class_constructor_value.as_function())); ScriptFunction* class_constructor = static_cast<ScriptFunction*>(&class_constructor_value.as_function()); class_constructor->set_is_class_constructor(); Value super_constructor = js_undefined(); @@ -870,7 +870,7 @@ Value ClassExpression::execute(Interpreter& interpreter, GlobalObject& global_ob case ClassMethod::Kind::Setter: return String::formatted("set {}", get_function_name(global_object, key)); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }(); update_function_name(method_value, accessor_name); @@ -1492,7 +1492,7 @@ Value UpdateExpression::execute(Interpreter& interpreter, GlobalObject& global_o new_value = js_bigint(interpreter.heap(), old_value.as_bigint().big_integer().minus(Crypto::SignedBigInteger { 1 })); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } reference.put(global_object, new_value); @@ -1610,7 +1610,7 @@ Value VariableDeclarator::execute(Interpreter& interpreter, GlobalObject&) const ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } }; // NOTE: VariableDeclarator execution is handled by VariableDeclaration. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void VariableDeclaration::dump(int indent) const @@ -1671,7 +1671,7 @@ Value ObjectProperty::execute(Interpreter& interpreter, GlobalObject&) const ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } }; // NOTE: ObjectProperty execution is handled by ObjectExpression. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const @@ -1733,7 +1733,7 @@ Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_o update_function_name(value, name); if (property.type() == ObjectProperty::Type::Getter || property.type() == ObjectProperty::Type::Setter) { - ASSERT(value.is_function()); + VERIFY(value.is_function()); object->define_accessor(PropertyName::from_value(global_object, key), value.as_function(), property.type() == ObjectProperty::Type::Getter, Attribute::Configurable | Attribute::Enumerable); if (interpreter.exception()) return {}; @@ -1757,13 +1757,13 @@ void MemberExpression::dump(int indent) const PropertyName MemberExpression::computed_property_name(Interpreter& interpreter, GlobalObject& global_object) const { if (!is_computed()) { - ASSERT(is<Identifier>(*m_property)); + VERIFY(is<Identifier>(*m_property)); return static_cast<const Identifier&>(*m_property).string(); } auto value = m_property->execute(interpreter, global_object); if (interpreter.exception()) return {}; - ASSERT(!value.is_empty()); + VERIFY(!value.is_empty()); return PropertyName::from_value(global_object, value); } @@ -1774,7 +1774,7 @@ String MemberExpression::to_string_approximation() const object_string = static_cast<const Identifier&>(*m_object).string(); if (is_computed()) return String::formatted("{}[<computed>]", object_string); - ASSERT(is<Identifier>(*m_property)); + VERIFY(is<Identifier>(*m_property)); return String::formatted("{}.{}", object_string, static_cast<const Identifier&>(*m_property).string()); } @@ -1803,7 +1803,7 @@ void MetaProperty::dump(int indent) const else if (m_type == MetaProperty::Type::ImportMeta) name = "import.meta"; else - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); print_indent(indent); outln("{} {}", class_name(), name); } @@ -1817,7 +1817,7 @@ Value MetaProperty::execute(Interpreter& interpreter, GlobalObject&) const return interpreter.vm().get_new_target().value_or(js_undefined()); if (m_type == MetaProperty::Type::ImportMeta) TODO(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value StringLiteral::execute(Interpreter& interpreter, GlobalObject&) const @@ -2073,7 +2073,7 @@ Value CatchClause::execute(Interpreter& interpreter, GlobalObject&) const ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } }; // NOTE: CatchClause execution is handled by TryStatement. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } @@ -2137,7 +2137,7 @@ Value SwitchCase::execute(Interpreter& interpreter, GlobalObject&) const ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } }; // NOTE: SwitchCase execution is handled by SwitchStatement. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } diff --git a/Userland/Libraries/LibJS/AST.h b/Userland/Libraries/LibJS/AST.h index f24035a5f7..b22c99dc4c 100644 --- a/Userland/Libraries/LibJS/AST.h +++ b/Userland/Libraries/LibJS/AST.h @@ -971,7 +971,7 @@ public: const Expression& key() const { return m_key; } const Expression& value() const { - ASSERT(m_value); + VERIFY(m_value); return *m_value; } diff --git a/Userland/Libraries/LibJS/Heap/Allocator.cpp b/Userland/Libraries/LibJS/Heap/Allocator.cpp index 03190382c4..fcbeeeaaa8 100644 --- a/Userland/Libraries/LibJS/Heap/Allocator.cpp +++ b/Userland/Libraries/LibJS/Heap/Allocator.cpp @@ -48,7 +48,7 @@ Cell* Allocator::allocate_cell(Heap& heap) auto& block = *m_usable_blocks.last(); auto* cell = block.allocate(); - ASSERT(cell); + VERIFY(cell); if (block.is_full()) m_full_blocks.append(*m_usable_blocks.last()); return cell; @@ -62,7 +62,7 @@ void Allocator::block_did_become_empty(Badge<Heap>, HeapBlock& block) void Allocator::block_did_become_usable(Badge<Heap>, HeapBlock& block) { - ASSERT(!block.is_full()); + VERIFY(!block.is_full()); m_usable_blocks.append(block); } diff --git a/Userland/Libraries/LibJS/Heap/Heap.cpp b/Userland/Libraries/LibJS/Heap/Heap.cpp index 7f4daae2e3..dd093c2b0b 100644 --- a/Userland/Libraries/LibJS/Heap/Heap.cpp +++ b/Userland/Libraries/LibJS/Heap/Heap.cpp @@ -64,7 +64,7 @@ ALWAYS_INLINE Allocator& Heap::allocator_for_size(size_t cell_size) if (allocator->cell_size() >= cell_size) return *allocator; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Cell* Heap::allocate_cell(size_t size) @@ -84,7 +84,7 @@ Cell* Heap::allocate_cell(size_t size) void Heap::collect_garbage(CollectionType collection_type, bool print_report) { - ASSERT(!m_collecting_garbage); + VERIFY(!m_collecting_garbage); TemporaryChange change(m_collecting_garbage, true); Core::ElapsedTimer collection_measurement_timer; @@ -288,25 +288,25 @@ void Heap::sweep_dead_cells(bool print_report, const Core::ElapsedTimer& measure void Heap::did_create_handle(Badge<HandleImpl>, HandleImpl& impl) { - ASSERT(!m_handles.contains(&impl)); + VERIFY(!m_handles.contains(&impl)); m_handles.set(&impl); } void Heap::did_destroy_handle(Badge<HandleImpl>, HandleImpl& impl) { - ASSERT(m_handles.contains(&impl)); + VERIFY(m_handles.contains(&impl)); m_handles.remove(&impl); } void Heap::did_create_marked_value_list(Badge<MarkedValueList>, MarkedValueList& list) { - ASSERT(!m_marked_value_lists.contains(&list)); + VERIFY(!m_marked_value_lists.contains(&list)); m_marked_value_lists.set(&list); } void Heap::did_destroy_marked_value_list(Badge<MarkedValueList>, MarkedValueList& list) { - ASSERT(m_marked_value_lists.contains(&list)); + VERIFY(m_marked_value_lists.contains(&list)); m_marked_value_lists.remove(&list); } @@ -317,7 +317,7 @@ void Heap::defer_gc(Badge<DeferGC>) void Heap::undefer_gc(Badge<DeferGC>) { - ASSERT(m_gc_deferrals > 0); + VERIFY(m_gc_deferrals > 0); --m_gc_deferrals; if (!m_gc_deferrals) { diff --git a/Userland/Libraries/LibJS/Heap/HeapBlock.cpp b/Userland/Libraries/LibJS/Heap/HeapBlock.cpp index 0341eeb243..c250211421 100644 --- a/Userland/Libraries/LibJS/Heap/HeapBlock.cpp +++ b/Userland/Libraries/LibJS/Heap/HeapBlock.cpp @@ -42,7 +42,7 @@ NonnullOwnPtr<HeapBlock> HeapBlock::create_with_cell_size(Heap& heap, size_t cel #else auto* block = (HeapBlock*)aligned_alloc(block_size, block_size); #endif - ASSERT(block != MAP_FAILED); + VERIFY(block != MAP_FAILED); new (block) HeapBlock(heap, cell_size); return NonnullOwnPtr<HeapBlock>(NonnullOwnPtr<HeapBlock>::Adopt, *block); } @@ -51,7 +51,7 @@ void HeapBlock::operator delete(void* ptr) { #ifdef __serenity__ int rc = munmap(ptr, block_size); - ASSERT(rc == 0); + VERIFY(rc == 0); #else free(ptr); #endif @@ -61,7 +61,7 @@ HeapBlock::HeapBlock(Heap& heap, size_t cell_size) : m_heap(heap) , m_cell_size(cell_size) { - ASSERT(cell_size >= sizeof(FreelistEntry)); + VERIFY(cell_size >= sizeof(FreelistEntry)); FreelistEntry* next = nullptr; for (ssize_t i = cell_count() - 1; i >= 0; i--) { @@ -75,10 +75,10 @@ HeapBlock::HeapBlock(Heap& heap, size_t cell_size) void HeapBlock::deallocate(Cell* cell) { - ASSERT(is_valid_cell_pointer(cell)); - ASSERT(!m_freelist || is_valid_cell_pointer(m_freelist)); - ASSERT(cell->is_live()); - ASSERT(!cell->is_marked()); + VERIFY(is_valid_cell_pointer(cell)); + VERIFY(!m_freelist || is_valid_cell_pointer(m_freelist)); + VERIFY(cell->is_live()); + VERIFY(!cell->is_marked()); cell->~Cell(); auto* freelist_entry = new (cell) FreelistEntry(); freelist_entry->set_live(false); diff --git a/Userland/Libraries/LibJS/Heap/HeapBlock.h b/Userland/Libraries/LibJS/Heap/HeapBlock.h index 6cc3e5acb1..459ae5f80a 100644 --- a/Userland/Libraries/LibJS/Heap/HeapBlock.h +++ b/Userland/Libraries/LibJS/Heap/HeapBlock.h @@ -51,7 +51,7 @@ public: { if (!m_freelist) return nullptr; - ASSERT(is_valid_cell_pointer(m_freelist)); + VERIFY(is_valid_cell_pointer(m_freelist)); return exchange(m_freelist, m_freelist->next); } diff --git a/Userland/Libraries/LibJS/Interpreter.cpp b/Userland/Libraries/LibJS/Interpreter.cpp index 69ec6e18b8..5b14b8101c 100644 --- a/Userland/Libraries/LibJS/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Interpreter.cpp @@ -57,7 +57,7 @@ Interpreter::~Interpreter() Value Interpreter::run(GlobalObject& global_object, const Program& program) { auto& vm = this->vm(); - ASSERT(!vm.exception()); + VERIFY(!vm.exception()); VM::InterpreterExecutionScope scope(*this); @@ -66,10 +66,10 @@ Value Interpreter::run(GlobalObject& global_object, const Program& program) static FlyString global_execution_context_name = "(global execution context)"; global_call_frame.function_name = global_execution_context_name; global_call_frame.scope = &global_object; - ASSERT(!vm.exception()); + VERIFY(!vm.exception()); global_call_frame.is_strict_mode = program.is_strict_mode(); vm.push_call_frame(global_call_frame, global_object); - ASSERT(!vm.exception()); + VERIFY(!vm.exception()); auto result = program.execute(*this, global_object); vm.pop_call_frame(); return result; @@ -185,7 +185,7 @@ Value Interpreter::execute_statement(GlobalObject& global_object, const Statemen LexicalEnvironment* Interpreter::current_environment() { - ASSERT(is<LexicalEnvironment>(vm().call_frame().scope)); + VERIFY(is<LexicalEnvironment>(vm().call_frame().scope)); return static_cast<LexicalEnvironment*>(vm().call_frame().scope); } diff --git a/Userland/Libraries/LibJS/MarkupGenerator.cpp b/Userland/Libraries/LibJS/MarkupGenerator.cpp index afdd347098..6766b1b858 100644 --- a/Userland/Libraries/LibJS/MarkupGenerator.cpp +++ b/Userland/Libraries/LibJS/MarkupGenerator.cpp @@ -185,7 +185,7 @@ String MarkupGenerator::style_from_style_type(StyleType type) case StyleType::Identifier: return "color: -libweb-palette-syntax-identifier;"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -216,7 +216,7 @@ MarkupGenerator::StyleType MarkupGenerator::style_type_for_token(Token token) return StyleType::Identifier; default: dbgln("Unknown style type for token {}", token.name()); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibJS/Parser.cpp b/Userland/Libraries/LibJS/Parser.cpp index ac8fbeb2e9..0eb7352a17 100644 --- a/Userland/Libraries/LibJS/Parser.cpp +++ b/Userland/Libraries/LibJS/Parser.cpp @@ -94,7 +94,7 @@ public: int p = m_token_precedence[static_cast<size_t>(token)]; if (p == 0) { warnln("Internal Error: No precedence for operator {}", Token::name(token)); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return -1; } @@ -827,7 +827,7 @@ NonnullRefPtr<ObjectExpression> Parser::parse_object_expression() } if (match(TokenType::ParenOpen)) { - ASSERT(property_name); + VERIFY(property_name); u8 parse_options = FunctionNodeParseOptions::AllowSuperPropertyLookup; if (property_type == ObjectProperty::Type::Getter) parse_options |= FunctionNodeParseOptions::IsGetterFunction; @@ -905,7 +905,7 @@ NonnullRefPtr<StringLiteral> Parser::parse_string_literal(Token token, bool in_t } else if (status == Token::StringValueStatus::UnicodeEscapeOverflow) { message = "Unicode code_point must not be greater than 0x10ffff in escape sequence"; } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (!message.is_empty()) @@ -1158,7 +1158,7 @@ NonnullRefPtr<Expression> Parser::parse_secondary_expression(NonnullRefPtr<Expre NonnullRefPtr<AssignmentExpression> Parser::parse_assignment_expression(AssignmentOp assignment_op, NonnullRefPtr<Expression> lhs, int min_precedence, Associativity associativity) { auto rule_start = push_start(); - ASSERT(match(TokenType::Equals) + VERIFY(match(TokenType::Equals) || match(TokenType::PlusEquals) || match(TokenType::MinusEquals) || match(TokenType::AsteriskEquals) @@ -1315,7 +1315,7 @@ template<typename FunctionNodeType> NonnullRefPtr<FunctionNodeType> Parser::parse_function_node(u8 parse_options) { auto rule_start = push_start(); - ASSERT(!(parse_options & FunctionNodeParseOptions::IsGetterFunction && parse_options & FunctionNodeParseOptions::IsSetterFunction)); + VERIFY(!(parse_options & FunctionNodeParseOptions::IsGetterFunction && parse_options & FunctionNodeParseOptions::IsSetterFunction)); TemporaryChange super_property_access_rollback(m_parser_state.m_allow_super_property_lookup, !!(parse_options & FunctionNodeParseOptions::AllowSuperPropertyLookup)); TemporaryChange super_constructor_call_rollback(m_parser_state.m_allow_super_constructor_call, !!(parse_options & FunctionNodeParseOptions::AllowSuperConstructorCall)); @@ -1427,7 +1427,7 @@ NonnullRefPtr<VariableDeclaration> Parser::parse_variable_declaration(bool for_l declaration_kind = DeclarationKind::Const; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } consume(); @@ -2037,7 +2037,7 @@ void Parser::save_state() void Parser::load_state() { - ASSERT(!m_saved_state.is_empty()); + VERIFY(!m_saved_state.is_empty()); m_parser_state = m_saved_state.take_last(); } diff --git a/Userland/Libraries/LibJS/Parser.h b/Userland/Libraries/LibJS/Parser.h index 6d6c4a57a6..628c90803b 100644 --- a/Userland/Libraries/LibJS/Parser.h +++ b/Userland/Libraries/LibJS/Parser.h @@ -187,8 +187,8 @@ private: ~RulePosition() { auto last = m_parser.m_rule_starts.take_last(); - ASSERT(last.line == m_position.line); - ASSERT(last.column == m_position.column); + VERIFY(last.line == m_position.line); + VERIFY(last.column == m_position.column); } const Position& position() const { return m_position; } diff --git a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp index c3cbd179b0..62c6c8cde0 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp @@ -63,7 +63,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayIteratorPrototype::next) auto target_array = iterator.array(); if (target_array.is_undefined()) return create_iterator_result_object(global_object, js_undefined(), true); - ASSERT(target_array.is_object()); + VERIFY(target_array.is_object()); auto& array = target_array.as_object(); auto index = iterator.index(); diff --git a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp index 440cc8a05e..311ea3707b 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp @@ -670,9 +670,9 @@ static void array_merge_sort(VM& vm, GlobalObject& global_object, Function* comp // Because they are called with primitive strings, these abstract_relation calls // should never result in a VM exception. auto x_lt_y_relation = abstract_relation(global_object, true, x_string_value, y_string_value); - ASSERT(x_lt_y_relation != TriState::Unknown); + VERIFY(x_lt_y_relation != TriState::Unknown); auto y_lt_x_relation = abstract_relation(global_object, true, y_string_value, x_string_value); - ASSERT(y_lt_x_relation != TriState::Unknown); + VERIFY(y_lt_x_relation != TriState::Unknown); if (x_lt_y_relation == TriState::True) { comparison_result = -1; diff --git a/Userland/Libraries/LibJS/Runtime/BigInt.cpp b/Userland/Libraries/LibJS/Runtime/BigInt.cpp index 59a0951ff7..37d5c51c1e 100644 --- a/Userland/Libraries/LibJS/Runtime/BigInt.cpp +++ b/Userland/Libraries/LibJS/Runtime/BigInt.cpp @@ -33,7 +33,7 @@ namespace JS { BigInt::BigInt(Crypto::SignedBigInteger big_integer) : m_big_integer(move(big_integer)) { - ASSERT(!m_big_integer.is_invalid()); + VERIFY(!m_big_integer.is_invalid()); } BigInt::~BigInt() diff --git a/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp b/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp index 5bd828a4d9..d38101c8a8 100644 --- a/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp @@ -108,7 +108,7 @@ static Value parse_simplified_iso8601(const String& iso_8601) } // We parsed a valid date simplified ISO 8601 string. Values not present in the string are -1. - ASSERT(year != -1); // A valid date string always has at least a year. + VERIFY(year != -1); // A valid date string always has at least a year. struct tm tm = {}; tm.tm_year = year - 1900; tm.tm_mon = month == -1 ? 0 : month - 1; diff --git a/Userland/Libraries/LibJS/Runtime/Exception.cpp b/Userland/Libraries/LibJS/Runtime/Exception.cpp index 08c6f6bde9..b7769581a3 100644 --- a/Userland/Libraries/LibJS/Runtime/Exception.cpp +++ b/Userland/Libraries/LibJS/Runtime/Exception.cpp @@ -45,7 +45,7 @@ Exception::Exception(Value value) auto& node_stack = vm().node_stack(); for (ssize_t i = node_stack.size() - 1; i >= 0; --i) { auto* node = node_stack[i]; - ASSERT(node); + VERIFY(node); m_source_ranges.append(node->source_range()); } } diff --git a/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp b/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp index 577d7b9175..6ed90ff166 100644 --- a/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp +++ b/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp @@ -50,8 +50,8 @@ Optional<ValueAndAttributes> SimpleIndexedPropertyStorage::get(u32 index) const void SimpleIndexedPropertyStorage::put(u32 index, Value value, PropertyAttributes attributes) { - ASSERT(attributes == default_attributes); - ASSERT(index < SPARSE_ARRAY_THRESHOLD); + VERIFY(attributes == default_attributes); + VERIFY(index < SPARSE_ARRAY_THRESHOLD); if (index >= m_array_size) { m_array_size = index + 1; @@ -69,10 +69,10 @@ void SimpleIndexedPropertyStorage::remove(u32 index) void SimpleIndexedPropertyStorage::insert(u32 index, Value value, PropertyAttributes attributes) { - ASSERT(attributes == default_attributes); - ASSERT(index < SPARSE_ARRAY_THRESHOLD); + VERIFY(attributes == default_attributes); + VERIFY(index < SPARSE_ARRAY_THRESHOLD); m_array_size++; - ASSERT(m_array_size <= SPARSE_ARRAY_THRESHOLD); + VERIFY(m_array_size <= SPARSE_ARRAY_THRESHOLD); m_packed_elements.insert(index, value); } @@ -92,7 +92,7 @@ ValueAndAttributes SimpleIndexedPropertyStorage::take_last() void SimpleIndexedPropertyStorage::set_array_like_size(size_t new_size) { - ASSERT(new_size <= SPARSE_ARRAY_THRESHOLD); + VERIFY(new_size <= SPARSE_ARRAY_THRESHOLD); m_array_size = new_size; m_packed_elements.resize(new_size); } @@ -177,7 +177,7 @@ void GenericIndexedPropertyStorage::insert(u32 index, Value value, PropertyAttri ValueAndAttributes GenericIndexedPropertyStorage::take_first() { - ASSERT(m_array_size > 0); + VERIFY(m_array_size > 0); m_array_size--; if (!m_sparse_elements.is_empty()) { @@ -192,7 +192,7 @@ ValueAndAttributes GenericIndexedPropertyStorage::take_first() ValueAndAttributes GenericIndexedPropertyStorage::take_last() { - ASSERT(m_array_size > 0); + VERIFY(m_array_size > 0); m_array_size--; if (m_array_size <= SPARSE_ARRAY_THRESHOLD) { @@ -202,7 +202,7 @@ ValueAndAttributes GenericIndexedPropertyStorage::take_last() } else { auto result = m_sparse_elements.get(m_array_size); m_sparse_elements.remove(m_array_size); - ASSERT(result.has_value()); + VERIFY(result.has_value()); return result.value(); } } @@ -282,7 +282,7 @@ Optional<ValueAndAttributes> IndexedProperties::get(Object* this_object, u32 ind return {}; auto& value = result.value(); if (value.value.is_accessor()) { - ASSERT(this_object); + VERIFY(this_object); auto& accessor = value.value.as_accessor(); return ValueAndAttributes { accessor.call_getter(this_object), value.attributes }; } @@ -300,7 +300,7 @@ void IndexedProperties::put(Object* this_object, u32 index, Value value, Propert auto value_here = m_storage->get(index); if (value_here.has_value() && value_here.value().value.is_accessor()) { - ASSERT(this_object); + VERIFY(this_object); value_here.value().value.as_accessor().call_setter(this_object, value); } else { m_storage->put(index, value, attributes); diff --git a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp index ee6a8ed057..6dd9259203 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp @@ -33,7 +33,7 @@ namespace JS { Object* get_iterator(GlobalObject& global_object, Value value, String hint, Value method) { auto& vm = global_object.vm(); - ASSERT(hint == "sync" || hint == "async"); + VERIFY(hint == "sync" || hint == "async"); if (method.is_empty()) { if (hint == "async") TODO(); @@ -128,7 +128,7 @@ void get_iterator_values(GlobalObject& global_object, Value value, AK::Function< auto result = callback(next_value); if (result == IterationDecision::Break) return; - ASSERT(result == IterationDecision::Continue); + VERIFY(result == IterationDecision::Continue); } } diff --git a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp index b4959dc733..c1bcfe0c0e 100644 --- a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp @@ -433,7 +433,7 @@ Value JSONObject::parse_json_value(GlobalObject& global_object, const JsonValue& return js_string(global_object.heap(), value.to_string()); if (value.is_bool()) return Value(static_cast<bool>(value.as_bool())); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Object* JSONObject::parse_json_object(GlobalObject& global_object, const JsonObject& json_object) diff --git a/Userland/Libraries/LibJS/Runtime/LexicalEnvironment.cpp b/Userland/Libraries/LibJS/Runtime/LexicalEnvironment.cpp index 94d1c97e2d..72549ea8bb 100644 --- a/Userland/Libraries/LibJS/Runtime/LexicalEnvironment.cpp +++ b/Userland/Libraries/LibJS/Runtime/LexicalEnvironment.cpp @@ -89,7 +89,7 @@ bool LexicalEnvironment::has_super_binding() const Value LexicalEnvironment::get_super_base() { - ASSERT(has_super_binding()); + VERIFY(has_super_binding()); if (m_home_object.is_object()) return m_home_object.as_object().prototype(); return {}; @@ -107,12 +107,12 @@ bool LexicalEnvironment::has_this_binding() const case EnvironmentRecordType::Module: return true; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value LexicalEnvironment::get_this_binding(GlobalObject& global_object) const { - ASSERT(has_this_binding()); + VERIFY(has_this_binding()); if (this_binding_status() == ThisBindingStatus::Uninitialized) { vm().throw_exception<ReferenceError>(global_object, ErrorType::ThisHasNotBeenInitialized); return {}; @@ -122,7 +122,7 @@ Value LexicalEnvironment::get_this_binding(GlobalObject& global_object) const void LexicalEnvironment::bind_this_value(GlobalObject& global_object, Value this_value) { - ASSERT(has_this_binding()); + VERIFY(has_this_binding()); if (m_this_binding_status == ThisBindingStatus::Initialized) { vm().throw_exception<ReferenceError>(global_object, ErrorType::ThisIsAlreadyInitialized); return; diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index 8aec832a2f..a6d76f6903 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -160,8 +160,8 @@ bool Object::prevent_extensions() Value Object::get_own_property(const PropertyName& property_name, Value receiver) const { - ASSERT(property_name.is_valid()); - ASSERT(!receiver.is_empty()); + VERIFY(property_name.is_valid()); + VERIFY(!receiver.is_empty()); Value value_here; @@ -177,7 +177,7 @@ Value Object::get_own_property(const PropertyName& property_name, Value receiver value_here = m_storage[metadata.value().offset].value_or(js_undefined()); } - ASSERT(!value_here.is_empty()); + VERIFY(!value_here.is_empty()); if (value_here.is_accessor()) return value_here.as_accessor().call_getter(receiver); if (value_here.is_native_property()) @@ -263,7 +263,7 @@ Value Object::get_own_properties(const Object& this_object, PropertyKind kind, b Optional<PropertyDescriptor> Object::get_own_property_descriptor(const PropertyName& property_name) const { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); Value value; PropertyAttributes attributes; @@ -304,7 +304,7 @@ Optional<PropertyDescriptor> Object::get_own_property_descriptor(const PropertyN Value Object::get_own_property_descriptor_object(const PropertyName& property_name) const { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); auto& vm = this->vm(); auto descriptor_opt = get_own_property_descriptor(property_name); @@ -433,7 +433,7 @@ bool Object::define_property_without_transition(const PropertyName& property_nam bool Object::define_property(const PropertyName& property_name, Value value, PropertyAttributes attributes, bool throw_exceptions) { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); if (property_name.is_number()) return put_own_property_by_index(*this, property_name.as_number(), value, attributes, PutOwnPropertyMode::DefineProperty, throw_exceptions); @@ -448,7 +448,7 @@ bool Object::define_property(const PropertyName& property_name, Value value, Pro bool Object::define_accessor(const PropertyName& property_name, Function& getter_or_setter, bool is_getter, PropertyAttributes attributes, bool throw_exceptions) { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); Accessor* accessor { nullptr }; auto property_metadata = shape().lookup(property_name.to_string_or_symbol()); @@ -475,7 +475,7 @@ bool Object::define_accessor(const PropertyName& property_name, Function& getter bool Object::put_own_property(Object& this_object, const StringOrSymbol& property_name, Value value, PropertyAttributes attributes, PutOwnPropertyMode mode, bool throw_exceptions) { - ASSERT(!(mode == PutOwnPropertyMode::Put && value.is_accessor())); + VERIFY(!(mode == PutOwnPropertyMode::Put && value.is_accessor())); if (value.is_accessor()) { auto& accessor = value.as_accessor(); @@ -523,7 +523,7 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert m_storage.resize(m_shape->property_count()); } metadata = shape().lookup(property_name); - ASSERT(metadata.has_value()); + VERIFY(metadata.has_value()); } if (!new_property && mode == PutOwnPropertyMode::DefineProperty && !metadata.value().attributes.is_configurable() && attributes != metadata.value().attributes) { @@ -569,7 +569,7 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert bool Object::put_own_property_by_index(Object& this_object, u32 property_index, Value value, PropertyAttributes attributes, PutOwnPropertyMode mode, bool throw_exceptions) { - ASSERT(!(mode == PutOwnPropertyMode::Put && value.is_accessor())); + VERIFY(!(mode == PutOwnPropertyMode::Put && value.is_accessor())); auto existing_property = m_indexed_properties.get(nullptr, property_index, false); auto new_property = !existing_property.has_value(); @@ -623,7 +623,7 @@ bool Object::put_own_property_by_index(Object& this_object, u32 property_index, Value Object::delete_property(const PropertyName& property_name) { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); if (property_name.is_number()) return Value(m_indexed_properties.remove(property_name.as_number())); @@ -684,7 +684,7 @@ Value Object::get_by_index(u32 property_index) const Value Object::get(const PropertyName& property_name, Value receiver) const { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); if (property_name.is_number()) return get_by_index(property_name.as_number()); @@ -714,7 +714,7 @@ Value Object::get(const PropertyName& property_name, Value receiver) const bool Object::put_by_index(u32 property_index, Value value) { - ASSERT(!value.is_empty()); + VERIFY(!value.is_empty()); // If there's a setter in the prototype chain, we go to the setter. // Otherwise, it goes in the own property storage. @@ -743,12 +743,12 @@ bool Object::put_by_index(u32 property_index, Value value) bool Object::put(const PropertyName& property_name, Value value, Value receiver) { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); if (property_name.is_number()) return put_by_index(property_name.as_number(), value); - ASSERT(!value.is_empty()); + VERIFY(!value.is_empty()); if (property_name.is_string()) { auto& property_string = property_name.as_string(); @@ -837,7 +837,7 @@ bool Object::has_property(const PropertyName& property_name) const bool Object::has_own_property(const PropertyName& property_name) const { - ASSERT(property_name.is_valid()); + VERIFY(property_name.is_valid()); auto has_indexed_property = [&](u32 index) -> bool { if (is<StringObject>(*this)) @@ -859,7 +859,7 @@ bool Object::has_own_property(const PropertyName& property_name) const Value Object::ordinary_to_primitive(Value::PreferredType preferred_type) const { - ASSERT(preferred_type == Value::PreferredType::String || preferred_type == Value::PreferredType::Number); + VERIFY(preferred_type == Value::PreferredType::String || preferred_type == Value::PreferredType::Number); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/PropertyName.h b/Userland/Libraries/LibJS/Runtime/PropertyName.h index bbd6a0c640..cad939cd81 100644 --- a/Userland/Libraries/LibJS/Runtime/PropertyName.h +++ b/Userland/Libraries/LibJS/Runtime/PropertyName.h @@ -60,7 +60,7 @@ public: : m_type(Type::Number) , m_number(index) { - ASSERT(index >= 0); + VERIFY(index >= 0); } PropertyName(const char* chars) @@ -73,21 +73,21 @@ public: : m_type(Type::String) , m_string(FlyString(string)) { - ASSERT(!string.is_null()); + VERIFY(!string.is_null()); } PropertyName(const FlyString& string) : m_type(Type::String) , m_string(string) { - ASSERT(!string.is_null()); + VERIFY(!string.is_null()); } PropertyName(Symbol* symbol) : m_type(Type::Symbol) , m_symbol(symbol) { - ASSERT(symbol); + VERIFY(symbol); } PropertyName(const StringOrSymbol& string_or_symbol) @@ -108,26 +108,26 @@ public: i32 as_number() const { - ASSERT(is_number()); + VERIFY(is_number()); return m_number; } const FlyString& as_string() const { - ASSERT(is_string()); + VERIFY(is_string()); return m_string; } const Symbol* as_symbol() const { - ASSERT(is_symbol()); + VERIFY(is_symbol()); return m_symbol; } String to_string() const { - ASSERT(is_valid()); - ASSERT(!is_symbol()); + VERIFY(is_valid()); + VERIFY(!is_symbol()); if (is_string()) return as_string(); return String::number(as_number()); @@ -135,8 +135,8 @@ public: StringOrSymbol to_string_or_symbol() const { - ASSERT(is_valid()); - ASSERT(!is_number()); + VERIFY(is_valid()); + VERIFY(!is_number()); if (is_string()) return StringOrSymbol(as_string()); return StringOrSymbol(as_symbol()); diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp index 6386022b1e..4bf111978b 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp @@ -546,13 +546,13 @@ Value ProxyObject::construct(Function& new_target) const FlyString& ProxyObject::name() const { - ASSERT(is_function()); + VERIFY(is_function()); return static_cast<Function&>(m_target).name(); } LexicalEnvironment* ProxyObject::create_environment() { - ASSERT(is_function()); + VERIFY(is_function()); return static_cast<Function&>(m_target).create_environment(); } diff --git a/Userland/Libraries/LibJS/Runtime/Shape.cpp b/Userland/Libraries/LibJS/Runtime/Shape.cpp index 1f74b14471..056837ef64 100644 --- a/Userland/Libraries/LibJS/Runtime/Shape.cpp +++ b/Userland/Libraries/LibJS/Runtime/Shape.cpp @@ -32,7 +32,7 @@ namespace JS { Shape* Shape::create_unique_clone() const { - ASSERT(m_global_object); + VERIFY(m_global_object); auto* new_shape = heap().allocate_without_global_object<Shape>(*m_global_object); new_shape->m_unique = true; new_shape->m_prototype = m_prototype; @@ -179,7 +179,7 @@ void Shape::ensure_property_table() const m_property_table->set(shape->m_property_name, { next_offset++, shape->m_attributes }); } else if (shape->m_transition_type == TransitionType::Configure) { auto it = m_property_table->find(shape->m_property_name); - ASSERT(it != m_property_table->end()); + VERIFY(it != m_property_table->end()); it->value.attributes = shape->m_attributes; } } @@ -187,31 +187,31 @@ void Shape::ensure_property_table() const void Shape::add_property_to_unique_shape(const StringOrSymbol& property_name, PropertyAttributes attributes) { - ASSERT(is_unique()); - ASSERT(m_property_table); - ASSERT(!m_property_table->contains(property_name)); + VERIFY(is_unique()); + VERIFY(m_property_table); + VERIFY(!m_property_table->contains(property_name)); m_property_table->set(property_name, { m_property_table->size(), attributes }); ++m_property_count; } void Shape::reconfigure_property_in_unique_shape(const StringOrSymbol& property_name, PropertyAttributes attributes) { - ASSERT(is_unique()); - ASSERT(m_property_table); + VERIFY(is_unique()); + VERIFY(m_property_table); auto it = m_property_table->find(property_name); - ASSERT(it != m_property_table->end()); + VERIFY(it != m_property_table->end()); it->value.attributes = attributes; m_property_table->set(property_name, it->value); } void Shape::remove_property_from_unique_shape(const StringOrSymbol& property_name, size_t offset) { - ASSERT(is_unique()); - ASSERT(m_property_table); + VERIFY(is_unique()); + VERIFY(m_property_table); if (m_property_table->remove(property_name)) --m_property_count; for (auto& it : *m_property_table) { - ASSERT(it.value.offset != offset); + VERIFY(it.value.offset != offset); if (it.value.offset > offset) --it.value.offset; } diff --git a/Userland/Libraries/LibJS/Runtime/StringOrSymbol.h b/Userland/Libraries/LibJS/Runtime/StringOrSymbol.h index 38311b61b2..3ac5d3baea 100644 --- a/Userland/Libraries/LibJS/Runtime/StringOrSymbol.h +++ b/Userland/Libraries/LibJS/Runtime/StringOrSymbol.h @@ -57,14 +57,14 @@ public: StringOrSymbol(const String& string) : m_ptr(string.impl()) { - ASSERT(!string.is_null()); + VERIFY(!string.is_null()); as_string_impl().ref(); } StringOrSymbol(const FlyString& string) : m_ptr(string.impl()) { - ASSERT(!string.is_null()); + VERIFY(!string.is_null()); as_string_impl().ref(); } @@ -98,13 +98,13 @@ public: ALWAYS_INLINE String as_string() const { - ASSERT(is_string()); + VERIFY(is_string()); return as_string_impl(); } ALWAYS_INLINE const Symbol* as_symbol() const { - ASSERT(is_symbol()); + VERIFY(is_symbol()); return reinterpret_cast<const Symbol*>(bits() & ~1ul); } @@ -114,7 +114,7 @@ public: return as_string(); if (is_symbol()) return as_symbol()->to_string(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value to_value(VM& vm) const @@ -178,7 +178,7 @@ private: ALWAYS_INLINE const StringImpl& as_string_impl() const { - ASSERT(is_string()); + VERIFY(is_string()); return *reinterpret_cast<const StringImpl*>(m_ptr); } diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.h b/Userland/Libraries/LibJS/Runtime/TypedArray.h index a0f6709a76..0b580be39d 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArray.h +++ b/Userland/Libraries/LibJS/Runtime/TypedArray.h @@ -131,10 +131,10 @@ protected: TypedArray(u32 array_length, Object& prototype) : TypedArrayBase(prototype) { - ASSERT(!Checked<u32>::multiplication_would_overflow(array_length, sizeof(T))); + VERIFY(!Checked<u32>::multiplication_would_overflow(array_length, sizeof(T))); m_viewed_array_buffer = ArrayBuffer::create(global_object(), array_length * sizeof(T)); if (array_length) - ASSERT(!data().is_null()); + VERIFY(!data().is_null()); m_array_length = array_length; m_byte_length = m_viewed_array_buffer->byte_length(); } diff --git a/Userland/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp b/Userland/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp index ee7c8c14ff..6f923d67ce 100644 --- a/Userland/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp +++ b/Userland/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp @@ -47,7 +47,7 @@ Uint8ClampedArray::Uint8ClampedArray(u32 length, Object& prototype) Uint8ClampedArray::~Uint8ClampedArray() { - ASSERT(m_data); + VERIFY(m_data); free(m_data); m_data = nullptr; } diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index 73842974c7..ea88e9fc01 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -64,7 +64,7 @@ VM::~VM() Interpreter& VM::interpreter() { - ASSERT(!m_interpreters.is_empty()); + VERIFY(!m_interpreters.is_empty()); return *m_interpreters.last(); } @@ -82,9 +82,9 @@ void VM::push_interpreter(Interpreter& interpreter) void VM::pop_interpreter(Interpreter& interpreter) { - ASSERT(!m_interpreters.is_empty()); + VERIFY(!m_interpreters.is_empty()); auto* popped_interpreter = m_interpreters.take_last(); - ASSERT(popped_interpreter == &interpreter); + VERIFY(popped_interpreter == &interpreter); } VM::InterpreterExecutionScope::InterpreterExecutionScope(Interpreter& interpreter) @@ -256,7 +256,7 @@ Value VM::construct(Function& function, Function& new_target, Optional<MarkedVal // If we are constructing an instance of a derived class, // set the prototype on objects created by constructors that return an object (i.e. NativeFunction subclasses). if (function.constructor_kind() == Function::ConstructorKind::Base && new_target.constructor_kind() == Function::ConstructorKind::Derived && result.is_object()) { - ASSERT(is<LexicalEnvironment>(current_scope())); + VERIFY(is<LexicalEnvironment>(current_scope())); static_cast<LexicalEnvironment*>(current_scope())->replace_this_binding(result); auto prototype = new_target.get(names.prototype); if (exception()) @@ -319,18 +319,18 @@ const ScopeObject* VM::find_this_scope() const if (scope->has_this_binding()) return scope; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Value VM::get_new_target() const { - ASSERT(is<LexicalEnvironment>(find_this_scope())); + VERIFY(is<LexicalEnvironment>(find_this_scope())); return static_cast<const LexicalEnvironment*>(find_this_scope())->new_target(); } Value VM::call_internal(Function& function, Value this_value, Optional<MarkedValueList> arguments) { - ASSERT(!exception()); + VERIFY(!exception()); CallFrame call_frame; call_frame.is_strict_mode = function.is_strict_mode(); @@ -342,7 +342,7 @@ Value VM::call_internal(Function& function, Value this_value, Optional<MarkedVal auto* environment = function.create_environment(); call_frame.scope = environment; - ASSERT(environment->this_binding_status() == LexicalEnvironment::ThisBindingStatus::Uninitialized); + VERIFY(environment->this_binding_status() == LexicalEnvironment::ThisBindingStatus::Uninitialized); environment->bind_this_value(function.global_object(), call_frame.this_value); if (exception()) return {}; diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index 320ea53405..571703ec93 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -109,13 +109,13 @@ public: PrimitiveString& empty_string() { return *m_empty_string; } PrimitiveString& single_ascii_character_string(u8 character) { - ASSERT(character < 0x80); + VERIFY(character < 0x80); return *m_single_ascii_character_strings[character]; } void push_call_frame(CallFrame& call_frame, GlobalObject& global_object) { - ASSERT(!exception()); + VERIFY(!exception()); // Ensure we got some stack space left, so the next function call doesn't kill us. // This value is merely a guess and might need tweaking at a later point. if (m_stack_info.size_free() < 16 * KiB) diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index 148d1834fc..8362c832df 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -213,7 +213,7 @@ bool Value::is_array() const Array& Value::as_array() { - ASSERT(is_array()); + VERIFY(is_array()); return static_cast<Array&>(*m_value.as_object); } @@ -224,7 +224,7 @@ bool Value::is_function() const Function& Value::as_function() { - ASSERT(is_function()); + VERIFY(is_function()); return static_cast<Function&>(as_object()); } @@ -268,7 +268,7 @@ String Value::to_string_without_side_effects() const case Type::NativeProperty: return "<native-property>"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -307,7 +307,7 @@ String Value::to_string(GlobalObject& global_object, bool legacy_null_to_empty_s return primitive_value.to_string(global_object); } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -332,7 +332,7 @@ bool Value::to_boolean() const case Type::Object: return true; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -368,7 +368,7 @@ Object* Value::to_object(GlobalObject& global_object) const return &const_cast<Object&>(as_object()); default: dbgln("Dying because I can't to_object() on {}", *this); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -420,7 +420,7 @@ Value Value::to_number(GlobalObject& global_object) const return primitive.to_number(global_object); } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -458,7 +458,7 @@ BigInt* Value::to_bigint(GlobalObject& global_object) const vm.throw_exception<TypeError>(global_object, ErrorType::Convert, "symbol", "BigInt"); return {}; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -470,13 +470,13 @@ i32 Value::as_i32() const u32 Value::as_u32() const { - ASSERT(as_double() >= 0); + VERIFY(as_double() >= 0); return min((double)as_i32(), MAX_U32); } size_t Value::as_size_t() const { - ASSERT(as_double() >= 0); + VERIFY(as_double() >= 0); return min((double)as_i32(), MAX_ARRAY_LIKE_INDEX); } @@ -552,7 +552,7 @@ size_t Value::to_index(GlobalObject& global_object) const return INVALID; } auto index = Value(integer_index).to_length(global_object); - ASSERT(!vm.exception()); + VERIFY(!vm.exception()); if (integer_index != index) { vm.throw_exception<RangeError>(global_object, ErrorType::InvalidIndex); return INVALID; @@ -1028,8 +1028,8 @@ bool same_value_zero(Value lhs, Value rhs) bool same_value_non_numeric(Value lhs, Value rhs) { - ASSERT(!lhs.is_number() && !lhs.is_bigint()); - ASSERT(lhs.type() == rhs.type()); + VERIFY(!lhs.is_number() && !lhs.is_bigint()); + VERIFY(lhs.type() == rhs.type()); switch (lhs.type()) { case Value::Type::Undefined: @@ -1044,7 +1044,7 @@ bool same_value_non_numeric(Value lhs, Value rhs) case Value::Type::Object: return &lhs.as_object() == &rhs.as_object(); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -1160,7 +1160,7 @@ TriState abstract_relation(GlobalObject& global_object, bool left_first, Value l } } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (x_primitive.is_bigint() && y_primitive.is_string()) { @@ -1213,7 +1213,7 @@ TriState abstract_relation(GlobalObject& global_object, bool left_first, Value l return TriState::False; } - ASSERT((x_numeric.is_number() && y_numeric.is_bigint()) || (x_numeric.is_bigint() && y_numeric.is_number())); + VERIFY((x_numeric.is_number() && y_numeric.is_bigint()) || (x_numeric.is_bigint() && y_numeric.is_number())); bool x_lower_than_y; if (x_numeric.is_number()) { diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h index a24db80057..781d996c5d 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -169,73 +169,73 @@ public: double as_double() const { - ASSERT(type() == Type::Number); + VERIFY(type() == Type::Number); return m_value.as_double; } bool as_bool() const { - ASSERT(type() == Type::Boolean); + VERIFY(type() == Type::Boolean); return m_value.as_bool; } Object& as_object() { - ASSERT(type() == Type::Object); + VERIFY(type() == Type::Object); return *m_value.as_object; } const Object& as_object() const { - ASSERT(type() == Type::Object); + VERIFY(type() == Type::Object); return *m_value.as_object; } PrimitiveString& as_string() { - ASSERT(is_string()); + VERIFY(is_string()); return *m_value.as_string; } const PrimitiveString& as_string() const { - ASSERT(is_string()); + VERIFY(is_string()); return *m_value.as_string; } Symbol& as_symbol() { - ASSERT(is_symbol()); + VERIFY(is_symbol()); return *m_value.as_symbol; } const Symbol& as_symbol() const { - ASSERT(is_symbol()); + VERIFY(is_symbol()); return *m_value.as_symbol; } Cell* as_cell() { - ASSERT(is_cell()); + VERIFY(is_cell()); return m_value.as_cell; } Accessor& as_accessor() { - ASSERT(is_accessor()); + VERIFY(is_accessor()); return *m_value.as_accessor; } BigInt& as_bigint() { - ASSERT(is_bigint()); + VERIFY(is_bigint()); return *m_value.as_bigint; } NativeProperty& as_native_property() { - ASSERT(is_native_property()); + VERIFY(is_native_property()); return *m_value.as_native_property; } diff --git a/Userland/Libraries/LibJS/Token.cpp b/Userland/Libraries/LibJS/Token.cpp index 638d4b7931..1a502b3476 100644 --- a/Userland/Libraries/LibJS/Token.cpp +++ b/Userland/Libraries/LibJS/Token.cpp @@ -42,7 +42,7 @@ const char* Token::name(TokenType type) ENUMERATE_JS_TOKENS #undef __ENUMERATE_JS_TOKEN default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "<Unknown>"; } } @@ -61,7 +61,7 @@ TokenCategory Token::category(TokenType type) ENUMERATE_JS_TOKENS #undef __ENUMERATE_JS_TOKEN default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -72,7 +72,7 @@ TokenCategory Token::category() const double Token::double_value() const { - ASSERT(type() == TokenType::NumericLiteral); + VERIFY(type() == TokenType::NumericLiteral); String value_string(m_value); if (value_string[0] == '0' && value_string.length() >= 2) { if (value_string[1] == 'x' || value_string[1] == 'X') { @@ -95,7 +95,7 @@ double Token::double_value() const static u32 hex2int(char x) { - ASSERT(isxdigit(x)); + VERIFY(isxdigit(x)); if (x >= '0' && x <= '9') return x - '0'; return 10u + (tolower(x) - 'a'); @@ -103,7 +103,7 @@ static u32 hex2int(char x) String Token::string_value(StringValueStatus& status) const { - ASSERT(type() == TokenType::StringLiteral || type() == TokenType::TemplateLiteralString); + VERIFY(type() == TokenType::StringLiteral || type() == TokenType::TemplateLiteralString); auto is_template = type() == TokenType::TemplateLiteralString; GenericLexer lexer(is_template ? m_value : m_value.substring_view(1, m_value.length() - 2)); @@ -122,7 +122,7 @@ String Token::string_value(StringValueStatus& status) const } lexer.ignore(); - ASSERT(!lexer.is_eof()); + VERIFY(!lexer.is_eof()); // Line continuation if (lexer.next_is('\n') || lexer.next_is('\r')) { @@ -146,7 +146,7 @@ String Token::string_value(StringValueStatus& status) const if (!isxdigit(lexer.peek()) || !isxdigit(lexer.peek(1))) return encoding_failure(StringValueStatus::MalformedHexEscape); auto code_point = hex2int(lexer.consume()) * 16 + hex2int(lexer.consume()); - ASSERT(code_point <= 255); + VERIFY(code_point <= 255); builder.append_code_point(code_point); continue; } @@ -202,7 +202,7 @@ String Token::string_value(StringValueStatus& status) const if (!octal_str.is_null()) { status = StringValueStatus::LegacyOctalEscapeSequence; auto code_point = strtoul(octal_str.characters(), nullptr, 8); - ASSERT(code_point <= 255); + VERIFY(code_point <= 255); builder.append_code_point(code_point); continue; } @@ -215,7 +215,7 @@ String Token::string_value(StringValueStatus& status) const bool Token::bool_value() const { - ASSERT(type() == TokenType::BoolLiteral); + VERIFY(type() == TokenType::BoolLiteral); return m_value == "true"; } diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp index acab00433d..4bb27d0ea2 100644 --- a/Userland/Libraries/LibLine/Editor.cpp +++ b/Userland/Libraries/LibLine/Editor.cpp @@ -1352,7 +1352,7 @@ void Editor::reposition_cursor(bool to_end) auto line = cursor_line() - 1; auto column = offset_in_line(); - ASSERT(column + m_origin_column <= m_num_columns); + VERIFY(column + m_origin_column <= m_num_columns); VT::move_absolute(line + m_origin_row, column + m_origin_column); if (line + m_origin_row > m_num_lines) { diff --git a/Userland/Libraries/LibLine/Editor.h b/Userland/Libraries/LibLine/Editor.h index 6523d403be..083d3ceb91 100644 --- a/Userland/Libraries/LibLine/Editor.h +++ b/Userland/Libraries/LibLine/Editor.h @@ -331,7 +331,7 @@ private: void restore() { - ASSERT(m_initialized); + VERIFY(m_initialized); tcsetattr(0, TCSANOW, &m_default_termios); m_initialized = false; for (auto id : m_signal_handlers) diff --git a/Userland/Libraries/LibLine/InternalFunctions.cpp b/Userland/Libraries/LibLine/InternalFunctions.cpp index e4e3be3be8..fa8d95da5c 100644 --- a/Userland/Libraries/LibLine/InternalFunctions.cpp +++ b/Userland/Libraries/LibLine/InternalFunctions.cpp @@ -227,7 +227,7 @@ void Editor::enter_search() { if (m_is_searching) { // How did we get here? - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { m_is_searching = true; m_search_offset = 0; @@ -494,7 +494,7 @@ void Editor::case_change_word(Editor::CaseChangeOp change_op) if (change_op == CaseChangeOp::Uppercase || (change_op == CaseChangeOp::Capital && m_cursor == start)) { m_buffer[m_cursor] = toupper(m_buffer[m_cursor]); } else { - ASSERT(change_op == CaseChangeOp::Lowercase || (change_op == CaseChangeOp::Capital && m_cursor > start)); + VERIFY(change_op == CaseChangeOp::Lowercase || (change_op == CaseChangeOp::Capital && m_cursor > start)); m_buffer[m_cursor] = tolower(m_buffer[m_cursor]); } ++m_cursor; diff --git a/Userland/Libraries/LibLine/KeyCallbackMachine.cpp b/Userland/Libraries/LibLine/KeyCallbackMachine.cpp index 742976abad..d7036ebad5 100644 --- a/Userland/Libraries/LibLine/KeyCallbackMachine.cpp +++ b/Userland/Libraries/LibLine/KeyCallbackMachine.cpp @@ -44,7 +44,7 @@ void KeyCallbackMachine::key_pressed(Editor& editor, Key key) dbgln("Key<{}, {}> pressed, seq_length={}, {} things in the matching vector", key.key, key.modifiers, m_sequence_length, m_current_matching_keys.size()); #endif if (m_sequence_length == 0) { - ASSERT(m_current_matching_keys.is_empty()); + VERIFY(m_current_matching_keys.is_empty()); for (auto& it : m_key_callbacks) { if (it.key.first() == key) diff --git a/Userland/Libraries/LibLine/SuggestionManager.cpp b/Userland/Libraries/LibLine/SuggestionManager.cpp index f7c0667e49..8978ac8a6b 100644 --- a/Userland/Libraries/LibLine/SuggestionManager.cpp +++ b/Userland/Libraries/LibLine/SuggestionManager.cpp @@ -53,7 +53,7 @@ void SuggestionManager::set_suggestions(Vector<CompletionSuggestion>&& suggestio // make sure we were not given invalid suggestions for (auto& suggestion : m_suggestions) - ASSERT(suggestion.is_valid); + VERIFY(suggestion.is_valid); size_t common_suggestion_prefix { 0 }; if (m_suggestions.size() == 1) { diff --git a/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp b/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp index 7e341854ee..03b5243416 100644 --- a/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp +++ b/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp @@ -183,7 +183,7 @@ bool XtermSuggestionDisplay::cleanup() size_t XtermSuggestionDisplay::fit_to_page_boundary(size_t selection_index) { - ASSERT(m_pages.size() > 0); + VERIFY(m_pages.size() > 0); size_t index = 0; auto* match = binary_search( diff --git a/Userland/Libraries/LibM/math.cpp b/Userland/Libraries/LibM/math.cpp index 9df74829b1..a17666af81 100644 --- a/Userland/Libraries/LibM/math.cpp +++ b/Userland/Libraries/LibM/math.cpp @@ -552,19 +552,19 @@ long double log2l(long double x) NOEXCEPT double frexp(double, int*) NOEXCEPT { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return 0; } float frexpf(float, int*) NOEXCEPT { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return 0; } long double frexpl(long double, int*) NOEXCEPT { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return 0; } diff --git a/Userland/Libraries/LibMarkdown/Heading.h b/Userland/Libraries/LibMarkdown/Heading.h index 5628f68679..5bb6e7c4b5 100644 --- a/Userland/Libraries/LibMarkdown/Heading.h +++ b/Userland/Libraries/LibMarkdown/Heading.h @@ -40,7 +40,7 @@ public: : m_text(move(text)) , m_level(level) { - ASSERT(m_level > 0); + VERIFY(m_level > 0); } virtual ~Heading() override { } diff --git a/Userland/Libraries/LibMarkdown/List.cpp b/Userland/Libraries/LibMarkdown/List.cpp index d9484cb098..d80503efb1 100644 --- a/Userland/Libraries/LibMarkdown/List.cpp +++ b/Userland/Libraries/LibMarkdown/List.cpp @@ -116,7 +116,7 @@ OwnPtr<List> List::parse(Vector<StringView>::ConstIterator& lines) break; } - ASSERT(!(appears_unordered && appears_ordered)); + VERIFY(!(appears_unordered && appears_ordered)); if (appears_unordered || appears_ordered) { if (first) @@ -142,7 +142,7 @@ OwnPtr<List> List::parse(Vector<StringView>::ConstIterator& lines) first = false; if (!item_builder.is_empty()) item_builder.append(' '); - ASSERT(offset <= line.length()); + VERIFY(offset <= line.length()); item_builder.append(line.substring_view(offset, line.length() - offset)); ++lines; offset = 0; diff --git a/Userland/Libraries/LibMarkdown/Table.cpp b/Userland/Libraries/LibMarkdown/Table.cpp index 065a0a48d9..b70c1f572c 100644 --- a/Userland/Libraries/LibMarkdown/Table.cpp +++ b/Userland/Libraries/LibMarkdown/Table.cpp @@ -67,7 +67,7 @@ String Table::render_for_terminal(size_t view_width) const for (size_t i = 0; i < m_row_count; ++i) { bool first = true; for (auto& col : m_columns) { - ASSERT(i < col.rows.size()); + VERIFY(i < col.rows.size()); auto& cell = col.rows[i]; if (!first) @@ -101,7 +101,7 @@ String Table::render_to_html() const for (size_t i = 0; i < m_row_count; ++i) { builder.append("<tr>"); for (auto& column : m_columns) { - ASSERT(i < column.rows.size()); + VERIFY(i < column.rows.size()); builder.append("<td>"); builder.append(column.rows[i].render_to_html()); builder.append("</td>"); diff --git a/Userland/Libraries/LibMarkdown/Text.cpp b/Userland/Libraries/LibMarkdown/Text.cpp index 1fd83daed9..31631e9678 100644 --- a/Userland/Libraries/LibMarkdown/Text.cpp +++ b/Userland/Libraries/LibMarkdown/Text.cpp @@ -196,7 +196,7 @@ Optional<Text> Text::parse(const StringView& str) Vector<Span> spans; auto append_span_if_needed = [&](size_t offset) { - ASSERT(current_span_start <= offset); + VERIFY(current_span_start <= offset); if (current_span_start != offset) { Span span { unescape(str.substring_view(current_span_start, offset - current_span_start)), @@ -280,7 +280,7 @@ Optional<Text> Text::parse(const StringView& str) break; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // We've processed the character as a special, so the next offset will diff --git a/Userland/Libraries/LibPCIDB/Database.cpp b/Userland/Libraries/LibPCIDB/Database.cpp index bb73c308ea..b8a106d9ea 100644 --- a/Userland/Libraries/LibPCIDB/Database.cpp +++ b/Userland/Libraries/LibPCIDB/Database.cpp @@ -113,14 +113,14 @@ static u8 parse_hex_digit(char digit) { if (digit >= '0' && digit <= '9') return digit - '0'; - ASSERT(digit >= 'a' && digit <= 'f'); + VERIFY(digit >= 'a' && digit <= 'f'); return 10 + (digit - 'a'); } template<typename T> static T parse_hex(StringView str, size_t count) { - ASSERT(str.length() >= count); + VERIFY(str.length() >= count); T res = 0; for (size_t i = 0; i < count; i++) diff --git a/Userland/Libraries/LibProtocol/Download.cpp b/Userland/Libraries/LibProtocol/Download.cpp index 130a237174..6f5b35015e 100644 --- a/Userland/Libraries/LibProtocol/Download.cpp +++ b/Userland/Libraries/LibProtocol/Download.cpp @@ -42,7 +42,7 @@ bool Download::stop() void Download::stream_into(OutputStream& stream) { - ASSERT(!m_internal_stream_data); + VERIFY(!m_internal_stream_data); auto notifier = Core::Notifier::construct(fd(), Core::Notifier::Read); @@ -85,9 +85,9 @@ void Download::set_should_buffer_all_input(bool value) return; } - ASSERT(!m_internal_stream_data); - ASSERT(!m_internal_buffered_data); - ASSERT(on_buffered_download_finish); // Not having this set makes no sense. + VERIFY(!m_internal_stream_data); + VERIFY(!m_internal_buffered_data); + VERIFY(on_buffered_download_finish); // Not having this set makes no sense. m_internal_buffered_data = make<InternalBufferedData>(fd()); m_should_buffer_all_input = true; diff --git a/Userland/Libraries/LibPthread/pthread.cpp b/Userland/Libraries/LibPthread/pthread.cpp index 4b28cde0e4..fa0f9e2ff0 100644 --- a/Userland/Libraries/LibPthread/pthread.cpp +++ b/Userland/Libraries/LibPthread/pthread.cpp @@ -92,7 +92,7 @@ static int create_thread(pthread_t* thread, void* (*entry)(void*), void* argumen push_on_stack(argument); push_on_stack((void*)entry); - ASSERT((uintptr_t)stack % 16 == 0); + VERIFY((uintptr_t)stack % 16 == 0); // Push a fake return address push_on_stack(nullptr); @@ -107,7 +107,7 @@ static int create_thread(pthread_t* thread, void* (*entry)(void*), void* argumen { KeyDestroyer::destroy_for_current_thread(); syscall(SC_exit_thread, code); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int pthread_self() @@ -485,7 +485,7 @@ static int cond_wait(pthread_cond_t* cond, pthread_mutex_t* mutex, const struct int pthread_cond_wait(pthread_cond_t* cond, pthread_mutex_t* mutex) { int rc = cond_wait(cond, mutex, nullptr); - ASSERT(rc == 0); + VERIFY(rc == 0); return 0; } @@ -516,7 +516,7 @@ int pthread_cond_signal(pthread_cond_t* cond) u32 value = cond->previous + 1; cond->value = value; int rc = futex(&cond->value, FUTEX_WAKE, 1, nullptr, nullptr, 0); - ASSERT(rc >= 0); + VERIFY(rc >= 0); return 0; } @@ -525,7 +525,7 @@ int pthread_cond_broadcast(pthread_cond_t* cond) u32 value = cond->previous + 1; cond->value = value; int rc = futex(&cond->value, FUTEX_WAKE, INT32_MAX, nullptr, nullptr, 0); - ASSERT(rc >= 0); + VERIFY(rc >= 0); return 0; } @@ -874,15 +874,15 @@ int pthread_rwlockattr_destroy(pthread_rwlockattr_t*) } int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t* __restrict, int* __restrict) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int pthread_rwlockattr_init(pthread_rwlockattr_t*) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int pthread_rwlockattr_setpshared(pthread_rwlockattr_t*, int) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void)) diff --git a/Userland/Libraries/LibPthread/pthread_once.cpp b/Userland/Libraries/LibPthread/pthread_once.cpp index 88acb88f67..6fdf1b5b8e 100644 --- a/Userland/Libraries/LibPthread/pthread_once.cpp +++ b/Userland/Libraries/LibPthread/pthread_once.cpp @@ -59,7 +59,7 @@ int pthread_once(pthread_once_t* self, void (*callback)(void)) switch (state2) { case State::INITIAL: case State::DONE: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case State::PERFORMING_NO_WAITERS: // The fast path: there's no contention, so we don't have to wake // anyone. @@ -77,7 +77,7 @@ int pthread_once(pthread_once_t* self, void (*callback)(void)) while (true) { switch (state2) { case State::INITIAL: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); case State::DONE: // Awesome, nothing to do then. return 0; diff --git a/Userland/Libraries/LibRegex/RegexByteCode.cpp b/Userland/Libraries/LibRegex/RegexByteCode.cpp index b996c4b7ca..0987192af7 100644 --- a/Userland/Libraries/LibRegex/RegexByteCode.cpp +++ b/Userland/Libraries/LibRegex/RegexByteCode.cpp @@ -42,7 +42,7 @@ const char* OpCode::name(OpCodeId opcode_id) ENUMERATE_OPCODES #undef __ENUMERATE_OPCODE default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "<Unknown>"; } } @@ -61,7 +61,7 @@ const char* execution_result_name(ExecutionResult result) ENUMERATE_EXECUTION_RESULTS #undef __ENUMERATE_EXECUTION_RESULT default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "<Unknown>"; } } @@ -75,7 +75,7 @@ const char* boundary_check_type_name(BoundaryCheckType ty) ENUMERATE_BOUNDARY_CHECK_TYPES #undef __ENUMERATE_BOUNDARY_CHECK_TYPE default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "<Unknown>"; } } @@ -89,7 +89,7 @@ const char* character_compare_type_name(CharacterCompareType ch_compare_type) ENUMERATE_CHARACTER_COMPARE_TYPES #undef __ENUMERATE_CHARACTER_COMPARE_TYPE default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "<Unknown>"; } } @@ -103,7 +103,7 @@ static const char* character_class_name(CharClass ch_class) ENUMERATE_CHARACTER_CLASSES #undef __ENUMERATE_CHARACTER_CLASS default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "<Unknown>"; } } @@ -222,7 +222,7 @@ ALWAYS_INLINE ExecutionResult OpCode_GoBack::execute(const MatchInput&, MatchSta ALWAYS_INLINE ExecutionResult OpCode_FailForks::execute(const MatchInput& input, MatchState&, MatchOutput&) const { - ASSERT(count() > 0); + VERIFY(count() > 0); input.fail_counter += count() - 1; return ExecutionResult::Failed_ExecuteLowPrioForks; @@ -291,7 +291,7 @@ ALWAYS_INLINE ExecutionResult OpCode_CheckBoundary::execute(const MatchInput& in return ExecutionResult::Failed_ExecuteLowPrioForks; } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } ALWAYS_INLINE ExecutionResult OpCode_CheckEnd::execute(const MatchInput& input, MatchState& state, MatchOutput&) const @@ -335,7 +335,7 @@ ALWAYS_INLINE ExecutionResult OpCode_SaveRightCaptureGroup::execute(const MatchI if (start_position < match.column) return ExecutionResult::Continue; - ASSERT(start_position + length <= input.view.length()); + VERIFY(start_position + length <= input.view.length()); auto view = input.view.substring_view(start_position, length); @@ -371,11 +371,11 @@ ALWAYS_INLINE ExecutionResult OpCode_SaveRightNamedCaptureGroup::execute(const M auto& map = output.named_capture_group_matches.at(input.match_index); if constexpr (REGEX_DEBUG) { - ASSERT(start_position + length <= input.view.length()); + VERIFY(start_position + length <= input.view.length()); dbgln("Save named capture group with name={} and content='{}'", capture_group_name, input.view.substring_view(start_position, length)); } - ASSERT(start_position + length <= input.view.length()); + VERIFY(start_position + length <= input.view.length()); auto view = input.view.substring_view(start_position, length); if (input.regex_options & AllFlags::StringCopyMatches) { map.set(capture_group_name, { view.to_string(), input.line, start_position, input.global_offset + start_position }); // create a copy of the original string @@ -420,7 +420,7 @@ ALWAYS_INLINE ExecutionResult OpCode_Compare::execute(const MatchInput& input, M else if (compare_type == CharacterCompareType::TemporaryInverse) { // If "TemporaryInverse" is given, negate the current inversion state only for the next opcode. // it follows that this cannot be the last compare element. - ASSERT(i != arguments_count() - 1); + VERIFY(i != arguments_count() - 1); temporary_inverse = true; reset_temp_inverse = false; @@ -439,11 +439,11 @@ ALWAYS_INLINE ExecutionResult OpCode_Compare::execute(const MatchInput& input, M if (input.view.length() - state.string_position < 1) return ExecutionResult::Failed_ExecuteLowPrioForks; - ASSERT(!current_inversion_state()); + VERIFY(!current_inversion_state()); ++state.string_position; } else if (compare_type == CharacterCompareType::String) { - ASSERT(!current_inversion_state()); + VERIFY(!current_inversion_state()); const auto& length = m_bytecode->at(offset++); StringBuilder str_builder; @@ -511,7 +511,7 @@ ALWAYS_INLINE ExecutionResult OpCode_Compare::execute(const MatchInput& input, M } else { fprintf(stderr, "Undefined comparison: %i\n", (int)compare_type); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } diff --git a/Userland/Libraries/LibRegex/RegexByteCode.h b/Userland/Libraries/LibRegex/RegexByteCode.h index f9a69c6d73..1909e36a91 100644 --- a/Userland/Libraries/LibRegex/RegexByteCode.h +++ b/Userland/Libraries/LibRegex/RegexByteCode.h @@ -161,10 +161,10 @@ public: ByteCode arguments; for (auto& value : pairs) { - ASSERT(value.type != CharacterCompareType::RangeExpressionDummy); - ASSERT(value.type != CharacterCompareType::Undefined); - ASSERT(value.type != CharacterCompareType::String); - ASSERT(value.type != CharacterCompareType::NamedReference); + VERIFY(value.type != CharacterCompareType::RangeExpressionDummy); + VERIFY(value.type != CharacterCompareType::Undefined); + VERIFY(value.type != CharacterCompareType::String); + VERIFY(value.type != CharacterCompareType::NamedReference); arguments.append((ByteCodeValueType)value.type); if (value.type != CharacterCompareType::Inverse && value.type != CharacterCompareType::AnyChar && value.type != CharacterCompareType::TemporaryInverse) @@ -327,7 +327,7 @@ public: } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void insert_bytecode_alternation(ByteCode&& left, ByteCode&& right) @@ -503,7 +503,7 @@ public: ALWAYS_INLINE ByteCodeValueType argument(size_t offset) const { - ASSERT(state().instruction_position + offset <= m_bytecode->size()); + VERIFY(state().instruction_position + offset <= m_bytecode->size()); return m_bytecode->at(state().instruction_position + 1 + offset); } @@ -526,7 +526,7 @@ public: ALWAYS_INLINE const MatchState& state() const { - ASSERT(m_state.has_value()); + VERIFY(m_state.has_value()); return *m_state.value(); } @@ -809,28 +809,28 @@ ALWAYS_INLINE bool is<OpCode_Compare>(const OpCode& opcode) template<typename T> ALWAYS_INLINE const T& to(const OpCode& opcode) { - ASSERT(is<T>(opcode)); + VERIFY(is<T>(opcode)); return static_cast<const T&>(opcode); } template<typename T> ALWAYS_INLINE T* to(OpCode* opcode) { - ASSERT(is<T>(opcode)); + VERIFY(is<T>(opcode)); return static_cast<T*>(opcode); } template<typename T> ALWAYS_INLINE const T* to(const OpCode* opcode) { - ASSERT(is<T>(opcode)); + VERIFY(is<T>(opcode)); return static_cast<const T*>(opcode); } template<typename T> ALWAYS_INLINE T& to(OpCode& opcode) { - ASSERT(is<T>(opcode)); + VERIFY(is<T>(opcode)); return static_cast<T&>(opcode); } diff --git a/Userland/Libraries/LibRegex/RegexLexer.cpp b/Userland/Libraries/LibRegex/RegexLexer.cpp index e61708a4c4..c7bd1194c5 100644 --- a/Userland/Libraries/LibRegex/RegexLexer.cpp +++ b/Userland/Libraries/LibRegex/RegexLexer.cpp @@ -41,7 +41,7 @@ const char* Token::name(const TokenType type) ENUMERATE_REGEX_TOKENS #undef __ENUMERATE_REGEX_TOKEN default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return "<Unknown>"; } } @@ -68,7 +68,7 @@ void Lexer::back(size_t offset) if (offset == m_position + 1) offset = m_position; // 'position == 0' occurs twice. - ASSERT(offset <= m_position); + VERIFY(offset <= m_position); if (!offset) return; m_position -= offset; @@ -122,7 +122,7 @@ Token Lexer::next() }; auto commit_token = [&](auto type) -> Token& { - ASSERT(token_start_position + m_previous_position - token_start_position + 1 <= m_source.length()); + VERIFY(token_start_position + m_previous_position - token_start_position + 1 <= m_source.length()); auto substring = m_source.substring_view(token_start_position, m_previous_position - token_start_position + 1); m_current_token = Token(type, token_start_position, substring); return m_current_token; diff --git a/Userland/Libraries/LibRegex/RegexMatch.h b/Userland/Libraries/LibRegex/RegexMatch.h index d688dcab0f..73b332ac3e 100644 --- a/Userland/Libraries/LibRegex/RegexMatch.h +++ b/Userland/Libraries/LibRegex/RegexMatch.h @@ -64,13 +64,13 @@ public: const StringView& u8view() const { - ASSERT(m_u8view.has_value()); + VERIFY(m_u8view.has_value()); return m_u8view.value(); }; const Utf32View& u32view() const { - ASSERT(m_u32view.has_value()); + VERIFY(m_u32view.has_value()); return m_u32view.value(); }; diff --git a/Userland/Libraries/LibRegex/RegexMatcher.cpp b/Userland/Libraries/LibRegex/RegexMatcher.cpp index 7d6f6d8e92..970db6bf1c 100644 --- a/Userland/Libraries/LibRegex/RegexMatcher.cpp +++ b/Userland/Libraries/LibRegex/RegexMatcher.cpp @@ -104,7 +104,7 @@ RegexResult Matcher<Parser>::match(const Vector<RegexStringView> views, Optional output.operations = 0; if (input.regex_options.has_flag_set(AllFlags::Internal_Stateful)) - ASSERT(views.size() == 1); + VERIFY(views.size() == 1); if (c_match_preallocation_count) { output.matches.ensure_capacity(c_match_preallocation_count); @@ -130,7 +130,7 @@ RegexResult Matcher<Parser>::match(const Vector<RegexStringView> views, Optional if (output.matches.size() == input.match_index) output.matches.empend(); - ASSERT(start_position + state.string_position - start_position <= input.view.length()); + VERIFY(start_position + state.string_position - start_position <= input.view.length()); if (input.regex_options.has_flag_set(AllFlags::StringCopyMatches)) { output.matches.at(input.match_index) = { input.view.substring_view(start_position, state.string_position - start_position).to_string(), input.line, start_position, input.global_offset + start_position }; } else { // let the view point to the original string ... @@ -360,7 +360,7 @@ Optional<bool> Matcher<Parser>::execute(const MatchInput& input, MatchState& sta } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } template<class Parser> diff --git a/Userland/Libraries/LibRegex/RegexParser.cpp b/Userland/Libraries/LibRegex/RegexParser.cpp index 6ed5e2e217..eacc306975 100644 --- a/Userland/Libraries/LibRegex/RegexParser.cpp +++ b/Userland/Libraries/LibRegex/RegexParser.cpp @@ -313,7 +313,7 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_bracket_expression(ByteCode& stack // FIXME: Parse collating element, this is needed when we have locale support // This could have impact on length parameter, I guess. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); consume(TokenType::Period, Error::InvalidCollationElement); consume(TokenType::RightBracket, Error::MismatchingBracket); @@ -322,7 +322,7 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_bracket_expression(ByteCode& stack consume(); // FIXME: Parse collating element, this is needed when we have locale support // This could have impact on length parameter, I guess. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); consume(TokenType::EqualSign, Error::InvalidCollationElement); consume(TokenType::RightBracket, Error::MismatchingBracket); @@ -529,16 +529,16 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_sub_expression(ByteCode& stack, si } else if (match(TokenType::EqualSign)) { // positive lookahead consume(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else if (consume("!")) { // negative lookahead - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else if (consume("<")) { if (match(TokenType::EqualSign)) { // positive lookbehind consume(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (consume("!")) // negative lookbehind - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { return set_error(Error::InvalidRepetitionMarker); } @@ -926,7 +926,7 @@ bool ECMA262Parser::parse_quantifier(ByteCode& stack, size_t& match_length_minim match_length_minimum *= repeat_min.value(); break; case Repetition::None: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return true; @@ -1370,8 +1370,8 @@ bool ECMA262Parser::parse_nonempty_class_ranges(Vector<CompareTypeAndValuePair>& return false; } - ASSERT(!first_atom.value().is_negated); - ASSERT(!second_atom.value().is_negated); + VERIFY(!first_atom.value().is_negated); + VERIFY(!second_atom.value().is_negated); ranges.empend(CompareTypeAndValuePair { CharacterCompareType::CharRange, CharRange { first_atom.value().code_point, second_atom.value().code_point } }); continue; @@ -1386,7 +1386,7 @@ bool ECMA262Parser::parse_nonempty_class_ranges(Vector<CompareTypeAndValuePair>& ranges.empend(CompareTypeAndValuePair { CharacterCompareType::TemporaryInverse, 0 }); ranges.empend(CompareTypeAndValuePair { CharacterCompareType::CharClass, (ByteCodeValueType)first_atom.value().character_class }); } else { - ASSERT(!atom.is_negated); + VERIFY(!atom.is_negated); ranges.empend(CompareTypeAndValuePair { CharacterCompareType::Char, first_atom.value().code_point }); } } diff --git a/Userland/Libraries/LibRegex/Tests/Benchmark.cpp b/Userland/Libraries/LibRegex/Tests/Benchmark.cpp index 0a25ee1847..a17794a7e3 100644 --- a/Userland/Libraries/LibRegex/Tests/Benchmark.cpp +++ b/Userland/Libraries/LibRegex/Tests/Benchmark.cpp @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <AK/TestSuite.h> // import first, to prevent warning of ASSERT* redefinition +#include <AK/TestSuite.h> // import first, to prevent warning of VERIFY* redefinition #include <LibRegex/Regex.h> #include <stdio.h> diff --git a/Userland/Libraries/LibRegex/Tests/Regex.cpp b/Userland/Libraries/LibRegex/Tests/Regex.cpp index ffd585e8d3..93bab8d705 100644 --- a/Userland/Libraries/LibRegex/Tests/Regex.cpp +++ b/Userland/Libraries/LibRegex/Tests/Regex.cpp @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <AK/TestSuite.h> // import first, to prevent warning of ASSERT* redefinition +#include <AK/TestSuite.h> // import first, to prevent warning of VERIFY* redefinition #include <AK/StringBuilder.h> #include <LibRegex/Regex.h> diff --git a/Userland/Libraries/LibSyntax/Highlighter.cpp b/Userland/Libraries/LibSyntax/Highlighter.cpp index c1463e6537..0fe7706a0f 100644 --- a/Userland/Libraries/LibSyntax/Highlighter.cpp +++ b/Userland/Libraries/LibSyntax/Highlighter.cpp @@ -127,7 +127,7 @@ void Highlighter::highlight_matching_token_pair() void Highlighter::attach(HighlighterClient& client) { - ASSERT(!m_client); + VERIFY(!m_client); m_client = &client; } diff --git a/Userland/Libraries/LibTLS/ClientHandshake.cpp b/Userland/Libraries/LibTLS/ClientHandshake.cpp index 39f2193a8e..6051291880 100644 --- a/Userland/Libraries/LibTLS/ClientHandshake.cpp +++ b/Userland/Libraries/LibTLS/ClientHandshake.cpp @@ -348,7 +348,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) case ClientHello: // FIXME: We only support client mode right now if (m_context.is_server) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } payload_res = (i8)Error::UnexpectedMessage; break; @@ -364,7 +364,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) #endif if (m_context.is_server) { dbgln("unsupported: server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { payload_res = handle_hello(buffer.slice(1, payload_size), write_packets); } @@ -386,7 +386,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) if (m_context.connection_status == ConnectionStatus::Negotiating) { if (m_context.is_server) { dbgln("unsupported: server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } payload_res = handle_certificate(buffer.slice(1, payload_size)); if (m_context.certificates.size()) { @@ -420,7 +420,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) #endif if (m_context.is_server) { dbgln("unsupported: server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { payload_res = handle_server_key_exchange(buffer.slice(1, payload_size)); } @@ -435,7 +435,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) if (m_context.is_server) { dbgln("invalid request"); dbgln("unsupported: server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { // we do not support "certificate request" dbgln("certificate request"); @@ -456,7 +456,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) #endif if (m_context.is_server) { dbgln("unsupported: server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { payload_res = handle_server_hello_done(buffer.slice(1, payload_size)); if (payload_res > 0) @@ -491,7 +491,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) #endif if (m_context.is_server) { dbgln("unsupported: server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { payload_res = (i8)Error::UnexpectedMessage; } @@ -581,7 +581,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) break; default: dbgln("Unknown TLS::Error with value {}", payload_res); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } if (payload_res < 0) @@ -628,7 +628,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) case WritePacketStage::ServerHandshake: // server handshake dbgln("UNSUPPORTED: Server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; case WritePacketStage::Finished: // finished diff --git a/Userland/Libraries/LibTLS/Exchange.cpp b/Userland/Libraries/LibTLS/Exchange.cpp index 9f3ea55eb9..26f71e2697 100644 --- a/Userland/Libraries/LibTLS/Exchange.cpp +++ b/Userland/Libraries/LibTLS/Exchange.cpp @@ -189,7 +189,7 @@ ByteBuffer TLSv12::build_certificate() if (m_context.is_server) { dbgln("Unsupported: Server mode"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { local_certificates = &m_context.client_certificates; } diff --git a/Userland/Libraries/LibTLS/Handshake.cpp b/Userland/Libraries/LibTLS/Handshake.cpp index 1fa0f01fca..88395b4e27 100644 --- a/Userland/Libraries/LibTLS/Handshake.cpp +++ b/Userland/Libraries/LibTLS/Handshake.cpp @@ -110,7 +110,7 @@ ByteBuffer TLSv12::build_hello() if (alpn_length) { // TODO - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } // set the "length" field of the packet diff --git a/Userland/Libraries/LibTLS/Record.cpp b/Userland/Libraries/LibTLS/Record.cpp index 4bdf6f0e9b..f9822dc377 100644 --- a/Userland/Libraries/LibTLS/Record.cpp +++ b/Userland/Libraries/LibTLS/Record.cpp @@ -117,7 +117,7 @@ void TLSv12::update_packet(ByteBuffer& packet) aad_stream.write({ &seq_no, sizeof(seq_no) }); aad_stream.write(packet.bytes().slice(0, 3)); // content-type + version aad_stream.write({ &len, sizeof(len) }); // length - ASSERT(aad_stream.is_end()); + VERIFY(aad_stream.is_end()); // AEAD IV (12) // IV (4) @@ -141,7 +141,7 @@ void TLSv12::update_packet(ByteBuffer& packet) aad_bytes, ct.bytes().slice(header_size + 8 + length, 16)); - ASSERT(header_size + 8 + length + 16 == ct.size()); + VERIFY(header_size + 8 + length + 16 == ct.size()); } else { // We need enough space for a header, iv_length bytes of IV and whatever the packet contains @@ -161,7 +161,7 @@ void TLSv12::update_packet(ByteBuffer& packet) memset(buffer.offset_pointer(buffer_position), padding - 1, padding); buffer_position += padding; - ASSERT(buffer_position == buffer.size()); + VERIFY(buffer_position == buffer.size()); auto iv = ByteBuffer::create_uninitialized(iv_size); AK::fill_with_random(iv.data(), iv.size()); @@ -169,8 +169,8 @@ void TLSv12::update_packet(ByteBuffer& packet) // write it into the ciphertext portion of the message ct.overwrite(header_size, iv.data(), iv.size()); - ASSERT(header_size + iv_size + length == ct.size()); - ASSERT(length % block_size == 0); + VERIFY(header_size + iv_size + length == ct.size()); + VERIFY(length % block_size == 0); // get a block to encrypt into auto view = ct.bytes().slice(header_size + iv_size, length); @@ -269,7 +269,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) } if (is_aead()) { - ASSERT(m_aes_remote.gcm); + VERIFY(m_aes_remote.gcm); if (length < 24) { dbgln("Invalid packet length"); @@ -297,7 +297,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) aad_stream.write({ &seq_no, sizeof(seq_no) }); // Sequence number aad_stream.write(buffer.slice(0, header_size - 2)); // content-type + version aad_stream.write({ &len, sizeof(u16) }); - ASSERT(aad_stream.is_end()); + VERIFY(aad_stream.is_end()); auto nonce = payload.slice(0, iv_length()); payload = payload.slice(iv_length()); @@ -333,7 +333,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) plain = decrypted; } else { - ASSERT(m_aes_remote.cbc); + VERIFY(m_aes_remote.cbc); auto iv_size = iv_length(); decrypted = m_aes_remote.cbc->create_aligned_buffer(length - iv_size); diff --git a/Userland/Libraries/LibTLS/Socket.cpp b/Userland/Libraries/LibTLS/Socket.cpp index 3022b5e17d..3e8b712eaa 100644 --- a/Userland/Libraries/LibTLS/Socket.cpp +++ b/Userland/Libraries/LibTLS/Socket.cpp @@ -61,7 +61,7 @@ String TLSv12::read_line(size_t max_size) auto* start = m_context.application_buffer.data(); auto* newline = (u8*)memchr(m_context.application_buffer.data(), '\n', m_context.application_buffer.size()); - ASSERT(newline); + VERIFY(newline); size_t offset = newline - start; @@ -106,7 +106,7 @@ bool TLSv12::common_connect(const struct sockaddr* saddr, socklen_t length) if (Core::Socket::is_connected()) { if (is_established()) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else { Core::Socket::close(); // reuse? } diff --git a/Userland/Libraries/LibTLS/TLSPacketBuilder.h b/Userland/Libraries/LibTLS/TLSPacketBuilder.h index 2994ed27ab..98c3fcf2d9 100644 --- a/Userland/Libraries/LibTLS/TLSPacketBuilder.h +++ b/Userland/Libraries/LibTLS/TLSPacketBuilder.h @@ -107,7 +107,7 @@ public: } inline void set(size_t offset, u8 value) { - ASSERT(offset < m_current_length); + VERIFY(offset < m_current_length); m_packet_data[offset] = value; } size_t length() const { return m_current_length; } diff --git a/Userland/Libraries/LibTTF/Cmap.cpp b/Userland/Libraries/LibTTF/Cmap.cpp index ce651e5385..5a4993fbaf 100644 --- a/Userland/Libraries/LibTTF/Cmap.cpp +++ b/Userland/Libraries/LibTTF/Cmap.cpp @@ -45,7 +45,7 @@ Cmap::Subtable::Platform Cmap::Subtable::platform_id() const case 4: return Platform::Custom; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -71,7 +71,7 @@ Cmap::Subtable::Format Cmap::Subtable::format() const case 14: return Format::UnicodeVariationSequences; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -89,7 +89,7 @@ Optional<Cmap::Subtable> Cmap::subtable(u32 index) const u16 platform_id = be_u16(m_slice.offset_pointer(record_offset)); u16 encoding_id = be_u16(m_slice.offset_pointer(record_offset + (u32)Offsets::EncodingRecord_EncodingID)); u32 subtable_offset = be_u32(m_slice.offset_pointer(record_offset + (u32)Offsets::EncodingRecord_Offset)); - ASSERT(subtable_offset < m_slice.size()); + VERIFY(subtable_offset < m_slice.size()); auto subtable_slice = ReadonlyBytes(m_slice.offset_pointer(subtable_offset), m_slice.size() - subtable_offset); return Subtable(subtable_slice, platform_id, encoding_id); } @@ -128,7 +128,7 @@ u32 Cmap::Subtable::glyph_id_for_codepoint_table_4(u32 codepoint) const return (codepoint + delta) & 0xffff; } u32 glyph_offset = (u32)Table4Offsets::GlyphOffsetConstBase + segcount_x2 * 3 + offset + range + (codepoint - start_codepoint) * 2; - ASSERT(glyph_offset + 2 <= m_slice.size()); + VERIFY(glyph_offset + 2 <= m_slice.size()); return (be_u16(m_slice.offset_pointer(glyph_offset)) + delta) & 0xffff; } return 0; @@ -137,7 +137,7 @@ u32 Cmap::Subtable::glyph_id_for_codepoint_table_4(u32 codepoint) const u32 Cmap::Subtable::glyph_id_for_codepoint_table_12(u32 codepoint) const { u32 num_groups = be_u32(m_slice.offset_pointer((u32)Table12Offsets::NumGroups)); - ASSERT(m_slice.size() >= (u32)Table12Sizes::Header + (u32)Table12Sizes::Record * num_groups); + VERIFY(m_slice.size() >= (u32)Table12Sizes::Header + (u32)Table12Sizes::Record * num_groups); for (u32 offset = 0; offset < num_groups * (u32)Table12Sizes::Record; offset += (u32)Table12Sizes::Record) { u32 start_codepoint = be_u32(m_slice.offset_pointer((u32)Table12Offsets::Record_StartCode + offset)); if (codepoint < start_codepoint) { diff --git a/Userland/Libraries/LibTTF/Font.cpp b/Userland/Libraries/LibTTF/Font.cpp index be649dc171..03c6c92cdd 100644 --- a/Userland/Libraries/LibTTF/Font.cpp +++ b/Userland/Libraries/LibTTF/Font.cpp @@ -117,7 +117,7 @@ IndexToLocFormat Head::index_to_loc_format() const case 1: return IndexToLocFormat::Offset32; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -207,7 +207,7 @@ String Name::string_for_id(NameId id) const GlyphHorizontalMetrics Hmtx::get_glyph_horizontal_metrics(u32 glyph_id) const { - ASSERT(glyph_id < m_num_glyphs); + VERIFY(glyph_id < m_num_glyphs); if (glyph_id < m_number_of_h_metrics) { auto offset = glyph_id * (u32)Sizes::LongHorMetric; u16 advance_width = be_u16(m_slice.offset_pointer(offset)); diff --git a/Userland/Libraries/LibTTF/Glyf.cpp b/Userland/Libraries/LibTTF/Glyf.cpp index 7ad25cd4e1..bf3c01177e 100644 --- a/Userland/Libraries/LibTTF/Glyf.cpp +++ b/Userland/Libraries/LibTTF/Glyf.cpp @@ -273,8 +273,8 @@ void Rasterizer::draw_line(Gfx::FloatPoint p0, Gfx::FloatPoint p1) return; } - ASSERT(p0.x() >= 0.0 && p0.y() >= 0.0 && p0.x() <= m_size.width() && p0.y() <= m_size.height()); - ASSERT(p1.x() >= 0.0 && p1.y() >= 0.0 && p1.x() <= m_size.width() && p1.y() <= m_size.height()); + VERIFY(p0.x() >= 0.0 && p0.y() >= 0.0 && p0.x() <= m_size.width() && p0.y() <= m_size.height()); + VERIFY(p1.x() >= 0.0 && p1.y() >= 0.0 && p1.x() <= m_size.width() && p1.y() <= m_size.height()); // If we're on the same Y, there's no need to draw if (p0.y() == p1.y()) { @@ -356,14 +356,14 @@ Optional<Loca> Loca::from_slice(const ReadonlyBytes& slice, u32 num_glyphs, Inde u32 Loca::get_glyph_offset(u32 glyph_id) const { - ASSERT(glyph_id < m_num_glyphs); + VERIFY(glyph_id < m_num_glyphs); switch (m_index_to_loc_format) { case IndexToLocFormat::Offset16: return ((u32)be_u16(m_slice.offset_pointer(glyph_id * 2))) * 2; case IndexToLocFormat::Offset32: return be_u32(m_slice.offset_pointer(glyph_id * 4)); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -428,7 +428,7 @@ void Glyf::Glyph::raster_inner(Rasterizer& rasterizer, Gfx::AffineTransform& aff contour_size = current_contour_end - last_contour_end; last_contour_end = current_contour_end; auto opt_item = point_iterator.next(); - ASSERT(opt_item.has_value()); + VERIFY(opt_item.has_value()); contour_start = opt_item.value().point; path.move_to(contour_start.value()); contour_size--; @@ -506,7 +506,7 @@ RefPtr<Gfx::Bitmap> Glyf::Glyph::raster_simple(float x_scale, float y_scale) con Glyf::Glyph Glyf::glyph(u32 offset) const { - ASSERT(m_slice.size() >= offset + (u32)Sizes::GlyphHeader); + VERIFY(m_slice.size() >= offset + (u32)Sizes::GlyphHeader); i16 num_contours = be_i16(m_slice.offset_pointer(offset)); i16 xmin = be_i16(m_slice.offset_pointer(offset + (u32)Offsets::XMin)); i16 ymin = be_i16(m_slice.offset_pointer(offset + (u32)Offsets::YMin)); diff --git a/Userland/Libraries/LibTTF/Glyf.h b/Userland/Libraries/LibTTF/Glyf.h index c7beb43644..2568001afd 100644 --- a/Userland/Libraries/LibTTF/Glyf.h +++ b/Userland/Libraries/LibTTF/Glyf.h @@ -91,7 +91,7 @@ public: case Type::Composite: return raster_composite(x_scale, y_scale, glyph_callback); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } int ascender() const { return m_ymax; } int descender() const { return m_ymin; } diff --git a/Userland/Libraries/LibTar/Tar.h b/Userland/Libraries/LibTar/Tar.h index 70f1764344..3ca46b3ca2 100644 --- a/Userland/Libraries/LibTar/Tar.h +++ b/Userland/Libraries/LibTar/Tar.h @@ -97,7 +97,7 @@ size_t Header::get_tar_field(const char (&field)[N]) if (field[i] == 0) break; - ASSERT(field[i] >= '0' && field[i] <= '7'); + VERIFY(field[i] >= '0' && field[i] <= '7'); value *= 8; value += field[i] - '0'; } diff --git a/Userland/Libraries/LibTar/TarStream.cpp b/Userland/Libraries/LibTar/TarStream.cpp index 533a01e932..30654dc607 100644 --- a/Userland/Libraries/LibTar/TarStream.cpp +++ b/Userland/Libraries/LibTar/TarStream.cpp @@ -37,7 +37,7 @@ TarFileStream::TarFileStream(TarStream& tar_stream) size_t TarFileStream::read(Bytes bytes) { // verify that the stream has not advanced - ASSERT(m_tar_stream.m_generation == m_generation); + VERIFY(m_tar_stream.m_generation == m_generation); if (has_any_error()) return 0; @@ -52,7 +52,7 @@ size_t TarFileStream::read(Bytes bytes) bool TarFileStream::unreliable_eof() const { // verify that the stream has not advanced - ASSERT(m_tar_stream.m_generation == m_generation); + VERIFY(m_tar_stream.m_generation == m_generation); return m_tar_stream.m_stream.unreliable_eof() || m_tar_stream.m_file_offset >= m_tar_stream.header().size(); @@ -61,7 +61,7 @@ bool TarFileStream::unreliable_eof() const bool TarFileStream::read_or_error(Bytes bytes) { // verify that the stream has not advanced - ASSERT(m_tar_stream.m_generation == m_generation); + VERIFY(m_tar_stream.m_generation == m_generation); if (read(bytes) < bytes.size()) { set_fatal_error(); @@ -74,7 +74,7 @@ bool TarFileStream::read_or_error(Bytes bytes) bool TarFileStream::discard_or_error(size_t count) { // verify that the stream has not advanced - ASSERT(m_tar_stream.m_generation == m_generation); + VERIFY(m_tar_stream.m_generation == m_generation); if (count > m_tar_stream.header().size() - m_tar_stream.m_file_offset) { return false; @@ -90,7 +90,7 @@ TarStream::TarStream(InputStream& stream) m_finished = true; return; } - ASSERT(m_stream.discard_or_error(block_size - sizeof(Header))); + VERIFY(m_stream.discard_or_error(block_size - sizeof(Header))); } static constexpr unsigned long block_ceiling(unsigned long offset) @@ -104,7 +104,7 @@ void TarStream::advance() return; m_generation++; - ASSERT(m_stream.discard_or_error(block_ceiling(m_header.size()) - m_file_offset)); + VERIFY(m_stream.discard_or_error(block_ceiling(m_header.size()) - m_file_offset)); m_file_offset = 0; if (!m_stream.read_or_error(Bytes(&m_header, sizeof(m_header)))) { @@ -116,7 +116,7 @@ void TarStream::advance() return; } - ASSERT(m_stream.discard_or_error(block_size - sizeof(Header))); + VERIFY(m_stream.discard_or_error(block_size - sizeof(Header))); } bool TarStream::valid() const @@ -126,7 +126,7 @@ bool TarStream::valid() const TarFileStream TarStream::file_contents() { - ASSERT(!m_finished); + VERIFY(!m_finished); return TarFileStream(*this); } diff --git a/Userland/Libraries/LibThread/BackgroundAction.cpp b/Userland/Libraries/LibThread/BackgroundAction.cpp index a2880dfb3f..6bf7d561ba 100644 --- a/Userland/Libraries/LibThread/BackgroundAction.cpp +++ b/Userland/Libraries/LibThread/BackgroundAction.cpp @@ -48,7 +48,7 @@ static int background_thread_func() sleep(1); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static void init() diff --git a/Userland/Libraries/LibThread/Lock.h b/Userland/Libraries/LibThread/Lock.h index 7ab63162c7..5d92c7c304 100644 --- a/Userland/Libraries/LibThread/Lock.h +++ b/Userland/Libraries/LibThread/Lock.h @@ -82,8 +82,8 @@ ALWAYS_INLINE void Lock::lock() inline void Lock::unlock() { - ASSERT(m_holder == gettid()); - ASSERT(m_level); + VERIFY(m_holder == gettid()); + VERIFY(m_level); if (m_level == 1) m_holder.store(0, AK::memory_order_release); else diff --git a/Userland/Libraries/LibThread/Thread.cpp b/Userland/Libraries/LibThread/Thread.cpp index 7d8fea4af4..4179604647 100644 --- a/Userland/Libraries/LibThread/Thread.cpp +++ b/Userland/Libraries/LibThread/Thread.cpp @@ -59,10 +59,10 @@ void LibThread::Thread::start() }, static_cast<void*>(this)); - ASSERT(rc == 0); + VERIFY(rc == 0); if (!m_thread_name.is_empty()) { rc = pthread_setname_np(m_tid, m_thread_name.characters()); - ASSERT(rc == 0); + VERIFY(rc == 0); } dbgln("Started thread \"{}\", tid = {}", m_thread_name, m_tid); } diff --git a/Userland/Libraries/LibVT/Line.cpp b/Userland/Libraries/LibVT/Line.cpp index 56f776e9cb..6818220e62 100644 --- a/Userland/Libraries/LibVT/Line.cpp +++ b/Userland/Libraries/LibVT/Line.cpp @@ -114,7 +114,7 @@ bool Line::has_only_one_background_color() const void Line::convert_to_utf32() { - ASSERT(!m_utf32); + VERIFY(!m_utf32); auto* new_code_points = new u32[m_length]; for (size_t i = 0; i < m_length; ++i) { new_code_points[i] = m_code_points.as_u8[i]; diff --git a/Userland/Libraries/LibVT/Terminal.cpp b/Userland/Libraries/LibVT/Terminal.cpp index 6a25ccccfb..6d61c1853f 100644 --- a/Userland/Libraries/LibVT/Terminal.cpp +++ b/Userland/Libraries/LibVT/Terminal.cpp @@ -744,8 +744,8 @@ void Terminal::set_cursor(unsigned a_row, unsigned a_column) unsigned column = min(a_column, m_columns - 1u); if (row == m_cursor_row && column == m_cursor_column) return; - ASSERT(row < rows()); - ASSERT(column < columns()); + VERIFY(row < rows()); + VERIFY(column < columns()); invalidate_cursor(); m_cursor_row = row; m_cursor_column = column; @@ -755,8 +755,8 @@ void Terminal::set_cursor(unsigned a_row, unsigned a_column) void Terminal::put_character_at(unsigned row, unsigned column, u32 code_point) { - ASSERT(row < rows()); - ASSERT(column < columns()); + VERIFY(row < rows()); + VERIFY(column < columns()); auto& line = m_lines[row]; line.set_code_point(column, code_point); line.attributes()[column] = m_current_attribute; diff --git a/Userland/Libraries/LibVT/Terminal.h b/Userland/Libraries/LibVT/Terminal.h index a1e383d109..50090f7dfa 100644 --- a/Userland/Libraries/LibVT/Terminal.h +++ b/Userland/Libraries/LibVT/Terminal.h @@ -244,7 +244,7 @@ private: return; if (m_history.size() < max_history_size()) { - ASSERT(m_history_start == 0); + VERIFY(m_history_start == 0); m_history.append(move(line)); return; } diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index b315d4185b..ba17011f98 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -590,7 +590,7 @@ VT::Position TerminalWidget::buffer_position_at(const Gfx::IntPoint& position) c u32 TerminalWidget::code_point_at(const VT::Position& position) const { - ASSERT(position.row() >= 0 && static_cast<size_t>(position.row()) < m_terminal.line_count()); + VERIFY(position.row() >= 0 && static_cast<size_t>(position.row()) < m_terminal.line_count()); auto& line = m_terminal.line(position.row()); if (position.column() == line.length()) return '\n'; @@ -599,7 +599,7 @@ u32 TerminalWidget::code_point_at(const VT::Position& position) const VT::Position TerminalWidget::next_position_after(const VT::Position& position, bool should_wrap) const { - ASSERT(position.row() >= 0 && static_cast<size_t>(position.row()) < m_terminal.line_count()); + VERIFY(position.row() >= 0 && static_cast<size_t>(position.row()) < m_terminal.line_count()); auto& line = m_terminal.line(position.row()); if (position.column() == line.length()) { if (static_cast<size_t>(position.row()) == m_terminal.line_count() - 1) { @@ -614,7 +614,7 @@ VT::Position TerminalWidget::next_position_after(const VT::Position& position, b VT::Position TerminalWidget::previous_position_before(const VT::Position& position, bool should_wrap) const { - ASSERT(position.row() >= 0 && static_cast<size_t>(position.row()) < m_terminal.line_count()); + VERIFY(position.row() >= 0 && static_cast<size_t>(position.row()) < m_terminal.line_count()); if (position.column() == 0) { if (position.row() == 0) { if (should_wrap) { @@ -747,7 +747,7 @@ void TerminalWidget::paste() int nwritten = write(m_ptm_fd, text.data(), text.size()); if (nwritten < 0) { perror("write"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp index 2abd1f54f2..1a7bfb2719 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp @@ -110,7 +110,7 @@ static DOM::Window* impl_from(JS::VM& vm, JS::GlobalObject& global_object) { auto* this_object = vm.this_value(global_object).to_object(global_object); if (!this_object) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return nullptr; } if (StringView("WindowObject") != this_object->class_name()) { @@ -317,7 +317,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::atob) // decode_base64() returns a byte string. LibJS uses UTF-8 for strings. Use Latin1Decoder to convert bytes 128-255 to UTF-8. auto decoder = TextCodec::decoder_for("windows-1252"); - ASSERT(decoder); + VERIFY(decoder); return JS::js_string(vm, decoder->to_utf8(decoded)); } diff --git a/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp b/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp index b257a378a6..13d3f662fd 100644 --- a/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp +++ b/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp @@ -36,7 +36,7 @@ Wrappable::~Wrappable() void Wrappable::set_wrapper(Wrapper& wrapper) { - ASSERT(!m_wrapper); + VERIFY(!m_wrapper); m_wrapper = wrapper.make_weak_ptr(); } diff --git a/Userland/Libraries/LibWeb/CSS/Length.cpp b/Userland/Libraries/LibWeb/CSS/Length.cpp index 08b2ca500f..a2a55c81ba 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.cpp +++ b/Userland/Libraries/LibWeb/CSS/Length.cpp @@ -55,7 +55,7 @@ float Length::relative_length_to_px(const Layout::Node& layout_node) const return max(viewport.width(), viewport.height()) * (m_value / 100); } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -97,7 +97,7 @@ const char* Length::unit_name() const case Type::Vmin: return "vmin"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibWeb/CSS/Length.h b/Userland/Libraries/LibWeb/CSS/Length.h index bce76a059c..78ee24f5de 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.h +++ b/Userland/Libraries/LibWeb/CSS/Length.h @@ -143,7 +143,7 @@ public: case Type::Undefined: case Type::Percentage: default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp index ad5ab28745..87fcde8d6e 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp @@ -33,11 +33,11 @@ #include <stdlib.h> #include <string.h> -#define PARSE_ASSERT(x) \ +#define PARSE_VERIFY(x) \ if (!(x)) { \ dbgln("CSS PARSER ASSERTION FAILED: {}", #x); \ dbgln("At character# {} in CSS: _{}_", index, css); \ - ASSERT_NOT_REACHED(); \ + VERIFY_NOT_REACHED(); \ } #define PARSE_ERROR() \ @@ -344,7 +344,7 @@ public: char consume_one() { - PARSE_ASSERT(index < css.length()); + PARSE_VERIFY(index < css.length()); return css[index++]; }; @@ -424,7 +424,7 @@ public: if (type != CSS::Selector::SimpleSelector::Type::Universal) { while (is_valid_selector_char(peek())) buffer.append(consume_one()); - PARSE_ASSERT(!buffer.is_null()); + PARSE_VERIFY(!buffer.is_null()); } auto value = String::copy(buffer); @@ -593,7 +593,7 @@ public: break; simple_selectors.append(component.value()); // If this assert triggers, we're most likely up to no good. - PARSE_ASSERT(simple_selectors.size() < 100); + PARSE_VERIFY(simple_selectors.size() < 100); } if (simple_selectors.is_empty()) @@ -682,7 +682,7 @@ public: continue; } if (ch == ')') { - PARSE_ASSERT(paren_nesting_level > 0); + PARSE_VERIFY(paren_nesting_level > 0); --paren_nesting_level; buffer.append(consume_one()); continue; diff --git a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp index 5f553e2be0..a1db87f78f 100644 --- a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp +++ b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp @@ -119,7 +119,7 @@ static bool matches(const CSS::Selector::SimpleSelector& component, const DOM::E case CSS::Selector::SimpleSelector::Type::TagName: return component.value == element.local_name(); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -134,7 +134,7 @@ static bool matches(const CSS::Selector& selector, int component_list_index, con case CSS::Selector::ComplexSelector::Relation::None: return true; case CSS::Selector::ComplexSelector::Relation::Descendant: - ASSERT(component_list_index != 0); + VERIFY(component_list_index != 0); for (auto* ancestor = element.parent(); ancestor; ancestor = ancestor->parent()) { if (!is<DOM::Element>(*ancestor)) continue; @@ -143,29 +143,29 @@ static bool matches(const CSS::Selector& selector, int component_list_index, con } return false; case CSS::Selector::ComplexSelector::Relation::ImmediateChild: - ASSERT(component_list_index != 0); + VERIFY(component_list_index != 0); if (!element.parent() || !is<DOM::Element>(*element.parent())) return false; return matches(selector, component_list_index - 1, downcast<DOM::Element>(*element.parent())); case CSS::Selector::ComplexSelector::Relation::AdjacentSibling: - ASSERT(component_list_index != 0); + VERIFY(component_list_index != 0); if (auto* sibling = element.previous_element_sibling()) return matches(selector, component_list_index - 1, *sibling); return false; case CSS::Selector::ComplexSelector::Relation::GeneralSibling: - ASSERT(component_list_index != 0); + VERIFY(component_list_index != 0); for (auto* sibling = element.previous_element_sibling(); sibling; sibling = sibling->previous_element_sibling()) { if (matches(selector, component_list_index - 1, *sibling)) return true; } return false; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool matches(const CSS::Selector& selector, const DOM::Element& element) { - ASSERT(!selector.complex_selectors().is_empty()); + VERIFY(!selector.complex_selectors().is_empty()); return matches(selector, selector.complex_selectors().size() - 1, element); } diff --git a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp b/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp index da6f2a6fd9..2ced865baa 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp @@ -188,7 +188,7 @@ static bool contains(Edge a, Edge b) static inline void set_property_border_width(StyleProperties& style, const StyleValue& value, Edge edge) { - ASSERT(value.is_length()); + VERIFY(value.is_length()); if (contains(Edge::Top, edge)) style.set_property(CSS::PropertyID::BorderTopWidth, value); if (contains(Edge::Right, edge)) @@ -201,7 +201,7 @@ static inline void set_property_border_width(StyleProperties& style, const Style static inline void set_property_border_color(StyleProperties& style, const StyleValue& value, Edge edge) { - ASSERT(value.is_color()); + VERIFY(value.is_color()); if (contains(Edge::Top, edge)) style.set_property(CSS::PropertyID::BorderTopColor, value); if (contains(Edge::Right, edge)) @@ -214,7 +214,7 @@ static inline void set_property_border_color(StyleProperties& style, const Style static inline void set_property_border_style(StyleProperties& style, const StyleValue& value, Edge edge) { - ASSERT(value.is_string()); + VERIFY(value.is_string()); if (contains(Edge::Top, edge)) style.set_property(CSS::PropertyID::BorderTopStyle, value); if (contains(Edge::Right, edge)) diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp index c6d6b503bf..65905b54d5 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp @@ -54,7 +54,7 @@ Color IdentifierStyleValue::to_color(const DOM::Document& document) const if (id() == CSS::ValueID::LibwebLink) return document.link_color(); - ASSERT(document.page()); + VERIFY(document.page()); auto palette = document.page()->palette(); switch (id()) { case CSS::ValueID::LibwebPaletteDesktopBackground: diff --git a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp.cpp b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp.cpp index 2b7b2218c7..1fde66eee3 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp.cpp @@ -58,8 +58,8 @@ int main(int argc, char** argv) return 1; auto json = JsonValue::from_string(file->read_all()); - ASSERT(json.has_value()); - ASSERT(json.value().is_object()); + VERIFY(json.has_value()); + VERIFY(json.value().is_object()); StringBuilder builder; SourceGenerator generator { builder }; @@ -75,7 +75,7 @@ PropertyID property_id_from_string(const StringView& string) )~~~"); json.value().as_object().for_each_member([&](auto& name, auto& value) { - ASSERT(value.is_object()); + VERIFY(value.is_object()); auto member_generator = generator.fork(); member_generator.set("name", name); @@ -95,7 +95,7 @@ const char* string_from_property_id(PropertyID property_id) { )~~~"); json.value().as_object().for_each_member([&](auto& name, auto& value) { - ASSERT(value.is_object()); + VERIFY(value.is_object()); auto member_generator = generator.fork(); member_generator.set("name", name); diff --git a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h.cpp b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h.cpp index e2f235db62..6391df70f4 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h.cpp @@ -58,8 +58,8 @@ int main(int argc, char** argv) return 1; auto json = JsonValue::from_string(file->read_all()); - ASSERT(json.has_value()); - ASSERT(json.value().is_object()); + VERIFY(json.has_value()); + VERIFY(json.value().is_object()); StringBuilder builder; SourceGenerator generator { builder }; @@ -76,7 +76,7 @@ enum class PropertyID { )~~~"); json.value().as_object().for_each_member([&](auto& name, auto& value) { - ASSERT(value.is_object()); + VERIFY(value.is_object()); auto member_generator = generator.fork(); member_generator.set("name:titlecase", title_casify(name)); diff --git a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_cpp.cpp b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_cpp.cpp index 4991a4040a..0fb443bcc6 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_cpp.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_cpp.cpp @@ -58,8 +58,8 @@ int main(int argc, char** argv) return 1; auto json = JsonValue::from_string(file->read_all()); - ASSERT(json.has_value()); - ASSERT(json.value().is_array()); + VERIFY(json.has_value()); + VERIFY(json.value().is_array()); StringBuilder builder; SourceGenerator generator { builder }; diff --git a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_h.cpp b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_h.cpp index 7c85ade83f..03b474908c 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_h.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_h.cpp @@ -58,8 +58,8 @@ int main(int argc, char** argv) return 1; auto json = JsonValue::from_string(file->read_all()); - ASSERT(json.has_value()); - ASSERT(json.value().is_array()); + VERIFY(json.has_value()); + VERIFY(json.value().is_array()); StringBuilder builder; SourceGenerator generator { builder }; diff --git a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp index 5b257c1b0d..7a7449ed0b 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp @@ -585,7 +585,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter )~~~"); } else { dbgln("Unimplemented JS-to-C++ conversion: {}", parameter.type.name); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }; diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index d4f2170f1b..242b2924b8 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -89,8 +89,8 @@ Document::~Document() void Document::removed_last_ref() { - ASSERT(!ref_count()); - ASSERT(!m_deletion_has_begun); + VERIFY(!ref_count()); + VERIFY(!m_deletion_has_begun); if (m_referencing_node_count) { // The document has reached ref_count==0 but still has nodes keeping it alive. @@ -121,8 +121,8 @@ void Document::removed_last_ref() }); for (auto& node : descendants) { - ASSERT(&node.document() == this); - ASSERT(!node.is_document()); + VERIFY(&node.document() == this); + VERIFY(!node.is_document()); if (node.parent()) node.parent()->remove_child(node); } @@ -299,7 +299,7 @@ void Document::attach_to_frame(Badge<Frame>, Frame& frame) void Document::detach_from_frame(Badge<Frame>, Frame& frame) { - ASSERT(&frame == m_frame); + VERIFY(&frame == m_frame); tear_down_layout_tree(); m_frame = nullptr; } diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index e789df05a3..30c4c17b32 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -259,14 +259,14 @@ private: void increment_referencing_node_count() { - ASSERT(!m_deletion_has_begun); + VERIFY(!m_deletion_has_begun); ++m_referencing_node_count; } void decrement_referencing_node_count() { - ASSERT(!m_deletion_has_begun); - ASSERT(m_referencing_node_count); + VERIFY(!m_deletion_has_begun); + VERIFY(m_referencing_node_count); --m_referencing_node_count; if (!m_referencing_node_count && !ref_count()) { m_deletion_has_begun = true; diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 10e2bda733..24b063d5cd 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -131,7 +131,7 @@ RefPtr<Layout::Node> Element::create_layout_node() switch (display) { case CSS::Display::None: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; case CSS::Display::Block: return adopt(*new Layout::BlockBox(document(), this, move(style))); @@ -164,7 +164,7 @@ RefPtr<Layout::Node> Element::create_layout_node() // FIXME: This is just an incorrect placeholder until we improve table layout support. return adopt(*new Layout::BlockBox(document(), this, move(style))); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Element::parse_attribute(const FlyString& name, const String& value) @@ -214,7 +214,7 @@ static StyleDifference compute_style_difference(const CSS::StyleProperties& old_ void Element::recompute_style() { set_needs_style_update(false); - ASSERT(parent()); + VERIFY(parent()); auto old_specified_css_values = m_specified_css_values; auto new_specified_css_values = document().style_resolver().resolve_style(*this); m_specified_css_values = new_specified_css_values; diff --git a/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp b/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp index e45b42c23e..1ec7f8b96b 100644 --- a/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp @@ -136,7 +136,7 @@ void EventDispatcher::invoke(Event::PathEntry& struct_, Event& event, Event::Pha return entry.index <= struct_.index && !entry.shadow_adjusted_target.is_null(); }); - ASSERT(last_valid_shadow_adjusted_target.has_value()); + VERIFY(last_valid_shadow_adjusted_target.has_value()); event.set_target(last_valid_shadow_adjusted_target.value().shadow_adjusted_target); event.set_related_target(struct_.related_target); @@ -249,7 +249,7 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr< return !entry.shadow_adjusted_target.is_null(); }); - ASSERT(clear_targets_struct.has_value()); + VERIFY(clear_targets_struct.has_value()); if (is<Node>(clear_targets_struct.value().shadow_adjusted_target.ptr())) { auto& shadow_adjusted_target_node = downcast<Node>(*clear_targets_struct.value().shadow_adjusted_target); diff --git a/Userland/Libraries/LibWeb/DOM/EventListener.cpp b/Userland/Libraries/LibWeb/DOM/EventListener.cpp index eb64bfa503..ad9f0cd3e7 100644 --- a/Userland/Libraries/LibWeb/DOM/EventListener.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventListener.cpp @@ -31,7 +31,7 @@ namespace Web::DOM { JS::Function& EventListener::function() { - ASSERT(m_function.cell()); + VERIFY(m_function.cell()); return *m_function.cell(); } diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index 26204538bc..d66c33e138 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -54,7 +54,7 @@ Node::Node(Document& document, NodeType type) Node::~Node() { - ASSERT(m_deletion_has_begun); + VERIFY(m_deletion_has_begun); if (layout_node() && layout_node()->parent()) layout_node()->parent()->remove_child(*layout_node()); diff --git a/Userland/Libraries/LibWeb/DOM/Window.cpp b/Userland/Libraries/LibWeb/DOM/Window.cpp index b6fae82ebf..0b7f66afc4 100644 --- a/Userland/Libraries/LibWeb/DOM/Window.cpp +++ b/Userland/Libraries/LibWeb/DOM/Window.cpp @@ -95,7 +95,7 @@ i32 Window::set_timeout(JS::Function& callback, i32 interval) void Window::timer_did_fire(Badge<Timer>, Timer& timer) { // We should not be here if there's no JS wrapper for the Window object. - ASSERT(wrapper()); + VERIFY(wrapper()); auto& vm = wrapper()->vm(); // NOTE: This protector pointer keeps the timer alive until the end of this function no matter what. diff --git a/Userland/Libraries/LibWeb/DOMTreeModel.cpp b/Userland/Libraries/LibWeb/DOMTreeModel.cpp index 76c0e39769..ad732548d5 100644 --- a/Userland/Libraries/LibWeb/DOMTreeModel.cpp +++ b/Userland/Libraries/LibWeb/DOMTreeModel.cpp @@ -79,7 +79,7 @@ GUI::ModelIndex DOMTreeModel::parent_index(const GUI::ModelIndex& index) const ++grandparent_child_index; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } diff --git a/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp b/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp index 46585e80d9..c41be830a8 100644 --- a/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp +++ b/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp @@ -70,7 +70,7 @@ void GlobalEventHandlers::set_event_handler_attribute(const FlyString& name, HTM return; } auto* function = JS::ScriptFunction::create(self.script_execution_context()->interpreter().global_object(), name, program->body(), program->parameters(), program->function_length(), nullptr, false, false); - ASSERT(function); + VERIFY(function); listener = adopt(*new DOM::EventListener(JS::make_handle(static_cast<JS::Function*>(function)))); } if (listener) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp index d2f071314d..4b6462417e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp @@ -53,7 +53,7 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co if (color.has_value()) style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value())); } else if (name.equals_ignoring_case("background")) { - ASSERT(m_background_style_value); + VERIFY(m_background_style_value); style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value); } }); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp index 9144211b07..259f88083d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp @@ -65,7 +65,7 @@ RefPtr<Layout::Node> HTMLCanvasElement::create_layout_node() CanvasRenderingContext2D* HTMLCanvasElement::get_context(String type) { - ASSERT(type == "2d"); + VERIFY(type == "2d"); if (!m_context) m_context = CanvasRenderingContext2D::create(*this); return m_context; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index 36fff8b52c..73113dd242 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -73,7 +73,7 @@ bool HTMLElement::is_editable() const case ContentEditableState::Inherit: return parent() && parent()->is_editable(); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -87,7 +87,7 @@ String HTMLElement::content_editable() const case ContentEditableState::Inherit: return "inherit"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index d4fe2cb37f..06b942e076 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -44,7 +44,7 @@ namespace Web::HTML { HTMLIFrameElement::HTMLIFrameElement(DOM::Document& document, QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - ASSERT(document.frame()); + VERIFY(document.frame()); m_content_frame = Frame::create_subframe(*this, document.frame()->main_frame()); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index d2005bb4b0..8fcf9edaff 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -56,7 +56,7 @@ void HTMLLinkElement::resource_did_fail() void HTMLLinkElement::resource_did_load() { - ASSERT(resource()); + VERIFY(resource()); if (!resource()->has_encoded_data()) return; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp index 9eeaa8b9ec..e3a64bcbb9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp @@ -93,7 +93,7 @@ void HTMLScriptElement::execute_script() document().set_current_script({}, old_current_script); } else { - ASSERT(!document().current_script()); + VERIFY(!document().current_script()); TODO(); } diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp index 8320416d20..fd7a1655a3 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp @@ -267,7 +267,7 @@ void HTMLDocumentParser::process_using_the_rules_for(InsertionMode mode, HTMLTok handle_after_after_frameset(token); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -429,7 +429,7 @@ HTMLDocumentParser::AdjustedInsertionLocation HTMLDocumentParser::find_appropria return { downcast<HTMLTemplateElement>(last_template.element)->content(), nullptr }; } if (!last_table.element) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); // Guaranteed not to be a template element (it will be the html element), // so no need to check the parent is a template. return { m_stack_of_open_elements.elements().first(), nullptr }; @@ -903,7 +903,7 @@ void HTMLDocumentParser::reconstruct_the_active_formatting_elements() ssize_t index = m_list_of_active_formatting_elements.entries().size() - 1; RefPtr<DOM::Element> entry = m_list_of_active_formatting_elements.entries().at(index).element; - ASSERT(entry); + VERIFY(entry); Rewind: if (index == 0) { @@ -912,7 +912,7 @@ Rewind: --index; entry = m_list_of_active_formatting_elements.entries().at(index).element; - ASSERT(entry); + VERIFY(entry); if (!m_stack_of_open_elements.contains(*entry)) goto Rewind; @@ -920,7 +920,7 @@ Rewind: Advance: ++index; entry = m_list_of_active_formatting_elements.entries().at(index).element; - ASSERT(entry); + VERIFY(entry); Create: // FIXME: Hold on to the real token! @@ -1140,7 +1140,7 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token) if (m_stack_of_open_elements.elements().size() == 1 || m_stack_of_open_elements.elements().at(1).local_name() != HTML::TagNames::body || m_stack_of_open_elements.contains(HTML::TagNames::template_)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } m_frameset_ok = false; @@ -1158,7 +1158,7 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token) if (m_stack_of_open_elements.elements().size() == 1 || m_stack_of_open_elements.elements().at(1).local_name() != HTML::TagNames::body) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } @@ -1863,7 +1863,7 @@ void HTMLDocumentParser::increment_script_nesting_level() void HTMLDocumentParser::decrement_script_nesting_level() { - ASSERT(m_script_nesting_level); + VERIFY(m_script_nesting_level); --m_script_nesting_level; } @@ -1917,7 +1917,7 @@ void HTMLDocumentParser::handle_text(HTMLToken& token) if (the_script->failed_to_load()) return; - ASSERT(the_script->is_ready_to_be_parser_executed()); + VERIFY(the_script->is_ready_to_be_parser_executed()); if (m_aborted) return; @@ -1926,13 +1926,13 @@ void HTMLDocumentParser::handle_text(HTMLToken& token) // FIXME: Handle tokenizer insertion point stuff here too. - ASSERT(script_nesting_level() == 0); + VERIFY(script_nesting_level() == 0); increment_script_nesting_level(); the_script->execute_script(); decrement_script_nesting_level(); - ASSERT(script_nesting_level() == 0); + VERIFY(script_nesting_level() == 0); m_parser_pause_flag = false; // FIXME: Handle tokenizer insertion point stuff here too. @@ -1955,7 +1955,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_context() m_stack_of_open_elements.pop(); if (current_node().local_name() == HTML::TagNames::html) - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); } void HTMLDocumentParser::clear_the_stack_back_to_a_table_row_context() @@ -1964,7 +1964,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_row_context() m_stack_of_open_elements.pop(); if (current_node().local_name() == HTML::TagNames::html) - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); } void HTMLDocumentParser::clear_the_stack_back_to_a_table_body_context() @@ -1973,7 +1973,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_body_context() m_stack_of_open_elements.pop(); if (current_node().local_name() == HTML::TagNames::html) - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); } void HTMLDocumentParser::handle_in_row(HTMLToken& token) @@ -2068,7 +2068,7 @@ void HTMLDocumentParser::handle_in_cell(HTMLToken& token) } if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr)) { if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::td) && !m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::th)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); PARSE_ERROR(); return; } @@ -2109,7 +2109,7 @@ void HTMLDocumentParser::handle_in_table_text(HTMLToken& token) } for (auto& pending_token : m_pending_table_character_tokens) { - ASSERT(pending_token.is_character()); + VERIFY(pending_token.is_character()); if (!pending_token.is_parser_whitespace()) { // If any of the tokens in the pending table character tokens list // are character tokens that are not ASCII whitespace, then this is a parse error: @@ -2401,7 +2401,7 @@ void HTMLDocumentParser::handle_in_select(HTMLToken& token) if (token.is_end_tag() && token.tag_name() == HTML::TagNames::select) { if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); PARSE_ERROR(); return; } @@ -2414,7 +2414,7 @@ void HTMLDocumentParser::handle_in_select(HTMLToken& token) PARSE_ERROR(); if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } @@ -2427,7 +2427,7 @@ void HTMLDocumentParser::handle_in_select(HTMLToken& token) PARSE_ERROR(); if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } @@ -2459,7 +2459,7 @@ void HTMLDocumentParser::handle_in_caption(HTMLToken& token) { if (token.is_end_tag() && token.tag_name() == HTML::TagNames::caption) { if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::caption)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); PARSE_ERROR(); return; } @@ -2479,7 +2479,7 @@ void HTMLDocumentParser::handle_in_caption(HTMLToken& token) if ((token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr)) || (token.is_end_tag() && token.tag_name() == HTML::TagNames::table)) { if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::caption)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); PARSE_ERROR(); return; } @@ -2634,7 +2634,7 @@ void HTMLDocumentParser::handle_in_template(HTMLToken& token) if (token.is_end_of_file()) { if (!m_stack_of_open_elements.contains(HTML::TagNames::template_)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); stop_parsing(); return; } @@ -2849,7 +2849,7 @@ void HTMLDocumentParser::process_using_the_rules_for_foreign_content(HTMLToken& PARSE_ERROR(); for (ssize_t i = m_stack_of_open_elements.elements().size() - 1; i >= 0; --i) { if (node == m_stack_of_open_elements.first()) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } // FIXME: See the above FIXME @@ -2870,7 +2870,7 @@ void HTMLDocumentParser::process_using_the_rules_for_foreign_content(HTMLToken& } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void HTMLDocumentParser::reset_the_insertion_mode_appropriately() @@ -2935,14 +2935,14 @@ void HTMLDocumentParser::reset_the_insertion_mode_appropriately() } if (node->local_name() == HTML::TagNames::frameset) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); m_insertion_mode = InsertionMode::InFrameset; return; } if (node->local_name() == HTML::TagNames::html) { if (!m_head_element) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); m_insertion_mode = InsertionMode::BeforeHead; return; } @@ -2952,7 +2952,7 @@ void HTMLDocumentParser::reset_the_insertion_mode_appropriately() } } - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); m_insertion_mode = InsertionMode::InBody; } @@ -2965,7 +2965,7 @@ const char* HTMLDocumentParser::insertion_mode_name() const ENUMERATE_INSERTION_MODES #undef __ENUMERATE_INSERTION_MODE } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } DOM::Document& HTMLDocumentParser::document() diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp index 53a2357be5..38652bdb4e 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp @@ -55,7 +55,7 @@ String HTMLToken::to_string() const builder.append("EndOfFile"); break; case HTMLToken::Type::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (type() == HTMLToken::Type::StartTag || type() == HTMLToken::Type::EndTag) { diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h index c2246229c6..fcfad6e34b 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h @@ -75,9 +75,9 @@ public: u32 code_point() const { - ASSERT(is_character()); + VERIFY(is_character()); Utf8View view(m_comment_or_character.data.string_view()); - ASSERT(view.length() == 1); + VERIFY(view.length() == 1); return *view.begin(); } @@ -100,19 +100,19 @@ public: String tag_name() const { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); return m_tag.tag_name.to_string(); } bool is_self_closing() const { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); return m_tag.self_closing; } bool has_acknowledged_self_closing_flag() const { - ASSERT(is_self_closing()); + VERIFY(is_self_closing()); return m_tag.self_closing_acknowledged; } @@ -124,7 +124,7 @@ public: StringView attribute(const FlyString& attribute_name) { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); for (auto& attribute : m_tag.attributes) { if (attribute_name == attribute.local_name_builder.string_view()) return attribute.value_builder.string_view(); @@ -139,7 +139,7 @@ public: void adjust_tag_name(const FlyString& old_name, const FlyString& new_name) { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); if (old_name == m_tag.tag_name.string_view()) { m_tag.tag_name.clear(); m_tag.tag_name.append(new_name); @@ -148,7 +148,7 @@ public: void adjust_attribute_name(const FlyString& old_name, const FlyString& new_name) { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); for (auto& attribute : m_tag.attributes) { if (old_name == attribute.local_name_builder.string_view()) { attribute.local_name_builder.clear(); @@ -159,7 +159,7 @@ public: void adjust_foreign_attribute(const FlyString& old_name, const FlyString& prefix, const FlyString& local_name, const FlyString& namespace_) { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); for (auto& attribute : m_tag.attributes) { if (old_name == attribute.local_name_builder.string_view()) { attribute.prefix_builder.clear(); @@ -176,7 +176,7 @@ public: void drop_attributes() { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); m_tag.attributes.clear(); } diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp index 6aa94b1163..2b35432a19 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp @@ -189,7 +189,7 @@ namespace Web::HTML { { #define END_STATE \ - ASSERT_NOT_REACHED(); \ + VERIFY_NOT_REACHED(); \ break; \ } \ } \ @@ -2610,7 +2610,7 @@ void HTMLTokenizer::create_new_token(HTMLToken::Type type) HTMLTokenizer::HTMLTokenizer(const StringView& input, const String& encoding) { auto* decoder = TextCodec::decoder_for(encoding); - ASSERT(decoder); + VERIFY(decoder); m_decoded_input = decoder->to_utf8(input); m_utf8_view = Utf8View(m_decoded_input); m_utf8_iterator = m_utf8_view.begin(); @@ -2640,7 +2640,7 @@ void HTMLTokenizer::will_emit(HTMLToken& token) bool HTMLTokenizer::current_end_tag_token_is_appropriate() const { - ASSERT(m_current_token.is_end_tag()); + VERIFY(m_current_token.is_end_tag()); if (!m_last_emitted_start_tag.is_start_tag()) return false; return m_current_token.tag_name() == m_last_emitted_start_tag.tag_name(); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h index 787bc12b46..e0c84271c4 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h @@ -152,7 +152,7 @@ private: ENUMERATE_TOKENIZER_STATES #undef __ENUMERATE_TOKENIZER_STATE }; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void will_emit(HTMLToken&); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp index 2406711bff..502e8e0c6b 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp @@ -45,7 +45,7 @@ bool StackOfOpenElements::has_in_scope_impl(const FlyString& tag_name, const Vec if (list.contains_slow(node.local_name())) return false; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool StackOfOpenElements::has_in_scope(const FlyString& tag_name) const @@ -62,7 +62,7 @@ bool StackOfOpenElements::has_in_scope_impl(const DOM::Element& target_node, con if (list.contains_slow(node.local_name())) return false; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool StackOfOpenElements::has_in_scope(const DOM::Element& target_node) const diff --git a/Userland/Libraries/LibWeb/InProcessWebView.cpp b/Userland/Libraries/LibWeb/InProcessWebView.cpp index b74cc8828c..7f664b3920 100644 --- a/Userland/Libraries/LibWeb/InProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/InProcessWebView.cpp @@ -96,8 +96,8 @@ void InProcessWebView::select_all() last_layout_node = layout_node; } - ASSERT(first_layout_node); - ASSERT(last_layout_node); + VERIFY(first_layout_node); + VERIFY(last_layout_node); int last_layout_node_index_in_node = 0; if (is<Layout::TextNode>(*last_layout_node)) @@ -114,7 +114,7 @@ String InProcessWebView::selected_text() const void InProcessWebView::page_did_layout() { - ASSERT(layout_root()); + VERIFY(layout_root()); set_content_size(layout_root()->size().to_type<int>()); } diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index bb7def7bb5..2f1c1e96b4 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -359,7 +359,7 @@ void BlockFormattingContext::layout_block_level_children(Box& box, LayoutMode la void BlockFormattingContext::place_block_level_replaced_element_in_normal_flow(Box& child_box, Box& containing_block) { - ASSERT(!containing_block.is_absolutely_positioned()); + VERIFY(!containing_block.is_absolutely_positioned()); auto& replaced_element_box_model = child_box.box_model(); replaced_element_box_model.margin.top = child_box.computed_values().margin().top.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); @@ -472,7 +472,7 @@ void BlockFormattingContext::layout_initial_containing_block(LayoutMode layout_m layout_block_level_children(context_box(), layout_mode); - ASSERT(!icb.children_are_inline()); + VERIFY(!icb.children_are_inline()); // FIXME: The ICB should have the height of the viewport. // Instead of auto-sizing the ICB, we should spill into overflow. @@ -501,7 +501,7 @@ static Gfx::FloatRect rect_in_coordinate_space(const Box& box, const Box& contex void BlockFormattingContext::layout_floating_child(Box& box, Box& containing_block) { - ASSERT(box.is_floating()); + VERIFY(box.is_floating()); compute_width(box); layout_inside(box, LayoutMode::Default); diff --git a/Userland/Libraries/LibWeb/Layout/Box.cpp b/Userland/Libraries/LibWeb/Layout/Box.cpp index 190340f13c..0cea9f0b3f 100644 --- a/Userland/Libraries/LibWeb/Layout/Box.cpp +++ b/Userland/Libraries/LibWeb/Layout/Box.cpp @@ -156,11 +156,11 @@ StackingContext* Box::enclosing_stacking_context() auto& ancestor_box = downcast<Box>(*ancestor); if (!ancestor_box.establishes_stacking_context()) continue; - ASSERT(ancestor_box.stacking_context()); + VERIFY(ancestor_box.stacking_context()); return ancestor_box.stacking_context(); } // We should always reach the Layout::InitialContainingBlockBox stacking context. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool Box::establishes_stacking_context() const @@ -196,7 +196,7 @@ LineBox& Box::add_line_box() float Box::width_of_logical_containing_block() const { auto* containing_block = this->containing_block(); - ASSERT(containing_block); + VERIFY(containing_block); return containing_block->width(); } diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index 11d0c6b7b0..b96fa7d039 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -99,7 +99,7 @@ void FormattingContext::layout_inside(Box& box, LayoutMode layout_mode) context.run(box, layout_mode); } else { // FIXME: This needs refactoring! - ASSERT(is_block_formatting_context()); + VERIFY(is_block_formatting_context()); run(box, layout_mode); } } diff --git a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp index f3210ad941..d0c8b432c6 100644 --- a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp @@ -45,7 +45,7 @@ FrameBox::~FrameBox() void FrameBox::prepare_for_replaced_layout() { - ASSERT(dom_node().content_frame()); + VERIFY(dom_node().content_frame()); set_has_intrinsic_width(true); set_has_intrinsic_height(true); @@ -90,7 +90,7 @@ void FrameBox::did_set_rect() { ReplacedBox::did_set_rect(); - ASSERT(dom_node().content_frame()); + VERIFY(dom_node().content_frame()); dom_node().content_frame()->set_size(size().to_type<int>()); } diff --git a/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp b/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp index 587c9198c8..fa74a76dda 100644 --- a/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp @@ -51,11 +51,11 @@ void InitialContainingBlockBox::build_stacking_context_tree() if (&box == this) return IterationDecision::Continue; if (!box.establishes_stacking_context()) { - ASSERT(!box.stacking_context()); + VERIFY(!box.stacking_context()); return IterationDecision::Continue; } auto* parent_context = box.enclosing_stacking_context(); - ASSERT(parent_context); + VERIFY(parent_context); box.set_stacking_context(make<StackingContext>(box, parent_context)); return IterationDecision::Continue; }); diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp index 50430ce843..0e57f6a184 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp @@ -90,10 +90,10 @@ float InlineFormattingContext::available_width_at_line(size_t line_index) const void InlineFormattingContext::run(Box&, LayoutMode layout_mode) { - ASSERT(containing_block().children_are_inline()); + VERIFY(containing_block().children_are_inline()); containing_block().line_boxes().clear(); containing_block().for_each_child([&](auto& child) { - ASSERT(child.is_inline()); + VERIFY(child.is_inline()); if (is<Box>(child) && child.is_absolutely_positioned()) { layout_absolutely_positioned_element(downcast<Box>(child)); return; diff --git a/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp b/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp index c1f6aa1db9..c7c1d3995b 100644 --- a/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp +++ b/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp @@ -55,7 +55,7 @@ LayoutRange LayoutRange::normalized() const NonnullRefPtr<DOM::Range> LayoutRange::to_dom_range() const { - ASSERT(is_valid()); + VERIFY(is_valid()); auto start = m_start.to_dom_position(); auto end = m_end.to_dom_position(); diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index e62a688513..5c708f42eb 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -114,25 +114,25 @@ HitTestResult Node::hit_test(const Gfx::IntPoint& position, HitTestType type) co const Frame& Node::frame() const { - ASSERT(document().frame()); + VERIFY(document().frame()); return *document().frame(); } Frame& Node::frame() { - ASSERT(document().frame()); + VERIFY(document().frame()); return *document().frame(); } const InitialContainingBlockBox& Node::root() const { - ASSERT(document().layout_node()); + VERIFY(document().layout_node()); return *document().layout_node(); } InitialContainingBlockBox& Node::root() { - ASSERT(document().layout_node()); + VERIFY(document().layout_node()); return *document().layout_node(); } @@ -159,7 +159,7 @@ Gfx::FloatPoint Node::box_type_agnostic_position() const { if (is<Box>(*this)) return downcast<Box>(*this).absolute_position(); - ASSERT(is_inline()); + VERIFY(is_inline()); Gfx::FloatPoint position; if (auto* block = containing_block()) { block->for_each_fragment([&](auto& fragment) { diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp index 23fa3eaf6e..79c5e58784 100644 --- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -115,7 +115,7 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node) if (!m_parent_stack[i]->is_inline() || m_parent_stack[i]->is_inline_block()) return *m_parent_stack[i]; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }(); auto& insertion_point = insertion_parent_for_block_node(nearest_non_inline_ancestor, *layout_node); insertion_point.append_child(*layout_node); @@ -260,7 +260,7 @@ static void for_each_sequence_of_consecutive_children_matching(NodeWithStyle& pa template<typename WrapperBoxType> static void wrap_in_anonymous(NonnullRefPtrVector<Node>& sequence, Node* nearest_sibling) { - ASSERT(!sequence.is_empty()); + VERIFY(!sequence.is_empty()); auto& parent = *sequence.first().parent(); auto computed_values = parent.computed_values().clone_inherited_values(); static_cast<CSS::MutableComputedValues&>(computed_values).set_display(WrapperBoxType::static_display()); diff --git a/Userland/Libraries/LibWeb/LayoutTreeModel.cpp b/Userland/Libraries/LibWeb/LayoutTreeModel.cpp index 440b2fce52..b2caa2d6ca 100644 --- a/Userland/Libraries/LibWeb/LayoutTreeModel.cpp +++ b/Userland/Libraries/LibWeb/LayoutTreeModel.cpp @@ -78,7 +78,7 @@ GUI::ModelIndex LayoutTreeModel::parent_index(const GUI::ModelIndex& index) cons ++grandparent_child_index; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp index 6dcbaa5434..956fa31295 100644 --- a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp @@ -227,7 +227,7 @@ void FrameLoader::load_error_page(const URL& failed_url, const String& error) ResourceLoader::the().load( error_page_url, [this, failed_url, error](auto data, auto&) { - ASSERT(!data.is_null()); + VERIFY(!data.is_null()); #pragma GCC diagnostic ignored "-Wformat-nonliteral" auto html = String::format( String::copy(data).characters(), @@ -235,12 +235,12 @@ void FrameLoader::load_error_page(const URL& failed_url, const String& error) escape_html_entities(error).characters()); #pragma GCC diagnostic pop auto document = HTML::parse_html_document(html, failed_url, "utf-8"); - ASSERT(document); + VERIFY(document); frame().set_document(document); }, [](auto error) { dbgln("Failed to load error page: {}", error); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }); } @@ -279,7 +279,7 @@ void FrameLoader::resource_did_load() if (auto* host_element = frame().host_element()) { // FIXME: Perhaps in the future we'll have a better common base class for <frame> and <iframe> - ASSERT(is<HTML::HTMLIFrameElement>(*host_element)); + VERIFY(is<HTML::HTMLIFrameElement>(*host_element)); downcast<HTML::HTMLIFrameElement>(*host_element).content_frame_did_load({}); } diff --git a/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp b/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp index 30bfa5ab81..4d049c8d5f 100644 --- a/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp @@ -60,7 +60,7 @@ void ImageLoader::set_visible_in_viewport(bool visible_in_viewport) const void ImageLoader::resource_did_load() { - ASSERT(resource()); + VERIFY(resource()); if (!resource()->mime_type().starts_with("image/")) { m_loading_state = LoadingState::Failed; diff --git a/Userland/Libraries/LibWeb/Loader/Resource.cpp b/Userland/Libraries/LibWeb/Loader/Resource.cpp index 03f17b34d1..048d500aec 100644 --- a/Userland/Libraries/LibWeb/Loader/Resource.cpp +++ b/Userland/Libraries/LibWeb/Loader/Resource.cpp @@ -87,7 +87,7 @@ static String mime_type_from_content_type(const String& content_type) void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, const HashMap<String, String, CaseInsensitiveStringTraits>& headers) { - ASSERT(!m_loaded); + VERIFY(!m_loaded); m_encoded_data = ByteBuffer::copy(data); m_response_headers = headers; m_loaded = true; @@ -128,13 +128,13 @@ void Resource::did_fail(Badge<ResourceLoader>, const String& error) void Resource::register_client(Badge<ResourceClient>, ResourceClient& client) { - ASSERT(!m_clients.contains(&client)); + VERIFY(!m_clients.contains(&client)); m_clients.set(&client); } void Resource::unregister_client(Badge<ResourceClient>, ResourceClient& client) { - ASSERT(m_clients.contains(&client)); + VERIFY(m_clients.contains(&client)); m_clients.remove(&client); } @@ -144,7 +144,7 @@ void ResourceClient::set_resource(Resource* resource) m_resource->unregister_client({}, *this); m_resource = resource; if (m_resource) { - ASSERT(resource->type() == client_type()); + VERIFY(resource->type() == client_type()); m_resource->register_client({}, *this); diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp index 29e3467ceb..df60760b4b 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -55,7 +55,7 @@ OutOfProcessWebView::~OutOfProcessWebView() void OutOfProcessWebView::handle_web_content_process_crash() { create_client(); - ASSERT(m_client_state.client); + VERIFY(m_client_state.client); // Don't keep a stale backup bitmap around. m_backup_bitmap = nullptr; @@ -337,7 +337,7 @@ void OutOfProcessWebView::request_repaint() WebContentClient& OutOfProcessWebView::client() { - ASSERT(m_client_state.client); + VERIFY(m_client_state.client); return *m_client_state.client; } diff --git a/Userland/Libraries/LibWeb/Page/Frame.cpp b/Userland/Libraries/LibWeb/Page/Frame.cpp index 2dab2252c3..4c90e16fa1 100644 --- a/Userland/Libraries/LibWeb/Page/Frame.cpp +++ b/Userland/Libraries/LibWeb/Page/Frame.cpp @@ -277,7 +277,7 @@ String Frame::selected_text() const } // End node - ASSERT(layout_node == selection.end().layout_node); + VERIFY(layout_node == selection.end().layout_node); if (is<Layout::TextNode>(*layout_node)) { auto& text = downcast<Layout::TextNode>(*layout_node).text_for_rendering(); builder.append(text.substring(0, selection.end().index_in_node)); @@ -289,13 +289,13 @@ String Frame::selected_text() const void Frame::register_viewport_client(ViewportClient& client) { auto result = m_viewport_clients.set(&client); - ASSERT(result == AK::HashSetResult::InsertedNewEntry); + VERIFY(result == AK::HashSetResult::InsertedNewEntry); } void Frame::unregister_viewport_client(ViewportClient& client) { bool was_removed = m_viewport_clients.remove(&client); - ASSERT(was_removed); + VERIFY(was_removed); } } diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index 7524f4fff9..fc9dbc8d02 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -37,7 +37,7 @@ StackingContext::StackingContext(Box& box, StackingContext* parent) : m_box(box) , m_parent(parent) { - ASSERT(m_parent != this); + VERIFY(m_parent != this); if (m_parent) { m_parent->m_children.append(this); diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp index f812d42dfc..07773c0f72 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp @@ -38,7 +38,7 @@ namespace Web::SVG { static void print_instruction(const PathInstruction& instruction) { - ASSERT(PATH_DEBUG); + VERIFY(PATH_DEBUG); auto& data = instruction.data; @@ -115,7 +115,7 @@ Vector<PathInstruction> PathDataParser::parse() while (!done()) parse_drawto(); if (!m_instructions.is_empty() && m_instructions[0].type != PathInstructionType::Move) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return m_instructions; } @@ -348,7 +348,7 @@ void PathDataParser::parse_whitespace(bool must_match_once) matched = true; } - ASSERT(!must_match_once || matched); + VERIFY(!must_match_once || matched); } void PathDataParser::parse_comma_whitespace() @@ -379,7 +379,7 @@ float PathDataParser::parse_fractional_constant() while (!done() && isdigit(ch())) builder.append(consume()); } else { - ASSERT(builder.length() > 0); + VERIFY(builder.length() > 0); } if (floating_point) @@ -398,7 +398,7 @@ float PathDataParser::parse_number() float PathDataParser::parse_flag() { if (!match('0') && !match('1')) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return consume() - '0'; } @@ -475,7 +475,7 @@ Gfx::Path& SVGPathElement::get_path() if (absolute) { path.move_to(point); } else { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); path.move_to(point + path.segments().last().point()); } break; @@ -488,13 +488,13 @@ Gfx::Path& SVGPathElement::get_path() if (absolute) { path.line_to(point); } else { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); path.line_to(point + path.segments().last().point()); } break; } case PathInstructionType::HorizontalLine: { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); auto last_point = path.segments().last().point(); if (absolute) { path.line_to(Gfx::FloatPoint { data[0], last_point.y() }); @@ -504,7 +504,7 @@ Gfx::Path& SVGPathElement::get_path() break; } case PathInstructionType::VerticalLine: { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); auto last_point = path.segments().last().point(); if (absolute) { path.line_to(Gfx::FloatPoint { last_point.x(), data[0] }); @@ -610,7 +610,7 @@ Gfx::Path& SVGPathElement::get_path() path.quadratic_bezier_curve_to(through, point); m_previous_control_point = through; } else { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); auto last_point = path.segments().last().point(); auto control_point = through + last_point; path.quadratic_bezier_curve_to(control_point, point + last_point); @@ -621,7 +621,7 @@ Gfx::Path& SVGPathElement::get_path() case PathInstructionType::SmoothQuadraticBezierCurve: { clear_last_control_point = false; - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); auto last_point = path.segments().last().point(); if (m_previous_control_point.is_null()) { @@ -650,7 +650,7 @@ Gfx::Path& SVGPathElement::get_path() // with these path instructions, let's just skip them continue; case PathInstructionType::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (clear_last_control_point) { diff --git a/Userland/Libraries/LibWeb/StylePropertiesModel.cpp b/Userland/Libraries/LibWeb/StylePropertiesModel.cpp index 123337db8e..fde0a4898a 100644 --- a/Userland/Libraries/LibWeb/StylePropertiesModel.cpp +++ b/Userland/Libraries/LibWeb/StylePropertiesModel.cpp @@ -58,7 +58,7 @@ String StylePropertiesModel::column_name(int column_index) const case Column::PropertyValue: return "Value"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } GUI::Variant StylePropertiesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const diff --git a/Userland/Libraries/LibWeb/TreeNode.h b/Userland/Libraries/LibWeb/TreeNode.h index 1673a52dc5..c304230e7b 100644 --- a/Userland/Libraries/LibWeb/TreeNode.h +++ b/Userland/Libraries/LibWeb/TreeNode.h @@ -39,15 +39,15 @@ class TreeNode : public Weakable<T> { public: void ref() { - ASSERT(!m_in_removed_last_ref); - ASSERT(m_ref_count); + VERIFY(!m_in_removed_last_ref); + VERIFY(m_ref_count); ++m_ref_count; } void unref() { - ASSERT(!m_in_removed_last_ref); - ASSERT(m_ref_count); + VERIFY(!m_in_removed_last_ref); + VERIFY(m_ref_count); if (!--m_ref_count) { if constexpr (IsBaseOf<DOM::Node, T>::value) { m_in_removed_last_ref = true; @@ -324,7 +324,7 @@ inline void TreeNode<T>::remove_all_children() template<typename T> inline NonnullRefPtr<T> TreeNode<T>::remove_child(NonnullRefPtr<T> node) { - ASSERT(node->m_parent == this); + VERIFY(node->m_parent == this); if (m_first_child == node) m_first_child = node->m_next_sibling; @@ -354,7 +354,7 @@ inline NonnullRefPtr<T> TreeNode<T>::remove_child(NonnullRefPtr<T> node) template<typename T> inline void TreeNode<T>::append_child(NonnullRefPtr<T> node, bool notify) { - ASSERT(!node->m_parent); + VERIFY(!node->m_parent); if (!static_cast<T*>(this)->is_child_allowed(*node)) return; @@ -380,8 +380,8 @@ inline void TreeNode<T>::insert_before(NonnullRefPtr<T> node, RefPtr<T> child, b if (!child) return append_child(move(node), notify); - ASSERT(!node->m_parent); - ASSERT(child->parent() == this); + VERIFY(!node->m_parent); + VERIFY(child->parent() == this); if (!static_cast<T*>(this)->is_child_allowed(*node)) return; @@ -412,7 +412,7 @@ inline void TreeNode<T>::insert_before(NonnullRefPtr<T> node, RefPtr<T> child, b template<typename T> inline void TreeNode<T>::prepend_child(NonnullRefPtr<T> node) { - ASSERT(!node->m_parent); + VERIFY(!node->m_parent); if (!static_cast<T*>(this)->is_child_allowed(*node)) return; diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWeb/WebContentClient.cpp index 56a25cf7f6..ed947be896 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.cpp +++ b/Userland/Libraries/LibWeb/WebContentClient.cpp @@ -39,7 +39,7 @@ WebContentClient::WebContentClient(OutOfProcessWebView& view) void WebContentClient::die() { - ASSERT(on_web_content_process_crash); + VERIFY(on_web_content_process_crash); on_web_content_process_crash(); } diff --git a/Userland/Libraries/LibX86/Instruction.cpp b/Userland/Libraries/LibX86/Instruction.cpp index c8713e723a..eb24a7db3a 100644 --- a/Userland/Libraries/LibX86/Instruction.cpp +++ b/Userland/Libraries/LibX86/Instruction.cpp @@ -195,7 +195,7 @@ static void build(InstructionDescriptor* table, u8 op, const char* mnemonic, Ins static void build_slash(InstructionDescriptor* table, u8 op, u8 slash, const char* mnemonic, InstructionFormat format, InstructionHandler handler, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { InstructionDescriptor& d = table[op]; - ASSERT(d.handler == nullptr); + VERIFY(d.handler == nullptr); d.format = MultibyteWithSlash; d.has_rm = true; if (!d.slashes) @@ -206,11 +206,11 @@ static void build_slash(InstructionDescriptor* table, u8 op, u8 slash, const cha static void build_slash_rm(InstructionDescriptor* table, u8 op, u8 slash, u8 rm, const char* mnemonic, InstructionFormat format, InstructionHandler handler) { - ASSERT((rm & 0xc0) == 0xc0); - ASSERT(((rm >> 3) & 7) == slash); + VERIFY((rm & 0xc0) == 0xc0); + VERIFY(((rm >> 3) & 7) == slash); InstructionDescriptor& d0 = table[op]; - ASSERT(d0.format == MultibyteWithSlash); + VERIFY(d0.format == MultibyteWithSlash); InstructionDescriptor& d = d0.slashes[slash]; if (!d.slashes) { @@ -937,19 +937,19 @@ String MemoryOrRegisterReference::to_string_o32(const Instruction& insn) const String MemoryOrRegisterReference::to_string_fpu_reg() const { - ASSERT(is_register()); + VERIFY(is_register()); return register_name(reg_fpu()); } String MemoryOrRegisterReference::to_string_fpu_mem(const Instruction& insn) const { - ASSERT(!is_register()); + VERIFY(!is_register()); return String::format("[%s]", to_string(insn).characters()); } String MemoryOrRegisterReference::to_string_fpu_ax16() const { - ASSERT(is_register()); + VERIFY(is_register()); return register_name(reg16()); } @@ -976,7 +976,7 @@ String MemoryOrRegisterReference::to_string_fpu64(const Instruction& insn) const String MemoryOrRegisterReference::to_string_fpu80(const Instruction& insn) const { - ASSERT(!is_register()); + VERIFY(!is_register()); return String::format("tbyte ptr [%s]", to_string(insn).characters()); } String MemoryOrRegisterReference::to_string_mm(const Instruction& insn) const @@ -1824,7 +1824,7 @@ void Instruction::to_string_internal(StringBuilder& builder, u32 origin, const S String Instruction::mnemonic() const { if (!m_descriptor) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return m_descriptor->mnemonic; } diff --git a/Userland/Libraries/LibX86/Instruction.h b/Userland/Libraries/LibX86/Instruction.h index 64505856ff..0473841724 100644 --- a/Userland/Libraries/LibX86/Instruction.h +++ b/Userland/Libraries/LibX86/Instruction.h @@ -641,7 +641,7 @@ ALWAYS_INLINE u32 MemoryOrRegisterReference::evaluate_sib(const CPU& cpu, Segmen base += cpu.ebp().value(); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } break; @@ -689,7 +689,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::write32(CPU& cpu, const Instructio template<typename CPU, typename T> ALWAYS_INLINE void MemoryOrRegisterReference::write64(CPU& cpu, const Instruction& insn, T value) { - ASSERT(!is_register()); + VERIFY(!is_register()); auto address = resolve(cpu, insn); cpu.write_memory64(address, value); } @@ -727,7 +727,7 @@ ALWAYS_INLINE typename CPU::ValueWithShadowType32 MemoryOrRegisterReference::rea template<typename CPU> ALWAYS_INLINE typename CPU::ValueWithShadowType64 MemoryOrRegisterReference::read64(CPU& cpu, const Instruction& insn) { - ASSERT(!is_register()); + VERIFY(!is_register()); auto address = resolve(cpu, insn); return cpu.read_memory64(address); } @@ -864,7 +864,7 @@ ALWAYS_INLINE Instruction::Instruction(InstructionStreamType& stream, bool o32, m_imm2 = stream.read32(); break; default: - ASSERT(imm2_bytes == 0); + VERIFY(imm2_bytes == 0); break; } @@ -879,7 +879,7 @@ ALWAYS_INLINE Instruction::Instruction(InstructionStreamType& stream, bool o32, m_imm1 = stream.read32(); break; default: - ASSERT(imm1_bytes == 0); + VERIFY(imm1_bytes == 0); break; } @@ -910,7 +910,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::decode(InstructionStreamType& stre m_displacement32 = stream.read32(); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } else { @@ -925,7 +925,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::decode(InstructionStreamType& stre m_displacement16 = stream.read16(); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } @@ -939,7 +939,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::decode16(InstructionStreamType&) if ((m_rm & 0x07) == 6) m_displacement_bytes = 2; else - ASSERT(m_displacement_bytes == 0); + VERIFY(m_displacement_bytes == 0); break; case 0x40: m_displacement_bytes = 1; @@ -987,7 +987,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::decode32(InstructionStreamType& st m_displacement_bytes = 4; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; } } |