volitile... duh, yeah the variable need to be labeled volitile
authorBob Pendleton <bob@pendleton.com>
Thu, 09 Jul 2009 21:31:27 +0000
changeset 321648a80f2a7ff2
parent 3215 b425c3e2b796
child 3217 26ce0b98f2fb
volitile... duh, yeah the variable need to be labeled volitile
include/SDL_atomic.h
src/atomic/dummy/SDL_atomic.c
src/atomic/linux/SDL_atomic.c
test/testatomic.c
     1.1 --- a/include/SDL_atomic.h	Tue Jul 07 14:02:57 2009 +0000
     1.2 +++ b/include/SDL_atomic.h	Thu Jul 09 21:31:27 2009 +0000
     1.3 @@ -54,40 +54,40 @@
     1.4  
     1.5  /* 8 bit atomic operations */
     1.6  
     1.7 -extern DECLSPEC Uint8 SDLCALL SDL_AtomicExchange8(Uint8 * ptr, Uint8 value);
     1.8 -extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareThenSet8(Uint8 * ptr,
     1.9 +extern DECLSPEC Uint8 SDLCALL SDL_AtomicExchange8(volatile Uint8 * ptr, Uint8 value);
    1.10 +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareThenSet8(volatile Uint8 * ptr,
    1.11                                                              Uint8 oldvalue, Uint8 newvalue);
    1.12 -extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet8(Uint8 * ptr);
    1.13 -extern DECLSPEC void SDLCALL SDL_AtomicClear8(Uint8 * ptr);
    1.14 -extern DECLSPEC Uint8 SDLCALL SDL_AtomicFetchThenIncrement8(Uint8 * ptr);
    1.15 -extern DECLSPEC Uint8 SDLCALL SDL_AtomicFetchThenDecrement8(Uint8 * ptr);
    1.16 -extern DECLSPEC Uint8 SDLCALL SDL_AtomicFetchThenAdd8(Uint8 * ptr, Uint8 value);
    1.17 -extern DECLSPEC Uint8 SDLCALL SDL_AtomicFetchThenSubtract8(Uint8 * ptr, Uint8 value);
    1.18 -extern DECLSPEC Uint8 SDLCALL SDL_AtomicIncrementThenFetch8(Uint8 * ptr);
    1.19 -extern DECLSPEC Uint8 SDLCALL SDL_AtomicDecrementThenFetch8(Uint8 * ptr);
    1.20 -extern DECLSPEC Uint8 SDLCALL SDL_AtomicAddThenFetch8(Uint8 * ptr, Uint8 value);
    1.21 -extern DECLSPEC Uint8 SDLCALL SDL_AtomicSubtractThenFetch8(Uint8 * ptr, Uint8 value);
    1.22 +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet8(volatile Uint8 * ptr);
    1.23 +extern DECLSPEC void SDLCALL SDL_AtomicClear8(volatile Uint8 * ptr);
    1.24 +extern DECLSPEC Uint8 SDLCALL SDL_AtomicFetchThenIncrement8(volatile Uint8 * ptr);
    1.25 +extern DECLSPEC Uint8 SDLCALL SDL_AtomicFetchThenDecrement8(volatile Uint8 * ptr);
    1.26 +extern DECLSPEC Uint8 SDLCALL SDL_AtomicFetchThenAdd8(volatile Uint8 * ptr, Uint8 value);
    1.27 +extern DECLSPEC Uint8 SDLCALL SDL_AtomicFetchThenSubtract8(volatile Uint8 * ptr, Uint8 value);
    1.28 +extern DECLSPEC Uint8 SDLCALL SDL_AtomicIncrementThenFetch8(volatile Uint8 * ptr);
    1.29 +extern DECLSPEC Uint8 SDLCALL SDL_AtomicDecrementThenFetch8(volatile Uint8 * ptr);
    1.30 +extern DECLSPEC Uint8 SDLCALL SDL_AtomicAddThenFetch8(volatile Uint8 * ptr, Uint8 value);
    1.31 +extern DECLSPEC Uint8 SDLCALL SDL_AtomicSubtractThenFetch8(volatile Uint8 * ptr, Uint8 value);
    1.32  
    1.33  /* 16 bit atomic operations */
    1.34  
    1.35 -extern DECLSPEC Uint16 SDLCALL SDL_AtomicExchange16(Uint16 * ptr, Uint16 value);
    1.36 -extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareThenSet16(Uint16 * ptr,
    1.37 +extern DECLSPEC Uint16 SDLCALL SDL_AtomicExchange16(volatile Uint16 * ptr, Uint16 value);
    1.38 +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareThenSet16(volatile Uint16 * ptr,
    1.39                                                              Uint16 oldvalue, Uint16 newvalue);
    1.40 -extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet16(Uint16 * ptr);
    1.41 -extern DECLSPEC void SDLCALL SDL_AtomicClear16(Uint16 * ptr);
    1.42 -extern DECLSPEC Uint16 SDLCALL SDL_AtomicFetchThenIncrement16(Uint16 * ptr);
    1.43 -extern DECLSPEC Uint16 SDLCALL SDL_AtomicFetchThenDecrement16(Uint16 * ptr);
    1.44 -extern DECLSPEC Uint16 SDLCALL SDL_AtomicFetchThenAdd16(Uint16 * ptr, Uint16 value);
    1.45 -extern DECLSPEC Uint16 SDLCALL SDL_AtomicFetchThenSubtract16(Uint16 * ptr, Uint16 value);
    1.46 -extern DECLSPEC Uint16 SDLCALL SDL_AtomicIncrementThenFetch16(Uint16 * ptr);
    1.47 -extern DECLSPEC Uint16 SDLCALL SDL_AtomicDecrementThenFetch16(Uint16 * ptr);
    1.48 -extern DECLSPEC Uint16 SDLCALL SDL_AtomicAddThenFetch16(Uint16 * ptr, Uint16 value);
    1.49 -extern DECLSPEC Uint16 SDLCALL SDL_AtomicSubtractThenFetch16(Uint16 * ptr, Uint16 value);
    1.50 +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet16(volatile Uint16 * ptr);
    1.51 +extern DECLSPEC void SDLCALL SDL_AtomicClear16(volatile Uint16 * ptr);
    1.52 +extern DECLSPEC Uint16 SDLCALL SDL_AtomicFetchThenIncrement16(volatile Uint16 * ptr);
    1.53 +extern DECLSPEC Uint16 SDLCALL SDL_AtomicFetchThenDecrement16(volatile Uint16 * ptr);
    1.54 +extern DECLSPEC Uint16 SDLCALL SDL_AtomicFetchThenAdd16(volatile Uint16 * ptr, Uint16 value);
    1.55 +extern DECLSPEC Uint16 SDLCALL SDL_AtomicFetchThenSubtract16(volatile Uint16 * ptr, Uint16 value);
    1.56 +extern DECLSPEC Uint16 SDLCALL SDL_AtomicIncrementThenFetch16(volatile Uint16 * ptr);
    1.57 +extern DECLSPEC Uint16 SDLCALL SDL_AtomicDecrementThenFetch16(volatile Uint16 * ptr);
    1.58 +extern DECLSPEC Uint16 SDLCALL SDL_AtomicAddThenFetch16(volatile Uint16 * ptr, Uint16 value);
    1.59 +extern DECLSPEC Uint16 SDLCALL SDL_AtomicSubtractThenFetch16(volatile Uint16 * ptr, Uint16 value);
    1.60  
    1.61  /* 32 bit atomic operations */
    1.62  
    1.63  /**
    1.64 - * \fn int SDL_AtomicExchange32(Uint32 * ptr, Uint32 value)
    1.65 + * \fn int SDL_AtomicExchange32(volatile Uint32 * ptr, Uint32 value)
    1.66   *
    1.67   * \brief Atomically exchange two 32 bit values.
    1.68   *
    1.69 @@ -100,9 +100,9 @@
    1.70   * with value. This function can be used to implement SDL_TestThenSet.
    1.71   *
    1.72   */
    1.73 -extern DECLSPEC Uint32 SDLCALL SDL_AtomicExchange32(Uint32 * ptr, Uint32 value);
    1.74 +extern DECLSPEC Uint32 SDLCALL SDL_AtomicExchange32(volatile Uint32 * ptr, Uint32 value);
    1.75  /**
    1.76 - * \fn int SDL_AtomicCompareThenSet32(Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue)
    1.77 + * \fn int SDL_AtomicCompareThenSet32(volatile Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue)
    1.78   *
    1.79   * \brief If *ptr == oldvalue then replace the contents of *ptr by new value. 
    1.80   *
    1.81 @@ -113,10 +113,10 @@
    1.82   * \param newvalue is value to be stored at *ptr.
    1.83   *
    1.84   */
    1.85 -extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareThenSet32(Uint32 * ptr,
    1.86 +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareThenSet32(volatile Uint32 * ptr,
    1.87                                                              Uint32 oldvalue, Uint32 newvalue);
    1.88  /**
    1.89 - * \fn  SDL_bool SDL_AtomicTestThenSet32(Uint32 * ptr);
    1.90 + * \fn  SDL_bool SDL_AtomicTestThenSet32(volatile Uint32 * ptr);
    1.91   *
    1.92   * \brief Check to see if *ptr == 0 and set it to non-zero.
    1.93   *
    1.94 @@ -126,18 +126,18 @@
    1.95   * \param ptr points to the value to be tested and set.
    1.96   *
    1.97   */
    1.98 -extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet32(Uint32 * ptr);
    1.99 +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet32(volatile Uint32 * ptr);
   1.100  /**
   1.101 - * \fn  void SDL_AtomicClear32(Uint32 * ptr);
   1.102 + * \fn  void SDL_AtomicClear32(volatile Uint32 * ptr);
   1.103   *
   1.104   * \brief set the value pointed to by ptr to be zero.
   1.105   *
   1.106   * \param ptr address of the value to be set to zero
   1.107   *
   1.108   */
   1.109 -extern DECLSPEC void SDLCALL SDL_AtomicClear32(Uint32 * ptr);
   1.110 +extern DECLSPEC void SDLCALL SDL_AtomicClear32(volatile Uint32 * ptr);
   1.111  /**
   1.112 - * \fn  Uint32 SDL_AtomicFetchThenIncrement32(Uint32 * ptr);
   1.113 + * \fn  Uint32 SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr);
   1.114   *
   1.115   * \brief fetch the current value of *ptr and then increment that
   1.116   * value in place.
   1.117 @@ -147,9 +147,9 @@
   1.118   * \param ptr address of the value to fetch and increment
   1.119   *
   1.120   */
   1.121 -extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenIncrement32(Uint32 * ptr);
   1.122 +extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr);
   1.123  /**
   1.124 - * \fn  Uint32 SDL_AtomicFetchThenDecrement32(Uint32 * ptr);
   1.125 + * \fn  Uint32 SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr);
   1.126   *
   1.127   * \brief fetch *ptr and then decrement the value in place.
   1.128   *
   1.129 @@ -158,9 +158,9 @@
   1.130   * \param ptr address of the value to fetch and drement
   1.131   *
   1.132   */
   1.133 -extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenDecrement32(Uint32 * ptr);
   1.134 +extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr);
   1.135  /**
   1.136 - * \fn  Uint32 SDL_AtomicFetchThenAdd32(Uint32 * ptr, Uint32 value);
   1.137 + * \fn  Uint32 SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value);
   1.138   *
   1.139   * \brief fetch the current value at ptr and then add value to *ptr.
   1.140   *
   1.141 @@ -170,9 +170,9 @@
   1.142   * \param value the value to add to *ptr. 
   1.143   *
   1.144   */
   1.145 -extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenAdd32(Uint32 * ptr, Uint32 value);
   1.146 +extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value);
   1.147  /**
   1.148 - * \fn  Uint32 SDL_AtomicFetchThenSubtract32(Uint32 * ptr, Uint32 value);
   1.149 + * \fn  Uint32 SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value);
   1.150   *
   1.151   * \brief Fetch *ptr and then subtract value from it.
   1.152   *
   1.153 @@ -182,9 +182,9 @@
   1.154   * \param value the value to subtract from *ptr.
   1.155   *
   1.156   */
   1.157 -extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenSubtract32(Uint32 * ptr, Uint32 value);
   1.158 +extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value);
   1.159  /**
   1.160 - * \fn  Uint32 SDL_AtomicIncrementThenFetch32(Uint32 * ptr);
   1.161 + * \fn  Uint32 SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr);
   1.162   *
   1.163   * \brief Add one to the data pointed to by ptr and return that value.
   1.164   *
   1.165 @@ -193,9 +193,9 @@
   1.166   * \param ptr address of the data to increment.
   1.167   *
   1.168   */
   1.169 -extern DECLSPEC Uint32 SDLCALL SDL_AtomicIncrementThenFetch32(Uint32 * ptr);
   1.170 +extern DECLSPEC Uint32 SDLCALL SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr);
   1.171  /**
   1.172 - * \fn  Uint32 SDL_AtomicDecrementThenFetch32(Uint32 * ptr);
   1.173 + * \fn  Uint32 SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr);
   1.174   *
   1.175   * \brief Subtract one from data pointed to by ptr and return the new value.
   1.176   *
   1.177 @@ -204,9 +204,9 @@
   1.178   * \param ptr The address of the data to decrement.
   1.179   *
   1.180   */
   1.181 -extern DECLSPEC Uint32 SDLCALL SDL_AtomicDecrementThenFetch32(Uint32 * ptr);
   1.182 +extern DECLSPEC Uint32 SDLCALL SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr);
   1.183  /**
   1.184 - * \fn  Uint32 SDL_AtomicAddThenFetch32(Uint32 * ptr, Uint32 value);
   1.185 + * \fn  Uint32 SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value);
   1.186   *
   1.187   * \brief Add value to the data pointed to by ptr and return result.
   1.188   *
   1.189 @@ -216,9 +216,9 @@
   1.190   * \param value The value to be added.
   1.191   *
   1.192   */
   1.193 -extern DECLSPEC Uint32 SDLCALL SDL_AtomicAddThenFetch32(Uint32 * ptr, Uint32 value);
   1.194 +extern DECLSPEC Uint32 SDLCALL SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value);
   1.195  /**
   1.196 - * \fn  Uint32 SDL_AtomicSubtractThenFetch32(Uint32 * ptr, Uint32 value);
   1.197 + * \fn  Uint32 SDL_AtomicSubtractThenFetch32(volatile Uint32 * ptr, Uint32 value);
   1.198   *
   1.199   * \brief Subtract value from the data pointed to by ptr and return the result.
   1.200   *
   1.201 @@ -228,24 +228,24 @@
   1.202   * \param value The value to be subtracted.
   1.203   *
   1.204   */
   1.205 -extern DECLSPEC Uint32 SDLCALL SDL_AtomicSubtractThenFetch32(Uint32 * ptr, Uint32 value);
   1.206 +extern DECLSPEC Uint32 SDLCALL SDL_AtomicSubtractThenFetch32(volatile Uint32 * ptr, Uint32 value);
   1.207  
   1.208  /* 64 bit atomic operations */
   1.209  #ifdef SDL_HAS_64BIT_TYPE
   1.210  
   1.211 -extern DECLSPEC Uint64 SDLCALL SDL_AtomicExchange64(Uint64 * ptr, Uint64 value);
   1.212 -extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareThenSet64(Uint64 * ptr,
   1.213 +extern DECLSPEC Uint64 SDLCALL SDL_AtomicExchange64(volatile Uint64 * ptr, Uint64 value);
   1.214 +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareThenSet64(volatile Uint64 * ptr,
   1.215                                                              Uint64 oldvalue, Uint64 newvalue);
   1.216 -extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet64(Uint64 * ptr);
   1.217 -extern DECLSPEC void SDLCALL SDL_AtomicClear64(Uint64 * ptr);
   1.218 -extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenIncrement64(Uint64 * ptr);
   1.219 -extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenDecrement64(Uint64 * ptr);
   1.220 -extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenAdd64(Uint64 * ptr, Uint64 value);
   1.221 -extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenSubtract64(Uint64 * ptr, Uint64 value);
   1.222 -extern DECLSPEC Uint64 SDLCALL SDL_AtomicIncrementThenFetch64(Uint64 * ptr);
   1.223 -extern DECLSPEC Uint64 SDLCALL SDL_AtomicDecrementThenFetch64(Uint64 * ptr);
   1.224 -extern DECLSPEC Uint64 SDLCALL SDL_AtomicAddThenFetch64(Uint64 * ptr, Uint64 value);
   1.225 -extern DECLSPEC Uint64 SDLCALL SDL_AtomicSubtractThenFetch64(Uint64 * ptr, Uint64 value);
   1.226 +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet64(volatile Uint64 * ptr);
   1.227 +extern DECLSPEC void SDLCALL SDL_AtomicClear64(volatile Uint64 * ptr);
   1.228 +extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenIncrement64(volatile Uint64 * ptr);
   1.229 +extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenDecrement64(volatile Uint64 * ptr);
   1.230 +extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenAdd64(volatile Uint64 * ptr, Uint64 value);
   1.231 +extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenSubtract64(volatile Uint64 * ptr, Uint64 value);
   1.232 +extern DECLSPEC Uint64 SDLCALL SDL_AtomicIncrementThenFetch64(volatile Uint64 * ptr);
   1.233 +extern DECLSPEC Uint64 SDLCALL SDL_AtomicDecrementThenFetch64(volatile Uint64 * ptr);
   1.234 +extern DECLSPEC Uint64 SDLCALL SDL_AtomicAddThenFetch64(volatile Uint64 * ptr, Uint64 value);
   1.235 +extern DECLSPEC Uint64 SDLCALL SDL_AtomicSubtractThenFetch64(volatile Uint64 * ptr, Uint64 value);
   1.236  #endif /*  SDL_HAS_64BIT_TYPE */
   1.237  
   1.238  /* Ends C function definitions when using C++ */
     2.1 --- a/src/atomic/dummy/SDL_atomic.c	Tue Jul 07 14:02:57 2009 +0000
     2.2 +++ b/src/atomic/dummy/SDL_atomic.c	Thu Jul 09 21:31:27 2009 +0000
     2.3 @@ -165,7 +165,7 @@
     2.4  /* 8 bit atomic operations */
     2.5  
     2.6  Uint8
     2.7 -SDL_AtomicExchange8(Uint8 * ptr, Uint8 value)
     2.8 +SDL_AtomicExchange8(volatile Uint8 * ptr, Uint8 value)
     2.9  {
    2.10  #ifdef nativeExchange8
    2.11     return nativeExchange8(ptr, value);
    2.12 @@ -182,7 +182,7 @@
    2.13  }
    2.14  
    2.15  SDL_bool
    2.16 -SDL_AtomicCompareThenSet8(Uint8 * ptr, Uint8 oldvalue, Uint8 newvalue)
    2.17 +SDL_AtomicCompareThenSet8(volatile Uint8 * ptr, Uint8 oldvalue, Uint8 newvalue)
    2.18  {
    2.19  #ifdef nativeCompareThenSet8
    2.20     return (SDL_bool)nativeCompareThenSet8(ptr, oldvalue, newvalue);
    2.21 @@ -202,7 +202,7 @@
    2.22  }
    2.23  
    2.24  SDL_bool
    2.25 -SDL_AtomicTestThenSet8(Uint8 * ptr)
    2.26 +SDL_AtomicTestThenSet8(volatile Uint8 * ptr)
    2.27  {
    2.28  #ifdef nativeTestThenSet8
    2.29     return (SDL_bool)nativeTestThenSet8(ptr);
    2.30 @@ -222,7 +222,7 @@
    2.31  }
    2.32  
    2.33  void
    2.34 -SDL_AtomicClear8(Uint8 * ptr)
    2.35 +SDL_AtomicClear8(volatile Uint8 * ptr)
    2.36  {
    2.37  #ifdef nativeClear8
    2.38     nativeClear8(ptr);
    2.39 @@ -236,7 +236,7 @@
    2.40  }
    2.41  
    2.42  Uint8
    2.43 -SDL_AtomicFetchThenIncrement8(Uint8 * ptr)
    2.44 +SDL_AtomicFetchThenIncrement8(volatile Uint8 * ptr)
    2.45  {
    2.46  #ifdef nativeFetchThenIncrement8
    2.47     return nativeFetchThenIncrement8(ptr);
    2.48 @@ -253,7 +253,7 @@
    2.49  }
    2.50  
    2.51  Uint8
    2.52 -SDL_AtomicFetchThenDecrement8(Uint8 * ptr)
    2.53 +SDL_AtomicFetchThenDecrement8(volatile Uint8 * ptr)
    2.54  {
    2.55  #ifdef nativeFetchThenDecrement8
    2.56     return nativeFetchThenDecrement8(ptr);
    2.57 @@ -270,7 +270,7 @@
    2.58  }
    2.59  
    2.60  Uint8
    2.61 -SDL_AtomicFetchThenAdd8(Uint8 * ptr, Uint8 value)
    2.62 +SDL_AtomicFetchThenAdd8(volatile Uint8 * ptr, Uint8 value)
    2.63  {
    2.64  #ifdef nativeFetchThenAdd8
    2.65     return nativeFetchThenAdd8(ptr, value);
    2.66 @@ -287,7 +287,7 @@
    2.67  }
    2.68  
    2.69  Uint8
    2.70 -SDL_AtomicFetchThenSubtract8(Uint8 * ptr, Uint8 value)
    2.71 +SDL_AtomicFetchThenSubtract8(volatile Uint8 * ptr, Uint8 value)
    2.72  {
    2.73  #ifdef nativeFetchThenSubtract8
    2.74     return nativeFetchThenSubtract8(ptr, value);
    2.75 @@ -304,7 +304,7 @@
    2.76  }
    2.77  
    2.78  Uint8
    2.79 -SDL_AtomicIncrementThenFetch8(Uint8 * ptr)
    2.80 +SDL_AtomicIncrementThenFetch8(volatile Uint8 * ptr)
    2.81  {
    2.82  #ifdef nativeIncrementThenFetch8
    2.83     return nativeIncrementThenFetch8(ptr);
    2.84 @@ -321,7 +321,7 @@
    2.85  }
    2.86  
    2.87  Uint8
    2.88 -SDL_AtomicDecrementThenFetch8(Uint8 * ptr)
    2.89 +SDL_AtomicDecrementThenFetch8(volatile Uint8 * ptr)
    2.90  {
    2.91  #ifdef nativeDecrementThenFetch8
    2.92     return nativeDecrementThenFetch8(ptr);
    2.93 @@ -338,7 +338,7 @@
    2.94  }
    2.95  
    2.96  Uint8
    2.97 -SDL_AtomicAddThenFetch8(Uint8 * ptr, Uint8 value)
    2.98 +SDL_AtomicAddThenFetch8(volatile Uint8 * ptr, Uint8 value)
    2.99  {
   2.100  #ifdef nativeAddThenFetch8
   2.101     return nativeAddThenFetch8(ptr, value);
   2.102 @@ -355,7 +355,7 @@
   2.103  }
   2.104  
   2.105  Uint8
   2.106 -SDL_AtomicSubtractThenFetch8(Uint8 * ptr, Uint8 value)
   2.107 +SDL_AtomicSubtractThenFetch8(volatile Uint8 * ptr, Uint8 value)
   2.108  {
   2.109  #ifdef nativeSubtractThenFetch8
   2.110     return nativeSubtractThenFetch8(ptr, value);
   2.111 @@ -374,7 +374,7 @@
   2.112  /* 16 bit atomic operations */
   2.113  
   2.114  Uint16
   2.115 -SDL_AtomicExchange16(Uint16 * ptr, Uint16 value)
   2.116 +SDL_AtomicExchange16(volatile Uint16 * ptr, Uint16 value)
   2.117  {
   2.118  #ifdef nativeExchange16
   2.119     return nativeExchange16(ptr, value);
   2.120 @@ -391,7 +391,7 @@
   2.121  }
   2.122  
   2.123  SDL_bool
   2.124 -SDL_AtomicCompareThenSet16(Uint16 * ptr, Uint16 oldvalue, Uint16 newvalue)
   2.125 +SDL_AtomicCompareThenSet16(volatile Uint16 * ptr, Uint16 oldvalue, Uint16 newvalue)
   2.126  {
   2.127  #ifdef nativeCompareThenSet16
   2.128     return (SDL_bool)nativeCompareThenSet16(ptr, oldvalue, newvalue);
   2.129 @@ -411,7 +411,7 @@
   2.130  }
   2.131  
   2.132  SDL_bool
   2.133 -SDL_AtomicTestThenSet16(Uint16 * ptr)
   2.134 +SDL_AtomicTestThenSet16(volatile Uint16 * ptr)
   2.135  {
   2.136  #ifdef nativeTestThenSet16
   2.137     return (SDL_bool)nativeTestThenSet16(ptr);
   2.138 @@ -431,7 +431,7 @@
   2.139  }
   2.140  
   2.141  void
   2.142 -SDL_AtomicClear16(Uint16 * ptr)
   2.143 +SDL_AtomicClear16(volatile Uint16 * ptr)
   2.144  {
   2.145  #ifdef nativeClear16
   2.146     nativeClear16(ptr);
   2.147 @@ -445,7 +445,7 @@
   2.148  }
   2.149  
   2.150  Uint16
   2.151 -SDL_AtomicFetchThenIncrement16(Uint16 * ptr)
   2.152 +SDL_AtomicFetchThenIncrement16(volatile Uint16 * ptr)
   2.153  {
   2.154  #ifdef nativeFetchThenIncrement16
   2.155     return nativeFetchThenIncrement16(ptr);
   2.156 @@ -462,7 +462,7 @@
   2.157  }
   2.158  
   2.159  Uint16
   2.160 -SDL_AtomicFetchThenDecrement16(Uint16 * ptr)
   2.161 +SDL_AtomicFetchThenDecrement16(volatile Uint16 * ptr)
   2.162  {
   2.163  #ifdef nativeFetchThenDecrement16
   2.164     return nativeFetchThenDecrement16(ptr);
   2.165 @@ -479,7 +479,7 @@
   2.166  }
   2.167  
   2.168  Uint16
   2.169 -SDL_AtomicFetchThenAdd16(Uint16 * ptr, Uint16 value)
   2.170 +SDL_AtomicFetchThenAdd16(volatile Uint16 * ptr, Uint16 value)
   2.171  {
   2.172  #ifdef nativeFetchThenAdd16
   2.173     return nativeFetchThenAdd16(ptr, value);
   2.174 @@ -496,7 +496,7 @@
   2.175  }
   2.176  
   2.177  Uint16
   2.178 -SDL_AtomicFetchThenSubtract16(Uint16 * ptr, Uint16 value)
   2.179 +SDL_AtomicFetchThenSubtract16(volatile Uint16 * ptr, Uint16 value)
   2.180  {
   2.181  #ifdef nativeFetchThenSubtract16
   2.182     return nativeFetchThenSubtract16(ptr, value);
   2.183 @@ -513,7 +513,7 @@
   2.184  }
   2.185  
   2.186  Uint16
   2.187 -SDL_AtomicIncrementThenFetch16(Uint16 * ptr)
   2.188 +SDL_AtomicIncrementThenFetch16(volatile Uint16 * ptr)
   2.189  {
   2.190  #ifdef nativeIncrementThenFetch16
   2.191     return nativeIncrementThenFetch16(ptr);
   2.192 @@ -530,7 +530,7 @@
   2.193  }
   2.194  
   2.195  Uint16
   2.196 -SDL_AtomicDecrementThenFetch16(Uint16 * ptr)
   2.197 +SDL_AtomicDecrementThenFetch16(volatile Uint16 * ptr)
   2.198  {
   2.199  #ifdef nativeDecrementThenFetch16
   2.200     return nativeDecrementThenFetch16(ptr);
   2.201 @@ -547,7 +547,7 @@
   2.202  }
   2.203  
   2.204  Uint16
   2.205 -SDL_AtomicAddThenFetch16(Uint16 * ptr, Uint16 value)
   2.206 +SDL_AtomicAddThenFetch16(volatile Uint16 * ptr, Uint16 value)
   2.207  {
   2.208  #ifdef nativeAddThenFetch16
   2.209     return nativeAddThenFetch16(ptr, value);
   2.210 @@ -564,7 +564,7 @@
   2.211  }
   2.212  
   2.213  Uint16
   2.214 -SDL_AtomicSubtractThenFetch16(Uint16 * ptr, Uint16 value)
   2.215 +SDL_AtomicSubtractThenFetch16(volatile Uint16 * ptr, Uint16 value)
   2.216  {
   2.217  #ifdef nativeSubtractThenFetch16
   2.218     return nativeSubtractThenFetch16(ptr, value);
   2.219 @@ -583,7 +583,7 @@
   2.220  /* 32 bit atomic operations */
   2.221  
   2.222  Uint32
   2.223 -SDL_AtomicExchange32(Uint32 * ptr, Uint32 value)
   2.224 +SDL_AtomicExchange32(volatile Uint32 * ptr, Uint32 value)
   2.225  {
   2.226  #ifdef nativeExchange32
   2.227     return nativeExchange32(ptr, value);
   2.228 @@ -600,7 +600,7 @@
   2.229  }
   2.230  
   2.231  SDL_bool
   2.232 -SDL_AtomicCompareThenSet32(Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue)
   2.233 +SDL_AtomicCompareThenSet32(volatile Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue)
   2.234  {
   2.235  #ifdef nativeCompareThenSet32
   2.236     return (SDL_bool)nativeCompareThenSet32(ptr, oldvalue, newvalue);
   2.237 @@ -620,7 +620,7 @@
   2.238  }
   2.239  
   2.240  SDL_bool
   2.241 -SDL_AtomicTestThenSet32(Uint32 * ptr)
   2.242 +SDL_AtomicTestThenSet32(volatile Uint32 * ptr)
   2.243  {
   2.244  #ifdef nativeTestThenSet32
   2.245     return (SDL_bool)nativeTestThenSet32(ptr);
   2.246 @@ -640,7 +640,7 @@
   2.247  }
   2.248  
   2.249  void
   2.250 -SDL_AtomicClear32(Uint32 * ptr)
   2.251 +SDL_AtomicClear32(volatile Uint32 * ptr)
   2.252  {
   2.253  #ifdef nativeClear32
   2.254     nativeClear32(ptr);
   2.255 @@ -654,7 +654,7 @@
   2.256  }
   2.257  
   2.258  Uint32
   2.259 -SDL_AtomicFetchThenIncrement32(Uint32 * ptr)
   2.260 +SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr)
   2.261  {
   2.262  #ifdef nativeFetchThenIncrement32
   2.263     return nativeFetchThenIncrement32(ptr);
   2.264 @@ -671,7 +671,7 @@
   2.265  }
   2.266  
   2.267  Uint32
   2.268 -SDL_AtomicFetchThenDecrement32(Uint32 * ptr)
   2.269 +SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr)
   2.270  {
   2.271  #ifdef nativeFetchThenDecrement32
   2.272     return nativeFetchThenDecrement32(ptr);
   2.273 @@ -688,7 +688,7 @@
   2.274  }
   2.275  
   2.276  Uint32
   2.277 -SDL_AtomicFetchThenAdd32(Uint32 * ptr, Uint32 value)
   2.278 +SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value)
   2.279  {
   2.280  #ifdef nativeFetchThenAdd32
   2.281     return nativeFetchThenAdd32(ptr, value);
   2.282 @@ -705,7 +705,7 @@
   2.283  }
   2.284  
   2.285  Uint32
   2.286 -SDL_AtomicFetchThenSubtract32(Uint32 * ptr, Uint32 value)
   2.287 +SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value)
   2.288  {
   2.289  #ifdef nativeFetchThenSubtract32
   2.290     return nativeFetchThenSubtract32(ptr, value);
   2.291 @@ -722,7 +722,7 @@
   2.292  }
   2.293  
   2.294  Uint32
   2.295 -SDL_AtomicIncrementThenFetch32(Uint32 * ptr)
   2.296 +SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr)
   2.297  {
   2.298  #ifdef nativeIncrementThenFetch32
   2.299     return nativeIncrementThenFetch32(ptr);
   2.300 @@ -739,7 +739,7 @@
   2.301  }
   2.302  
   2.303  Uint32
   2.304 -SDL_AtomicDecrementThenFetch32(Uint32 * ptr)
   2.305 +SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr)
   2.306  {
   2.307  #ifdef nativeDecrementThenFetch32
   2.308     return nativeDecrementThenFetch32(ptr);
   2.309 @@ -756,7 +756,7 @@
   2.310  }
   2.311  
   2.312  Uint32
   2.313 -SDL_AtomicAddThenFetch32(Uint32 * ptr, Uint32 value)
   2.314 +SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value)
   2.315  {
   2.316  #ifdef nativeAddThenFetch32
   2.317     return nativeAddThenFetch32(ptr, value);
   2.318 @@ -773,7 +773,7 @@
   2.319  }
   2.320  
   2.321  Uint32
   2.322 -SDL_AtomicSubtractThenFetch32(Uint32 * ptr, Uint32 value)
   2.323 +SDL_AtomicSubtractThenFetch32(volatile Uint32 * ptr, Uint32 value)
   2.324  {
   2.325  #ifdef nativeSubtractThenFetch32
   2.326     return nativeSubtractThenFetch32(ptr, value);
   2.327 @@ -793,7 +793,7 @@
   2.328  #ifdef SDL_HAS_64BIT_TYPE
   2.329  
   2.330  Uint64
   2.331 -SDL_AtomicExchange64(Uint64 * ptr, Uint64 value)
   2.332 +SDL_AtomicExchange64(volatile Uint64 * ptr, Uint64 value)
   2.333  {
   2.334  #ifdef nativeExchange64
   2.335     return nativeExchange64(ptr, value);
   2.336 @@ -810,7 +810,7 @@
   2.337  }
   2.338  
   2.339  SDL_bool
   2.340 -SDL_AtomicCompareThenSet64(Uint64 * ptr, Uint64 oldvalue, Uint64 newvalue)
   2.341 +SDL_AtomicCompareThenSet64(volatile Uint64 * ptr, Uint64 oldvalue, Uint64 newvalue)
   2.342  {
   2.343  #ifdef nativeCompareThenSet64
   2.344     return (SDL_bool)nativeCompareThenSet64(ptr, oldvalue, newvalue);
   2.345 @@ -830,7 +830,7 @@
   2.346  }
   2.347  
   2.348  SDL_bool
   2.349 -SDL_AtomicTestThenSet64(Uint64 * ptr)
   2.350 +SDL_AtomicTestThenSet64(volatile Uint64 * ptr)
   2.351  {
   2.352  #ifdef nativeTestThenSet64
   2.353     return (SDL_bool)nativeTestThenSet64(ptr);
   2.354 @@ -850,7 +850,7 @@
   2.355  }
   2.356  
   2.357  void
   2.358 -SDL_AtomicClear64(Uint64 * ptr)
   2.359 +SDL_AtomicClear64(volatile Uint64 * ptr)
   2.360  {
   2.361  #ifdef nativeClear64
   2.362     nativeClear64(ptr);
   2.363 @@ -864,7 +864,7 @@
   2.364  }
   2.365  
   2.366  Uint64
   2.367 -SDL_AtomicFetchThenIncrement64(Uint64 * ptr)
   2.368 +SDL_AtomicFetchThenIncrement64(volatile Uint64 * ptr)
   2.369  {
   2.370  #ifdef nativeFetchThenIncrement64
   2.371     return nativeFetchThenIncrement64(ptr);
   2.372 @@ -881,7 +881,7 @@
   2.373  }
   2.374  
   2.375  Uint64
   2.376 -SDL_AtomicFetchThenDecrement64(Uint64 * ptr)
   2.377 +SDL_AtomicFetchThenDecrement64(volatile Uint64 * ptr)
   2.378  {
   2.379  #ifdef nativeFetchThenDecrement64
   2.380     return nativeFetchThenDecrement64(ptr);
   2.381 @@ -898,7 +898,7 @@
   2.382  }
   2.383  
   2.384  Uint64
   2.385 -SDL_AtomicFetchThenAdd64(Uint64 * ptr, Uint64 value)
   2.386 +SDL_AtomicFetchThenAdd64(volatile Uint64 * ptr, Uint64 value)
   2.387  {
   2.388  #ifdef nativeFetchThenAdd64
   2.389     return nativeFetchThenAdd64(ptr, value);
   2.390 @@ -915,7 +915,7 @@
   2.391  }
   2.392  
   2.393  Uint64
   2.394 -SDL_AtomicFetchThenSubtract64(Uint64 * ptr, Uint64 value)
   2.395 +SDL_AtomicFetchThenSubtract64(volatile Uint64 * ptr, Uint64 value)
   2.396  {
   2.397  #ifdef nativeFetchThenSubtract64
   2.398     return nativeFetchThenSubtract64(ptr, value);
   2.399 @@ -932,7 +932,7 @@
   2.400  }
   2.401  
   2.402  Uint64
   2.403 -SDL_AtomicIncrementThenFetch64(Uint64 * ptr)
   2.404 +SDL_AtomicIncrementThenFetch64(volatile Uint64 * ptr)
   2.405  {
   2.406  #ifdef nativeIncrementThenFetch64
   2.407     return nativeIncrementThenFetch64(ptr);
   2.408 @@ -949,7 +949,7 @@
   2.409  }
   2.410  
   2.411  Uint64
   2.412 -SDL_AtomicDecrementThenFetch64(Uint64 * ptr)
   2.413 +SDL_AtomicDecrementThenFetch64(volatile Uint64 * ptr)
   2.414  {
   2.415  #ifdef nativeDecrementThenFetch64
   2.416     return nativeDecrementThenFetch64(ptr);
   2.417 @@ -966,7 +966,7 @@
   2.418  }
   2.419  
   2.420  Uint64
   2.421 -SDL_AtomicAddThenFetch64(Uint64 * ptr, Uint64 value)
   2.422 +SDL_AtomicAddThenFetch64(volatile Uint64 * ptr, Uint64 value)
   2.423  {
   2.424  #ifdef nativeAddThenFetch64
   2.425     return nativeAddThenFetch64(ptr, value);
   2.426 @@ -983,7 +983,7 @@
   2.427  }
   2.428  
   2.429  Uint64
   2.430 -SDL_AtomicSubtractThenFetch64(Uint64 * ptr, Uint64 value)
   2.431 +SDL_AtomicSubtractThenFetch64(volatile Uint64 * ptr, Uint64 value)
   2.432  {
   2.433  #ifdef nativeSubtractThenFetch64
   2.434     return nativeSubtractThenFetch64(ptr, value);
     3.1 --- a/src/atomic/linux/SDL_atomic.c	Tue Jul 07 14:02:57 2009 +0000
     3.2 +++ b/src/atomic/linux/SDL_atomic.c	Thu Jul 09 21:31:27 2009 +0000
     3.3 @@ -137,7 +137,7 @@
     3.4  /* 8 bit atomic operations */
     3.5  
     3.6  Uint8
     3.7 -SDL_AtomicExchange8(Uint8 * ptr, Uint8 value)
     3.8 +SDL_AtomicExchange8(volatile Uint8 * ptr, Uint8 value)
     3.9  {
    3.10  #ifdef nativeExchange8
    3.11     return nativeExchange8(ptr, value);
    3.12 @@ -154,7 +154,7 @@
    3.13  }
    3.14  
    3.15  SDL_bool
    3.16 -SDL_AtomicCompareThenSet8(Uint8 * ptr, Uint8 oldvalue, Uint8 newvalue)
    3.17 +SDL_AtomicCompareThenSet8(volatile Uint8 * ptr, Uint8 oldvalue, Uint8 newvalue)
    3.18  {
    3.19  #ifdef nativeCompareThenSet8
    3.20     return (SDL_bool)nativeCompareThenSet8(ptr, oldvalue, newvalue);
    3.21 @@ -174,7 +174,7 @@
    3.22  }
    3.23  
    3.24  SDL_bool
    3.25 -SDL_AtomicTestThenSet8(Uint8 * ptr)
    3.26 +SDL_AtomicTestThenSet8(volatile Uint8 * ptr)
    3.27  {
    3.28  #ifdef nativeTestThenSet8
    3.29     return (SDL_bool)nativeTestThenSet8(ptr);
    3.30 @@ -194,7 +194,7 @@
    3.31  }
    3.32  
    3.33  void
    3.34 -SDL_AtomicClear8(Uint8 * ptr)
    3.35 +SDL_AtomicClear8(volatile Uint8 * ptr)
    3.36  {
    3.37  #ifdef nativeClear8
    3.38     nativeClear8(ptr);
    3.39 @@ -208,7 +208,7 @@
    3.40  }
    3.41  
    3.42  Uint8
    3.43 -SDL_AtomicFetchThenIncrement8(Uint8 * ptr)
    3.44 +SDL_AtomicFetchThenIncrement8(volatile Uint8 * ptr)
    3.45  {
    3.46  #ifdef nativeFetchThenIncrement8
    3.47     return nativeFetchThenIncrement8(ptr);
    3.48 @@ -225,7 +225,7 @@
    3.49  }
    3.50  
    3.51  Uint8
    3.52 -SDL_AtomicFetchThenDecrement8(Uint8 * ptr)
    3.53 +SDL_AtomicFetchThenDecrement8(volatile Uint8 * ptr)
    3.54  {
    3.55  #ifdef nativeFetchThenDecrement8
    3.56     return nativeFetchThenDecrement8(ptr);
    3.57 @@ -242,7 +242,7 @@
    3.58  }
    3.59  
    3.60  Uint8
    3.61 -SDL_AtomicFetchThenAdd8(Uint8 * ptr, Uint8 value)
    3.62 +SDL_AtomicFetchThenAdd8(volatile Uint8 * ptr, Uint8 value)
    3.63  {
    3.64  #ifdef nativeFetchThenAdd8
    3.65     return nativeFetchThenAdd8(ptr, value);
    3.66 @@ -259,7 +259,7 @@
    3.67  }
    3.68  
    3.69  Uint8
    3.70 -SDL_AtomicFetchThenSubtract8(Uint8 * ptr, Uint8 value)
    3.71 +SDL_AtomicFetchThenSubtract8(volatile Uint8 * ptr, Uint8 value)
    3.72  {
    3.73  #ifdef nativeFetchThenSubtract8
    3.74     return nativeFetchThenSubtract8(ptr, value);
    3.75 @@ -276,7 +276,7 @@
    3.76  }
    3.77  
    3.78  Uint8
    3.79 -SDL_AtomicIncrementThenFetch8(Uint8 * ptr)
    3.80 +SDL_AtomicIncrementThenFetch8(volatile Uint8 * ptr)
    3.81  {
    3.82  #ifdef nativeIncrementThenFetch8
    3.83     return nativeIncrementThenFetch8(ptr);
    3.84 @@ -293,7 +293,7 @@
    3.85  }
    3.86  
    3.87  Uint8
    3.88 -SDL_AtomicDecrementThenFetch8(Uint8 * ptr)
    3.89 +SDL_AtomicDecrementThenFetch8(volatile Uint8 * ptr)
    3.90  {
    3.91  #ifdef nativeDecrementThenFetch8
    3.92     return nativeDecrementThenFetch8(ptr);
    3.93 @@ -310,7 +310,7 @@
    3.94  }
    3.95  
    3.96  Uint8
    3.97 -SDL_AtomicAddThenFetch8(Uint8 * ptr, Uint8 value)
    3.98 +SDL_AtomicAddThenFetch8(volatile Uint8 * ptr, Uint8 value)
    3.99  {
   3.100  #ifdef nativeAddThenFetch8
   3.101     return nativeAddThenFetch8(ptr, value);
   3.102 @@ -327,7 +327,7 @@
   3.103  }
   3.104  
   3.105  Uint8
   3.106 -SDL_AtomicSubtractThenFetch8(Uint8 * ptr, Uint8 value)
   3.107 +SDL_AtomicSubtractThenFetch8(volatile Uint8 * ptr, Uint8 value)
   3.108  {
   3.109  #ifdef nativeSubtractThenFetch8
   3.110     return nativeSubtractThenFetch8(ptr, value);
   3.111 @@ -346,7 +346,7 @@
   3.112  /* 16 bit atomic operations */
   3.113  
   3.114  Uint16
   3.115 -SDL_AtomicExchange16(Uint16 * ptr, Uint16 value)
   3.116 +SDL_AtomicExchange16(volatile Uint16 * ptr, Uint16 value)
   3.117  {
   3.118  #ifdef nativeExchange16
   3.119     return nativeExchange16(ptr, value);
   3.120 @@ -363,7 +363,7 @@
   3.121  }
   3.122  
   3.123  SDL_bool
   3.124 -SDL_AtomicCompareThenSet16(Uint16 * ptr, Uint16 oldvalue, Uint16 newvalue)
   3.125 +SDL_AtomicCompareThenSet16(volatile Uint16 * ptr, Uint16 oldvalue, Uint16 newvalue)
   3.126  {
   3.127  #ifdef nativeCompareThenSet16
   3.128     return (SDL_bool)nativeCompareThenSet16(ptr, oldvalue, newvalue);
   3.129 @@ -383,7 +383,7 @@
   3.130  }
   3.131  
   3.132  SDL_bool
   3.133 -SDL_AtomicTestThenSet16(Uint16 * ptr)
   3.134 +SDL_AtomicTestThenSet16(volatile Uint16 * ptr)
   3.135  {
   3.136  #ifdef nativeTestThenSet16
   3.137     return (SDL_bool)nativeTestThenSet16(ptr);
   3.138 @@ -403,7 +403,7 @@
   3.139  }
   3.140  
   3.141  void
   3.142 -SDL_AtomicClear16(Uint16 * ptr)
   3.143 +SDL_AtomicClear16(volatile Uint16 * ptr)
   3.144  {
   3.145  #ifdef nativeClear16
   3.146     nativeClear16(ptr);
   3.147 @@ -417,7 +417,7 @@
   3.148  }
   3.149  
   3.150  Uint16
   3.151 -SDL_AtomicFetchThenIncrement16(Uint16 * ptr)
   3.152 +SDL_AtomicFetchThenIncrement16(volatile Uint16 * ptr)
   3.153  {
   3.154  #ifdef nativeFetchThenIncrement16
   3.155     return nativeFetchThenIncrement16(ptr);
   3.156 @@ -434,7 +434,7 @@
   3.157  }
   3.158  
   3.159  Uint16
   3.160 -SDL_AtomicFetchThenDecrement16(Uint16 * ptr)
   3.161 +SDL_AtomicFetchThenDecrement16(volatile Uint16 * ptr)
   3.162  {
   3.163  #ifdef nativeFetchThenDecrement16
   3.164     return nativeFetchThenDecrement16(ptr);
   3.165 @@ -451,7 +451,7 @@
   3.166  }
   3.167  
   3.168  Uint16
   3.169 -SDL_AtomicFetchThenAdd16(Uint16 * ptr, Uint16 value)
   3.170 +SDL_AtomicFetchThenAdd16(volatile Uint16 * ptr, Uint16 value)
   3.171  {
   3.172  #ifdef nativeFetchThenAdd16
   3.173     return nativeFetchThenAdd16(ptr, value);
   3.174 @@ -468,7 +468,7 @@
   3.175  }
   3.176  
   3.177  Uint16
   3.178 -SDL_AtomicFetchThenSubtract16(Uint16 * ptr, Uint16 value)
   3.179 +SDL_AtomicFetchThenSubtract16(volatile Uint16 * ptr, Uint16 value)
   3.180  {
   3.181  #ifdef nativeFetchThenSubtract16
   3.182     return nativeFetchThenSubtract16(ptr, value);
   3.183 @@ -485,7 +485,7 @@
   3.184  }
   3.185  
   3.186  Uint16
   3.187 -SDL_AtomicIncrementThenFetch16(Uint16 * ptr)
   3.188 +SDL_AtomicIncrementThenFetch16(volatile Uint16 * ptr)
   3.189  {
   3.190  #ifdef nativeIncrementThenFetch16
   3.191     return nativeIncrementThenFetch16(ptr);
   3.192 @@ -502,7 +502,7 @@
   3.193  }
   3.194  
   3.195  Uint16
   3.196 -SDL_AtomicDecrementThenFetch16(Uint16 * ptr)
   3.197 +SDL_AtomicDecrementThenFetch16(volatile Uint16 * ptr)
   3.198  {
   3.199  #ifdef nativeDecrementThenFetch16
   3.200     return nativeDecrementThenFetch16(ptr);
   3.201 @@ -519,7 +519,7 @@
   3.202  }
   3.203  
   3.204  Uint16
   3.205 -SDL_AtomicAddThenFetch16(Uint16 * ptr, Uint16 value)
   3.206 +SDL_AtomicAddThenFetch16(volatile Uint16 * ptr, Uint16 value)
   3.207  {
   3.208  #ifdef nativeAddThenFetch16
   3.209     return nativeAddThenFetch16(ptr, value);
   3.210 @@ -536,7 +536,7 @@
   3.211  }
   3.212  
   3.213  Uint16
   3.214 -SDL_AtomicSubtractThenFetch16(Uint16 * ptr, Uint16 value)
   3.215 +SDL_AtomicSubtractThenFetch16(volatile Uint16 * ptr, Uint16 value)
   3.216  {
   3.217  #ifdef nativeSubtractThenFetch16
   3.218     return nativeSubtractThenFetch16(ptr, value);
   3.219 @@ -555,7 +555,7 @@
   3.220  /* 32 bit atomic operations */
   3.221  
   3.222  Uint32
   3.223 -SDL_AtomicExchange32(Uint32 * ptr, Uint32 value)
   3.224 +SDL_AtomicExchange32(volatile Uint32 * ptr, Uint32 value)
   3.225  {
   3.226  #ifdef nativeExchange32
   3.227     return nativeExchange32(ptr, value);
   3.228 @@ -572,7 +572,7 @@
   3.229  }
   3.230  
   3.231  SDL_bool
   3.232 -SDL_AtomicCompareThenSet32(Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue)
   3.233 +SDL_AtomicCompareThenSet32(volatile Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue)
   3.234  {
   3.235  #ifdef nativeCompareThenSet32
   3.236     return (SDL_bool)nativeCompareThenSet32(ptr, oldvalue, newvalue);
   3.237 @@ -592,7 +592,7 @@
   3.238  }
   3.239  
   3.240  SDL_bool
   3.241 -SDL_AtomicTestThenSet32(Uint32 * ptr)
   3.242 +SDL_AtomicTestThenSet32(volatile Uint32 * ptr)
   3.243  {
   3.244  #ifdef nativeTestThenSet32
   3.245     return (SDL_bool)nativeTestThenSet32(ptr);
   3.246 @@ -612,7 +612,7 @@
   3.247  }
   3.248  
   3.249  void
   3.250 -SDL_AtomicClear32(Uint32 * ptr)
   3.251 +SDL_AtomicClear32(volatile Uint32 * ptr)
   3.252  {
   3.253  #ifdef nativeClear32
   3.254     nativeClear32(ptr);
   3.255 @@ -626,7 +626,7 @@
   3.256  }
   3.257  
   3.258  Uint32
   3.259 -SDL_AtomicFetchThenIncrement32(Uint32 * ptr)
   3.260 +SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr)
   3.261  {
   3.262  #ifdef nativeFetchThenIncrement32
   3.263     return nativeFetchThenIncrement32(ptr);
   3.264 @@ -643,7 +643,7 @@
   3.265  }
   3.266  
   3.267  Uint32
   3.268 -SDL_AtomicFetchThenDecrement32(Uint32 * ptr)
   3.269 +SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr)
   3.270  {
   3.271  #ifdef nativeFetchThenDecrement32
   3.272     return nativeFetchThenDecrement32(ptr);
   3.273 @@ -660,7 +660,7 @@
   3.274  }
   3.275  
   3.276  Uint32
   3.277 -SDL_AtomicFetchThenAdd32(Uint32 * ptr, Uint32 value)
   3.278 +SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value)
   3.279  {
   3.280  #ifdef nativeFetchThenAdd32
   3.281     return nativeFetchThenAdd32(ptr, value);
   3.282 @@ -677,7 +677,7 @@
   3.283  }
   3.284  
   3.285  Uint32
   3.286 -SDL_AtomicFetchThenSubtract32(Uint32 * ptr, Uint32 value)
   3.287 +SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value)
   3.288  {
   3.289  #ifdef nativeFetchThenSubtract32
   3.290     return nativeFetchThenSubtract32(ptr, value);
   3.291 @@ -694,7 +694,7 @@
   3.292  }
   3.293  
   3.294  Uint32
   3.295 -SDL_AtomicIncrementThenFetch32(Uint32 * ptr)
   3.296 +SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr)
   3.297  {
   3.298  #ifdef nativeIncrementThenFetch32
   3.299     return nativeIncrementThenFetch32(ptr);
   3.300 @@ -711,7 +711,7 @@
   3.301  }
   3.302  
   3.303  Uint32
   3.304 -SDL_AtomicDecrementThenFetch32(Uint32 * ptr)
   3.305 +SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr)
   3.306  {
   3.307  #ifdef nativeDecrementThenFetch32
   3.308     return nativeDecrementThenFetch32(ptr);
   3.309 @@ -728,7 +728,7 @@
   3.310  }
   3.311  
   3.312  Uint32
   3.313 -SDL_AtomicAddThenFetch32(Uint32 * ptr, Uint32 value)
   3.314 +SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value)
   3.315  {
   3.316  #ifdef nativeAddThenFetch32
   3.317     return nativeAddThenFetch32(ptr, value);
   3.318 @@ -745,7 +745,7 @@
   3.319  }
   3.320  
   3.321  Uint32
   3.322 -SDL_AtomicSubtractThenFetch32(Uint32 * ptr, Uint32 value)
   3.323 +SDL_AtomicSubtractThenFetch32(volatile Uint32 * ptr, Uint32 value)
   3.324  {
   3.325  #ifdef nativeSubtractThenFetch32
   3.326     return nativeSubtractThenFetch32(ptr, value);
   3.327 @@ -765,7 +765,7 @@
   3.328  #ifdef SDL_HAS_64BIT_TYPE
   3.329  
   3.330  Uint64
   3.331 -SDL_AtomicExchange64(Uint64 * ptr, Uint64 value)
   3.332 +SDL_AtomicExchange64(volatile Uint64 * ptr, Uint64 value)
   3.333  {
   3.334  #ifdef nativeExchange64
   3.335     return nativeExchange64(ptr, value);
   3.336 @@ -782,7 +782,7 @@
   3.337  }
   3.338  
   3.339  SDL_bool
   3.340 -SDL_AtomicCompareThenSet64(Uint64 * ptr, Uint64 oldvalue, Uint64 newvalue)
   3.341 +SDL_AtomicCompareThenSet64(volatile Uint64 * ptr, Uint64 oldvalue, Uint64 newvalue)
   3.342  {
   3.343  #ifdef nativeCompareThenSet64
   3.344     return (SDL_bool)nativeCompareThenSet64(ptr, oldvalue, newvalue);
   3.345 @@ -802,7 +802,7 @@
   3.346  }
   3.347  
   3.348  SDL_bool
   3.349 -SDL_AtomicTestThenSet64(Uint64 * ptr)
   3.350 +SDL_AtomicTestThenSet64(volatile Uint64 * ptr)
   3.351  {
   3.352  #ifdef nativeTestThenSet64
   3.353     return (SDL_bool)nativeTestThenSet64(ptr);
   3.354 @@ -822,7 +822,7 @@
   3.355  }
   3.356  
   3.357  void
   3.358 -SDL_AtomicClear64(Uint64 * ptr)
   3.359 +SDL_AtomicClear64(volatile Uint64 * ptr)
   3.360  {
   3.361  #ifdef nativeClear64
   3.362     nativeClear64(ptr);
   3.363 @@ -836,7 +836,7 @@
   3.364  }
   3.365  
   3.366  Uint64
   3.367 -SDL_AtomicFetchThenIncrement64(Uint64 * ptr)
   3.368 +SDL_AtomicFetchThenIncrement64(volatile Uint64 * ptr)
   3.369  {
   3.370  #ifdef nativeFetchThenIncrement64
   3.371     return nativeFetchThenIncrement64(ptr);
   3.372 @@ -853,7 +853,7 @@
   3.373  }
   3.374  
   3.375  Uint64
   3.376 -SDL_AtomicFetchThenDecrement64(Uint64 * ptr)
   3.377 +SDL_AtomicFetchThenDecrement64(volatile Uint64 * ptr)
   3.378  {
   3.379  #ifdef nativeFetchThenDecrement64
   3.380     return nativeFetchThenDecrement64(ptr);
   3.381 @@ -870,7 +870,7 @@
   3.382  }
   3.383  
   3.384  Uint64
   3.385 -SDL_AtomicFetchThenAdd64(Uint64 * ptr, Uint64 value)
   3.386 +SDL_AtomicFetchThenAdd64(volatile Uint64 * ptr, Uint64 value)
   3.387  {
   3.388  #ifdef nativeFetchThenAdd64
   3.389     return nativeFetchThenAdd64(ptr, value);
   3.390 @@ -887,7 +887,7 @@
   3.391  }
   3.392  
   3.393  Uint64
   3.394 -SDL_AtomicFetchThenSubtract64(Uint64 * ptr, Uint64 value)
   3.395 +SDL_AtomicFetchThenSubtract64(volatile Uint64 * ptr, Uint64 value)
   3.396  {
   3.397  #ifdef nativeFetchThenSubtract64
   3.398     return nativeFetchThenSubtract64(ptr, value);
   3.399 @@ -904,7 +904,7 @@
   3.400  }
   3.401  
   3.402  Uint64
   3.403 -SDL_AtomicIncrementThenFetch64(Uint64 * ptr)
   3.404 +SDL_AtomicIncrementThenFetch64(volatile Uint64 * ptr)
   3.405  {
   3.406  #ifdef nativeIncrementThenFetch64
   3.407     return nativeIncrementThenFetch64(ptr);
   3.408 @@ -921,7 +921,7 @@
   3.409  }
   3.410  
   3.411  Uint64
   3.412 -SDL_AtomicDecrementThenFetch64(Uint64 * ptr)
   3.413 +SDL_AtomicDecrementThenFetch64(volatile Uint64 * ptr)
   3.414  {
   3.415  #ifdef nativeDecrementThenFetch64
   3.416     return nativeDecrementThenFetch64(ptr);
   3.417 @@ -938,7 +938,7 @@
   3.418  }
   3.419  
   3.420  Uint64
   3.421 -SDL_AtomicAddThenFetch64(Uint64 * ptr, Uint64 value)
   3.422 +SDL_AtomicAddThenFetch64(volatile Uint64 * ptr, Uint64 value)
   3.423  {
   3.424  #ifdef nativeAddThenFetch64
   3.425     return nativeAddThenFetch64(ptr, value);
   3.426 @@ -955,7 +955,7 @@
   3.427  }
   3.428  
   3.429  Uint64
   3.430 -SDL_AtomicSubtractThenFetch64(Uint64 * ptr, Uint64 value)
   3.431 +SDL_AtomicSubtractThenFetch64(volatile Uint64 * ptr, Uint64 value)
   3.432  {
   3.433  #ifdef nativeSubtractThenFetch64
   3.434     return nativeSubtractThenFetch64(ptr, value);
     4.1 --- a/test/testatomic.c	Tue Jul 07 14:02:57 2009 +0000
     4.2 +++ b/test/testatomic.c	Thu Jul 09 21:31:27 2009 +0000
     4.3 @@ -23,16 +23,16 @@
     4.4  main(int argc, char **argv)
     4.5  {
     4.6  
     4.7 -   Uint8 val8 = 0;
     4.8 +   volatile Uint8 val8 = 0;
     4.9     Uint8 ret8 = 0;
    4.10  
    4.11 -   Uint16 val16 = 0;
    4.12 +   volatile Uint16 val16 = 0;
    4.13     Uint16 ret16 = 0;
    4.14  
    4.15 -   Uint32 val32 = 0;
    4.16 +   volatile Uint32 val32 = 0;
    4.17     Uint32 ret32 = 0;
    4.18  
    4.19 -   Uint64 val64 = 0;
    4.20 +   volatile Uint64 val64 = 0;
    4.21     Uint64 ret64 = 0;
    4.22  
    4.23     SDL_bool tfret = SDL_FALSE;