diff --git a/core/config/engine.h b/core/config/engine.h index a0b1ffa98123..cf489a1785ad 100644 --- a/core/config/engine.h +++ b/core/config/engine.h @@ -34,7 +34,6 @@ #include "core/os/main_loop.h" #include "core/string/ustring.h" #include "core/templates/list.h" -#include "core/templates/vector.h" template class TypedArray; diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 562bde978e34..eedf23ece268 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -39,7 +39,6 @@ #include "core/io/marshalls.h" #include "core/io/resource_uid.h" #include "core/object/script_language.h" -#include "core/os/keyboard.h" #include "core/templates/rb_set.h" #include "core/variant/typed_array.h" #include "core/variant/variant_parser.h" diff --git a/core/io/ip_address.h b/core/io/ip_address.h index da7b0f77db1b..44c70643411e 100644 --- a/core/io/ip_address.h +++ b/core/io/ip_address.h @@ -41,8 +41,8 @@ struct IPAddress { uint32_t field32[4]; }; - bool valid; - bool wildcard; + bool valid = false; + bool wildcard = false; protected: void _parse_ipv6(const String &p_string); diff --git a/core/io/marshalls.h b/core/io/marshalls.h index 6f015ac386e3..1e29f7c25544 100644 --- a/core/io/marshalls.h +++ b/core/io/marshalls.h @@ -85,7 +85,7 @@ static inline unsigned int encode_uint32(uint32_t p_uint, uint8_t *p_arr) { } static inline unsigned int encode_float(float p_float, uint8_t *p_arr) { - MarshallFloat mf; + MarshallFloat mf{}; mf.f = p_float; encode_uint32(mf.i, p_arr); @@ -103,7 +103,7 @@ static inline unsigned int encode_uint64(uint64_t p_uint, uint8_t *p_arr) { } static inline unsigned int encode_double(double p_double, uint8_t *p_arr) { - MarshallDouble md; + MarshallDouble md{}; md.d = p_double; encode_uint64(md.l, p_arr); @@ -121,7 +121,7 @@ static inline unsigned int encode_uintr(uintr_t p_uint, uint8_t *p_arr) { } static inline unsigned int encode_real(real_t p_real, uint8_t *p_arr) { - MarshallReal mr; + MarshallReal mr{}; mr.r = p_real; encode_uintr(mr.i, p_arr); @@ -173,7 +173,7 @@ static inline uint32_t decode_uint32(const uint8_t *p_arr) { } static inline float decode_float(const uint8_t *p_arr) { - MarshallFloat mf; + MarshallFloat mf{}; mf.i = decode_uint32(p_arr); return mf.f; } @@ -192,7 +192,7 @@ static inline uint64_t decode_uint64(const uint8_t *p_arr) { } static inline double decode_double(const uint8_t *p_arr) { - MarshallDouble md; + MarshallDouble md{}; md.l = decode_uint64(p_arr); return md.d; } diff --git a/core/math/color.h b/core/math/color.h index 70fad78acbdd..0a3620da38eb 100644 --- a/core/math/color.h +++ b/core/math/color.h @@ -148,7 +148,7 @@ struct [[nodiscard]] Color { union { float f; int32_t i; - } R, G, B, E; + } R{ 0.0f }, G{ 0.0f }, B{ 0.0f }, E{ 0.0f }; E.f = MaxChannel; E.i += 0x07804000; // Add 15 to the exponent and 0x4000 to the mantissa diff --git a/core/object/callable_method_pointer.h b/core/object/callable_method_pointer.h index 86c66593bd3a..a41ac96d410c 100644 --- a/core/object/callable_method_pointer.h +++ b/core/object/callable_method_pointer.h @@ -41,8 +41,8 @@ class CallableCustomMethodPointerBase : public CallableCustom { uint32_t *comp_ptr = nullptr; - uint32_t comp_size; - uint32_t h; + uint32_t comp_size = 0U; + uint32_t h = 0U; #ifdef DEBUG_METHODS_ENABLED const char *text = ""; #endif diff --git a/core/object/message_queue.h b/core/object/message_queue.h index 673eb3845b55..64e244bda8b3 100644 --- a/core/object/message_queue.h +++ b/core/object/message_queue.h @@ -153,7 +153,7 @@ class CallQueue { bool is_flushing() const; int get_max_buffer_usage() const; - CallQueue(Allocator *p_custom_allocator = 0, uint32_t p_max_pages = 8192, const String &p_error_text = String()); + CallQueue(Allocator *p_custom_allocator = nullptr, uint32_t p_max_pages = 8192, const String &p_error_text = String()); virtual ~CallQueue(); }; diff --git a/core/templates/hashfuncs.h b/core/templates/hashfuncs.h index 21eef10297ab..292151d1b6c8 100644 --- a/core/templates/hashfuncs.h +++ b/core/templates/hashfuncs.h @@ -130,7 +130,7 @@ static _FORCE_INLINE_ uint32_t hash_murmur3_one_float(float p_in, uint32_t p_see union { float f; uint32_t i; - } u; + } u = { 0.0f }; // Normalize +/- 0.0 and NaN values so they hash the same. if (p_in == 0.0f) { @@ -153,7 +153,7 @@ static _FORCE_INLINE_ uint32_t hash_murmur3_one_double(double p_in, uint32_t p_s union { double d; uint64_t i; - } u; + } u = { 0.0 }; // Normalize +/- 0.0 and NaN values so they hash the same. if (p_in == 0.0f) { @@ -241,7 +241,7 @@ static _FORCE_INLINE_ uint32_t hash_djb2_one_float(double p_in, uint32_t p_prev union { double d; uint64_t i; - } u; + } u = { 0.0 }; // Normalize +/- 0.0 and NaN values so they hash the same. if (p_in == 0.0f) { @@ -270,7 +270,7 @@ static _FORCE_INLINE_ uint64_t hash_djb2_one_float_64(double p_in, uint64_t p_pr union { double d; uint64_t i; - } u; + } u = { 0.0 }; // Normalize +/- 0.0 and NaN values so they hash the same. if (p_in == 0.0f) { diff --git a/core/templates/safe_refcount.h b/core/templates/safe_refcount.h index 16b605eaffbb..120f376e7374 100644 --- a/core/templates/safe_refcount.h +++ b/core/templates/safe_refcount.h @@ -152,7 +152,7 @@ class SafeNumeric { }; class SafeFlag { - std::atomic_bool flag; + std::atomic_bool flag = false; static_assert(std::atomic_bool::is_always_lock_free); diff --git a/core/variant/variant.h b/core/variant/variant.h index c76b849abdb7..3f7f721409a5 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -814,8 +814,7 @@ class Variant { static void unregister_types(); Variant(const Variant &p_variant); - _FORCE_INLINE_ Variant() : - type(NIL) {} + _FORCE_INLINE_ Variant() {} _FORCE_INLINE_ ~Variant() { clear(); }