2
0
Эх сурвалжийг харах

Inline static variables (part 1)

kobewi 5 сар өмнө
parent
commit
5af4bef46f
52 өөрчлөгдсөн 85 нэмэгдсэн , 247 устгасан
  1. 0 2
      core/config/engine.cpp
  2. 1 1
      core/config/engine.h
  3. 0 4
      core/config/project_settings.cpp
  4. 2 2
      core/config/project_settings.h
  5. 0 16
      core/core_bind.cpp
  6. 8 8
      core/core_bind.h
  7. 0 35
      core/core_globals.cpp
  8. 3 3
      core/core_globals.h
  9. 0 7
      core/debugger/engine_debugger.cpp
  10. 5 5
      core/debugger/engine_debugger.h
  11. 0 3
      core/debugger/script_debugger.cpp
  12. 3 3
      core/debugger/script_debugger.h
  13. 0 9
      core/extension/gdextension.cpp
  14. 6 6
      core/extension/gdextension.h
  15. 0 2
      core/extension/gdextension_manager.cpp
  16. 1 1
      core/extension/gdextension_manager.h
  17. 0 2
      core/extension/gdextension_special_compat_hashes.cpp
  18. 1 1
      core/extension/gdextension_special_compat_hashes.h
  19. 0 2
      core/input/input.cpp
  20. 1 1
      core/input/input.h
  21. 0 3
      core/input/input_event.cpp
  22. 2 2
      core/input/input_event.h
  23. 0 4
      core/input/input_map.cpp
  24. 2 2
      core/input/input_map.h
  25. 0 8
      core/io/compression.cpp
  26. 8 6
      core/io/compression.h
  27. 0 2
      core/io/dir_access.cpp
  28. 1 1
      core/io/dir_access.h
  29. 0 3
      core/io/dtls_server.cpp
  30. 2 2
      core/io/dtls_server.h
  31. 0 7
      core/io/file_access.cpp
  32. 4 4
      core/io/file_access.h
  33. 0 2
      core/io/file_access_pack.cpp
  34. 1 1
      core/io/file_access_pack.h
  35. 0 2
      core/io/file_access_zip.cpp
  36. 1 1
      core/io/file_access_zip.h
  37. 0 26
      core/io/image.cpp
  38. 19 19
      core/io/image.h
  39. 0 2
      core/io/image_loader.cpp
  40. 1 1
      core/io/image_loader.h
  41. 0 2
      core/io/ip.cpp
  42. 1 1
      core/io/ip.h
  43. 0 2
      core/io/logger.cpp
  44. 1 1
      core/io/logger.h
  45. 0 3
      core/io/packet_peer_dtls.cpp
  46. 2 2
      core/io/packet_peer_dtls.h
  47. 0 2
      core/io/resource_format_binary.cpp
  48. 1 1
      core/io/resource_format_binary.h
  49. 0 4
      core/io/resource_importer.cpp
  50. 2 2
      core/io/resource_importer.h
  51. 0 10
      editor/gui/editor_file_dialog.cpp
  52. 6 6
      editor/gui/editor_file_dialog.h

+ 0 - 2
core/config/engine.cpp

@@ -400,8 +400,6 @@ String Engine::get_shader_cache_path() const {
 	return shader_cache_path;
 	return shader_cache_path;
 }
 }
 
 
-Engine *Engine::singleton = nullptr;
-
 Engine *Engine::get_singleton() {
 Engine *Engine::get_singleton() {
 	return singleton;
 	return singleton;
 }
 }

+ 1 - 1
core/config/engine.h

@@ -90,7 +90,7 @@ private:
 
 
 	bool _print_header = true;
 	bool _print_header = true;
 
 
-	static Engine *singleton;
+	static inline Engine *singleton = nullptr;
 
 
 	String write_movie_path;
 	String write_movie_path;
 	String shader_cache_path;
 	String shader_cache_path;

+ 0 - 4
core/config/project_settings.cpp

@@ -48,10 +48,6 @@
 #include "modules/modules_enabled.gen.h" // For mono.
 #include "modules/modules_enabled.gen.h" // For mono.
 #endif // TOOLS_ENABLED
 #endif // TOOLS_ENABLED
 
 
-const String ProjectSettings::PROJECT_DATA_DIR_NAME_SUFFIX = "godot";
-
-ProjectSettings *ProjectSettings::singleton = nullptr;
-
 ProjectSettings *ProjectSettings::get_singleton() {
 ProjectSettings *ProjectSettings::get_singleton() {
 	return singleton;
 	return singleton;
 }
 }

+ 2 - 2
core/config/project_settings.h

@@ -44,7 +44,7 @@ class ProjectSettings : public Object {
 
 
 public:
 public:
 	typedef HashMap<String, Variant> CustomMap;
 	typedef HashMap<String, Variant> CustomMap;
-	static const String PROJECT_DATA_DIR_NAME_SUFFIX;
+	static inline const String PROJECT_DATA_DIR_NAME_SUFFIX = "godot";
 
 
 	// Properties that are not for built in values begin from this value, so builtin ones are displayed first.
 	// Properties that are not for built in values begin from this value, so builtin ones are displayed first.
 	constexpr static const int32_t NO_BUILTIN_ORDER_BASE = 1 << 16;
 	constexpr static const int32_t NO_BUILTIN_ORDER_BASE = 1 << 16;
@@ -116,7 +116,7 @@ protected:
 	void _queue_changed();
 	void _queue_changed();
 	void _emit_changed();
 	void _emit_changed();
 
 
-	static ProjectSettings *singleton;
+	static inline ProjectSettings *singleton = nullptr;
 
 
 	Error _load_settings_text(const String &p_path);
 	Error _load_settings_text(const String &p_path);
 	Error _load_settings_binary(const String &p_path);
 	Error _load_settings_binary(const String &p_path);

+ 0 - 16
core/core_bind.cpp

@@ -46,8 +46,6 @@ namespace CoreBind {
 
 
 ////// ResourceLoader //////
 ////// ResourceLoader //////
 
 
-ResourceLoader *ResourceLoader::singleton = nullptr;
-
 Error ResourceLoader::load_threaded_request(const String &p_path, const String &p_type_hint, bool p_use_sub_threads, CacheMode p_cache_mode) {
 Error ResourceLoader::load_threaded_request(const String &p_path, const String &p_type_hint, bool p_use_sub_threads, CacheMode p_cache_mode) {
 	return ::ResourceLoader::load_threaded_request(p_path, p_type_hint, p_use_sub_threads, ResourceFormatLoader::CacheMode(p_cache_mode));
 	return ::ResourceLoader::load_threaded_request(p_path, p_type_hint, p_use_sub_threads, ResourceFormatLoader::CacheMode(p_cache_mode));
 }
 }
@@ -195,8 +193,6 @@ ResourceUID::ID ResourceSaver::get_resource_id_for_path(const String &p_path, bo
 	return ::ResourceSaver::get_resource_id_for_path(p_path, p_generate);
 	return ::ResourceSaver::get_resource_id_for_path(p_path, p_generate);
 }
 }
 
 
-ResourceSaver *ResourceSaver::singleton = nullptr;
-
 void ResourceSaver::_bind_methods() {
 void ResourceSaver::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("save", "resource", "path", "flags"), &ResourceSaver::save, DEFVAL(""), DEFVAL((uint32_t)FLAG_NONE));
 	ClassDB::bind_method(D_METHOD("save", "resource", "path", "flags"), &ResourceSaver::save, DEFVAL(""), DEFVAL((uint32_t)FLAG_NONE));
 	ClassDB::bind_method(D_METHOD("set_uid", "resource", "uid"), &ResourceSaver::set_uid);
 	ClassDB::bind_method(D_METHOD("set_uid", "resource", "uid"), &ResourceSaver::set_uid);
@@ -722,8 +718,6 @@ void OS::remove_logger(const Ref<Logger> &p_logger) {
 	logger_bind->loggers.erase(p_logger);
 	logger_bind->loggers.erase(p_logger);
 }
 }
 
 
