Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
The config sets the default assertion level so people can override it…
Browse files Browse the repository at this point in the history
… for their own use in application code.
  • Loading branch information
slouken committed Jan 13, 2010
1 parent 4ed2911 commit 5a2e08c
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 20 deletions.
8 changes: 4 additions & 4 deletions configure.in
Expand Up @@ -142,19 +142,19 @@ AC_HELP_STRING([--enable-assertions],
sdl_valid_assertion_level=no
if test x$enable_assertions = xno; then
sdl_valid_assertion_level=yes
AC_DEFINE(SDL_ASSERT_LEVEL, 0)
AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0)
fi
if test x$enable_assertions = xrelease; then
sdl_valid_assertion_level=yes
AC_DEFINE(SDL_ASSERT_LEVEL, 1)
AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1)
fi
if test x$enable_assertions = xyes; then
sdl_valid_assertion_level=yes
AC_DEFINE(SDL_ASSERT_LEVEL, 2)
AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2)
fi
if test x$enable_assertions = xparanoid; then
sdl_valid_assertion_level=yes
AC_DEFINE(SDL_ASSERT_LEVEL, 3)
AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3)
fi
if test x$sdl_valid_assertion_level = xno; then
AC_MSG_ERROR([*** unknown assertion level. stop.])
Expand Down
1 change: 0 additions & 1 deletion include/SDL.h
Expand Up @@ -77,7 +77,6 @@

#include "SDL_main.h"
#include "SDL_stdinc.h"
#include "SDL_assert.h"
#include "SDL_atomic.h"
#include "SDL_audio.h"
#include "SDL_cpuinfo.h"
Expand Down
11 changes: 4 additions & 7 deletions include/SDL_assert.h
Expand Up @@ -21,13 +21,11 @@
*/
#include "SDL_config.h"

/* This is an assert macro for SDL's internal use. Not for the public API! */

#ifndef _SDL_assert_h
#define _SDL_assert_h

#ifndef SDL_ASSERT_LEVEL
#error SDL_ASSERT_LEVEL is not defined. Please fix your SDL_config.h.
#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
#endif

/*
Expand Down Expand Up @@ -107,12 +105,12 @@ SDL_assert_state SDL_ReportAssertion(SDL_assert_data *, const char *, int);
#define SDL_enabled_assert(condition) \
do { \
while ( !(condition) ) { \
static struct SDL_assert_data assert_data = { \
static struct SDL_assert_data assert_data = { \
0, 0, #condition, __FILE__, 0, 0, 0 \
}; \
const SDL_assert_state state = SDL_ReportAssertion(&assert_data, \
const SDL_assert_state state = SDL_ReportAssertion(&assert_data, \
SDL_FUNCTION, \
__LINE__); \
__LINE__); \
if (state == SDL_ASSERTION_RETRY) { \
continue; /* go again. */ \
} else if (state == SDL_ASSERTION_BREAK) { \
Expand Down Expand Up @@ -148,4 +146,3 @@ SDL_assert_state SDL_ReportAssertion(SDL_assert_data *, const char *, int);
#endif /* _SDL_assert_h */

/* vi: set ts=4 sw=4 expandtab: */

2 changes: 1 addition & 1 deletion include/SDL_config.h.in
Expand Up @@ -163,7 +163,7 @@
#endif /* HAVE_LIBC */

/* SDL internal assertion support */
#undef SDL_ASSERT_LEVEL
#undef SDL_DEFAULT_ASSERT_LEVEL

/* Allow disabling of core subsystems */
#undef SDL_AUDIO_DISABLED
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_config_iphoneos.h
Expand Up @@ -26,7 +26,7 @@
#include "SDL_platform.h"

/* SDL internal assertion support */
#define SDL_ASSERT_LEVEL 1
#define SDL_DEFAULT_ASSERT_LEVEL 1

#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
typedef signed char int8_t;
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_config_macosx.h
Expand Up @@ -29,7 +29,7 @@
#include <AvailabilityMacros.h>

/* SDL internal assertion support */
#define SDL_ASSERT_LEVEL 1
#define SDL_DEFAULT_ASSERT_LEVEL 1

/* This is a set of defines to configure the SDL features */

Expand Down
2 changes: 1 addition & 1 deletion include/SDL_config_minimal.h
Expand Up @@ -34,7 +34,7 @@
#include <stdarg.h>

/* SDL internal assertion support */
#define SDL_ASSERT_LEVEL 1
#define SDL_DEFAULT_ASSERT_LEVEL 1

#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
typedef signed char int8_t;
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_config_nintendods.h
Expand Up @@ -28,7 +28,7 @@
/* This is a set of defines to configure the SDL features */

/* SDL internal assertion support */
#define SDL_ASSERT_LEVEL 1
#define SDL_DEFAULT_ASSERT_LEVEL 1

#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
typedef signed char int8_t;
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_config_pandora.h
Expand Up @@ -29,7 +29,7 @@
#include "SDL_platform.h"

/* SDL internal assertion support */
#define SDL_ASSERT_LEVEL 1
#define SDL_DEFAULT_ASSERT_LEVEL 1

#define SDL_HAS_64BIT_TYPE 1
#define SDL_BYTEORDER 1234
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_config_win32.h
Expand Up @@ -28,7 +28,7 @@
/* This is a set of defines to configure the SDL features */

/* SDL internal assertion support */
#define SDL_ASSERT_LEVEL 1
#define SDL_DEFAULT_ASSERT_LEVEL 1

#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_config_wiz.h
Expand Up @@ -29,7 +29,7 @@
#include "SDL_platform.h"

/* SDL internal assertion support */
#define SDL_ASSERT_LEVEL 1
#define SDL_DEFAULT_ASSERT_LEVEL 1

/* Make sure that this isn't included by Visual C++ */
#ifdef _MSC_VER
Expand Down

0 comments on commit 5a2e08c

Please sign in to comment.