Fixed bug 3517 - Compiler warnings with gcc -Wstrict-prototypes
authorSam Lantinga <slouken@libsdl.org>
Mon, 26 Dec 2016 02:12:21 -0800
changeset 1072188943d97bf00
parent 10720 2caf713d7ad8
child 10722 30e271a26a02
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.
Xcode-iOS/Demos/src/common.c
Xcode-iOS/Demos/src/common.h
include/SDL_atomic.h
include/SDL_gamecontroller.h
src/core/linux/SDL_fcitx.c
src/core/linux/SDL_fcitx.h
src/core/linux/SDL_ibus.h
src/core/windows/SDL_windows.c
src/core/windows/SDL_windows.h
src/joystick/SDL_gamecontroller.c
src/video/haiku/SDL_bkeyboard.cc
src/video/haiku/SDL_bkeyboard.h
src/video/uikit/SDL_uikitmessagebox.h
src/video/uikit/SDL_uikitmessagebox.m
src/video/uikit/SDL_uikitopengles.h
src/video/uikit/SDL_uikitopengles.m
src/video/winrt/SDL_winrtevents.cpp
src/video/winrt/SDL_winrtevents_c.h
     1.1 --- a/Xcode-iOS/Demos/src/common.c	Mon Dec 26 01:56:52 2016 -0800
     1.2 +++ b/Xcode-iOS/Demos/src/common.c	Mon Dec 26 02:12:21 2016 -0800
     1.3 @@ -39,7 +39,7 @@
     1.4  static Uint64 prevTime = 0;
     1.5  
     1.6  double
     1.7 -updateDeltaTime()
     1.8 +updateDeltaTime(void)
     1.9  {
    1.10      Uint64 curTime;
    1.11      double deltaTime;
     2.1 --- a/Xcode-iOS/Demos/src/common.h	Mon Dec 26 01:56:52 2016 -0800
     2.2 +++ b/Xcode-iOS/Demos/src/common.h	Mon Dec 26 02:12:21 2016 -0800
     2.3 @@ -7,4 +7,4 @@
     2.4  extern int randomInt(int min, int max);
     2.5  extern float randomFloat(float min, float max);
     2.6  extern void fatalError(const char *string);
     2.7 -extern double updateDeltaTime();
     2.8 +extern double updateDeltaTime(void);
     3.1 --- a/include/SDL_atomic.h	Mon Dec 26 01:56:52 2016 -0800
     3.2 +++ b/include/SDL_atomic.h	Mon Dec 26 02:12:21 2016 -0800
     3.3 @@ -159,8 +159,8 @@
     3.4  #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__)
     3.5  #ifdef __thumb__
     3.6  /* The mcr instruction isn't available in thumb mode, use real functions */
     3.7 -extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease();
     3.8 -extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire();
     3.9 +extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease(void);
    3.10 +extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire(void);
    3.11  #else
    3.12  #define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
    3.13  #define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
     4.1 --- a/include/SDL_gamecontroller.h	Mon Dec 26 01:56:52 2016 -0800
     4.2 +++ b/include/SDL_gamecontroller.h	Mon Dec 26 02:12:21 2016 -0800
     4.3 @@ -140,7 +140,7 @@
     4.4   *
     4.5   *  \return the number of mappings
     4.6   */
     4.7 -extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings();
     4.8 +extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
     4.9  
    4.10  /**
    4.11   *  Get the mapping at a particular index.
     5.1 --- a/src/core/linux/SDL_fcitx.c	Mon Dec 26 01:56:52 2016 -0800
     5.2 +++ b/src/core/linux/SDL_fcitx.c	Mon Dec 26 02:12:21 2016 -0800
     5.3 @@ -535,7 +535,7 @@
     5.4  }
     5.5  
     5.6  void
     5.7 -SDL_Fcitx_PumpEvents()
     5.8 +SDL_Fcitx_PumpEvents(void)
     5.9  {
    5.10      SDL_DBusContext *dbus = fcitx_client.dbus;
    5.11      DBusConnection *conn = dbus->session_conn;
     6.1 --- a/src/core/linux/SDL_fcitx.h	Mon Dec 26 01:56:52 2016 -0800
     6.2 +++ b/src/core/linux/SDL_fcitx.h	Mon Dec 26 02:12:21 2016 -0800
     6.3 @@ -33,7 +33,7 @@
     6.4  extern void SDL_Fcitx_Reset(void);
     6.5  extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode);
     6.6  extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect);
     6.7 -extern void SDL_Fcitx_PumpEvents();
     6.8 +extern void SDL_Fcitx_PumpEvents(void);
     6.9  
    6.10  #endif /* SDL_fcitx_h_ */
    6.11  
     7.1 --- a/src/core/linux/SDL_ibus.h	Mon Dec 26 01:56:52 2016 -0800
     7.2 +++ b/src/core/linux/SDL_ibus.h	Mon Dec 26 02:12:21 2016 -0800
     7.3 @@ -49,7 +49,7 @@
     7.4  
     7.5  /* Checks DBus for new IBus events, and calls SDL_SendKeyboardText / 
     7.6     SDL_SendEditingText for each event it finds */
     7.7 -extern void SDL_IBus_PumpEvents();
     7.8 +extern void SDL_IBus_PumpEvents(void);
     7.9  
    7.10  #endif /* HAVE_IBUS_IBUS_H */
    7.11  
     8.1 --- a/src/core/windows/SDL_windows.c	Mon Dec 26 01:56:52 2016 -0800
     8.2 +++ b/src/core/windows/SDL_windows.c	Mon Dec 26 02:12:21 2016 -0800
     8.3 @@ -115,7 +115,7 @@
     8.4  }
     8.5  #endif
     8.6  
     8.7 -BOOL WIN_IsWindowsVistaOrGreater()
     8.8 +BOOL WIN_IsWindowsVistaOrGreater(void)
     8.9  {
    8.10  #ifdef __WINRT__
    8.11      return TRUE;
     9.1 --- a/src/core/windows/SDL_windows.h	Mon Dec 26 01:56:52 2016 -0800
     9.2 +++ b/src/core/windows/SDL_windows.h	Mon Dec 26 02:12:21 2016 -0800
     9.3 @@ -57,7 +57,7 @@
     9.4  extern void WIN_CoUninitialize(void);
     9.5  
     9.6  /* Returns SDL_TRUE if we're running on Windows Vista and newer */
     9.7 -extern BOOL WIN_IsWindowsVistaOrGreater();
     9.8 +extern BOOL WIN_IsWindowsVistaOrGreater(void);
     9.9  
    9.10  /* You need to SDL_free() the result of this call. */
    9.11  extern char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid);
    10.1 --- a/src/joystick/SDL_gamecontroller.c	Mon Dec 26 01:56:52 2016 -0800
    10.2 +++ b/src/joystick/SDL_gamecontroller.c	Mon Dec 26 02:12:21 2016 -0800
    10.3 @@ -891,7 +891,7 @@
    10.4   *  Get the number of mappings installed
    10.5   */
    10.6  int
    10.7 -SDL_GameControllerNumMappings()
    10.8 +SDL_GameControllerNumMappings(void)
    10.9  {
   10.10      int num_mappings = 0;
   10.11      ControllerMapping_t *mapping;
    11.1 --- a/src/video/haiku/SDL_bkeyboard.cc	Mon Dec 26 01:56:52 2016 -0800
    11.2 +++ b/src/video/haiku/SDL_bkeyboard.cc	Mon Dec 26 02:12:21 2016 -0800
    11.3 @@ -41,7 +41,7 @@
    11.4  static SDL_Scancode keymap[KEYMAP_SIZE];
    11.5  static int8 keystate[KEYMAP_SIZE];
    11.6  
    11.7 -void BE_InitOSKeymap() {
    11.8 +void BE_InitOSKeymap(void) {
    11.9  		for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) {
   11.10  			keymap[i] = SDL_SCANCODE_UNKNOWN;
   11.11  		}
    12.1 --- a/src/video/haiku/SDL_bkeyboard.h	Mon Dec 26 01:56:52 2016 -0800
    12.2 +++ b/src/video/haiku/SDL_bkeyboard.h	Mon Dec 26 02:12:21 2016 -0800
    12.3 @@ -30,7 +30,7 @@
    12.4  
    12.5  #include "../../../include/SDL_keyboard.h"
    12.6  
    12.7 -extern void BE_InitOSKeymap();
    12.8 +extern void BE_InitOSKeymap(void);
    12.9  extern SDL_Scancode BE_GetScancodeFromBeKey(int32 bkey);
   12.10  extern int8 BE_GetKeyState(int32 bkey);
   12.11  extern void BE_SetKeyState(int32 bkey, int8 state);
    13.1 --- a/src/video/uikit/SDL_uikitmessagebox.h	Mon Dec 26 01:56:52 2016 -0800
    13.2 +++ b/src/video/uikit/SDL_uikitmessagebox.h	Mon Dec 26 02:12:21 2016 -0800
    13.3 @@ -22,7 +22,7 @@
    13.4  
    13.5  #if SDL_VIDEO_DRIVER_UIKIT
    13.6  
    13.7 -extern SDL_bool UIKit_ShowingMessageBox();
    13.8 +extern SDL_bool UIKit_ShowingMessageBox(void);
    13.9  
   13.10  extern int UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
   13.11  
    14.1 --- a/src/video/uikit/SDL_uikitmessagebox.m	Mon Dec 26 01:56:52 2016 -0800
    14.2 +++ b/src/video/uikit/SDL_uikitmessagebox.m	Mon Dec 26 02:12:21 2016 -0800
    14.3 @@ -31,7 +31,7 @@
    14.4  static SDL_bool s_showingMessageBox = SDL_FALSE;
    14.5  
    14.6  SDL_bool
    14.7 -UIKit_ShowingMessageBox()
    14.8 +UIKit_ShowingMessageBox(void)
    14.9  {
   14.10      return s_showingMessageBox;
   14.11  }
    15.1 --- a/src/video/uikit/SDL_uikitopengles.h	Mon Dec 26 01:56:52 2016 -0800
    15.2 +++ b/src/video/uikit/SDL_uikitopengles.h	Mon Dec 26 02:12:21 2016 -0800
    15.3 @@ -33,7 +33,7 @@
    15.4  extern void *UIKit_GL_GetProcAddress(_THIS, const char *proc);
    15.5  extern int UIKit_GL_LoadLibrary(_THIS, const char *path);
    15.6  
    15.7 -extern void UIKit_GL_RestoreCurrentContext();
    15.8 +extern void UIKit_GL_RestoreCurrentContext(void);
    15.9  
   15.10  #endif
   15.11  
    16.1 --- a/src/video/uikit/SDL_uikitopengles.m	Mon Dec 26 01:56:52 2016 -0800
    16.2 +++ b/src/video/uikit/SDL_uikitopengles.m	Mon Dec 26 02:12:21 2016 -0800
    16.3 @@ -228,7 +228,7 @@
    16.4  }
    16.5  
    16.6  void
    16.7 -UIKit_GL_RestoreCurrentContext()
    16.8 +UIKit_GL_RestoreCurrentContext(void)
    16.9  {
   16.10      @autoreleasepool {
   16.11          /* Some iOS system functionality (such as Dictation on the on-screen
    17.1 --- a/src/video/winrt/SDL_winrtevents.cpp	Mon Dec 26 01:56:52 2016 -0800
    17.2 +++ b/src/video/winrt/SDL_winrtevents.cpp	Mon Dec 26 02:12:21 2016 -0800
    17.3 @@ -105,7 +105,7 @@
    17.4  }
    17.5  
    17.6  void
    17.7 -WINRT_CycleXAMLThread()
    17.8 +WINRT_CycleXAMLThread(void)
    17.9  {
   17.10      switch (_threadState) {
   17.11          case ThreadState_NotLaunched:
    18.1 --- a/src/video/winrt/SDL_winrtevents_c.h	Mon Dec 26 01:56:52 2016 -0800
    18.2 +++ b/src/video/winrt/SDL_winrtevents_c.h	Mon Dec 26 02:12:21 2016 -0800
    18.3 @@ -75,7 +75,7 @@
    18.4  #endif  // NTDDI_VERSION >= ...
    18.5  
    18.6  /* XAML Thread Management */
    18.7 -extern void WINRT_CycleXAMLThread();
    18.8 +extern void WINRT_CycleXAMLThread(void);
    18.9  
   18.10  #endif // ifdef __cplusplus_winrt
   18.11