diff --git a/core/error_macros.h b/core/error_macros.h
index 3587e01d542..bee738ceea7 100644
--- a/core/error_macros.h
+++ b/core/error_macros.h
@@ -313,7 +313,7 @@ extern bool _err_error_exists;
 
 #define WARN_DEPRECATED                                                                                                                                   \
 	{                                                                                                                                                     \
-		static bool warning_shown = false;                                                                                                                \
+		static volatile bool warning_shown = false;                                                                                                       \
 		if (!warning_shown) {                                                                                                                             \
 			_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "This method has been deprecated and will be removed in the future", ERR_HANDLER_WARNING); \
 			_err_error_exists = false;                                                                                                                    \