CMake: Disable UTF-8 debug checks for release builds

Disable UTF-8 debug checks for release builds for optimization
purposes.

Also remove unused macro that currently lacks a proper use case.

Change version info to be more complete about the build type without
being too verbose.
This commit is contained in:
João Valverde 2022-12-14 16:54:01 +00:00
parent 400235ad7e
commit 2d3de008f5
4 changed files with 12 additions and 16 deletions

View File

@ -459,7 +459,7 @@ set_property(DIRECTORY
"G_DISABLE_SINGLE_INCLUDES"
$<$<OR:$<NOT:$<BOOL:${ENABLE_ASSERT}>>,$<CONFIG:Release>>:WS_DISABLE_ASSERT>
$<$<OR:$<NOT:$<BOOL:${ENABLE_DEBUG}>>,$<CONFIG:Release>>:WS_DISABLE_DEBUG>
$<$<BOOL:${ENABLE_DEBUG_MBS}>:WS_DEBUG_UTF_8>
$<$<OR:$<BOOL:${ENABLE_DEBUG_MBS}>,$<CONFIG:Debug>>:WS_DEBUG_UTF_8>
)
if(WIN32)

View File

@ -54,7 +54,7 @@ option(BUILD_fuzzshark "Build fuzzshark" OFF)
option(ENABLE_WERROR "Treat warnings as errors" ON)
option(ENABLE_DEBUG "Enable debug code" ON)
option(ENABLE_ASSERT "Enable assertions" ON)
option(ENABLE_DEBUG_MBS "Enable extra debug checks for detecting invalid multibyte (UTF-8) strings" ON)
option(ENABLE_DEBUG_MBS "Enable extra debug checks for detecting invalid multibyte (UTF-8) strings" OFF)
option(ENABLE_DEBUG_A2W "Enable line directive from .cnf file" OFF)
option(ENABLE_CCACHE "Speed up compiling and linking using ccache if possible" OFF)

View File

@ -208,18 +208,24 @@ get_compiled_version_info(gather_feature_func gather_compile)
#endif
#ifdef WS_DISABLE_DEBUG
g_string_append(str, ", release build");
g_string_append(str, ", release build (");
#else
g_string_append(str, ", debug build (");
#endif
#ifdef WS_DISABLE_ASSERT
g_string_append(str, ", without assertions");
g_string_append(str, "-assert");
#else
g_string_append(str, "+assert");
#endif
#ifdef WS_DEBUG_UTF_8
g_string_append(str, ", with UTF-8 validation");
g_string_append(str, " +utf8");
#else
g_string_append(str, " -utf8");
#endif
g_string_append(str, ".");
g_string_append(str, ").");
end_string(str);
free_features(&l);

View File

@ -49,16 +49,6 @@ extern "C" {
#define WS_UTF_8_DEBUG_HERE(str, len) \
_CHECK_UTF_8(LOG_LEVEL_ECHO, str, len)
#define WS_UTF_8_SANITIZE_STRBUF(buf) \
do { \
const char *__uni_endptr; \
if (!wmem_strbuf_utf8_validate(buf, &__uni_endptr)) { \
ws_log_utf8(buf->str, buf->len, __uni_endptr); \
wmem_strbuf_utf8_make_valid(buf); \
} \
} while (0)
WSUTIL_EXPORT
int ws_utf8_seqlen[256];