Commit 86f87bf7554036fac0490a264786fb2226f01369

Philipp Wiesemann 2015-01-31T22:45:54

Added missing guards in implementation for PSP. Thanks to Martin Gerhardy for pointing this out.

diff --git a/src/audio/psp/SDL_pspaudio.c b/src/audio/psp/SDL_pspaudio.c
index 3abe3a1..3603911 100644
--- a/src/audio/psp/SDL_pspaudio.c
+++ b/src/audio/psp/SDL_pspaudio.c
@@ -20,6 +20,8 @@
 */
 #include "../../SDL_internal.h"
 
+#if SDL_AUDIO_DRIVER_PSP
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -192,5 +194,6 @@ AudioBootStrap PSPAUD_bootstrap = {
 
  /* SDL_AUDI */
 
+#endif /* SDL_AUDIO_DRIVER_PSP */
 
-
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/joystick/psp/SDL_sysjoystick.c b/src/joystick/psp/SDL_sysjoystick.c
index 3f9bd2d..22bd6e9 100644
--- a/src/joystick/psp/SDL_sysjoystick.c
+++ b/src/joystick/psp/SDL_sysjoystick.c
@@ -20,6 +20,8 @@
 */
 #include "../../SDL_internal.h"
 
+#if SDL_JOYSTICK_PSP
+
 /* This is the PSP implementation of the SDL joystick API */
 #include <pspctrl.h>
 #include <pspkernel.h>
@@ -263,5 +265,7 @@ SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
     return guid;
 }
 
+#endif /* SDL_JOYSTICK_PSP */
+
 /* vim: ts=4 sw=4
  */
diff --git a/src/main/psp/SDL_psp_main.c b/src/main/psp/SDL_psp_main.c
index d79135d..2ca8e44 100644
--- a/src/main/psp/SDL_psp_main.c
+++ b/src/main/psp/SDL_psp_main.c
@@ -1,6 +1,9 @@
 /*
     SDL_psp_main.c, placed in the public domain by Sam Lantinga  3/13/14
 */
+#include "SDL_config.h"
+
+#ifdef __PSP__
 
 #include "SDL_main.h"
 #include <pspkernel.h>
@@ -61,3 +64,7 @@ int main(int argc, char *argv[])
     (void)SDL_main(argc, argv);
     return 0;
 }
+
+#endif /* __PSP__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/thread/psp/SDL_syscond.c b/src/thread/psp/SDL_syscond.c
index 1abd9a3..3959a4c 100644
--- a/src/thread/psp/SDL_syscond.c
+++ b/src/thread/psp/SDL_syscond.c
@@ -20,6 +20,8 @@
 */
 #include "../../SDL_internal.h"
 
+#if SDL_THREAD_PSP
+
 /* An implementation of condition variables using semaphores and mutexes */
 /*
    This implementation borrows heavily from the BeOS condition variable
@@ -217,4 +219,6 @@ SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex)
     return SDL_CondWaitTimeout(cond, mutex, SDL_MUTEX_MAXWAIT);
 }
 
+#endif /* SDL_THREAD_PSP */
+
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/thread/psp/SDL_sysmutex.c b/src/thread/psp/SDL_sysmutex.c
index 478575b..e1cf413 100644
--- a/src/thread/psp/SDL_sysmutex.c
+++ b/src/thread/psp/SDL_sysmutex.c
@@ -20,6 +20,8 @@
 */
 #include "../../SDL_internal.h"
 
+#if SDL_THREAD_PSP
+
 /* An implementation of mutexes using semaphores */
 
 #include "SDL_thread.h"
@@ -129,4 +131,6 @@ SDL_mutexV(SDL_mutex * mutex)
 #endif /* SDL_THREADS_DISABLED */
 }
 