-OS *OS::singleton = nullptr;
-
 void OS::_bind_methods() {
 void OS::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("get_entropy", "size"), &OS::get_entropy);
 	ClassDB::bind_method(D_METHOD("get_entropy", "size"), &OS::get_entropy);
 	ClassDB::bind_method(D_METHOD("get_system_ca_certificates"), &OS::get_system_ca_certificates);
 	ClassDB::bind_method(D_METHOD("get_system_ca_certificates"), &OS::get_system_ca_certificates);
@@ -877,8 +871,6 @@ OS::~OS() {
 
 
 ////// Geometry2D //////
 ////// Geometry2D //////
 
 
-Geometry2D *Geometry2D::singleton = nullptr;
-
 Geometry2D *Geometry2D::get_singleton() {
 Geometry2D *Geometry2D::get_singleton() {
 	return singleton;
 	return singleton;
 }
 }
@@ -1138,8 +1130,6 @@ void Geometry2D::_bind_methods() {
 
 
 ////// Geometry3D //////
 ////// Geometry3D //////
 
 
-Geometry3D *Geometry3D::singleton = nullptr;
-
 Geometry3D *Geometry3D::get_singleton() {
 Geometry3D *Geometry3D::get_singleton() {
 	return singleton;
 	return singleton;
 }
 }
@@ -1282,8 +1272,6 @@ void Geometry3D::_bind_methods() {
 
 
 ////// Marshalls //////
 ////// Marshalls //////
 
 
-Marshalls *Marshalls::singleton = nullptr;
-
 Marshalls *Marshalls::get_singleton() {
 Marshalls *Marshalls::get_singleton() {
 	return singleton;
 	return singleton;
 }
 }
@@ -2128,8 +2116,6 @@ void Engine::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "physics_jitter_fix"), "set_physics_jitter_fix", "get_physics_jitter_fix");
 	ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "physics_jitter_fix"), "set_physics_jitter_fix", "get_physics_jitter_fix");
 }
 }
 
 
