Fixed bug 3517 - Compiler warnings with gcc -Wstrict-prototypes felix Compiling even a simple SDL2 'hello world' program with gcc -Wstrict-prototypes (GCC 6.2.1) results in warnings like: /usr/include/SDL2/SDL_gamecontroller.h:143:1: attention : function declaration isn't a prototype [-Wstrict-prototypes] extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(); ^~~~~~ It seems there is a missing 'void' between the parentheses.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
diff --git a/Xcode-iOS/Demos/src/common.c b/Xcode-iOS/Demos/src/common.c
index 0a1485a..e15fb5f 100644
--- a/Xcode-iOS/Demos/src/common.c
+++ b/Xcode-iOS/Demos/src/common.c
@@ -39,7 +39,7 @@ fatalError(const char *string)
static Uint64 prevTime = 0;
double
-updateDeltaTime()
+updateDeltaTime(void)
{
Uint64 curTime;
double deltaTime;
diff --git a/Xcode-iOS/Demos/src/common.h b/Xcode-iOS/Demos/src/common.h
index 96b2c96..6047508 100644
--- a/Xcode-iOS/Demos/src/common.h
+++ b/Xcode-iOS/Demos/src/common.h
@@ -7,4 +7,4 @@
extern int randomInt(int min, int max);
extern float randomFloat(float min, float max);
extern void fatalError(const char *string);
-extern double updateDeltaTime();
+extern double updateDeltaTime(void);
diff --git a/include/SDL_atomic.h b/include/SDL_atomic.h
index 5ff9632..580e041 100644
--- a/include/SDL_atomic.h
+++ b/include/SDL_atomic.h
@@ -159,8 +159,8 @@ void _ReadWriteBarrier(void);
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
#ifdef __thumb__
/* The mcr instruction isn't available in thumb mode, use real functions */
-extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease();
-extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire();
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease(void);
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire(void);
#else
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
diff --git a/include/SDL_gamecontroller.h b/include/SDL_gamecontroller.h
index 56051a8..36af08d 100644
--- a/include/SDL_gamecontroller.h
+++ b/include/SDL_gamecontroller.h
@@ -140,7 +140,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingStri
*
* \return the number of mappings
*/
-extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings();
+extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
/**
* Get the mapping at a particular index.
diff --git a/src/core/linux/SDL_fcitx.c b/src/core/linux/SDL_fcitx.c
index 83d19e6..a4bc404 100644
--- a/src/core/linux/SDL_fcitx.c
+++ b/src/core/linux/SDL_fcitx.c
@@ -535,7 +535,7 @@ SDL_Fcitx_UpdateTextRect(SDL_Rect *rect)
}
void
-SDL_Fcitx_PumpEvents()
+SDL_Fcitx_PumpEvents(void)
{
SDL_DBusContext *dbus = fcitx_client.dbus;
DBusConnection *conn = dbus->session_conn;
diff --git a/src/core/linux/SDL_fcitx.h b/src/core/linux/SDL_fcitx.h
index c0d822a..e3148ea 100644
--- a/src/core/linux/SDL_fcitx.h
+++ b/src/core/linux/SDL_fcitx.h
@@ -33,7 +33,7 @@ extern void SDL_Fcitx_SetFocus(SDL_bool focused);
extern void SDL_Fcitx_Reset(void);
extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode);
extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect);
-extern void SDL_Fcitx_PumpEvents();
+extern void SDL_Fcitx_PumpEvents(void);
#endif /* SDL_fcitx_h_ */
diff --git a/src/core/linux/SDL_ibus.h b/src/core/linux/SDL_ibus.h
index bd22a88..d05e4ea 100644
--- a/src/core/linux/SDL_ibus.h
+++ b/src/core/linux/SDL_ibus.h
@@ -49,7 +49,7 @@ extern void SDL_IBus_UpdateTextRect(SDL_Rect *window_relative_rect);
/* Checks DBus for new IBus events, and calls SDL_SendKeyboardText /
SDL_SendEditingText for each event it finds */
-extern void SDL_IBus_PumpEvents();
+extern void SDL_IBus_PumpEvents(void);
#endif /* HAVE_IBUS_IBUS_H */
diff --git a/src/core/windows/SDL_windows.c b/src/core/windows/SDL_windows.c
index 6433fe2..676fadc 100644
--- a/src/core/windows/SDL_windows.c
+++ b/src/core/windows/SDL_windows.c
@@ -115,7 +115,7 @@ IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServiceP
}
#endif
-BOOL WIN_IsWindowsVistaOrGreater()
+BOOL WIN_IsWindowsVistaOrGreater(void)
{
#ifdef __WINRT__
return TRUE;
diff --git a/src/core/windows/SDL_windows.h b/src/core/windows/SDL_windows.h
index 0f67e4b..6a63c08 100644
--- a/src/core/windows/SDL_windows.h
+++ b/src/core/windows/SDL_windows.h
@@ -57,7 +57,7 @@ extern HRESULT WIN_CoInitialize(void);
extern void WIN_CoUninitialize(void);
/* Returns SDL_TRUE if we're running on Windows Vista and newer */
-extern BOOL WIN_IsWindowsVistaOrGreater();
+extern BOOL WIN_IsWindowsVistaOrGreater(void);
/* You need to SDL_free() the result of this call. */
extern char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid);
diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c
index a9c8e82..598d464 100644
--- a/src/joystick/SDL_gamecontroller.c
+++ b/src/joystick/SDL_gamecontroller.c
@@ -891,7 +891,7 @@ SDL_GameControllerAddMapping(const char *mappingString)
* Get the number of mappings installed
*/
int
-SDL_GameControllerNumMappings()
+SDL_GameControllerNumMappings(void)
{
int num_mappings = 0;
ControllerMapping_t *mapping;
diff --git a/src/video/haiku/SDL_bkeyboard.cc b/src/video/haiku/SDL_bkeyboard.cc
index 6880dae..3f81b40 100644
--- a/src/video/haiku/SDL_bkeyboard.cc
+++ b/src/video/haiku/SDL_bkeyboard.cc
@@ -41,7 +41,7 @@ extern "C" {
static SDL_Scancode keymap[KEYMAP_SIZE];
static int8 keystate[KEYMAP_SIZE];
-void BE_InitOSKeymap() {
+void BE_InitOSKeymap(void) {
for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) {
keymap[i] = SDL_SCANCODE_UNKNOWN;
}
diff --git a/src/video/haiku/SDL_bkeyboard.h b/src/video/haiku/SDL_bkeyboard.h
index 84621e2..90f4b2f 100644
--- a/src/video/haiku/SDL_bkeyboard.h
+++ b/src/video/haiku/SDL_bkeyboard.h
@@ -30,7 +30,7 @@ extern "C" {
#include "../../../include/SDL_keyboard.h"
-extern void BE_InitOSKeymap();
+extern void BE_InitOSKeymap(void);
extern SDL_Scancode BE_GetScancodeFromBeKey(int32 bkey);
extern int8 BE_GetKeyState(int32 bkey);
extern void BE_SetKeyState(int32 bkey, int8 state);
diff --git a/src/video/uikit/SDL_uikitmessagebox.h b/src/video/uikit/SDL_uikitmessagebox.h
index 5280724..6b97464 100644
--- a/src/video/uikit/SDL_uikitmessagebox.h
+++ b/src/video/uikit/SDL_uikitmessagebox.h
@@ -22,7 +22,7 @@
#if SDL_VIDEO_DRIVER_UIKIT
-extern SDL_bool UIKit_ShowingMessageBox();
+extern SDL_bool UIKit_ShowingMessageBox(void);
extern int UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
diff --git a/src/video/uikit/SDL_uikitmessagebox.m b/src/video/uikit/SDL_uikitmessagebox.m
index 5778032..5864e71 100644
--- a/src/video/uikit/SDL_uikitmessagebox.m
+++ b/src/video/uikit/SDL_uikitmessagebox.m
@@ -31,7 +31,7 @@
static SDL_bool s_showingMessageBox = SDL_FALSE;
SDL_bool
-UIKit_ShowingMessageBox()
+UIKit_ShowingMessageBox(void)
{
return s_showingMessageBox;
}
diff --git a/src/video/uikit/SDL_uikitopengles.h b/src/video/uikit/SDL_uikitopengles.h
index e1c78a4..4d12bca 100644
--- a/src/video/uikit/SDL_uikitopengles.h
+++ b/src/video/uikit/SDL_uikitopengles.h
@@ -33,7 +33,7 @@ extern void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context);
extern void *UIKit_GL_GetProcAddress(_THIS, const char *proc);
extern int UIKit_GL_LoadLibrary(_THIS, const char *path);
-extern void UIKit_GL_RestoreCurrentContext();
+extern void UIKit_GL_RestoreCurrentContext(void);
#endif
diff --git a/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m
index 1ce1386..c0e1299 100644
--- a/src/video/uikit/SDL_uikitopengles.m
+++ b/src/video/uikit/SDL_uikitopengles.m
@@ -228,7 +228,7 @@ UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
}
void
-UIKit_GL_RestoreCurrentContext()
+UIKit_GL_RestoreCurrentContext(void)
{
@autoreleasepool {
/* Some iOS system functionality (such as Dictation on the on-screen
diff --git a/src/video/winrt/SDL_winrtevents.cpp b/src/video/winrt/SDL_winrtevents.cpp
index 30cf016..85b56b3 100644
--- a/src/video/winrt/SDL_winrtevents.cpp
+++ b/src/video/winrt/SDL_winrtevents.cpp
@@ -105,7 +105,7 @@ WINRT_XAMLThreadMain(void * userdata)
}
void
-WINRT_CycleXAMLThread()
+WINRT_CycleXAMLThread(void)
{
switch (_threadState) {
case ThreadState_NotLaunched:
diff --git a/src/video/winrt/SDL_winrtevents_c.h b/src/video/winrt/SDL_winrtevents_c.h
index 05a90a3..98ed433 100644
--- a/src/video/winrt/SDL_winrtevents_c.h
+++ b/src/video/winrt/SDL_winrtevents_c.h
@@ -75,7 +75,7 @@ extern SDL_bool WINRT_IsScreenKeyboardShown(_THIS, SDL_Window *window);
#endif // NTDDI_VERSION >= ...
/* XAML Thread Management */
-extern void WINRT_CycleXAMLThread();
+extern void WINRT_CycleXAMLThread(void);
#endif // ifdef __cplusplus_winrt