Some patches to make SDL compile with armcc (ARM's C compiler).
authorRyan C. Gordon <icculus@icculus.org>
Thu, 02 Mar 2017 13:33:04 -0500
changeset 109254de9d54bbc87
parent 10924 abfe0c4d98ac
child 10926 97c829825e0e
Some patches to make SDL compile with armcc (ARM's C compiler).
include/begin_code.h
src/SDL.c
src/SDL_internal.h
src/audio/SDL_audiocvt.c
src/video/SDL_shape.c
     1.1 --- a/include/begin_code.h	Wed Mar 01 15:05:54 2017 -0800
     1.2 +++ b/include/begin_code.h	Thu Mar 02 13:33:04 2017 -0500
     1.3 @@ -111,7 +111,7 @@
     1.4  #elif defined(_MSC_VER) || defined(__BORLANDC__) || \
     1.5        defined(__DMC__) || defined(__SC__) || \
     1.6        defined(__WATCOMC__) || defined(__LCC__) || \
     1.7 -      defined(__DECC)
     1.8 +      defined(__DECC) || defined(__CC_ARM)
     1.9  #define SDL_INLINE __inline
    1.10  #ifndef __inline__
    1.11  #define __inline__ __inline
     2.1 --- a/src/SDL.c	Wed Mar 01 15:05:54 2017 -0800
     2.2 +++ b/src/SDL.c	Thu Mar 02 13:33:04 2017 -0500
     2.3 @@ -78,7 +78,7 @@
     2.4  {
     2.5      int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
     2.6      SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255);
     2.7 -    return (SDL_SubsystemRefCount[subsystem_index] == 0);
     2.8 +    return (SDL_SubsystemRefCount[subsystem_index] == 0) ? SDL_TRUE : SDL_FALSE;
     2.9  }
    2.10  
    2.11  /* Private helper to check if a system needs to be quit. */
    2.12 @@ -92,7 +92,7 @@
    2.13      /* If we're in SDL_Quit, we shut down every subsystem, even if refcount
    2.14       * isn't zero.
    2.15       */
    2.16 -    return SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit;
    2.17 +    return (SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE;
    2.18  }
    2.19  
    2.20  void
     3.1 --- a/src/SDL_internal.h	Wed Mar 01 15:05:54 2017 -0800
     3.2 +++ b/src/SDL_internal.h	Thu Mar 02 13:33:04 2017 -0500
     3.3 @@ -29,7 +29,7 @@
     3.4  /* This is for a variable-length array at the end of a struct:
     3.5      struct x { int y; char z[SDL_VARIABLE_LENGTH_ARRAY]; };
     3.6     Use this because GCC 2 needs different magic than other compilers. */
     3.7 -#if (defined(__GNUC__) && (__GNUC__ <= 2))
     3.8 +#if (defined(__GNUC__) && (__GNUC__ <= 2)) || defined(__CC_ARM)
     3.9  #define SDL_VARIABLE_LENGTH_ARRAY 1
    3.10  #else
    3.11  #define SDL_VARIABLE_LENGTH_ARRAY
     4.1 --- a/src/audio/SDL_audiocvt.c	Wed Mar 01 15:05:54 2017 -0800
     4.2 +++ b/src/audio/SDL_audiocvt.c	Thu Mar 02 13:33:04 2017 -0500
     4.3 @@ -439,7 +439,10 @@
     4.4      const int srclen = cvt->len_cvt;
     4.5      Sint16 *dst = (Sint16 *) cvt->buf;
     4.6      const int dstlen = (cvt->len * cvt->len_mult);
     4.7 -    Sint16 state[2] = { src[0], src[1] };
     4.8 +    Sint16 state[2];
     4.9 +
    4.10 +    state[0] = src[0];
    4.11 +    state[1] = src[1];
    4.12  
    4.13      SDL_assert(format == AUDIO_S16SYS);
    4.14  
     5.1 --- a/src/video/SDL_shape.c	Wed Mar 01 15:05:54 2017 -0800
     5.2 +++ b/src/video/SDL_shape.c	Thu Mar 02 13:33:04 2017 -0500
     5.3 @@ -206,8 +206,14 @@
     5.4  SDL_ShapeTree*
     5.5  SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape)
     5.6  {
     5.7 -    SDL_Rect dimensions = {0,0,shape->w,shape->h};
     5.8 +    SDL_Rect dimensions;
     5.9      SDL_ShapeTree* result = NULL;
    5.10 +
    5.11 +    dimensions.x = 0;
    5.12 +    dimensions.y = 0;
    5.13 +    dimensions.w = shape->w;
    5.14 +    dimensions.h = shape->h;
    5.15 +
    5.16      if(SDL_MUSTLOCK(shape))
    5.17          SDL_LockSurface(shape);
    5.18      result = RecursivelyCalculateShapeTree(mode,shape,dimensions);