From 1f6f364a56319eabd02c050746fe7df3f55ffee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 12 May 2020 17:01:17 +0200 Subject: Port member initialization from constructor to declaration (C++11) Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists. --- modules/gdnative/nativescript/nativescript.h | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'modules/gdnative/nativescript/nativescript.h') diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index 7e7598e06c..d24b247e59 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -43,6 +43,7 @@ #include "scene/main/node.h" #include "modules/gdnative/gdnative.h" + #include struct NativeScriptDesc { @@ -54,6 +55,7 @@ struct NativeScriptDesc { uint16_t rpc_method_id; String documentation; }; + struct Property { godot_property_set_func setter; godot_property_get_func getter; @@ -69,9 +71,9 @@ struct NativeScriptDesc { String documentation; }; - uint16_t rpc_count; + uint16_t rpc_count = 0; Map methods; - uint16_t rset_count; + uint16_t rset_count = 0; OrderedHashMap properties; Map signals_; // QtCreator doesn't like the name signals StringName base; @@ -82,20 +84,11 @@ struct NativeScriptDesc { String documentation; - const void *type_tag; + const void *type_tag = nullptr; bool is_tool; - inline NativeScriptDesc() : - rpc_count(0), - methods(), - rset_count(0), - properties(), - signals_(), - base(), - base_native_type(), - documentation(), - type_tag(nullptr) { + inline NativeScriptDesc() { zeromem(&create_func, sizeof(godot_instance_create_func)); zeromem(&destroy_func, sizeof(godot_instance_destroy_func)); } @@ -396,14 +389,13 @@ inline NativeScriptDesc *NativeScript::get_script_desc() const { class NativeReloadNode : public Node { GDCLASS(NativeReloadNode, Node); - bool unloaded; + bool unloaded = false; public: static void _bind_methods(); void _notification(int p_what); - NativeReloadNode() : - unloaded(false) {} + NativeReloadNode() {} }; class ResourceFormatLoaderNativeScript : public ResourceFormatLoader { -- cgit v1.2.3