Allow configure to override assertion settings, but by default this comes from the build optimization level.
authorSam Lantinga <slouken@libsdl.org>
Wed, 13 Jan 2010 08:06:32 +0000
changeset 3654336f3df1578d
parent 3653 1cd9f7117b98
child 3655 1cc7f0143c12
Allow configure to override assertion settings, but by default this comes from the build optimization level.
configure.in
include/SDL_assert.h
include/SDL_config_iphoneos.h
include/SDL_config_macosx.h
include/SDL_config_minimal.h
include/SDL_config_nintendods.h
include/SDL_config_pandora.h
include/SDL_config_win32.h
include/SDL_config_wiz.h
     1.1 --- a/configure.in	Wed Jan 13 07:52:53 2010 +0000
     1.2 +++ b/configure.in	Wed Jan 13 08:06:32 2010 +0000
     1.3 @@ -137,28 +137,27 @@
     1.4  dnl See whether we want assertions for debugging/sanity checking SDL itself.
     1.5  AC_ARG_ENABLE(assertions,
     1.6  AC_HELP_STRING([--enable-assertions],
     1.7 -               [Enable internal sanity checks (yes/no/release/paranoid) [[default=release]]]),
     1.8 -              , enable_assertions=release)
     1.9 -sdl_valid_assertion_level=no
    1.10 -if test x$enable_assertions = xno; then
    1.11 -    sdl_valid_assertion_level=yes
    1.12 -    AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0)
    1.13 -fi
    1.14 -if test x$enable_assertions = xrelease; then
    1.15 -    sdl_valid_assertion_level=yes
    1.16 -    AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1)
    1.17 -fi
    1.18 -if test x$enable_assertions = xyes; then
    1.19 -    sdl_valid_assertion_level=yes
    1.20 -    AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2)
    1.21 -fi
    1.22 -if test x$enable_assertions = xparanoid; then
    1.23 -    sdl_valid_assertion_level=yes
    1.24 -    AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3)
    1.25 -fi
    1.26 -if test x$sdl_valid_assertion_level = xno; then
    1.27 -    AC_MSG_ERROR([*** unknown assertion level. stop.])
    1.28 -fi
    1.29 +               [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]),
    1.30 +              , enable_assertions=auto)
    1.31 +case "$enable_assertions" in
    1.32 +    auto) # Use optimization settings to determine assertion level
    1.33 +        ;;
    1.34 +    disabled)
    1.35 +        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0)
    1.36 +        ;;
    1.37 +    release)
    1.38 +        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1)
    1.39 +        ;;
    1.40 +    enabled)
    1.41 +        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2)
    1.42 +        ;;
    1.43 +    paranoid)
    1.44 +        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3)
    1.45 +        ;;
    1.46 +    *)
    1.47 +        AC_MSG_ERROR([*** unknown assertion level. stop.])
    1.48 +        ;;
    1.49 +esac
    1.50  
    1.51  dnl See whether we can use gcc style dependency tracking
    1.52  AC_ARG_ENABLE(dependency-tracking,
     2.1 --- a/include/SDL_assert.h	Wed Jan 13 07:52:53 2010 +0000
     2.2 +++ b/include/SDL_assert.h	Wed Jan 13 08:06:32 2010 +0000
     2.3 @@ -25,8 +25,10 @@
     2.4  #define _SDL_assert_h
     2.5  
     2.6  #ifndef SDL_ASSERT_LEVEL
     2.7 -#if defined(_DEBUG) || defined(DEBUG) || \
     2.8 -    (defined(__GNUC__) && !defined(__OPTIMIZE__))
     2.9 +#ifdef SDL_DEFAULT_ASSERT_LEVEL
    2.10 +#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
    2.11 +#elif defined(_DEBUG) || defined(DEBUG) || \
    2.12 +      (defined(__GNUC__) && !defined(__OPTIMIZE__))
    2.13  #define SDL_ASSERT_LEVEL 2
    2.14  #else
    2.15  #define SDL_ASSERT_LEVEL 1
     3.1 --- a/include/SDL_config_iphoneos.h	Wed Jan 13 07:52:53 2010 +0000
     3.2 +++ b/include/SDL_config_iphoneos.h	Wed Jan 13 08:06:32 2010 +0000
     3.3 @@ -25,9 +25,6 @@
     3.4  
     3.5  #include "SDL_platform.h"
     3.6  
     3.7 -/* SDL internal assertion support */
     3.8 -#define SDL_DEFAULT_ASSERT_LEVEL 1
     3.9 -
    3.10  #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
    3.11  typedef signed char int8_t;
    3.12  typedef unsigned char uint8_t;
     4.1 --- a/include/SDL_config_macosx.h	Wed Jan 13 07:52:53 2010 +0000
     4.2 +++ b/include/SDL_config_macosx.h	Wed Jan 13 08:06:32 2010 +0000
     4.3 @@ -28,9 +28,6 @@
     4.4  /* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
     4.5  #include <AvailabilityMacros.h>
     4.6  
     4.7 -/* SDL internal assertion support */
     4.8 -#define SDL_DEFAULT_ASSERT_LEVEL 1
     4.9 -
    4.10  /* This is a set of defines to configure the SDL features */
    4.11  
    4.12  #ifdef __LP64__
     5.1 --- a/include/SDL_config_minimal.h	Wed Jan 13 07:52:53 2010 +0000
     5.2 +++ b/include/SDL_config_minimal.h	Wed Jan 13 08:06:32 2010 +0000
     5.3 @@ -33,9 +33,6 @@
     5.4  
     5.5  #include <stdarg.h>
     5.6  
     5.7 -/* SDL internal assertion support */
     5.8 -#define SDL_DEFAULT_ASSERT_LEVEL 1
     5.9 -
    5.10  #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
    5.11  typedef signed char int8_t;
    5.12  typedef unsigned char uint8_t;
     6.1 --- a/include/SDL_config_nintendods.h	Wed Jan 13 07:52:53 2010 +0000
     6.2 +++ b/include/SDL_config_nintendods.h	Wed Jan 13 08:06:32 2010 +0000
     6.3 @@ -27,9 +27,6 @@
     6.4  
     6.5  /* This is a set of defines to configure the SDL features */
     6.6  
     6.7 -/* SDL internal assertion support */
     6.8 -#define SDL_DEFAULT_ASSERT_LEVEL 1
     6.9 -
    6.10  #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
    6.11  typedef signed char int8_t;
    6.12  typedef unsigned char uint8_t;
     7.1 --- a/include/SDL_config_pandora.h	Wed Jan 13 07:52:53 2010 +0000
     7.2 +++ b/include/SDL_config_pandora.h	Wed Jan 13 08:06:32 2010 +0000
     7.3 @@ -28,9 +28,6 @@
     7.4  /* General platform specific identifiers */
     7.5  #include "SDL_platform.h"
     7.6  
     7.7 -/* SDL internal assertion support */
     7.8 -#define SDL_DEFAULT_ASSERT_LEVEL 1
     7.9 -
    7.10  #define SDL_HAS_64BIT_TYPE 1
    7.11  #define SDL_BYTEORDER 1234
    7.12  
     8.1 --- a/include/SDL_config_win32.h	Wed Jan 13 07:52:53 2010 +0000
     8.2 +++ b/include/SDL_config_win32.h	Wed Jan 13 08:06:32 2010 +0000
     8.3 @@ -27,9 +27,6 @@
     8.4  
     8.5  /* This is a set of defines to configure the SDL features */
     8.6  
     8.7 -/* SDL internal assertion support */
     8.8 -#define SDL_DEFAULT_ASSERT_LEVEL 1
     8.9 -
    8.10  #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
    8.11  #if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
    8.12  #define HAVE_STDINT_H	1
     9.1 --- a/include/SDL_config_wiz.h	Wed Jan 13 07:52:53 2010 +0000
     9.2 +++ b/include/SDL_config_wiz.h	Wed Jan 13 08:06:32 2010 +0000
     9.3 @@ -28,9 +28,6 @@
     9.4  /* General platform specific identifiers */
     9.5  #include "SDL_platform.h"
     9.6  
     9.7 -/* SDL internal assertion support */
     9.8 -#define SDL_DEFAULT_ASSERT_LEVEL 1
     9.9 -
    9.10  /* Make sure that this isn't included by Visual C++ */
    9.11  #ifdef _MSC_VER
    9.12  #error You should copy include/SDL_config.h.default to include/SDL_config.h