diff --git a/core/config/engine.h b/core/config/engine.h index a0b1ffa9812..cf489a1785a 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 562bde978e3..eedf23ece26 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 da7b0f77db1..44c70643411 100644 --- a/core/io/ip_address.h +++ b/core/io/ip_address.h @@ -41,8 +41,8 @@ private: 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 6f015ac386e..1e29f7c2554 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 70fad78acbd..8229942981a 100644 --- a/core/math/color.h +++ b/core/math/color.h @@ -146,7 +146,7 @@ struct [[nodiscard]] Color { // bit and the first 8 mantissa bits to be shifted down to the low 9 bits // of the mantissa, rounding the truncated bits. union { - float f; + float f = 0.0f; int32_t i; } R, G, B, E; diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 1afc5f4bbbd..54849c19fe7 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -136,7 +136,7 @@ public: union { uint64_t u; double f; - } ieee754; + } ieee754 = {}; ieee754.f = p_val; // (unsigned)(0x7ff0000000000001 >> 32) : 0x7ff00000 return ((((unsigned)(ieee754.u >> 32) & 0x7fffffff) + ((unsigned)ieee754.u != 0)) > 0x7ff00000); @@ -152,7 +152,7 @@ public: union { uint32_t u; float f; - } ieee754; + } ieee754 = {}; ieee754.f = p_val; // ----------------------------------- // (single-precision floating-point) @@ -176,7 +176,7 @@ public: union { uint64_t u; double f; - } ieee754; + } ieee754 = {}; ieee754.f = p_val; return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) == 0x7ff00000 && ((unsigned)ieee754.u == 0); @@ -193,7 +193,7 @@ public: union { uint32_t u; float f; - } ieee754; + } ieee754 = {}; ieee754.f = p_val; return (ieee754.u & 0x7fffffff) == 0x7f800000; #else @@ -624,7 +624,7 @@ public: union { float f; uint32_t i; - } u; + } u = {}; u.f = g; u.i &= 2147483647u; @@ -635,7 +635,7 @@ public: union { double d; uint64_t i; - } u; + } u = {}; u.d = g; u.i &= (uint64_t)9223372036854775807ll; return u.d; @@ -682,7 +682,7 @@ public: union { uint32_t u32; float f32; - } u; + } u = {}; u.u32 = halfbits_to_floatbits(*h); return u.f32; @@ -696,7 +696,7 @@ public: union { float fv; uint32_t ui; - } ci; + } ci = {}; ci.fv = f; uint32_t x = ci.ui; diff --git a/core/object/callable_method_pointer.h b/core/object/callable_method_pointer.h index 86c66593bd3..a41ac96d410 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 673eb3845b5..64e244bda8b 100644 --- a/core/object/message_queue.h +++ b/core/object/message_queue.h @@ -153,7 +153,7 @@ public: 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 21eef10297a..b658cb946a5 100644 --- a/core/templates/hashfuncs.h +++ b/core/templates/hashfuncs.h @@ -128,7 +128,7 @@ static _FORCE_INLINE_ uint32_t hash_murmur3_one_32(uint32_t p_in, uint32_t p_see static _FORCE_INLINE_ uint32_t hash_murmur3_one_float(float p_in, uint32_t p_seed = HASH_MURMUR3_SEED) { union { - float f; + float f = { 0.0f }; uint32_t i; } u; @@ -151,7 +151,7 @@ static _FORCE_INLINE_ uint32_t hash_murmur3_one_64(uint64_t p_in, uint32_t p_see static _FORCE_INLINE_ uint32_t hash_murmur3_one_double(double p_in, uint32_t p_seed = HASH_MURMUR3_SEED) { union { - double d; + double d = { 0.0 }; uint64_t i; } u; @@ -239,7 +239,7 @@ static _FORCE_INLINE_ uint32_t hash_murmur3_buffer(const void *key, int length, static _FORCE_INLINE_ uint32_t hash_djb2_one_float(double p_in, uint32_t p_prev = 5381) { union { - double d; + double d = { 0.0 }; uint64_t i; } u; @@ -268,7 +268,7 @@ static _FORCE_INLINE_ uint32_t hash_make_uint32_t(T p_in) { static _FORCE_INLINE_ uint64_t hash_djb2_one_float_64(double p_in, uint64_t p_prev = 5381) { union { - double d; + double d = { 0.0 }; uint64_t i; } u; diff --git a/core/templates/safe_refcount.h b/core/templates/safe_refcount.h index 16b605eaffb..120f376e737 100644 --- a/core/templates/safe_refcount.h +++ b/core/templates/safe_refcount.h @@ -152,7 +152,7 @@ public: }; 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 c76b849abdb..3f7f721409a 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -814,8 +814,7 @@ public: static void unregister_types(); Variant(const Variant &p_variant); - _FORCE_INLINE_ Variant() : - type(NIL) {} + _FORCE_INLINE_ Variant() {} _FORCE_INLINE_ ~Variant() { clear(); }