Skip to content

Commit

Permalink
define G_DISABLE_ASSERT unless --enable-debug is specified
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rhaberkorn committed Sep 9, 2024
1 parent dd36439 commit e5d49eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/expressions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit e5d49eb

Please sign in to comment.