11/*
22 Simple DirectMedia Layer
3- Copyright (C) 1997-2014 Sam Lantinga <[email protected] > 3+ Copyright (C) 1997-2015 Sam Lantinga <[email protected] > 44
55 This software is provided 'as-is', without any express or implied
66 warranty. In no event will the authors be held liable for any damages
@@ -86,8 +86,10 @@ This also solves the problem of...
8686disable assertions.
8787*/
8888
89+ /* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
90+ this condition isn't constant. And looks like an owl's face! */
8991#ifdef _MSC_VER /* stupid /W4 warnings. */
90- #define SDL_NULL_WHILE_LOOP_CONDITION (-1 == __LINE__ )
92+ #define SDL_NULL_WHILE_LOOP_CONDITION (0,0 )
9193#else
9294#define SDL_NULL_WHILE_LOOP_CONDITION (0)
9395#endif
@@ -102,23 +104,23 @@ typedef enum
102104 SDL_ASSERTION_ABORT , /**< Terminate the program. */
103105 SDL_ASSERTION_IGNORE , /**< Ignore the assert. */
104106 SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
105- } SDL_assert_state ;
107+ } SDL_AssertState ;
106108
107- typedef struct SDL_assert_data
109+ typedef struct SDL_AssertData
108110{
109111 int always_ignore ;
110112 unsigned int trigger_count ;
111113 const char * condition ;
112114 const char * filename ;
113115 int linenum ;
114116 const char * function ;
115- const struct SDL_assert_data * next ;
116- } SDL_assert_data ;
117+ const struct SDL_AssertData * next ;
118+ } SDL_AssertData ;
117119
118120#if (SDL_ASSERT_LEVEL > 0 )
119121
120122/* Never call this directly. Use the SDL_assert* macros. */
121- extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion (SDL_assert_data * ,
123+ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion (SDL_AssertData * ,
122124 const char * ,
123125 const char * , int )
124126#if defined(__clang__ )
@@ -141,10 +143,10 @@ extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *,
141143#define SDL_enabled_assert (condition ) \
142144 do { \
143145 while ( !(condition) ) { \
144- static struct SDL_assert_data sdl_assert_data = { \
146+ static struct SDL_AssertData sdl_assert_data = { \
145147 0, 0, #condition, 0, 0, 0, 0 \
146148 }; \
147- const SDL_assert_state sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
149+ const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
148150 if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
149151 continue; /* go again. */ \
150152 } else if (sdl_assert_state == SDL_ASSERTION_BREAK ) { \
@@ -181,8 +183,8 @@ extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *,
181183#define SDL_assert_always (condition ) SDL_enabled_assert(condition)
182184
183185
184- typedef SDL_assert_state (SDLCALL * SDL_AssertionHandler )(
185- const SDL_assert_data * data , void * userdata );
186+ typedef SDL_AssertState (SDLCALL * SDL_AssertionHandler )(
187+ const SDL_AssertData * data , void * userdata );
186188
187189/**
188190 * \brief Set an application-defined assertion handler.
@@ -199,7 +201,7 @@ typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)(
199201 *
200202 * This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
201203 *
202- * \return SDL_assert_state value of how to handle the assertion failure.
204+ * \return SDL_AssertState value of how to handle the assertion failure.
203205 *
204206 * \param handler Callback function, called when an assertion fails.
205207 * \param userdata A pointer passed to the callback as-is.
@@ -246,7 +248,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse
246248 * The proper way to examine this data looks something like this:
247249 *
248250 * <code>
249- * const SDL_assert_data *item = SDL_GetAssertionReport();
251+ * const SDL_AssertData *item = SDL_GetAssertionReport();
250252 * while (item) {
251253 * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
252254 * item->condition, item->function, item->filename,
@@ -259,7 +261,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse
259261 * \return List of all assertions.
260262 * \sa SDL_ResetAssertionReport
261263 */
262- extern DECLSPEC const SDL_assert_data * SDLCALL SDL_GetAssertionReport (void );
264+ extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport (void );
263265
264266/**
265267 * \brief Reset the list of all assertion failures.
@@ -270,6 +272,12 @@ extern DECLSPEC const SDL_assert_data * SDLCALL SDL_GetAssertionReport(void);
270272 */
271273extern DECLSPEC void SDLCALL SDL_ResetAssertionReport (void );
272274
275+
276+ /* these had wrong naming conventions until 2.0.4. Please update your app! */
277+ #define SDL_assert_state SDL_AssertState
278+ #define SDL_assert_data SDL_AssertData
279+
280+
273281/* Ends C function definitions when using C++ */
274282#ifdef __cplusplus
275283}
0 commit comments