[Mesa-dev] [PATCH] mesa: Have configure define NDEBUG, not mtypes.h.

Kenneth Graunke kenneth at whitecape.org
Fri Feb 20 13:51:24 PST 2015


On Friday, February 20, 2015 12:44:53 PM Matt Turner wrote:
> mtypes.h had been defining NDEBUG (used by assert) if DEBUG was not
> defined. Confusing and bizarre that you don't get NDEBUG if you don't
> include mtypes.h.
> 
> ... which is just what happened in commit bef38f62e.
> 
> Let's let configure define this for us if not using --enable-debug.
> ---
>  configure.ac           | 2 ++
>  src/mesa/main/mtypes.h | 3 ---
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index beb7a7d..5fbb7bc 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -370,6 +370,8 @@ if test "x$enable_debug" = xyes; then
>              CXXFLAGS="$CXXFLAGS -O0"
>          fi
>      fi
> +else
> +   DEFINES="$DEFINES -DNDEBUG"
>  fi
>  
>  dnl
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 05b5a81..6e99773 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -4512,9 +4512,6 @@ extern int MESA_DEBUG_FLAGS;
>  # define MESA_VERBOSE 0
>  # define MESA_DEBUG_FLAGS 0
>  # define MESA_FUNCTION "a function"
> -# ifndef NDEBUG
> -#  define NDEBUG
> -# endif
>  #endif
>  
>  
> 

It looks like scons/gallium.py already defines DEBUG and NDEBUG:

    cppdefines = []
    if env['build'] in ('debug', 'checked'):
        cppdefines += ['DEBUG']
    else:
        cppdefines += ['NDEBUG']

So this may not even break the SCons build.  If it does, there's a
fairly clear solution there.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150220/4046c4c3/attachment.sig>


More information about the mesa-dev mailing list