Opened 5 years ago

Closed 5 years ago

#4589 closed enhancement (fixed)

Disable c asserts when building without "--enable-debug"

Reported by: Algunenano Owned by: Algunenano
Priority: medium Milestone: PostGIS 3.1.0
Component: postgis Version: master
Keywords: Cc:

Description

In our configure we try to disable C asserts when not building in debug mode:

AC_ARG_ENABLE([debug], AC_HELP_STRING([--enable-debug], [Enable debugging code and flags]),
	[ENABLE_DEBUG=1], [ENABLE_DEBUG=0])

if test $ENABLE_DEBUG -eq 1; then
    AC_DEFINE([PARANOIA_LEVEL], [10], [Enable use of memory checks])
    CFLAGS="$CFLAGS -g"
else
    AC_DEFINE([PARANOIA_LEVEL], [0], [Disable use of memory checks])
    AC_DEFINE([NDEBUG], [0], [Disable C asserts])
fi

I don't know what AC_DEFINE([NDEBUG], [0], [Disable C asserts]) is doing, probably nothing, but I still have asserts enabled in my release builds. I suggest adding -DNDEBUG to the CPPFLAGS directly instead.

I'm considering this as an enhancement since someone might be surprised by the change on the default, but I believe this was the intention all along.

Change History (2)

comment:2 by Raúl Marín <git@…>, 5 years ago

Resolution: fixed
Status: assignedclosed

In 651add11/git:

Disable C asserts when building without "--enable-debug"

Closes https://github.com/postgis/postgis/pull/518
Closes #4589

Note: See TracTickets for help on using tickets.