comparison include/SDL_assert.h @ 3653:1cd9f7117b98

Automatically figure out the appropriate assertion level
author Sam Lantinga <slouken@libsdl.org>
date Wed, 13 Jan 2010 07:52:53 +0000
parents dbd6a29e4b77
children 336f3df1578d
comparison
equal deleted inserted replaced
3652:dbd6a29e4b77 3653:1cd9f7117b98
23 23
24 #ifndef _SDL_assert_h 24 #ifndef _SDL_assert_h
25 #define _SDL_assert_h 25 #define _SDL_assert_h
26 26
27 #ifndef SDL_ASSERT_LEVEL 27 #ifndef SDL_ASSERT_LEVEL
28 #define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL 28 #if defined(_DEBUG) || defined(DEBUG) || \
29 (defined(__GNUC__) && !defined(__OPTIMIZE__))
30 #define SDL_ASSERT_LEVEL 2
31 #else
32 #define SDL_ASSERT_LEVEL 1
29 #endif 33 #endif
34 #endif /* SDL_ASSERT_LEVEL */
30 35
31 /* 36 /*
32 sizeof (x) makes the compiler still parse the expression even without 37 sizeof (x) makes the compiler still parse the expression even without
33 assertions enabled, so the code is always checked at compile time, but 38 assertions enabled, so the code is always checked at compile time, but
34 doesn't actually generate code for it, so there are no side effects or 39 doesn't actually generate code for it, so there are no side effects or