-Engine *Engine::singleton = nullptr;
-
 ////// EngineDebugger //////
 ////// EngineDebugger //////
 
 
 bool EngineDebugger::is_active() {
 bool EngineDebugger::is_active() {
@@ -2275,8 +2261,6 @@ EngineDebugger::~EngineDebugger() {
 	captures.clear();
 	captures.clear();
 }
 }
 
 
-EngineDebugger *EngineDebugger::singleton = nullptr;
-
 void EngineDebugger::_bind_methods() {
 void EngineDebugger::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("is_active"), &EngineDebugger::is_active);
 	ClassDB::bind_method(D_METHOD("is_active"), &EngineDebugger::is_active);
 
 

+ 8 - 8
core/core_bind.h

@@ -48,7 +48,7 @@ class ResourceLoader : public Object {
 
 
 protected:
 protected:
 	static void _bind_methods();
 	static void _bind_methods();
-	static ResourceLoader *singleton;
+	static inline ResourceLoader *singleton = nullptr;
 
 
 public:
 public:
 	enum ThreadLoadStatus {
 	enum ThreadLoadStatus {
@@ -93,7 +93,7 @@ class ResourceSaver : public Object {
 
 
 protected:
 protected:
 	static void _bind_methods();
 	static void _bind_methods();
-	static ResourceSaver *singleton;
+	static inline ResourceSaver *singleton = nullptr;
 
 
 public:
 public:
 	enum SaverFlags {
 	enum SaverFlags {
@@ -162,7 +162,7 @@ class OS : public Object {
 
 
 protected:
 protected:
 	static void _bind_methods();
 	static void _bind_methods();
-	static OS *singleton;
+	static inline OS *singleton = nullptr;
 
 
 #ifndef DISABLE_DEPRECATED
 #ifndef DISABLE_DEPRECATED
 	Dictionary _execute_with_pipe_bind_compat_94434(const String &p_path, const Vector<String> &p_arguments);
 	Dictionary _execute_with_pipe_bind_compat_94434(const String &p_path, const Vector<String> &p_arguments);
@@ -322,7 +322,7 @@ public:
 class Geometry2D : public Object {
 class Geometry2D : public Object {
 	GDCLASS(Geometry2D, Object);
 	GDCLASS(Geometry2D, Object);
 
 
-	static Geometry2D *singleton;
+	static inline Geometry2D *singleton = nullptr;
 
 
 protected:
 protected:
 	static void _bind_methods();
 	static void _bind_methods();
@@ -388,7 +388,7 @@ public:
 class Geometry3D : public Object {
 class Geometry3D : public Object {
 	GDCLASS(Geometry3D, Object);
 	GDCLASS(Geometry3D, Object);
 
 
-	static Geometry3D *singleton;
+	static inline Geometry3D *singleton = nullptr;
 
 
 protected:
 protected:
 	static void _bind_methods();
 	static void _bind_methods();
@@ -419,7 +419,7 @@ public:
 class Marshalls : public Object {
 class Marshalls : public Object {
 	GDCLASS(Marshalls, Object);
 	GDCLASS(Marshalls, Object);
 
 
-	static Marshalls *singleton;
+	static inline Marshalls *singleton = nullptr;
 
 
 protected:
 protected:
 	static void _bind_methods();
 	static void _bind_methods();
@@ -570,7 +570,7 @@ class Engine : public Object {
 
 
 protected:
 protected:
 	static void _bind_methods();
 	static void _bind_methods();
-	static Engine *singleton;
+	static inline Engine *singleton = nullptr;
 
 
 public:
 public:
 	static Engine *get_singleton() { return singleton; }
 	static Engine *get_singleton() { return singleton; }
@@ -650,7 +650,7 @@ class EngineDebugger : public Object {
 
 
 protected:
 protected:
 	static void _bind_methods();
 	static void _bind_methods();
-	static EngineDebugger *singleton;
+	static inline EngineDebugger *singleton = nullptr;
 
 
 public:
 public:
 	static EngineDebugger *get_singleton() { return singleton; }
 	static EngineDebugger *get_singleton() { return singleton; }

+ 0 - 35
core/core_globals.cpp

@@ -1,35 +0,0 @@
-/**************************************************************************/
-/*  core_globals.cpp                                                      */
-/**************************************************************************/
-/*                         This file is part of:                          */
-/*                             GODOT ENGINE                               */
-/*                        https://godotengine.org                         */
-/**************************************************************************/
-/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
-/*                                                                        */
-/* Permission is hereby granted, free of charge, to any person obtaining  */
-/* a copy of this software and associated documentation files (the        */
-/* "Software"), to deal in the Software without restriction, including    */
-/* without limitation the rights to use, copy, modify, merge, publish,    */
-/* distribute, sublicense, and/or sell copies of the Software, and to     */
-/* permit persons to whom the Software is furnished to do so, subject to  */
-/* the following conditions:                                              */
-/*                                                                        */
-/* The above copyright notice and this permission notice shall be         */
-/* included in all copies or substantial portions of the Software.        */
-/*                                                                        */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
-/**************************************************************************/
-
-#include "core_globals.h"
-
-bool CoreGlobals::leak_reporting_enabled = true;
-bool CoreGlobals::print_line_enabled = true;
-bool CoreGlobals::print_error_enabled = true;

+ 3 - 3
core/core_globals.h

@@ -35,7 +35,7 @@
 
 
 class CoreGlobals {
 class CoreGlobals {
 public:
 public:
-	static bool leak_reporting_enabled;
-	static bool print_line_enabled;
-	static bool print_error_enabled;
+	static inline bool leak_reporting_enabled = true;
+	static inline bool print_line_enabled = true;
+	static inline bool print_error_enabled = true;
 };
 };

+ 0 - 7
core/debugger/engine_debugger.cpp

@@ -36,13 +36,6 @@
 #include "core/debugger/script_debugger.h"
 #include "core/debugger/script_debugger.h"
 #include "core/os/os.h"
 #include "core/os/os.h"
 
 
-EngineDebugger *EngineDebugger::singleton = nullptr;
-ScriptDebugger *EngineDebugger::script_debugger = nullptr;
-
-HashMap<StringName, EngineDebugger::Profiler> EngineDebugger::profilers;
-HashMap<StringName, EngineDebugger::Capture> EngineDebugger::captures;
-HashMap<String, EngineDebugger::CreatePeerFunc> EngineDebugger::protocols;
-
 void (*EngineDebugger::allow_focus_steal_fn)();
 void (*EngineDebugger::allow_focus_steal_fn)();
 
 
 void EngineDebugger::register_profiler(const StringName &p_name, const Profiler &p_func) {
 void EngineDebugger::register_profiler(const StringName &p_name, const Profiler &p_func) {

+ 5 - 5
core/debugger/engine_debugger.h

@@ -91,12 +91,12 @@ private:
 	uint32_t poll_every = 0;
 	uint32_t poll_every = 0;
 
 
 protected:
 protected:
-	static EngineDebugger *singleton;
-	static ScriptDebugger *script_debugger;
+	static inline EngineDebugger *singleton = nullptr;
+	static inline ScriptDebugger *script_debugger = nullptr;
 
 
-	static HashMap<StringName, Profiler> profilers;
-	static HashMap<StringName, Capture> captures;
-	static HashMap<String, CreatePeerFunc> protocols;
+	static inline HashMap<StringName, Profiler> profilers;
+	static inline HashMap<StringName, Capture> captures;
+	static inline HashMap<String, CreatePeerFunc> protocols;
 
 
 	static void (*allow_focus_steal_fn)();
 	static void (*allow_focus_steal_fn)();
 
 

+ 0 - 3
core/debugger/script_debugger.cpp

@@ -32,9 +32,6 @@
 
 
 #include "core/debugger/engine_debugger.h"
 #include "core/debugger/engine_debugger.h"
 
 
-thread_local int ScriptDebugger::lines_left = -1;
-thread_local int ScriptDebugger::depth = -1;
-thread_local ScriptLanguage *ScriptDebugger::break_lang = nullptr;
 thread_local Vector<ScriptDebugger::StackInfo> ScriptDebugger::error_stack_info;
 thread_local Vector<ScriptDebugger::StackInfo> ScriptDebugger::error_stack_info;
 
 
 void ScriptDebugger::set_lines_left(int p_left) {
 void ScriptDebugger::set_lines_left(int p_left) {

+ 3 - 3
core/debugger/script_debugger.h

@@ -43,9 +43,9 @@ class ScriptDebugger {
 
 
 	HashMap<int, HashSet<StringName>> breakpoints;
 	HashMap<int, HashSet<StringName>> breakpoints;
 
 
-	static thread_local int lines_left;
-	static thread_local int depth;
-	static thread_local ScriptLanguage *break_lang;
+	static inline thread_local int lines_left = -1;
+	static inline thread_local int depth = -1;
+	static inline thread_local ScriptLanguage *break_lang = nullptr;
 	static thread_local Vector<StackInfo> error_stack_info;
 	static thread_local Vector<StackInfo> error_stack_info;
 
 
 public:
 public:

+ 0 - 9
core/extension/gdextension.cpp

@@ -686,8 +686,6 @@ void GDExtension::_register_get_classes_used_callback(GDExtensionClassLibraryPtr
 #endif
 #endif
 }
 }
 
 
-HashMap<StringName, GDExtensionInterfaceFunctionPtr> GDExtension::gdextension_interface_functions;
-
 void GDExtension::register_interface_function(const StringName &p_function_name, GDExtensionInterfaceFunctionPtr p_function_pointer) {
 void GDExtension::register_interface_function(const StringName &p_function_name, GDExtensionInterfaceFunctionPtr p_function_pointer) {
 	ERR_FAIL_COND_MSG(gdextension_interface_functions.has(p_function_name), vformat("Attempt to register interface function '%s', which appears to be already registered.", p_function_name));
 	ERR_FAIL_COND_MSG(gdextension_interface_functions.has(p_function_name), vformat("Attempt to register interface function '%s', which appears to be already registered.", p_function_name));
 	gdextension_interface_functions.insert(p_function_name, p_function_pointer);
 	gdextension_interface_functions.insert(p_function_name, p_function_pointer);
@@ -1050,10 +1048,6 @@ PackedStringArray GDExtension::get_classes_used() const {
 	return ret;
 	return ret;
 }
 }
 
 
-Vector<StringName> GDExtensionEditorPlugins::extension_classes;
-GDExtensionEditorPlugins::EditorPluginRegisterFunc GDExtensionEditorPlugins::editor_node_add_plugin = nullptr;
-GDExtensionEditorPlugins::EditorPluginRegisterFunc GDExtensionEditorPlugins::editor_node_remove_plugin = nullptr;
-
 void GDExtensionEditorPlugins::add_extension_class(const StringName &p_class_name) {
 void GDExtensionEditorPlugins::add_extension_class(const StringName &p_class_name) {
 	if (editor_node_add_plugin) {
 	if (editor_node_add_plugin) {
 		editor_node_add_plugin(p_class_name);
 		editor_node_add_plugin(p_class_name);
@@ -1070,9 +1064,6 @@ void GDExtensionEditorPlugins::remove_extension_class(const StringName &p_class_
 	}
 	}
 }
 }
 
 
-GDExtensionEditorHelp::EditorHelpLoadXmlBufferFunc GDExtensionEditorHelp::editor_help_load_xml_buffer = nullptr;
-GDExtensionEditorHelp::EditorHelpRemoveClassFunc GDExtensionEditorHelp::editor_help_remove_class = nullptr;
-
 void GDExtensionEditorHelp::load_xml_buffer(const uint8_t *p_buffer, int p_size) {
 void GDExtensionEditorHelp::load_xml_buffer(const uint8_t *p_buffer, int p_size) {
 	ERR_FAIL_NULL(editor_help_load_xml_buffer);
 	ERR_FAIL_NULL(editor_help_load_xml_buffer);
 	editor_help_load_xml_buffer(p_buffer, p_size);
 	editor_help_load_xml_buffer(p_buffer, p_size);

+ 6 - 6
core/extension/gdextension.h

@@ -115,7 +115,7 @@ class GDExtension : public Resource {
 	void clear_instance_bindings();
 	void clear_instance_bindings();
 #endif
 #endif
 
 
-	static HashMap<StringName, GDExtensionInterfaceFunctionPtr> gdextension_interface_functions;
+	static inline HashMap<StringName, GDExtensionInterfaceFunctionPtr> gdextension_interface_functions;
 
 
 protected:
 protected:
 	static void _bind_methods();
 	static void _bind_methods();
@@ -189,7 +189,7 @@ public:
 #ifdef TOOLS_ENABLED
 #ifdef TOOLS_ENABLED
 class GDExtensionEditorPlugins {
 class GDExtensionEditorPlugins {
 private:
 private:
-	static Vector<StringName> extension_classes;
+	static inline Vector<StringName> extension_classes;
 
 
 protected:
 protected:
 	friend class EditorNode;
 	friend class EditorNode;
@@ -197,8 +197,8 @@ protected:
 	// Since this in core, we can't directly reference EditorNode, so it will
 	// Since this in core, we can't directly reference EditorNode, so it will
 	// set these function pointers in its constructor.
 	// set these function pointers in its constructor.
 	typedef void (*EditorPluginRegisterFunc)(const StringName &p_class_name);
 	typedef void (*EditorPluginRegisterFunc)(const StringName &p_class_name);
-	static EditorPluginRegisterFunc editor_node_add_plugin;
-	static EditorPluginRegisterFunc editor_node_remove_plugin;
+	static inline EditorPluginRegisterFunc editor_node_add_plugin = nullptr;
+	static inline EditorPluginRegisterFunc editor_node_remove_plugin = nullptr;
 
 
 public:
 public:
 	static void add_extension_class(const StringName &p_class_name);
 	static void add_extension_class(const StringName &p_class_name);
@@ -218,10 +218,10 @@ protected:
 	// is initialized even _before_ it gets instantiated, as we need to rely on
 	// is initialized even _before_ it gets instantiated, as we need to rely on
 	// this method while initializing the engine.
 	// this method while initializing the engine.
 	typedef void (*EditorHelpLoadXmlBufferFunc)(const uint8_t *p_buffer, int p_size);
 	typedef void (*EditorHelpLoadXmlBufferFunc)(const uint8_t *p_buffer, int p_size);
-	static EditorHelpLoadXmlBufferFunc editor_help_load_xml_buffer;
+	static inline EditorHelpLoadXmlBufferFunc editor_help_load_xml_buffer = nullptr;
 
 
 	typedef void (*EditorHelpRemoveClassFunc)(const String &p_class);
 	typedef void (*EditorHelpRemoveClassFunc)(const String &p_class);
-	static EditorHelpRemoveClassFunc editor_help_remove_class;
+	static inline EditorHelpRemoveClassFunc editor_help_remove_class = nullptr;
 
 
 public:
 public:
 	static void load_xml_buffer(const uint8_t *p_buffer, int p_size);
 	static void load_xml_buffer(const uint8_t *p_buffer, int p_size);

+ 0 - 2
core/extension/gdextension_manager.cpp

@@ -411,8 +411,6 @@ void GDExtensionManager::_bind_methods() {
 	ADD_SIGNAL(MethodInfo("extension_unloading", PropertyInfo(Variant::OBJECT, "extension", PROPERTY_HINT_RESOURCE_TYPE, "GDExtension")));
 	ADD_SIGNAL(MethodInfo("extension_unloading", PropertyInfo(Variant::OBJECT, "extension", PROPERTY_HINT_RESOURCE_TYPE, "GDExtension")));
 }
 }
 
 
-GDExtensionManager *GDExtensionManager::singleton = nullptr;
-
 GDExtensionManager::GDExtensionManager() {
 GDExtensionManager::GDExtensionManager() {
 	ERR_FAIL_COND(singleton != nullptr);
 	ERR_FAIL_COND(singleton != nullptr);
 	singleton = this;
 	singleton = this;

+ 1 - 1
core/extension/gdextension_manager.h

@@ -41,7 +41,7 @@ class GDExtensionManager : public Object {
 
 
 	static void _bind_methods();
 	static void _bind_methods();
 
 
-	static GDExtensionManager *singleton;
+	static inline GDExtensionManager *singleton = nullptr;
 
 
 public:
 public:
 	enum LoadStatus {
 	enum LoadStatus {

+ 0 - 2
core/extension/gdextension_special_compat_hashes.cpp

@@ -35,8 +35,6 @@
 #include "core/object/class_db.h"
 #include "core/object/class_db.h"
 #include "core/variant/variant.h"
 #include "core/variant/variant.h"
 
 
-HashMap<StringName, LocalVector<GDExtensionSpecialCompatHashes::Mapping>> GDExtensionSpecialCompatHashes::mappings;
-
 bool GDExtensionSpecialCompatHashes::lookup_current_hash(const StringName &p_class, const StringName &p_method, uint32_t p_legacy_hash, uint32_t *r_current_hash) {
 bool GDExtensionSpecialCompatHashes::lookup_current_hash(const StringName &p_class, const StringName &p_method, uint32_t p_legacy_hash, uint32_t *r_current_hash) {
 	LocalVector<Mapping> *methods = mappings.getptr(p_class);
 	LocalVector<Mapping> *methods = mappings.getptr(p_class);
 	if (!methods) {
 	if (!methods) {

+ 1 - 1
core/extension/gdextension_special_compat_hashes.h

@@ -47,7 +47,7 @@ class GDExtensionSpecialCompatHashes {
 		uint32_t current_hash;
 		uint32_t current_hash;
 	};
 	};
 
 
-	static HashMap<StringName, LocalVector<Mapping>> mappings;
+	static inline HashMap<StringName, LocalVector<Mapping>> mappings;
 
 
 public:
 public:
 	static void initialize();
 	static void initialize();

+ 0 - 2
core/input/input.cpp

@@ -73,8 +73,6 @@ static const char *_joy_axes[(size_t)JoyAxis::SDL_MAX] = {
 	"righttrigger",
 	"righttrigger",
 };
 };
 
 
-Input *Input::singleton = nullptr;
-
 void (*Input::set_mouse_mode_func)(Input::MouseMode) = nullptr;
 void (*Input::set_mouse_mode_func)(Input::MouseMode) = nullptr;
 Input::MouseMode (*Input::get_mouse_mode_func)() = nullptr;
 Input::MouseMode (*Input::get_mouse_mode_func)() = nullptr;
 void (*Input::set_mouse_mode_override_func)(Input::MouseMode) = nullptr;
 void (*Input::set_mouse_mode_override_func)(Input::MouseMode) = nullptr;

+ 1 - 1
core/input/input.h

@@ -41,7 +41,7 @@ class Input : public Object {
 	GDCLASS(Input, Object);
 	GDCLASS(Input, Object);
 	_THREAD_SAFE_CLASS_
 	_THREAD_SAFE_CLASS_
 
 
-	static Input *singleton;
+	static inline Input *singleton = nullptr;
 
 
 	static constexpr uint64_t MAX_EVENT = 32;
 	static constexpr uint64_t MAX_EVENT = 32;
 
 

+ 0 - 3
core/input/input_event.cpp

@@ -35,9 +35,6 @@
 #include "core/os/keyboard.h"
 #include "core/os/keyboard.h"
 #include "core/os/os.h"
 #include "core/os/os.h"
 
 
-const int InputEvent::DEVICE_ID_EMULATION = -1;
-const int InputEvent::DEVICE_ID_INTERNAL = -2;
-
 void InputEvent::set_device(int p_device) {
 void InputEvent::set_device(int p_device) {
 	device = p_device;
 	device = p_device;
 	emit_changed();
 	emit_changed();

+ 2 - 2
core/input/input_event.h

@@ -61,8 +61,8 @@ protected:
 	static void _bind_methods();
 	static void _bind_methods();
 
 
 public:
 public:
-	static const int DEVICE_ID_EMULATION;
-	static const int DEVICE_ID_INTERNAL;
+	static constexpr int DEVICE_ID_EMULATION = -1;
+	static constexpr int DEVICE_ID_INTERNAL = -2;
 
 
 	void set_device(int p_device);
 	void set_device(int p_device);
 	int get_device() const;
 	int get_device() const;

+ 0 - 4
core/input/input_map.cpp

@@ -37,10 +37,6 @@
 #include "core/os/os.h"
 #include "core/os/os.h"
 #include "core/variant/typed_array.h"
 #include "core/variant/typed_array.h"
 
 
-InputMap *InputMap::singleton = nullptr;
-
-int InputMap::ALL_DEVICES = -1;
-
 void InputMap::_bind_methods() {
 void InputMap::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("has_action", "action"), &InputMap::has_action);
 	ClassDB::bind_method(D_METHOD("has_action", "action"), &InputMap::has_action);
 	ClassDB::bind_method(D_METHOD("get_actions"), &InputMap::_get_actions);
 	ClassDB::bind_method(D_METHOD("get_actions"), &InputMap::_get_actions);

+ 2 - 2
core/input/input_map.h

@@ -45,7 +45,7 @@ public:
 	/**
 	/**
 	 * A special value used to signify that a given Action can be triggered by any device
 	 * A special value used to signify that a given Action can be triggered by any device
 	 */
 	 */
-	static int ALL_DEVICES;
+	static constexpr int ALL_DEVICES = -1;
 
 
 	struct Action {
 	struct Action {
 		int id;
 		int id;
@@ -58,7 +58,7 @@ public:
 	static constexpr float DEFAULT_TOGGLE_DEADZONE = 0.5f;
 	static constexpr float DEFAULT_TOGGLE_DEADZONE = 0.5f;
 
 
 private:
 private:
-	static InputMap *singleton;
+	static inline InputMap *singleton = nullptr;
 
 
 	mutable HashMap<StringName, Action> input_map;
 	mutable HashMap<StringName, Action> input_map;
 	HashMap<String, List<Ref<InputEvent>>> default_builtin_cache;
 	HashMap<String, List<Ref<InputEvent>>> default_builtin_cache;

+ 0 - 8
core/io/compression.cpp

@@ -35,7 +35,6 @@
 
 
 #include "thirdparty/misc/fastlz.h"
 #include "thirdparty/misc/fastlz.h"
 
 
-#include <zlib.h>
 #include <zstd.h>
 #include <zstd.h>
 
 
 #ifdef BROTLI_ENABLED
 #ifdef BROTLI_ENABLED
@@ -364,10 +363,3 @@ int Compression::decompress_dynamic(Vector<uint8_t> *p_dst_vect, int p_max_dst_s
 		return Z_OK;
 		return Z_OK;
 	}
 	}
 }
 }
-
-int Compression::zlib_level = Z_DEFAULT_COMPRESSION;
-int Compression::gzip_level = Z_DEFAULT_COMPRESSION;
-int Compression::zstd_level = 3;
-bool Compression::zstd_long_distance_matching = false;
-int Compression::zstd_window_log_size = 27; // ZSTD_WINDOWLOG_LIMIT_DEFAULT
-int Compression::gzip_chunk = 16384;

+ 8 - 6
core/io/compression.h

@@ -33,14 +33,16 @@
 #include "core/templates/vector.h"
 #include "core/templates/vector.h"
 #include "core/typedefs.h"
 #include "core/typedefs.h"
 
 
+#include <zlib.h>
+
 class Compression {
 class Compression {
 public:
 public:
-	static int zlib_level;
-	static int gzip_level;
-	static int zstd_level;
-	static bool zstd_long_distance_matching;
-	static int zstd_window_log_size;
-	static int gzip_chunk;
+	static inline int zlib_level = Z_DEFAULT_COMPRESSION;
+	static inline int gzip_level = Z_DEFAULT_COMPRESSION;
+	static inline int zstd_level = 3;
+	static inline bool zstd_long_distance_matching = false;
+	static inline int zstd_window_log_size = 27; // ZSTD_WINDOWLOG_LIMIT_DEFAULT
+	static inline int gzip_chunk = 16384;
 
 
 	enum Mode : int32_t {
 	enum Mode : int32_t {
 		MODE_FASTLZ,
 		MODE_FASTLZ,

+ 0 - 2
core/io/dir_access.cpp

@@ -36,8 +36,6 @@
 #include "core/os/time.h"
 #include "core/os/time.h"
 #include "core/templates/local_vector.h"
 #include "core/templates/local_vector.h"
 
 
-thread_local Error DirAccess::last_dir_open_error = OK;
-
 String DirAccess::_get_root_path() const {
 String DirAccess::_get_root_path() const {
 	switch (_access_type) {
 	switch (_access_type) {
 		case ACCESS_RESOURCES:
 		case ACCESS_RESOURCES:

+ 1 - 1
core/io/dir_access.h

@@ -56,7 +56,7 @@ private:
 	Error _copy_dir(Ref<DirAccess> &p_target_da, const String &p_to, int p_chmod_flags, bool p_copy_links);
 	Error _copy_dir(Ref<DirAccess> &p_target_da, const String &p_to, int p_chmod_flags, bool p_copy_links);
 	PackedStringArray _get_contents(bool p_directories);
 	PackedStringArray _get_contents(bool p_directories);
 
 
-	thread_local static Error last_dir_open_error;
+	static inline thread_local Error last_dir_open_error = OK;
 	bool include_navigational = false;
 	bool include_navigational = false;
 	bool include_hidden = false;
 	bool include_hidden = false;
 
 

+ 0 - 3
core/io/dtls_server.cpp

@@ -30,9 +30,6 @@
 
 
 #include "dtls_server.h"
 #include "dtls_server.h"
 
 
-DTLSServer *(*DTLSServer::_create)(bool p_notify_postinitialize) = nullptr;
-bool DTLSServer::available = false;
-
 DTLSServer *DTLSServer::create(bool p_notify_postinitialize) {
 DTLSServer *DTLSServer::create(bool p_notify_postinitialize) {
 	if (_create) {
 	if (_create) {
 		return _create(p_notify_postinitialize);
 		return _create(p_notify_postinitialize);

+ 2 - 2
core/io/dtls_server.h

@@ -37,10 +37,10 @@ class DTLSServer : public RefCounted {
 	GDCLASS(DTLSServer, RefCounted);
 	GDCLASS(DTLSServer, RefCounted);
 
 
 protected:
 protected:
-	static DTLSServer *(*_create)(bool p_notify_postinitialize);
+	static inline DTLSServer *(*_create)(bool p_notify_postinitialize) = nullptr;
 	static void _bind_methods();
 	static void _bind_methods();
 
 
-	static bool available;
+	static inline bool available = false;
 
 
 public:
 public:
 	static bool is_available();
 	static bool is_available();

+ 0 - 7
core/io/file_access.cpp

@@ -40,13 +40,6 @@
 #include "core/os/os.h"
 #include "core/os/os.h"
 #include "core/os/time.h"
 #include "core/os/time.h"
 
 
-FileAccess::CreateFunc FileAccess::create_func[ACCESS_MAX] = {};
-
-FileAccess::FileCloseFailNotify FileAccess::close_fail_notify = nullptr;
-
-bool FileAccess::backup_save = false;
-thread_local Error FileAccess::last_file_open_error = OK;
-
 Ref<FileAccess> FileAccess::create(AccessType p_access) {
 Ref<FileAccess> FileAccess::create(AccessType p_access) {
 	ERR_FAIL_INDEX_V(p_access, ACCESS_MAX, nullptr);
 	ERR_FAIL_INDEX_V(p_access, ACCESS_MAX, nullptr);
 	ERR_FAIL_NULL_V(create_func[p_access], nullptr);
 	ERR_FAIL_NULL_V(create_func[p_access], nullptr);

+ 4 - 4
core/io/file_access.h

@@ -112,7 +112,7 @@ protected:
 	virtual int64_t _get_size(const String &p_file) = 0;
 	virtual int64_t _get_size(const String &p_file) = 0;
 	virtual void _set_access_type(AccessType p_access);
 	virtual void _set_access_type(AccessType p_access);
 
 
-	static FileCloseFailNotify close_fail_notify;
+	static inline FileCloseFailNotify close_fail_notify = nullptr;
 
 
 #ifndef DISABLE_DEPRECATED
 #ifndef DISABLE_DEPRECATED
 	static Ref<FileAccess> _open_encrypted_bind_compat_98918(const String &p_path, ModeFlags p_mode_flags, const Vector<uint8_t> &p_key);
 	static Ref<FileAccess> _open_encrypted_bind_compat_98918(const String &p_path, ModeFlags p_mode_flags, const Vector<uint8_t> &p_key);
@@ -136,11 +136,11 @@ protected:
 #endif
 #endif
 
 
 private:
 private:
-	static bool backup_save;
-	thread_local static Error last_file_open_error;
+	static inline bool backup_save = false;
+	static inline thread_local Error last_file_open_error = OK;
 
 
 	AccessType _access_type = ACCESS_FILESYSTEM;
 	AccessType _access_type = ACCESS_FILESYSTEM;
-	static CreateFunc create_func[ACCESS_MAX]; /** default file access creation function for a platform */
+	static inline CreateFunc create_func[ACCESS_MAX]; /** default file access creation function for a platform */
 	template <typename T>
 	template <typename T>
 	static Ref<FileAccess> _create_builtin() {
 	static Ref<FileAccess> _create_builtin() {
 		return memnew(T);
 		return memnew(T);

+ 0 - 2
core/io/file_access_pack.cpp

@@ -158,8 +158,6 @@ void PackedData::clear() {
 	root = memnew(PackedDir);
 	root = memnew(PackedDir);
 }
 }
 
 
-PackedData *PackedData::singleton = nullptr;
-
 PackedData::PackedData() {
 PackedData::PackedData() {
 	singleton = this;
 	singleton = this;
 	root = memnew(PackedDir);
 	root = memnew(PackedDir);

+ 1 - 1
core/io/file_access_pack.h

@@ -102,7 +102,7 @@ private:
 
 
 	PackedDir *root = nullptr;
 	PackedDir *root = nullptr;
 
 
-	static PackedData *singleton;
+	static inline PackedData *singleton = nullptr;
 	bool disabled = false;
 	bool disabled = false;
 
 
 	void _free_packed_dirs(PackedDir *p_dir);
 	void _free_packed_dirs(PackedDir *p_dir);

+ 0 - 2
core/io/file_access_zip.cpp

@@ -34,8 +34,6 @@
 
 
 #include "core/io/file_access.h"
 #include "core/io/file_access.h"
 
 
-ZipArchive *ZipArchive::instance = nullptr;
-
 extern "C" {
 extern "C" {
 
 
 struct ZipData {
 struct ZipData {

+ 1 - 1
core/io/file_access_zip.h

@@ -53,7 +53,7 @@ private:
 
 
 	HashMap<String, File> files;
 	HashMap<String, File> files;
 
 
-	static ZipArchive *instance;
+	static inline ZipArchive *instance = nullptr;
 
 
 public:
 public:
 	void close_handle(unzFile p_file) const;
 	void close_handle(unzFile p_file) const;

+ 0 - 26
core/io/image.cpp

@@ -80,32 +80,6 @@ const char *Image::format_names[Image::FORMAT_MAX] = {
 	"ASTC_8x8_HDR",
 	"ASTC_8x8_HDR",
 };
 };
 
 
-// External saver function pointers.
-
-SavePNGFunc Image::save_png_func = nullptr;
-SaveJPGFunc Image::save_jpg_func = nullptr;
-SaveEXRFunc Image::save_exr_func = nullptr;
-SaveWebPFunc Image::save_webp_func = nullptr;
-SaveDDSFunc Image::save_dds_func = nullptr;
-
-SavePNGBufferFunc Image::save_png_buffer_func = nullptr;
-SaveJPGBufferFunc Image::save_jpg_buffer_func = nullptr;
-SaveEXRBufferFunc Image::save_exr_buffer_func = nullptr;
-SaveWebPBufferFunc Image::save_webp_buffer_func = nullptr;
-SaveDDSBufferFunc Image::save_dds_buffer_func = nullptr;
-
-// External loader function pointers.
-
-ImageMemLoadFunc Image::_png_mem_loader_func = nullptr;
-ImageMemLoadFunc Image::_png_mem_unpacker_func = nullptr;
-ImageMemLoadFunc Image::_jpg_mem_loader_func = nullptr;
-ImageMemLoadFunc Image::_webp_mem_loader_func = nullptr;
-ImageMemLoadFunc Image::_tga_mem_loader_func = nullptr;
-ImageMemLoadFunc Image::_bmp_mem_loader_func = nullptr;
-ScalableImageMemLoadFunc Image::_svg_scalable_mem_loader_func = nullptr;
-ImageMemLoadFunc Image::_ktx_mem_loader_func = nullptr;
-ImageMemLoadFunc Image::_dds_mem_loader_func = nullptr;
-
 // External VRAM compression function pointers.
 // External VRAM compression function pointers.
 
 
 void (*Image::_image_compress_bc_func)(Image *, Image::UsedChannels) = nullptr;
 void (*Image::_image_compress_bc_func)(Image *, Image::UsedChannels) = nullptr;

+ 19 - 19
core/io/image.h

@@ -184,28 +184,28 @@ public:
 
 
 	// External saver function pointers.
 	// External saver function pointers.
 
 
-	static SavePNGFunc save_png_func;
-	static SaveJPGFunc save_jpg_func;
-	static SaveEXRFunc save_exr_func;
-	static SaveWebPFunc save_webp_func;
-	static SaveDDSFunc save_dds_func;
-	static SavePNGBufferFunc save_png_buffer_func;
-	static SaveEXRBufferFunc save_exr_buffer_func;
-	static SaveJPGBufferFunc save_jpg_buffer_func;
-	static SaveWebPBufferFunc save_webp_buffer_func;
-	static SaveDDSBufferFunc save_dds_buffer_func;
+	static inline SavePNGFunc save_png_func = nullptr;
+	static inline SaveJPGFunc save_jpg_func = nullptr;
+	static inline SaveEXRFunc save_exr_func = nullptr;
+	static inline SaveWebPFunc save_webp_func = nullptr;
+	static inline SaveDDSFunc save_dds_func = nullptr;
+	static inline SavePNGBufferFunc save_png_buffer_func = nullptr;
+	static inline SaveEXRBufferFunc save_exr_buffer_func = nullptr;
+	static inline SaveJPGBufferFunc save_jpg_buffer_func = nullptr;
+	static inline SaveWebPBufferFunc save_webp_buffer_func = nullptr;
+	static inline SaveDDSBufferFunc save_dds_buffer_func = nullptr;
 
 
 	// External loader function pointers.
 	// External loader function pointers.
 
 
-	static ImageMemLoadFunc _png_mem_loader_func;
-	static ImageMemLoadFunc _png_mem_unpacker_func;
-	static ImageMemLoadFunc _jpg_mem_loader_func;
-	static ImageMemLoadFunc _webp_mem_loader_func;
-	static ImageMemLoadFunc _tga_mem_loader_func;
-	static ImageMemLoadFunc _bmp_mem_loader_func;
-	static ScalableImageMemLoadFunc _svg_scalable_mem_loader_func;
-	static ImageMemLoadFunc _ktx_mem_loader_func;
-	static ImageMemLoadFunc _dds_mem_loader_func;
+	static inline ImageMemLoadFunc _png_mem_loader_func = nullptr;
+	static inline ImageMemLoadFunc _png_mem_unpacker_func = nullptr;
+	static inline ImageMemLoadFunc _jpg_mem_loader_func = nullptr;
+	static inline ImageMemLoadFunc _webp_mem_loader_func = nullptr;
+	static inline ImageMemLoadFunc _tga_mem_loader_func = nullptr;
+	static inline ImageMemLoadFunc _bmp_mem_loader_func = nullptr;
+	static inline ScalableImageMemLoadFunc _svg_scalable_mem_loader_func = nullptr;
+	static inline ImageMemLoadFunc _ktx_mem_loader_func = nullptr;
+	static inline ImageMemLoadFunc _dds_mem_loader_func = nullptr;
 
 
 	// External VRAM compression function pointers.
 	// External VRAM compression function pointers.
 
 

+ 0 - 2
core/io/image_loader.cpp

@@ -124,8 +124,6 @@ Ref<ImageFormatLoader> ImageLoader::recognize(const String &p_extension) {
 	return nullptr;
 	return nullptr;
 }
 }
 
 
-Vector<Ref<ImageFormatLoader>> ImageLoader::loader;
-
 void ImageLoader::add_image_format_loader(Ref<ImageFormatLoader> p_loader) {
 void ImageLoader::add_image_format_loader(Ref<ImageFormatLoader> p_loader) {
 	loader.push_back(p_loader);
 	loader.push_back(p_loader);
 }
 }

+ 1 - 1
core/io/image_loader.h

@@ -85,7 +85,7 @@ public:
 };
 };
 
 
 class ImageLoader {
 class ImageLoader {
-	static Vector<Ref<ImageFormatLoader>> loader;
+	static inline Vector<Ref<ImageFormatLoader>> loader;
 	friend class ResourceFormatLoaderImage;
 	friend class ResourceFormatLoaderImage;
 
 
 protected:
 protected:

+ 0 - 2
core/io/ip.cpp

@@ -324,8 +324,6 @@ void IP::_bind_methods() {
 	BIND_ENUM_CONSTANT(TYPE_ANY);
 	BIND_ENUM_CONSTANT(TYPE_ANY);
 }
 }
 
 
-IP *IP::singleton = nullptr;
-
 IP *IP::get_singleton() {
 IP *IP::get_singleton() {
 	return singleton;
 	return singleton;
 }
 }

+ 1 - 1
core/io/ip.h

@@ -67,7 +67,7 @@ private:
 	_IP_ResolverPrivate *resolver = nullptr;
 	_IP_ResolverPrivate *resolver = nullptr;
 
 
 protected:
 protected:
-	static IP *singleton;
+	static inline IP *singleton = nullptr;
 	static void _bind_methods();
 	static void _bind_methods();
 
 
 	PackedStringArray _get_local_addresses() const;
 	PackedStringArray _get_local_addresses() const;

+ 0 - 2
core/io/logger.cpp

@@ -49,8 +49,6 @@ bool Logger::should_log(bool p_err) {
 	return (!p_err || CoreGlobals::print_error_enabled) && (p_err || CoreGlobals::print_line_enabled);
 	return (!p_err || CoreGlobals::print_error_enabled) && (p_err || CoreGlobals::print_line_enabled);
 }
 }
 
 
-bool Logger::_flush_stdout_on_print = true;
-
 void Logger::set_flush_stdout_on_print(bool value) {
 void Logger::set_flush_stdout_on_print(bool value) {
 	_flush_stdout_on_print = value;
 	_flush_stdout_on_print = value;
 }
 }

+ 1 - 1
core/io/logger.h

@@ -43,7 +43,7 @@ class Logger {
 protected:
 protected:
 	bool should_log(bool p_err);
 	bool should_log(bool p_err);
 
 
-	static bool _flush_stdout_on_print;
+	static inline bool _flush_stdout_on_print = true;
 
 
 public:
 public:
 	enum ErrorType {
 	enum ErrorType {

+ 0 - 3
core/io/packet_peer_dtls.cpp

@@ -30,9 +30,6 @@
 
 
 #include "packet_peer_dtls.h"
 #include "packet_peer_dtls.h"
 
 
-PacketPeerDTLS *(*PacketPeerDTLS::_create)(bool p_notify_postinitialize) = nullptr;
-bool PacketPeerDTLS::available = false;
-
 PacketPeerDTLS *PacketPeerDTLS::create(bool p_notify_postinitialize) {
 PacketPeerDTLS *PacketPeerDTLS::create(bool p_notify_postinitialize) {
 	if (_create) {
 	if (_create) {
 		return _create(p_notify_postinitialize);
 		return _create(p_notify_postinitialize);

+ 2 - 2
core/io/packet_peer_dtls.h

@@ -37,10 +37,10 @@ class PacketPeerDTLS : public PacketPeer {
 	GDCLASS(PacketPeerDTLS, PacketPeer);
 	GDCLASS(PacketPeerDTLS, PacketPeer);
 
 
 protected:
 protected:
-	static PacketPeerDTLS *(*_create)(bool p_notify_postinitialize);
+	static inline PacketPeerDTLS *(*_create)(bool p_notify_postinitialize) = nullptr;
 	static void _bind_methods();
 	static void _bind_methods();
 
 
-	static bool available;
+	static inline bool available = false;
 
 
 public:
 public:
 	enum Status {
 	enum Status {

+ 0 - 2
core/io/resource_format_binary.cpp

@@ -2506,8 +2506,6 @@ void ResourceFormatSaverBinary::get_recognized_extensions(const Ref<Resource> &p
 	}
 	}
 }
 }
 
 
-ResourceFormatSaverBinary *ResourceFormatSaverBinary::singleton = nullptr;
-
 ResourceFormatSaverBinary::ResourceFormatSaverBinary() {
 ResourceFormatSaverBinary::ResourceFormatSaverBinary() {
 	singleton = this;
 	singleton = this;
 }
 }

+ 1 - 1
core/io/resource_format_binary.h

@@ -180,7 +180,7 @@ public:
 
 
 class ResourceFormatSaverBinary : public ResourceFormatSaver {
 class ResourceFormatSaverBinary : public ResourceFormatSaver {
 public:
 public:
-	static ResourceFormatSaverBinary *singleton;
+	static inline ResourceFormatSaverBinary *singleton = nullptr;
 	virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
 	virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
 	virtual Error set_uid(const String &p_path, ResourceUID::ID p_uid) override;
 	virtual Error set_uid(const String &p_path, ResourceUID::ID p_uid) override;
 	virtual bool recognize(const Ref<Resource> &p_resource) const override;
 	virtual bool recognize(const Ref<Resource> &p_resource) const override;

+ 0 - 4
core/io/resource_importer.cpp

@@ -36,8 +36,6 @@
 #include "core/os/os.h"
 #include "core/os/os.h"
 #include "core/variant/variant_parser.h"
 #include "core/variant/variant_parser.h"
 
 
-ResourceFormatImporterLoadOnStartup ResourceImporter::load_on_startup = nullptr;
-
 bool ResourceFormatImporter::SortImporterByName::operator()(const Ref<ResourceImporter> &p_a, const Ref<ResourceImporter> &p_b) const {
 bool ResourceFormatImporter::SortImporterByName::operator()(const Ref<ResourceImporter> &p_a, const Ref<ResourceImporter> &p_b) const {
 	return p_a->get_importer_name() < p_b->get_importer_name();
 	return p_a->get_importer_name() < p_b->get_importer_name();
 }
 }
@@ -545,8 +543,6 @@ String ResourceFormatImporter::get_import_settings_hash() const {
 	return hash.md5_text();
 	return hash.md5_text();
 }
 }
 
 
-ResourceFormatImporter *ResourceFormatImporter::singleton = nullptr;
-
 ResourceFormatImporter::ResourceFormatImporter() {
 ResourceFormatImporter::ResourceFormatImporter() {
 	singleton = this;
 	singleton = this;
 }
 }

+ 2 - 2
core/io/resource_importer.h

@@ -50,7 +50,7 @@ class ResourceFormatImporter : public ResourceFormatLoader {
 
 
 	Error _get_path_and_type(const String &p_path, PathAndType &r_path_and_type, bool p_load, bool *r_valid = nullptr) const;
 	Error _get_path_and_type(const String &p_path, PathAndType &r_path_and_type, bool p_load, bool *r_valid = nullptr) const;
 
 
-	static ResourceFormatImporter *singleton;
+	static inline ResourceFormatImporter *singleton = nullptr;
 
 
 	//need them to stay in order to compute the settings hash
 	//need them to stay in order to compute the settings hash
 	struct SortImporterByName {
 	struct SortImporterByName {
@@ -109,7 +109,7 @@ protected:
 	static void _bind_methods();
 	static void _bind_methods();
 
 
 public:
 public:
-	static ResourceFormatImporterLoadOnStartup load_on_startup;
+	static inline ResourceFormatImporterLoadOnStartup load_on_startup = nullptr;
 
 
 	virtual String get_importer_name() const = 0;
 	virtual String get_importer_name() const = 0;
 	virtual String get_visible_name() const = 0;
 	virtual String get_visible_name() const = 0;

+ 0 - 10
editor/gui/editor_file_dialog.cpp

@@ -51,12 +51,6 @@
 #include "scene/gui/texture_rect.h"
 #include "scene/gui/texture_rect.h"
 #include "servers/display_server.h"
 #include "servers/display_server.h"
 
 
-EditorFileDialog::GetIconFunc EditorFileDialog::get_icon_func = nullptr;
-EditorFileDialog::GetIconFunc EditorFileDialog::get_thumbnail_func = nullptr;
-
-EditorFileDialog::RegisterFunc EditorFileDialog::register_func = nullptr;
-EditorFileDialog::RegisterFunc EditorFileDialog::unregister_func = nullptr;
-
 void EditorFileDialog::_native_popup() {
 void EditorFileDialog::_native_popup() {
 	// Show native dialog directly.
 	// Show native dialog directly.
 	String root;
 	String root;
@@ -1983,10 +1977,6 @@ void EditorFileDialog::_go_forward() {
 	dir_next->set_disabled(local_history_pos == local_history.size() - 1);
 	dir_next->set_disabled(local_history_pos == local_history.size() - 1);
 }
 }
 
 
-bool EditorFileDialog::default_show_hidden_files = false;
-
-EditorFileDialog::DisplayMode EditorFileDialog::default_display_mode = DISPLAY_THUMBNAILS;
-
 void EditorFileDialog::set_display_mode(DisplayMode p_mode) {
 void EditorFileDialog::set_display_mode(DisplayMode p_mode) {
 	if (display_mode == p_mode) {
 	if (display_mode == p_mode) {
 		return;
 		return;

+ 6 - 6
editor/gui/editor_file_dialog.h

@@ -72,10 +72,10 @@ public:
 	typedef Ref<Texture2D> (*GetIconFunc)(const String &);
 	typedef Ref<Texture2D> (*GetIconFunc)(const String &);
 	typedef void (*RegisterFunc)(EditorFileDialog *);
 	typedef void (*RegisterFunc)(EditorFileDialog *);
 
 
-	static GetIconFunc get_icon_func;
-	static GetIconFunc get_thumbnail_func;
-	static RegisterFunc register_func;
-	static RegisterFunc unregister_func;
+	static inline GetIconFunc get_icon_func = nullptr;
+	static inline GetIconFunc get_thumbnail_func = nullptr;
+	static inline RegisterFunc register_func = nullptr;
+	static inline RegisterFunc unregister_func = nullptr;
 
 
 private:
 private:
 	enum ItemMenu {
 	enum ItemMenu {
@@ -159,8 +159,8 @@ private:
 	int preview_wheel_index = 0;
 	int preview_wheel_index = 0;
 	float preview_wheel_timeout = 0.0f;
 	float preview_wheel_timeout = 0.0f;
 
 
-	static bool default_show_hidden_files;
-	static DisplayMode default_display_mode;
+	static inline bool default_show_hidden_files = false;
+	static inline DisplayMode default_display_mode = DISPLAY_THUMBNAILS;
 	bool show_hidden_files;
 	bool show_hidden_files;
 	DisplayMode display_mode;
 	DisplayMode display_mode;