Fixed ISO C99 compatibility

SDL now builds with gcc 7.2 with the following command line options:
-Wall -pedantic-errors -Wno-deprecated-declarations -Wno-overlength-strings --std=c99
This commit is contained in:
Sam Lantinga 2018-01-30 18:08:34 -08:00
parent e4556dc802
commit e9a1c0c9d0
40 changed files with 176 additions and 196 deletions

View file

@ -91,11 +91,7 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
#if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
if (!checked_setname) {
void *fn = dlsym(RTLD_DEFAULT, "pthread_setname_np");
#if defined(__MACOSX__) || defined(__IPHONEOS__)
ppthread_setname_np = (int(*)(const char*)) fn;
#elif defined(__LINUX__)
ppthread_setname_np = (int(*)(pthread_t, const char*)) fn;
#endif
*(void **)&ppthread_setname_np = fn;
checked_setname = SDL_TRUE;
}
#endif

View file

@ -178,7 +178,7 @@ SDL_SYS_SetupThread(const char *name)
if (!kernel32) {
kernel32 = LoadLibraryW(L"kernel32.dll");
if (kernel32) {
pSetThreadDescription = (pfnSetThreadDescription) GetProcAddress(kernel32, "SetThreadDescription");
*(void**)&pSetThreadDescription = GetProcAddress(kernel32, "SetThreadDescription");
}
}