# SDL: testhaptic.c, testjoystick.c: fixed -Wshadow warnings.

**URL:** <https://discourse.libsdl.org/t/sdl-testhaptic-c-testjoystick-c-fixed-wshadow-warnings/33664>\
**Category:** SDL Commits\
**Created:** [November 23, 2021, 12:12pm UTC](https://discourse.libsdl.org/t/sdl-testhaptic-c-testjoystick-c-fixed-wshadow-warnings/33664 "2021-11-23T12:12:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [November 23, 2021, 12:12pm UTC](https://discourse.libsdl.org/t/sdl-testhaptic-c-testjoystick-c-fixed-wshadow-warnings/33664/1 "2021-11-23T12:12:07Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/d2871a348bb71a73252ff38b84dcceb8f9b71342>

```diff
From d2871a348bb71a73252ff38b84dcceb8f9b71342 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Tue, 23 Nov 2021 15:10:50 +0300
Subject: [PATCH] testhaptic.c, testjoystick.c: fixed -Wshadow warnings.

---
 test/testhaptic.c | 8 ++++----
 test/testjoystick.c | 28 ++++++++++++++--------------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/test/testhaptic.c b/test/testhaptic.c
index 74be9e0c3d9..9b73ce29399 100644
--- a/test/testhaptic.c
+++ b/test/testhaptic.c
@@ -25,7 +25,7 @@ static SDL_Haptic *haptic;
  * prototypes
  */
 static void abort_execution(void);
-static void HapticPrintSupported(SDL_Haptic * haptic);
+static void HapticPrintSupported(SDL_Haptic *);
 
 
 /**
@@ -310,13 +310,13 @@ abort_execution(void)
  * Displays information about the haptic device.
  */
 static void
-HapticPrintSupported(SDL_Haptic * haptic)
+HapticPrintSupported(SDL_Haptic * ptr)
 {
     unsigned int supported;
 
- supported = SDL_HapticQuery(haptic);
+ supported = SDL_HapticQuery(ptr);
     SDL_Log(" Supported effects [%d effects, %d playing]:\n",
- SDL_HapticNumEffects(haptic), SDL_HapticNumEffectsPlaying(haptic));
+ SDL_HapticNumEffects(ptr), SDL_HapticNumEffectsPlaying(ptr));
     if (supported & SDL_HAPTIC_CONSTANT)
         SDL_Log(" constant\n");
     if (supported & SDL_HAPTIC_SINE)
diff --git a/test/testjoystick.c b/test/testjoystick.c
index fc8389ff5a5..ea7057262db 100644
--- a/test/testjoystick.c
+++ b/test/testjoystick.c
@@ -38,14 +38,14 @@ static SDL_Joystick *joystick = NULL;
 static SDL_bool done = SDL_FALSE;
 
 static void
-PrintJoystick(SDL_Joystick *joystick)
+PrintJoystick(SDL_Joystick *joy)
 {
     const char *type;
     char guid[64];
 
- SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick);
- SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), guid, sizeof (guid));
- switch (SDL_JoystickGetType(joystick)) {
+ SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joy)) == joy);
+ SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joy), guid, sizeof (guid));
+ switch (SDL_JoystickGetType(joy)) {
     case SDL_JOYSTICK_TYPE_GAMECONTROLLER:
         type = "Game Controller";
         break;
@@ -78,18 +78,18 @@ PrintJoystick(SDL_Joystick *joystick)
         break;
     }
     SDL_Log("Joystick\n");
- SDL_Log(" name: %s\n", SDL_JoystickName(joystick));
+ SDL_Log(" name: %s\n", SDL_JoystickName(joy));
     SDL_Log(" type: %s\n", type);
- SDL_Log(" LED: %s\n", SDL_JoystickHasLED(joystick) ? "yes" : "no");
- SDL_Log(" rumble: %s\n", SDL_JoystickHasRumble(joystick) ? "yes" : "no");
- SDL_Log("trigger rumble: %s\n", SDL_JoystickHasRumbleTriggers(joystick) ? "yes" : "no");
- SDL_Log(" axes: %d\n", SDL_JoystickNumAxes(joystick));
- SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joystick));
- SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joystick));
- SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joystick));
- SDL_Log(" instance id: %d\n", SDL_JoystickInstanceID(joystick));
+ SDL_Log(" LED: %s\n", SDL_JoystickHasLED(joy) ? "yes" : "no");
+ SDL_Log(" rumble: %s\n", SDL_JoystickHasRumble(joy) ? "yes" : "no");
+ SDL_Log("trigger rumble: %s\n", SDL_JoystickHasRumbleTriggers(joy) ? "yes" : "no");
+ SDL_Log(" axes: %d\n", SDL_JoystickNumAxes(joy));
+ SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joy));
+ SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joy));
+ SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joy));
+ SDL_Log(" instance id: %d\n", SDL_JoystickInstanceID(joy));
     SDL_Log(" guid: %s\n", guid);
- SDL_Log(" VID/PID: 0x%.4x/0x%.4x\n", SDL_JoystickGetVendor(joystick), SDL_JoystickGetProduct(joystick));
+ SDL_Log(" VID/PID: 0x%.4x/0x%.4x\n", SDL_JoystickGetVendor(joy), SDL_JoystickGetProduct(joy));
 }
 
 static void

```
