# SDL: Fixed compiler warning (3b0cd)

**URL:** <https://discourse.libsdl.org/t/sdl-fixed-compiler-warning-3b0cd/41191>\
**Category:** SDL Commits\
**Created:** [December 17, 2022, 2:54pm UTC](https://discourse.libsdl.org/t/sdl-fixed-compiler-warning-3b0cd/41191 "2022-12-17T14:54:03Z")\
**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:** [December 17, 2022, 2:54pm UTC](https://discourse.libsdl.org/t/sdl-fixed-compiler-warning-3b0cd/41191/1 "2022-12-17T14:54:03Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/3b0cd441584ada86c4456afb4e8b3edaf2173073>
>
> \`\`\`
> ./src/joystick/SDL\_joystick.c:105:12: warning: no previous extern declarati…on for non-static variable 'SDL\_joystick\_lock' \[-Wmissing-variable-declarations\]
> SDL\_mutex \*SDL\_joystick\_lock = NULL; /\* This needs to support recursive locks \*/
> ^
> ./src/joystick/SDL\_joystick.c:105:1: note: declare 'static' if the variable is not intended to be used outside of this translation unit
> SDL\_mutex \*SDL\_joystick\_lock = NULL; /\* This needs to support recursive locks \*/
> ^
> \`\`\`
> 1 warning generated.

```diff
From 3b0cd441584ada86c4456afb4e8b3edaf2173073 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 17 Dec 2022 06:51:02 -0800
Subject: [PATCH] Fixed compiler warning

```

./src/joystick/SDL\_joystick.c:105:12: warning: no previous extern declaration for non-static variable ‘SDL\_joystick\_lock’ [-Wmissing-variable-declarations]  
SDL\_mutex _SDL\_joystick\_lock = NULL; /_ This needs to support recursive locks \*/  
^  
./src/joystick/SDL\_joystick.c:105:1: note: declare ‘static’ if the variable is not intended to be used outside of this translation unit  
SDL\_mutex _SDL\_joystick\_lock = NULL; /_ This needs to support recursive locks \*/  
^

```auto
1 warning generated.
---
 src/joystick/SDL_joystick.c | 4 ++++
 src/joystick/hidapi/SDL_hidapi_rumble.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index dd9c4bdb4962..3cdcba9d1281 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -109,6 +109,10 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = {
         &SDL_DUMMY_JoystickDriver
 #endif
 };
+
+#ifndef SDL_THREAD_SAFETY_ANALYSIS
+static
+#endif
 SDL_mutex *SDL_joystick_lock = NULL; /* This needs to support recursive locks */
 static int SDL_joysticks_locked;
 static SDL_bool SDL_joysticks_initialized;
diff --git a/src/joystick/hidapi/SDL_hidapi_rumble.c b/src/joystick/hidapi/SDL_hidapi_rumble.c
index 6cd8dd535a28..2144b556d69f 100644
--- a/src/joystick/hidapi/SDL_hidapi_rumble.c
+++ b/src/joystick/hidapi/SDL_hidapi_rumble.c
@@ -51,6 +51,9 @@ typedef struct SDL_HIDAPI_RumbleContext
     SDL_HIDAPI_RumbleRequest *requests_tail;
 } SDL_HIDAPI_RumbleContext;
 
+#ifndef SDL_THREAD_SAFETY_ANALYSIS
+static
+#endif
 SDL_mutex *SDL_HIDAPI_rumble_lock;
 static SDL_HIDAPI_RumbleContext rumble_context SDL_GUARDED_BY(SDL_HIDAPI_rumble_lock);
 

```
