diff options
author | Andreas Kling <kling@serenityos.org> | 2021-02-23 20:42:32 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-23 20:56:54 +0100 |
commit | 5d180d1f996ead27f9c5cb3db7f91e293de34d9d (patch) | |
tree | e881854dac5d749518562970d6194a0ef65736ec /Userland/Libraries/LibC | |
parent | b33a6a443e700cd80325d312f21c985b0687bb97 (diff) | |
download | serenity-5d180d1f996ead27f9c5cb3db7f91e293de34d9d.zip |
Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)
Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.
We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
Diffstat (limited to 'Userland/Libraries/LibC')
-rw-r--r-- | Userland/Libraries/LibC/assert.h | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibC/cxxabi.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/dirent.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/dlfcn.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/getopt.cpp | 14 | ||||
-rw-r--r-- | Userland/Libraries/LibC/libgen.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibC/malloc.cpp | 18 | ||||
-rw-r--r-- | Userland/Libraries/LibC/netdb.cpp | 26 | ||||
-rw-r--r-- | Userland/Libraries/LibC/pwd.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/qsort.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/scanf.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibC/semaphore.cpp | 18 | ||||
-rw-r--r-- | Userland/Libraries/LibC/signal.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/stdio.cpp | 80 | ||||
-rw-r--r-- | Userland/Libraries/LibC/stdlib.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibC/sys/wait.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/syslog.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/termcap.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/time.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/unistd.cpp | 6 |
20 files changed, 109 insertions, 109 deletions
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() |