Fixed bug 4277 - warnings patch
authorSam Lantinga <slouken@libsdl.org>
Thu, 27 Sep 2018 14:56:29 -0700
changeset 12242df7260f149f2
parent 12241 f72836cfb92b
child 12243 a5781d950d5d
Fixed bug 4277 - warnings patch

Sylvain

Patch a few warnings when using:
-Wmissing-prototypes -Wdocumentation -Wdocumentation-unknown-command

They are automatically enabled with -Wall
include/SDL_sensor.h
include/SDL_vulkan.h
src/core/android/SDL_android.c
src/core/android/SDL_android.h
src/cpuinfo/SDL_cpuinfo.c
src/hidapi/android/hid.cpp
src/hidapi/hidapi/hidapi.h
src/render/SDL_render.c
src/sensor/SDL_sensor.c
src/video/SDL_blit_N.c
src/video/SDL_surface.c
src/video/SDL_yuv.c
     1.1 --- a/include/SDL_sensor.h	Thu Sep 27 11:55:02 2018 +0300
     1.2 +++ b/include/SDL_sensor.h	Thu Sep 27 14:56:29 2018 -0700
     1.3 @@ -41,7 +41,7 @@
     1.4  #endif
     1.5  
     1.6  /**
     1.7 - *  \file SDL_sensor.h
     1.8 + *  \brief SDL_sensor.h
     1.9   *
    1.10   *  In order to use these functions, SDL_Init() must have been called
    1.11   *  with the ::SDL_INIT_SENSOR flag.  This causes SDL to scan the system
     2.1 --- a/include/SDL_vulkan.h	Thu Sep 27 11:55:02 2018 +0300
     2.2 +++ b/include/SDL_vulkan.h	Thu Sep 27 14:56:29 2018 -0700
     2.3 @@ -137,9 +137,9 @@
     2.4   *
     2.5   *  \param [in]     \c NULL or window Window for which the required Vulkan instance
     2.6   *                  extensions should be retrieved
     2.7 - *  \param [in,out] count pointer to an \c unsigned related to the number of
     2.8 + *  \param [in,out] pCount pointer to an \c unsigned related to the number of
     2.9   *                  required Vulkan instance extensions
    2.10 - *  \param [out]    names \c NULL or a pointer to an array to be filled with the
    2.11 + *  \param [out]    pNames \c NULL or a pointer to an array to be filled with the
    2.12   *                  required Vulkan instance extensions
    2.13   *
    2.14   *  \return \c SDL_TRUE on success, \c SDL_FALSE on error.
     3.1 --- a/src/core/android/SDL_android.c	Thu Sep 27 11:55:02 2018 +0300
     3.2 +++ b/src/core/android/SDL_android.c	Thu Sep 27 14:56:29 2018 -0700
     3.3 @@ -144,6 +144,10 @@
     3.4          JNIEnv* env, jclass cls,
     3.5          jstring text, jint newCursorPosition);
     3.6  
     3.7 +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar)(
     3.8 +        JNIEnv* env, jclass cls,
     3.9 +        jchar chUnicode);
    3.10 +
    3.11  JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)(
    3.12          JNIEnv* env, jclass cls,
    3.13          jstring text, jint newCursorPosition);
    3.14 @@ -195,6 +199,7 @@
    3.15  /* #define DEBUG_JNI */
    3.16  
    3.17  static void Android_JNI_ThreadDestroyed(void*);
    3.18 +static void checkJNIReady(void);
    3.19  
    3.20  /*******************************************************************************
    3.21   This file links the Java side of Android with libsdl
     4.1 --- a/src/core/android/SDL_android.h	Thu Sep 27 11:55:02 2018 +0300
     4.2 +++ b/src/core/android/SDL_android.h	Thu Sep 27 14:56:29 2018 -0700
     4.3 @@ -85,8 +85,9 @@
     4.4  void Android_JNI_SuspendScreenSaver(SDL_bool suspend);
     4.5  
     4.6  /* Touch support */
     4.7 +int Android_JNI_InitTouch(void);
     4.8 +void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value);
     4.9  int Android_JNI_GetTouchDeviceIds(int **ids);
    4.10 -void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value);
    4.11  
    4.12  /* Threads */
    4.13  #include <jni.h>
    4.14 @@ -109,9 +110,15 @@
    4.15  SDL_bool Android_JNI_SetSystemCursor(int cursorID);
    4.16  
    4.17  /* Relative mouse support */
    4.18 -SDL_bool Android_JNI_SupportsRelativeMouse();
    4.19 +SDL_bool Android_JNI_SupportsRelativeMouse(void);
    4.20  SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled);
    4.21  
    4.22 +
    4.23 +SDL_bool SDL_IsAndroidTablet(void);
    4.24 +SDL_bool SDL_IsAndroidTV(void);
    4.25 +SDL_bool SDL_IsChromebook(void);
    4.26 +SDL_bool SDL_IsDeXMode(void);
    4.27 +
    4.28  /* Ends C function definitions when using C++ */
    4.29  #ifdef __cplusplus
    4.30  /* *INDENT-OFF* */
     5.1 --- a/src/cpuinfo/SDL_cpuinfo.c	Thu Sep 27 11:55:02 2018 +0300
     5.2 +++ b/src/cpuinfo/SDL_cpuinfo.c	Thu Sep 27 14:56:29 2018 -0700
     5.3 @@ -22,6 +22,7 @@
     5.4  #include "SDL_config.h"
     5.5  #else
     5.6  #include "../SDL_internal.h"
     5.7 +#include "SDL_simd.h"
     5.8  #endif
     5.9  
    5.10  #if defined(__WIN32__)
     6.1 --- a/src/hidapi/android/hid.cpp	Thu Sep 27 11:55:02 2018 +0300
     6.2 +++ b/src/hidapi/android/hid.cpp	Thu Sep 27 14:56:29 2018 -0700
     6.3 @@ -336,7 +336,7 @@
     6.4  static jmethodID g_midHIDDeviceManagerGetFeatureReport;
     6.5  static jmethodID g_midHIDDeviceManagerClose;
     6.6  
     6.7 -uint64_t get_timespec_ms( const struct timespec &ts )
     6.8 +static uint64_t get_timespec_ms( const struct timespec &ts )
     6.9  {
    6.10  	return (uint64_t)ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
    6.11  }
    6.12 @@ -694,6 +694,32 @@
    6.13  	}
    6.14  }
    6.15  
    6.16 +
    6.17 +extern "C"
    6.18 +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceRegisterCallback)(JNIEnv *env, jobject thiz, jobject callbackHandler);
    6.19 +
    6.20 +extern "C"
    6.21 +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceReleaseCallback)(JNIEnv *env, jobject thiz);
    6.22 +
    6.23 +extern "C"
    6.24 +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceConnected)(JNIEnv *env, jobject thiz, int nDeviceID, jstring sIdentifier, int nVendorId, int nProductId, jstring sSerialNumber, int nReleaseNumber, jstring sManufacturer, jstring sProduct, int nInterface );
    6.25 +
    6.26 +extern "C"
    6.27 +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenPending)(JNIEnv *env, jobject thiz, int nDeviceID);
    6.28 +
    6.29 +extern "C"
    6.30 +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenResult)(JNIEnv *env, jobject thiz, int nDeviceID, bool bOpened);
    6.31 +
    6.32 +extern "C"
    6.33 +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceDisconnected)(JNIEnv *env, jobject thiz, int nDeviceID);
    6.34 +
    6.35 +extern "C"
    6.36 +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceInputReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value);
    6.37 +
    6.38 +extern "C"
    6.39 +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceFeatureReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value);
    6.40 +
    6.41 +
    6.42  extern "C"
    6.43  JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceRegisterCallback)(JNIEnv *env, jobject thiz, jobject callbackHandler)
    6.44  {
     7.1 --- a/src/hidapi/hidapi/hidapi.h	Thu Sep 27 11:55:02 2018 +0300
     7.2 +++ b/src/hidapi/hidapi/hidapi.h	Thu Sep 27 14:56:29 2018 -0700
     7.3 @@ -225,7 +225,7 @@
     7.4  				-1 on error. If no packet was available to be read within
     7.5  				the timeout period, this function returns 0.
     7.6  		*/
     7.7 -		int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds);
     7.8 +		int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *device, unsigned char *data, size_t length, int milliseconds);
     7.9  
    7.10  		/** @brief Read an Input report from a HID device.
    7.11  
     8.1 --- a/src/render/SDL_render.c	Thu Sep 27 11:55:02 2018 +0300
     8.2 +++ b/src/render/SDL_render.c	Thu Sep 27 14:56:29 2018 -0700
     8.3 @@ -521,7 +521,8 @@
     8.4      return renderer->info.texture_formats[0];
     8.5  }
     8.6  
     8.7 -SDL_ScaleMode SDL_GetScaleMode(void)
     8.8 +
     8.9 +static SDL_ScaleMode SDL_GetScaleMode(void)
    8.10  {
    8.11      const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
    8.12  
     9.1 --- a/src/sensor/SDL_sensor.c	Thu Sep 27 11:55:02 2018 +0300
     9.2 +++ b/src/sensor/SDL_sensor.c	Thu Sep 27 14:56:29 2018 -0700
     9.3 @@ -48,7 +48,7 @@
     9.4  static SDL_mutex *SDL_sensor_lock = NULL; /* This needs to support recursive locks */
     9.5  static SDL_atomic_t SDL_next_sensor_instance_id;
     9.6  
     9.7 -void
     9.8 +static void
     9.9  SDL_LockSensors(void)
    9.10  {
    9.11      if (SDL_sensor_lock) {
    9.12 @@ -56,7 +56,7 @@
    9.13      }
    9.14  }
    9.15  
    9.16 -void
    9.17 +static void
    9.18  SDL_UnlockSensors(void)
    9.19  {
    9.20      if (SDL_sensor_lock) {
    9.21 @@ -118,7 +118,7 @@
    9.22   * Get the driver and device index for an API device index
    9.23   * This should be called while the sensor lock is held, to prevent another thread from updating the list
    9.24   */
    9.25 -SDL_bool
    9.26 +static SDL_bool
    9.27  SDL_GetDriverAndSensorIndex(int device_index, SDL_SensorDriver **driver, int *driver_index)
    9.28  {
    9.29      int i, num_sensors, total_sensors = 0;
    10.1 --- a/src/video/SDL_blit_N.c	Thu Sep 27 11:55:02 2018 +0300
    10.2 +++ b/src/video/SDL_blit_N.c	Thu Sep 27 14:56:29 2018 -0700
    10.3 @@ -2333,6 +2333,30 @@
    10.4      /* Set up some basic variables */
    10.5      ckey &= rgbmask;
    10.6  
    10.7 +    /* Fastpath: same source/destination format, no Amask, bpp 32, loop is vectorized. ~10x faster */
    10.8 +    if (srcfmt->format == dstfmt->format &&
    10.9 +        (srcfmt->format == SDL_PIXELFORMAT_RGB888 || srcfmt->format == SDL_PIXELFORMAT_BGR888)) {
   10.10 +        Uint32 *src32 = (Uint32*)src;
   10.11 +        Uint32 *dst32 = (Uint32*)dst;
   10.12 +        srcskip /= sizeof(Uint32);
   10.13 +        dstskip /= sizeof(Uint32);
   10.14 +        while (height--) {
   10.15 +            /* *INDENT-OFF* */
   10.16 +            DUFFS_LOOP(
   10.17 +            {
   10.18 +                Uint32 Pixel = (*src32 == ckey) ? *dst32 : *src32;
   10.19 +                *dst32 = Pixel;
   10.20 +                ++src32;
   10.21 +                ++dst32;
   10.22 +            },
   10.23 +            width);
   10.24 +            /* *INDENT-ON* */
   10.25 +            src32 += srcskip;
   10.26 +            dst32 += dstskip;
   10.27 +        }
   10.28 +        return;
   10.29 +    }
   10.30 +
   10.31      while (height--) {
   10.32          /* *INDENT-OFF* */
   10.33          DUFFS_LOOP(
   10.34 @@ -2380,6 +2404,33 @@
   10.35      dstbpp = dstfmt->BytesPerPixel;
   10.36      ckey &= rgbmask;
   10.37  
   10.38 +    /* Fastpath: same source/destination format, with Amask, bpp 32, loop is vectorized. ~10x faster */
   10.39 +    if (srcfmt->format == dstfmt->format &&
   10.40 +        (srcfmt->format == SDL_PIXELFORMAT_ARGB8888 ||
   10.41 +         srcfmt->format == SDL_PIXELFORMAT_ABGR8888 ||
   10.42 +         srcfmt->format == SDL_PIXELFORMAT_BGRA8888 ||
   10.43 +         srcfmt->format == SDL_PIXELFORMAT_RGBA8888)) {
   10.44 +        Uint32 *src32 = (Uint32*)src;
   10.45 +        Uint32 *dst32 = (Uint32*)dst;
   10.46 +        srcskip /= sizeof(Uint32);
   10.47 +        dstskip /= sizeof(Uint32);
   10.48 +        while (height--) {
   10.49 +            /* *INDENT-OFF* */
   10.50 +            DUFFS_LOOP(
   10.51 +            {
   10.52 +                Uint32 Pixel = ((*src32 & rgbmask) == ckey) ? *dst32 : *src32;
   10.53 +                *dst32 = Pixel;
   10.54 +                ++src32;
   10.55 +                ++dst32;
   10.56 +            },
   10.57 +            width);
   10.58 +            /* *INDENT-ON* */
   10.59 +            src32 += srcskip;
   10.60 +            dst32 += dstskip;
   10.61 +        }
   10.62 +        return;
   10.63 +    }
   10.64 +
   10.65      while (height--) {
   10.66          /* *INDENT-OFF* */
   10.67          DUFFS_LOOP(
    11.1 --- a/src/video/SDL_surface.c	Thu Sep 27 11:55:02 2018 +0300
    11.2 +++ b/src/video/SDL_surface.c	Thu Sep 27 14:56:29 2018 -0700
    11.3 @@ -37,7 +37,7 @@
    11.4  /*
    11.5   * Calculate the pad-aligned scanline width of a surface
    11.6   */
    11.7 -int
    11.8 +static int
    11.9  SDL_CalculatePitch(Uint32 format, int width)
   11.10  {
   11.11      int pitch;
    12.1 --- a/src/video/SDL_yuv.c	Thu Sep 27 11:55:02 2018 +0300
    12.2 +++ b/src/video/SDL_yuv.c	Thu Sep 27 14:56:29 2018 -0700
    12.3 @@ -23,6 +23,7 @@
    12.4  #include "SDL_endian.h"
    12.5  #include "SDL_video.h"
    12.6  #include "SDL_pixels_c.h"
    12.7 +#include "SDL_yuv_c.h"
    12.8  
    12.9  #include "yuv2rgb/yuv_rgb.h"
   12.10