From e5d49ebf13899a09db031403df6bdce2d845853c Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 8 Sep 2024 21:31:04 +0200 Subject: define G_DISABLE_ASSERT unless --enable-debug is specified * turns out that glib's g_assert() does not depend on NDEBUG like Standard C's assert() * this disables assertions in release builds and should speed up things slightly --- configure.ac | 4 ++++ src/expressions.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 3606803..8ad8288 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,10 @@ AC_CANONICAL_HOST AX_CHECK_ENABLE_DEBUG AM_CONDITIONAL(DEBUG, [test x$ax_enable_debug != xno]) +if [[ x$ax_enable_debug = xno ]]; then + # glib does not look at NDEBUG + AC_DEFINE(G_DISABLE_ASSERT, 1, [Disable g_assert()]) +fi # Use the user provided CXXFLAGS for Scintilla as well. # This makes sure that the same optimizations are applied diff --git a/src/expressions.c b/src/expressions.c index c7151f8..ef785e0 100644 --- a/src/expressions.c +++ b/src/expressions.c @@ -86,7 +86,7 @@ teco_int_t teco_expressions_pop_num(guint index) { teco_int_t n = 0; - teco_operator_t op = teco_expressions_pop_op(0); + G_GNUC_UNUSED teco_operator_t op = teco_expressions_pop_op(0); g_assert(op == TECO_OP_NUMBER); -- cgit v1.2.3