1 # ------------------------------------------------------------------------------
2 # Common tuning option definitions.
3 # ------------------------------------------------------------------------------
5 set(LIBC_COMMON_TUNE_OPTIONS "")
7 option(LIBC_UNSAFE_STRING_WIDE_READ "Functions searching for the first character in a string such as strlen will read the string as int sized blocks instead of bytes. This relies on undefined behavior and may fail on some systems, but improves performance on long strings." OFF)
8 if(LIBC_UNSAFE_STRING_WIDE_READ)
10 message(FATAL_ERROR "LIBC_UNSAFE_STRING_WIDE_READ is set at the same time as a sanitizer. LIBC_UNSAFE_STRING_WIDE_READ causes strlen and memchr to read beyond the end of their target strings, which is undefined behavior caught by sanitizers.")
12 list(APPEND LIBC_COMMON_TUNE_OPTIONS "-DLIBC_COPT_UNSAFE_STRING_WIDE_READ")