diff --git a/CMakeLists.txt b/CMakeLists.txt index 16142132ac..7e70205ce7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -457,7 +457,6 @@ set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS "G_DISABLE_DEPRECATED" "G_DISABLE_SINGLE_INCLUDES" - $<$>,$>:WS_DISABLE_ASSERT> $<$>,$>:WS_DISABLE_DEBUG> $<$,$>:WS_DEBUG_UTF_8> ) diff --git a/CMakeOptions.txt b/CMakeOptions.txt index daa0356c95..a31187c1f3 100644 --- a/CMakeOptions.txt +++ b/CMakeOptions.txt @@ -53,7 +53,6 @@ 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" OFF) option(ENABLE_DEBUG_A2W "Enable line directive from .cnf file" OFF) diff --git a/doc/README.developer b/doc/README.developer index d9281c9f8e..317dfbaaca 100644 --- a/doc/README.developer +++ b/doc/README.developer @@ -569,8 +569,8 @@ used for that purpose. Use assertions to catch logic errors in your program. A failed assertion indicates a bug in the code. Use ws_assert() instead of g_assert() to -test a logic condition. Note that ws_assert() will be removed with -WS_DISABLE_ASSERT. Therefore assertions should not have any side-effects, +test a logic condition. Note that ws_assert() can be removed at compile +time. Therefore assertions should not have any side-effects, otherwise the program may behave inconsistently. Use ws_assert_not_reached() instead of g_assert_not_reached() for diff --git a/ui/version_info.c b/ui/version_info.c index d5a8b2b38e..6ee5d03170 100644 --- a/ui/version_info.c +++ b/ui/version_info.c @@ -213,12 +213,6 @@ get_compiled_version_info(gather_feature_func gather_compile) g_string_append(str, ", debug build ("); #endif -#ifdef WS_DISABLE_ASSERT - g_string_append(str, "-assert"); -#else - g_string_append(str, "+assert"); -#endif - #ifdef WS_DEBUG_UTF_8 g_string_append(str, " +utf8"); #else diff --git a/wsutil/wmem/wmem-int.h b/wsutil/wmem/wmem-int.h index c4b5d1c94b..4cc14106ba 100644 --- a/wsutil/wmem/wmem-int.h +++ b/wsutil/wmem/wmem-int.h @@ -15,11 +15,11 @@ #include -#ifdef WS_DISABLE_ASSERT +#ifdef WS_DISABLE_DEBUG #define ASSERT(...) (void)0 #else #define ASSERT(...) g_assert(__VA_ARGS__) -#endif /* WS_DISABLE_ASSERT */ +#endif /* WS_DISABLE_DEBUG */ #endif /* __WMEM_INT_H__ */ diff --git a/wsutil/ws_assert.h b/wsutil/ws_assert.h index 4d6531c735..3b394e0616 100644 --- a/wsutil/ws_assert.h +++ b/wsutil/ws_assert.h @@ -16,7 +16,7 @@ #include #include -#ifdef WS_DISABLE_ASSERT +#ifdef WS_DISABLE_DEBUG #define _ASSERT_ENABLED false #else #define _ASSERT_ENABLED true @@ -27,9 +27,9 @@ extern "C" { #endif /* __cplusplus */ /* - * We don't want to execute the expression with WS_DISABLE_ASSERT because + * We don't want to execute the expression with WS_DISABLE_DEBUG because * it might be time and space costly and the goal here is to optimize for - * WS_DISABLE_ASSERT. However removing it completely is not good enough + * WS_DISABLE_DEBUG. However removing it completely is not good enough * because it might generate many unused variable warnings. So we use * if (false) and let the compiler optimize away the dead execution branch. */ @@ -40,7 +40,7 @@ extern "C" { } while (0) /* - * ws_abort_if_fail() is not conditional on WS_DISABLE_ASSERT. + * ws_abort_if_fail() is not conditional on WS_DISABLE_DEBUG. * Usually used to appease a static analyzer. */ #define ws_abort_if_fail(expr) \ @@ -48,7 +48,7 @@ extern "C" { /* * ws_assert() cannot produce side effects, otherwise code will - * behave differently because of WS_DISABLE_ASSERT, and probably introduce + * behave differently because of WS_DISABLE_DEBUG, and probably introduce * some difficult to track bugs. */ #define ws_assert(expr) \ @@ -70,7 +70,7 @@ extern "C" { } while (0) /* - * We don't want to disable ws_assert_not_reached() with WS_DISABLE_ASSERT. + * We don't want to disable ws_assert_not_reached() with WS_DISABLE_DEBUG. * That would blast compiler warnings everywhere for no benefit, not * even a miniscule performance gain. Reaching this function is always * a programming error and will unconditionally abort execution. diff --git a/wsutil/wslog.c b/wsutil/wslog.c index 7061360f96..91adbb0db7 100644 --- a/wsutil/wslog.c +++ b/wsutil/wslog.c @@ -10,18 +10,14 @@ #include "config.h" -/* Because ws_assert() dependes on ws_error() we do not use it - * here and fall back on assert() instead. */ -#if defined(WS_DISABLE_ASSERT) && !defined(NDEBUG) -#define NDEBUG -#endif - #include "wslog.h" #include #include #include #include +/* Because ws_assert() dependes on ws_error() we do not use it + * here and fall back on assert() instead. */ #include #ifdef HAVE_UNISTD_H #include @@ -40,12 +36,7 @@ #include "console_win32.h" #endif - -#ifndef WS_DISABLE_ASSERT #define ASSERT(expr) assert(expr) -#else -#define ASSERT(expr) (void)(expr); -#endif /* Runtime log level. */ #define ENV_VAR_LEVEL "WIRESHARK_LOG_LEVEL"