Clean up multi-include magic.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 10 Feb 2019 12:44:16 -0500
changeset 480c439c6d30cb
parent 47 6753afa26ee6
child 49 e848618f0962
Clean up multi-include magic.
src/SDL12_compat.c
src/SDL20_syms.h
     1.1 --- a/src/SDL12_compat.c	Sun Feb 10 12:38:07 2019 -0500
     1.2 +++ b/src/SDL12_compat.c	Sun Feb 10 12:44:16 2019 -0500
     1.3 @@ -57,19 +57,15 @@
     1.4  #define SDL20_SYM_PASSTHROUGH(rc,fn,params,args,ret) \
     1.5      SDL20_SYM(rc,fn,params,args,ret)
     1.6  #include "SDL20_syms.h"
     1.7 -#undef SDL20_SYM_PASSTHROUGH
     1.8 -#undef SDL20_SYM
     1.9 -
    1.10 +
    1.11 +/* this doesn't get handled in SDL20_syms.h because it uses varargs. */
    1.12  typedef int (SDLCALL *SDL20_SetError_t)(const char *fmt, ...);
    1.13  static SDL20_SetError_t SDL20_SetError = NULL;
    1.14  
    1.15  /* Things that _should_ be binary compatible pass right through... */
    1.16 -#define SDL20_SYM(rc,fn,params,args,ret)
    1.17  #define SDL20_SYM_PASSTHROUGH(rc,fn,params,args,ret) \
    1.18      DECLSPEC rc SDLCALL SDL_##fn params { ret SDL20_##fn args; }
    1.19  #include "SDL20_syms.h"
    1.20 -#undef SDL20_SYM_PASSTHROUGH
    1.21 -#undef SDL20_SYM
    1.22  
    1.23  
    1.24  /* these are macros (etc) in the SDL headers, so make our own. */
    1.25 @@ -446,8 +442,6 @@
    1.26      #define SDL20_SYM(rc,fn,params,args,ret) SDL20_##fn = NULL;
    1.27      #define SDL20_SYM_PASSTHROUGH(rc,fn,params,args,ret) SDL20_SYM(rc,fn,params,args,ret)
    1.28      #include "SDL20_syms.h"
    1.29 -    #undef SDL20_SYM_PASSTHROUGH
    1.30 -    #undef SDL20_SYM
    1.31      SDL20_SetError = NULL;
    1.32      CloseSDL20Library();
    1.33  }
    1.34 @@ -462,8 +456,6 @@
    1.35          #define SDL20_SYM(rc,fn,params,args,ret) SDL20_##fn = (SDL20_##fn##_t) LoadSDL20Symbol("SDL_" #fn, &okay);
    1.36          #define SDL20_SYM_PASSTHROUGH(rc,fn,params,args,ret) SDL20_SYM(rc,fn,params,args,ret)
    1.37          #include "SDL20_syms.h"
    1.38 -        #undef SDL20_SYM_PASSTHROUGH
    1.39 -        #undef SDL20_SYM
    1.40          SDL20_SetError = (SDL20_SetError_t) LoadSDL20Symbol("SDL_SetError", &okay);
    1.41          if (!okay)
    1.42              UnloadSDL20();
     2.1 --- a/src/SDL20_syms.h	Sun Feb 10 12:38:07 2019 -0500
     2.2 +++ b/src/SDL20_syms.h	Sun Feb 10 12:44:16 2019 -0500
     2.3 @@ -21,6 +21,14 @@
     2.4  
     2.5  /* don't #pragma once this file, it gets #included multiple times! */
     2.6  
     2.7 +#ifndef SDL20_SYM
     2.8 +#define SDL20_SYM(rc,fn,params,args,ret)
     2.9 +#endif
    2.10 +
    2.11 +#ifndef SDL20_SYM_PASSTHROUGH
    2.12 +#define SDL20_SYM_PASSTHROUGH(rc,fn,params,args,ret)
    2.13 +#endif
    2.14 +
    2.15  SDL20_SYM(int,Init,(Uint32 a),(a),return)
    2.16  SDL20_SYM(int,InitSubSystem,(Uint32 a),(a),return)
    2.17  SDL20_SYM(Uint32,WasInit,(Uint32 a),(a),return)
    2.18 @@ -224,5 +232,8 @@
    2.19  SDL20_SYM(int,setenv,(const char *a, const char *b, int c),(a,b,c),return)
    2.20  SDL20_SYM(int,atoi,(const char *a),(a),return)
    2.21  
    2.22 +#undef SDL20_SYM
    2.23 +#undef SDL20_SYM_PASSTHROUGH
    2.24 +
    2.25  /* vi: set ts=4 sw=4 expandtab: */
    2.26