# HG changeset patch # User Sam Lantinga # Date 1295228742 28800 # Node ID 8e8876e4aec685765d36ff2dcdaf061a67368116 # Parent 7f0265279b68ee9d13f086003ab78d2657a7c258 Include windows.h in SDL_atomic.h by default, but don't include the atomic API in SDL.h This allows all SDL code to take advantage of the atomic intrinsics on Windows, but doesn't cause applications just including SDL.h to pull in windows.h diff -r 7f0265279b68 -r 8e8876e4aec6 include/SDL.h --- a/include/SDL.h Sun Jan 16 15:31:09 2011 -0800 +++ b/include/SDL.h Sun Jan 16 17:45:42 2011 -0800 @@ -76,7 +76,6 @@ #include "SDL_main.h" #include "SDL_stdinc.h" -#include "SDL_atomic.h" #include "SDL_audio.h" #include "SDL_clipboard.h" #include "SDL_cpuinfo.h" diff -r 7f0265279b68 -r 8e8876e4aec6 include/SDL_atomic.h --- a/include/SDL_atomic.h Sun Jan 16 15:31:09 2011 -0800 +++ b/include/SDL_atomic.h Sun Jan 16 17:45:42 2011 -0800 @@ -107,14 +107,16 @@ /*@}*//*SDL AtomicLock*/ -/* Platform specific optimized versions of the atomic functions */ -#if defined(__WIN32__) && defined(_INC_WINDOWS) +/* Platform specific optimized versions of the atomic functions, + * you can disable these by defining SDL_DISABLE_ATOMIC_INLINE + */ +#ifndef SDL_DISABLE_ATOMIC_INLINE + +#if defined(__WIN32__) /* Don't include windows.h, since it may hose code that isn't expecting it, but if someone has already included it, this is fair game... */ -#if 0 #define WIN32_LEAN_AND_MEAN #include -#endif #define SDL_AtomicSet(a, v) InterlockedExchange(&(a)->value, v) #define SDL_AtomicGet(a) ((a)->value) @@ -169,6 +171,9 @@ #endif +#endif /* !SDL_DISABLE_ATOMIC_INLINE */ + + /** * \brief A type representing an atomic integer value. It is a struct * so people don't accidentally use numeric operations on it. diff -r 7f0265279b68 -r 8e8876e4aec6 src/SDL_assert.c --- a/src/SDL_assert.c Sun Jan 16 15:31:09 2011 -0800 +++ b/src/SDL_assert.c Sun Jan 16 17:45:42 2011 -0800 @@ -21,6 +21,7 @@ */ #include "SDL.h" +#include "SDL_atomic.h" #include "SDL_assert.h" #include "SDL_assert_c.h" #include "video/SDL_sysvideo.h" diff -r 7f0265279b68 -r 8e8876e4aec6 test/testatomic.c --- a/test/testatomic.c Sun Jan 16 15:31:09 2011 -0800 +++ b/test/testatomic.c Sun Jan 16 17:45:42 2011 -0800 @@ -1,5 +1,7 @@ #include + #include "SDL.h" +#include "SDL_atomic.h" #include "SDL_assert.h" /*