Skip to content

Commit

Permalink
Do the "fix" for asserts with MSVC's /W4 warnings only on MSVC.
Browse files Browse the repository at this point in the history
Naturally, this way generates a warning on GCC and Clang instead.  :)
  • Loading branch information
icculus committed Apr 8, 2015
1 parent 9a686aa commit 6a126a4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/SDL_assert.h
Expand Up @@ -88,7 +88,11 @@ disable assertions.

/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
this condition isn't constant. And looks like an owl's face! */
#ifdef _MSC_VER /* stupid /W4 warnings. */
#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
#else
#define SDL_NULL_WHILE_LOOP_CONDITION (0)
#endif

#define SDL_disabled_assert(condition) \
do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
Expand Down

0 comments on commit 6a126a4

Please sign in to comment.