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.
This commit is contained in:
Sam Lantinga 2016-12-26 02:12:21 -08:00
parent 9492492d5f
commit b4e069e7f8
18 changed files with 19 additions and 19 deletions

View file

@ -39,7 +39,7 @@ fatalError(const char *string)
static Uint64 prevTime = 0; static Uint64 prevTime = 0;
double double
updateDeltaTime() updateDeltaTime(void)
{ {
Uint64 curTime; Uint64 curTime;
double deltaTime; double deltaTime;

View file

@ -7,4 +7,4 @@
extern int randomInt(int min, int max); extern int randomInt(int min, int max);
extern float randomFloat(float min, float max); extern float randomFloat(float min, float max);
extern void fatalError(const char *string); extern void fatalError(const char *string);
extern double updateDeltaTime(); extern double updateDeltaTime(void);

View file

@ -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__) #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__ #ifdef __thumb__
/* The mcr instruction isn't available in thumb mode, use real functions */ /* The mcr instruction isn't available in thumb mode, use real functions */
extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease(); extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease(void);
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire(); extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire(void);
#else #else
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") #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") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")

View file

@ -140,7 +140,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingStri
* *
* \return the number of mappings * \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. * Get the mapping at a particular index.

View file

@ -535,7 +535,7 @@ SDL_Fcitx_UpdateTextRect(SDL_Rect *rect)
} }
void void
SDL_Fcitx_PumpEvents() SDL_Fcitx_PumpEvents(void)
{ {
SDL_DBusContext *dbus = fcitx_client.dbus; SDL_DBusContext *dbus = fcitx_client.dbus;
DBusConnection *conn = dbus->session_conn; DBusConnection *conn = dbus->session_conn;

View file

@ -33,7 +33,7 @@ extern void SDL_Fcitx_SetFocus(SDL_bool focused);
extern void SDL_Fcitx_Reset(void); extern void SDL_Fcitx_Reset(void);
extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode);
extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect); extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect);
extern void SDL_Fcitx_PumpEvents(); extern void SDL_Fcitx_PumpEvents(void);
#endif /* SDL_fcitx_h_ */ #endif /* SDL_fcitx_h_ */

View file

@ -49,7 +49,7 @@ extern void SDL_IBus_UpdateTextRect(SDL_Rect *window_relative_rect);
/* Checks DBus for new IBus events, and calls SDL_SendKeyboardText / /* Checks DBus for new IBus events, and calls SDL_SendKeyboardText /
SDL_SendEditingText for each event it finds */ SDL_SendEditingText for each event it finds */
extern void SDL_IBus_PumpEvents(); extern void SDL_IBus_PumpEvents(void);
#endif /* HAVE_IBUS_IBUS_H */ #endif /* HAVE_IBUS_IBUS_H */

View file

@ -115,7 +115,7 @@ IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServiceP
} }
#endif #endif
BOOL WIN_IsWindowsVistaOrGreater() BOOL WIN_IsWindowsVistaOrGreater(void)
{ {
#ifdef __WINRT__ #ifdef __WINRT__
return TRUE; return TRUE;

View file

@ -57,7 +57,7 @@ extern HRESULT WIN_CoInitialize(void);
extern void WIN_CoUninitialize(void); extern void WIN_CoUninitialize(void);
/* Returns SDL_TRUE if we're running on Windows Vista and newer */ /* 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. */ /* You need to SDL_free() the result of this call. */
extern char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid); extern char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid);

View file

@ -891,7 +891,7 @@ SDL_GameControllerAddMapping(const char *mappingString)
* Get the number of mappings installed * Get the number of mappings installed
*/ */
int int
SDL_GameControllerNumMappings() SDL_GameControllerNumMappings(void)
{ {
int num_mappings = 0; int num_mappings = 0;
ControllerMapping_t *mapping; ControllerMapping_t *mapping;

View file

@ -41,7 +41,7 @@ extern "C" {
static SDL_Scancode keymap[KEYMAP_SIZE]; static SDL_Scancode keymap[KEYMAP_SIZE];
static int8 keystate[KEYMAP_SIZE]; static int8 keystate[KEYMAP_SIZE];
void BE_InitOSKeymap() { void BE_InitOSKeymap(void) {
for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) { for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) {
keymap[i] = SDL_SCANCODE_UNKNOWN; keymap[i] = SDL_SCANCODE_UNKNOWN;
} }

View file

@ -30,7 +30,7 @@ extern "C" {
#include "../../../include/SDL_keyboard.h" #include "../../../include/SDL_keyboard.h"
extern void BE_InitOSKeymap(); extern void BE_InitOSKeymap(void);
extern SDL_Scancode BE_GetScancodeFromBeKey(int32 bkey); extern SDL_Scancode BE_GetScancodeFromBeKey(int32 bkey);
extern int8 BE_GetKeyState(int32 bkey); extern int8 BE_GetKeyState(int32 bkey);
extern void BE_SetKeyState(int32 bkey, int8 state); extern void BE_SetKeyState(int32 bkey, int8 state);

View file

@ -22,7 +22,7 @@
#if SDL_VIDEO_DRIVER_UIKIT #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); extern int UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);

View file

@ -31,7 +31,7 @@
static SDL_bool s_showingMessageBox = SDL_FALSE; static SDL_bool s_showingMessageBox = SDL_FALSE;
SDL_bool SDL_bool
UIKit_ShowingMessageBox() UIKit_ShowingMessageBox(void)
{ {
return s_showingMessageBox; return s_showingMessageBox;
} }

View file

@ -33,7 +33,7 @@ extern void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context);
extern void *UIKit_GL_GetProcAddress(_THIS, const char *proc); extern void *UIKit_GL_GetProcAddress(_THIS, const char *proc);
extern int UIKit_GL_LoadLibrary(_THIS, const char *path); extern int UIKit_GL_LoadLibrary(_THIS, const char *path);
extern void UIKit_GL_RestoreCurrentContext(); extern void UIKit_GL_RestoreCurrentContext(void);
#endif #endif

View file

@ -228,7 +228,7 @@ UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
} }
void void
UIKit_GL_RestoreCurrentContext() UIKit_GL_RestoreCurrentContext(void)
{ {
@autoreleasepool { @autoreleasepool {
/* Some iOS system functionality (such as Dictation on the on-screen /* Some iOS system functionality (such as Dictation on the on-screen

View file

@ -105,7 +105,7 @@ WINRT_XAMLThreadMain(void * userdata)
} }
void void
WINRT_CycleXAMLThread() WINRT_CycleXAMLThread(void)
{ {
switch (_threadState) { switch (_threadState) {
case ThreadState_NotLaunched: case ThreadState_NotLaunched:

View file

@ -75,7 +75,7 @@ extern SDL_bool WINRT_IsScreenKeyboardShown(_THIS, SDL_Window *window);
#endif // NTDDI_VERSION >= ... #endif // NTDDI_VERSION >= ...
/* XAML Thread Management */ /* XAML Thread Management */
extern void WINRT_CycleXAMLThread(); extern void WINRT_CycleXAMLThread(void);
#endif // ifdef __cplusplus_winrt #endif // ifdef __cplusplus_winrt