+#endif /* SDL_THREAD_PSP */
+
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/thread/psp/SDL_syssem.c b/src/thread/psp/SDL_syssem.c
index 3abb835..609ba73 100644
--- a/src/thread/psp/SDL_syssem.c
+++ b/src/thread/psp/SDL_syssem.c
@@ -20,6 +20,8 @@
 */
 #include "../../SDL_internal.h"
 
+#if SDL_THREAD_PSP
+
 /* Semaphore functions for the PSP. */
 
 #include <stdio.h>
@@ -153,5 +155,7 @@ int SDL_SemPost(SDL_sem *sem)
     return 0;
 }
 
+#endif /* SDL_THREAD_PSP */
+
 /* vim: ts=4 sw=4
  */
diff --git a/src/thread/psp/SDL_systhread.c b/src/thread/psp/SDL_systhread.c
index 2d5433c..8cbd2f1 100644
--- a/src/thread/psp/SDL_systhread.c
+++ b/src/thread/psp/SDL_systhread.c
@@ -20,6 +20,8 @@
 */
 #include "../../SDL_internal.h"
 
+#if SDL_THREAD_PSP
+
 /* PSP thread management routines for SDL */
 
 #include <stdio.h>
@@ -104,5 +106,7 @@ int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
 
 }
 
+#endif /* SDL_THREAD_PSP */
+
 /* vim: ts=4 sw=4
  */
diff --git a/src/timer/psp/SDL_systimer.c b/src/timer/psp/SDL_systimer.c
index 1ae3d7f..8488b28 100644
--- a/src/timer/psp/SDL_systimer.c
+++ b/src/timer/psp/SDL_systimer.c
@@ -20,6 +20,8 @@
 */
 #include "../../SDL_internal.h"
 
+#ifdef SDL_TIMERS_PSP
+
 #include "SDL_thread.h"
 #include "SDL_timer.h"
 #include "SDL_error.h"
@@ -83,5 +85,7 @@ void SDL_Delay(Uint32 ms)
     sceKernelDelayThreadCB(ms * 1000);
 }
 
+#endif /* SDL_TIMERS_PSP */
+
 /* vim: ts=4 sw=4
  */
diff --git a/src/video/psp/SDL_pspevents.c b/src/video/psp/SDL_pspevents.c
index 982186b..399566b 100644
--- a/src/video/psp/SDL_pspevents.c
+++ b/src/video/psp/SDL_pspevents.c
@@ -20,6 +20,8 @@
 */
 #include "../../SDL_internal.h"
 
+#if SDL_VIDEO_DRIVER_PSP
+
 /* Being a null driver, there's no event stream. We just define stubs for
    most of the API. */
 
@@ -283,3 +285,6 @@ void PSP_EventQuit(_THIS)
 
 /* end of SDL_pspevents.c ... */
 
+#endif /* SDL_VIDEO_DRIVER_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/psp/SDL_pspgl.c b/src/video/psp/SDL_pspgl.c
index 8b2cd88..61620de 100644
--- a/src/video/psp/SDL_pspgl.c
+++ b/src/video/psp/SDL_pspgl.c
@@ -20,6 +20,8 @@
 */
 #include "../../SDL_internal.h"
 
+#if SDL_VIDEO_DRIVER_PSP
+
 #include <stdlib.h>
 #include <string.h>
 
@@ -204,3 +206,6 @@ PSP_GL_DeleteContext(_THIS, SDL_GLContext context)
     return;
 }
 
+#endif /* SDL_VIDEO_DRIVER_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/psp/SDL_pspmouse.c b/src/video/psp/SDL_pspmouse.c
index d9d8eef..0c8f5a4 100644
--- a/src/video/psp/SDL_pspmouse.c
+++ b/src/video/psp/SDL_pspmouse.c
@@ -20,6 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
+#if SDL_VIDEO_DRIVER_PSP
 
 #include <stdio.h>
 
@@ -34,3 +35,7 @@
 struct WMcursor {
     int unused;
 };
+
+#endif /* SDL_VIDEO_DRIVER_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */