Skip to content

Commit

Permalink
silence -Wodr warning for unix builds using -flto:
Browse files Browse the repository at this point in the history
dynapi/SDL_dynapi_procs.h:59:1: warning: 'SDL_RWFromFP_REAL' violates the C++ One Definition Rule [-Wodr]
   59 | SDL_DYNAPI_PROC(SDL2_RWops*,SDL_RWFromFP,(void *a, SDL2_bool b),(a,b),return)
      | ^
sdl2_compat.c:2493:1: note: 'SDL_RWFromFP_REAL' was previously declared here
 2493 | SDL_RWFromFP(FILE *fp, SDL2_bool autoclose)
      | ^
  • Loading branch information
sezero committed Nov 30, 2024
1 parent aeb3213 commit 89e3c65
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
6 changes: 1 addition & 5 deletions src/dynapi/SDL_dynapi_procs.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *
SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c),(a,b,c),return)
#endif

#ifdef HAVE_STDIO_H
SDL_DYNAPI_PROC(SDL2_RWops*,SDL_RWFromFP,(FILE *a, SDL2_bool b),(a,b),return)
#else
SDL_DYNAPI_PROC(SDL2_RWops*,SDL_RWFromFP,(void *a, SDL2_bool b),(a,b),return)
#endif
SDL_DYNAPI_PROC(SDL2_RWops*,SDL_RWFromFP,(void *a, SDL2_bool b),(a,b),return) /* FILE *a */

#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
SDL_DYNAPI_PROC(int,SDL_RegisterApp,(const char *a, Uint32 b, void *c),(a,b,c),return)
Expand Down
4 changes: 2 additions & 2 deletions src/sdl2_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -2490,7 +2490,7 @@ stdio_close(SDL2_RWops *rwops2)
}

SDL_DECLSPEC SDL2_RWops * SDLCALL
SDL_RWFromFP(FILE *fp, SDL2_bool autoclose)
SDL_RWFromFP(void *fp, SDL2_bool autoclose)
{
SDL2_RWops *rwops = SDL_AllocRW();
if (rwops != NULL) {
Expand All @@ -2499,7 +2499,7 @@ SDL_RWFromFP(FILE *fp, SDL2_bool autoclose)
rwops->read = stdio_read;
rwops->write = stdio_write;
rwops->close = stdio_close;
rwops->hidden.stdio.fp = fp;
rwops->hidden.stdio.fp = (FILE *) fp;
rwops->hidden.stdio.autoclose = autoclose;
rwops->type = SDL_RWOPS_STDFILE;
}
Expand Down
6 changes: 1 addition & 5 deletions src/sdl2_protos.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ SDL2_PROTO(SDL_Thread*,CreateThread,(SDL_ThreadFunction a, const char *b, void *
SDL2_PROTO(SDL_Thread*,CreateThread,(SDL_ThreadFunction a, const char *b, void *c))
#endif

#ifdef HAVE_STDIO_H
SDL2_PROTO(SDL2_RWops*,RWFromFP,(FILE *a, SDL2_bool b))
#else
SDL2_PROTO(SDL2_RWops*,RWFromFP,(void *a, SDL2_bool b))
#endif
SDL2_PROTO(SDL2_RWops*,RWFromFP,(void *a, SDL2_bool b)) /* FILE *a */

#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
SDL2_PROTO(int,RegisterApp,(const char *a, Uint32 b, void *c))
Expand Down

0 comments on commit 89e3c65

Please sign in to comment.