This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.1.x by this push:
new 294c5f1 Adds a new --enable-all-asserts configure option (#7858)
294c5f1 is described below
commit 294c5f10a8fa15c8f47e38cb89c67e12a581878f
Author: Leif Hedstrom <[email protected]>
AuthorDate: Wed May 19 08:24:42 2021 -0600
Adds a new --enable-all-asserts configure option (#7858)
(cherry picked from commit 5585a9bc39b1bcad91948b56400a1d4b33cd55df)
---
configure.ac | 20 ++++++++++++++++----
include/tscore/ink_assert.h | 2 +-
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 0beba77..11c7a1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -151,7 +151,6 @@ AC_SUBST([build_number])
#
# Debug
#
-
AC_MSG_CHECKING([whether to enable debugging])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],[turn on debugging])],
@@ -168,6 +167,15 @@ AC_ARG_ENABLE([mime-sanity-check],
)
AC_MSG_RESULT([$enable_mime_sanity_check])
+AC_MSG_CHECKING([whether to enable all asserts, a cheaper debug])
+AC_ARG_ENABLE([all-asserts],
+ [AS_HELP_STRING([--enable-all-asserts],[turn on all code asserts, both debug
and release])],
+ [],
+ [enable_all_asserts=no]
+)
+AC_MSG_RESULT([$enable_all_asserts])
+
+
# Enable code coverage instrumentation only if requested by the user.
AC_MSG_CHECKING([whether to code coverage])
AC_ARG_ENABLE([coverage],
@@ -969,14 +977,18 @@ if test "x${enable_debug}" = "xyes"; then
TS_ADDTO(AM_CFLAGS, [${cc_oflag_dbg}])
TS_ADDTO(AM_CXXFLAGS, [${cxx_oflag_dbg}])
TS_ADDTO(AM_CPPFLAGS, [-DDEBUG -D_DEBUG])
- if test "x${enable_mime_sanity_check}" = "xyes"; then
- TS_ADDTO(AM_CPPFLAGS, [-DENABLE_MIME_SANITY_CHECK])
- fi
else
TS_ADDTO(AM_CFLAGS, [${cc_oflag_opt}])
TS_ADDTO(AM_CXXFLAGS, [${cxx_oflag_opt}])
fi
+if test "x${enable_mime_sanity_check}" = "xyes"; then
+ TS_ADDTO(AM_CPPFLAGS, [-DENABLE_MIME_SANITY_CHECK])
+fi
+if test "x${enable_all_asserts}" = "xyes"; then
+ TS_ADDTO(AM_CPPFLAGS, [-DENABLE_ALL_ASSERTS])
+fi
+
# Flags for ASAN
if test "x${enable_asan}" = "xyes"; then
if test "x${enable_tsan}" = "xyes" -o "x${enable_tsan}" = "xstatic"; then
diff --git a/include/tscore/ink_assert.h b/include/tscore/ink_assert.h
index b9c2861..de0336a 100644
--- a/include/tscore/ink_assert.h
+++ b/include/tscore/ink_assert.h
@@ -43,7 +43,7 @@ extern "C" {
inkcoreapi void _ink_assert(const char *a, const char *f, int l) TS_NORETURN;
-#if defined(DEBUG) || defined(__clang_analyzer__) || defined(__COVERITY__)
+#if defined(DEBUG) || defined(ENABLE_ALL_ASSERTS) ||
defined(__clang_analyzer__) || defined(__COVERITY__)
#define ink_assert(EX) ((void)(__builtin_expect(!!(EX), 1) ? (void)0 :
_ink_assert(#EX, __FILE__, __LINE__)))
#else
#define ink_assert(EX) (void)(EX)