From c42912b8c96ff1130437e47c163aeb5c1191fe5d Mon Sep 17 00:00:00 2001 From: Amy Huang Date: Fri, 13 Jun 2025 13:07:39 -0700 Subject: [PATCH] Fix string_length function so that it always returns. (#144148) Previously setting LIBC_COPT_STRING_UNSAFE_WIDE_READ would cause a build error because there is a path in the ifdef that doesn't return anything. --- libc/src/string/string_utils.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libc/src/string/string_utils.h b/libc/src/string/string_utils.h index dcbfc7584a30..4f56263fce8e 100644 --- a/libc/src/string/string_utils.h +++ b/libc/src/string/string_utils.h @@ -90,12 +90,11 @@ template LIBC_INLINE size_t string_length(const T *src) { // string a block at a time. if constexpr (cpp::is_same_v) return string_length_wide_read(src); -#else +#endif size_t length; for (length = 0; *src; ++src, ++length) ; return length; -#endif } template