include/SDL_assert.h
changeset 7736 84d89d60908f
parent 7664 6995a81e065a
child 8149 681eb46b8ac4
equal deleted inserted replaced
7735:eeba085802ca 7736:84d89d60908f
    84 
    84 
    85 ...which would cause compiles to complain that somevalue is unused if we
    85 ...which would cause compiles to complain that somevalue is unused if we
    86 disable assertions.
    86 disable assertions.
    87 */
    87 */
    88 
    88 
       
    89 #ifdef _MSC_VER  /* stupid /W4 warnings. */
       
    90 #define SDL_NULL_WHILE_LOOP_CONDITION (-1 == __LINE__)
       
    91 #else
       
    92 #define SDL_NULL_WHILE_LOOP_CONDITION (0)
       
    93 #endif
       
    94 
    89 #define SDL_disabled_assert(condition) \
    95 #define SDL_disabled_assert(condition) \
    90     do { (void) sizeof ((condition)); } while (0)
    96     do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
    91 
    97 
    92 typedef enum
    98 typedef enum
    93 {
    99 {
    94     SDL_ASSERTION_RETRY,  /**< Retry the assert immediately. */
   100     SDL_ASSERTION_RETRY,  /**< Retry the assert immediately. */
    95     SDL_ASSERTION_BREAK,  /**< Make the debugger trigger a breakpoint. */
   101     SDL_ASSERTION_BREAK,  /**< Make the debugger trigger a breakpoint. */
   138             } else if (state == SDL_ASSERTION_BREAK) { \
   144             } else if (state == SDL_ASSERTION_BREAK) { \
   139                 SDL_TriggerBreakpoint(); \
   145                 SDL_TriggerBreakpoint(); \
   140             } \
   146             } \
   141             break; /* not retrying. */ \
   147             break; /* not retrying. */ \
   142         } \
   148         } \
   143     } while (0)
   149     } while (SDL_NULL_WHILE_LOOP_CONDITION)
   144 
   150 
   145 #endif  /* enabled assertions support code */
   151 #endif  /* enabled assertions support code */
   146 
   152 
   147 /* Enable various levels of assertions. */
   153 /* Enable various levels of assertions. */
   148 #if SDL_ASSERT_LEVEL == 0   /* assertions disabled */
   154 #if SDL_ASSERT_LEVEL == 0   /* assertions disabled */