Browse Source

Merge pull request #22516 from akien-mga/fix-warnings

Fix warnings about wrong member initialization order [-Wreorder]
Rémi Verschelde 7 years ago
parent
commit
40c3c8745d

+ 1 - 1
core/object.cpp

@@ -277,8 +277,8 @@ MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyIn
 
 MethodInfo::MethodInfo(const PropertyInfo &p_ret, const String &p_name) :
 		name(p_name),
-		flags(METHOD_FLAG_NORMAL),
 		return_val(p_ret),
+		flags(METHOD_FLAG_NORMAL),
 		id(0) {
 }
 

+ 2 - 2
core/object.h

@@ -187,11 +187,11 @@ Array convert_property_list(const List<PropertyInfo> *p_list);
 struct MethodInfo {
 
 	String name;
-	List<PropertyInfo> arguments;
-	Vector<Variant> default_arguments;
 	PropertyInfo return_val;
 	uint32_t flags;
 	int id;
+	List<PropertyInfo> arguments;
+	Vector<Variant> default_arguments;
 
 	inline bool operator==(const MethodInfo &p_method) const { return id == p_method.id; }
 	inline bool operator<(const MethodInfo &p_method) const { return id == p_method.id ? (name < p_method.name) : (id < p_method.id); }

+ 3 - 3
core/script_debugger_remote.cpp

@@ -1094,12 +1094,12 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() :
 		performance(Engine::get_singleton()->get_singleton_object("Performance")),
 		requested_quit(false),
 		mutex(Mutex::create()),
-		max_cps(GLOBAL_GET("network/limits/debugger_stdout/max_chars_per_second")),
 		max_messages_per_frame(GLOBAL_GET("network/limits/debugger_stdout/max_messages_per_frame")),
-		max_errors_per_frame(GLOBAL_GET("network/limits/debugger_stdout/max_errors_per_frame")),
-		char_count(0),
 		n_messages_dropped(0),
+		max_errors_per_frame(GLOBAL_GET("network/limits/debugger_stdout/max_errors_per_frame")),
 		n_errors_dropped(0),
+		max_cps(GLOBAL_GET("network/limits/debugger_stdout/max_chars_per_second")),
+		char_count(0),
 		last_msec(0),
 		msec_count(0),
 		allow_focus_steal_pid(0),

+ 2 - 2
modules/bullet/area_bullet.cpp

@@ -46,7 +46,6 @@
 AreaBullet::AreaBullet() :
 		RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_AREA),
 		monitorable(true),
-		isScratched(false),
 		spOv_mode(PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED),
 		spOv_gravityPoint(false),
 		spOv_gravityPointDistanceScale(0),
@@ -55,7 +54,8 @@ AreaBullet::AreaBullet() :
 		spOv_gravityMag(10),
 		spOv_linearDump(0.1),
 		spOv_angularDump(1),
-		spOv_priority(0) {
+		spOv_priority(0),
+		isScratched(false) {
 
 	btGhost = bulletnew(btGhostObject);
 	btGhost->setCollisionShape(BulletPhysicsServer::get_empty_shape());

+ 2 - 2
modules/bullet/collision_object_bullet.cpp

@@ -66,13 +66,13 @@ void CollisionObjectBullet::ShapeWrapper::claim_bt_shape(const btVector3 &body_s
 
 CollisionObjectBullet::CollisionObjectBullet(Type p_type) :
 		RIDBullet(),
-		space(NULL),
 		type(p_type),
 		collisionsEnabled(true),
 		m_isStatic(false),
 		bt_collision_object(NULL),
 		body_scale(1., 1., 1.),
-		force_shape_reset(false) {}
+		force_shape_reset(false),
+		space(NULL) {}
 
 CollisionObjectBullet::~CollisionObjectBullet() {
 	// Remove all overlapping, notify is not required since godot take care of it

+ 1 - 1
modules/bullet/godot_ray_world_algorithm.cpp

@@ -49,9 +49,9 @@ GodotRayWorldAlgorithm::SwappedCreateFunc::SwappedCreateFunc(const btDiscreteDyn
 
 GodotRayWorldAlgorithm::GodotRayWorldAlgorithm(const btDiscreteDynamicsWorld *world, btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped) :
 		btActivatingCollisionAlgorithm(ci, body0Wrap, body1Wrap),
+		m_world(world),
 		m_manifoldPtr(mf),
 		m_ownManifold(false),
-		m_world(world),
 		m_isSwapped(isSwapped) {}
 
 GodotRayWorldAlgorithm::~GodotRayWorldAlgorithm() {

+ 8 - 7
modules/bullet/godot_result_callbacks.h

@@ -87,13 +87,13 @@ struct GodotAllConvexResultCallback : public btCollisionWorld::ConvexResultCallb
 public:
 	PhysicsDirectSpaceState::ShapeResult *m_results;
 	int m_resultMax;
-	int count;
 	const Set<RID> *m_exclude;
+	int count;
 
 	GodotAllConvexResultCallback(PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude) :
 			m_results(p_results),
-			m_exclude(p_exclude),
 			m_resultMax(p_resultMax),
+			m_exclude(p_exclude),
 			count(0) {}
 
 	virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
@@ -125,6 +125,7 @@ public:
 	GodotClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
 			btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld),
 			m_exclude(p_exclude),
+			m_shapeId(0),
 			collide_with_bodies(p_collide_with_bodies),
 			collide_with_areas(p_collide_with_areas) {}
 
@@ -138,8 +139,8 @@ public:
 	const btCollisionObject *m_self_object;
 	PhysicsDirectSpaceState::ShapeResult *m_results;
 	int m_resultMax;
-	int m_count;
 	const Set<RID> *m_exclude;
+	int m_count;
 
 	bool collide_with_bodies;
 	bool collide_with_areas;
@@ -147,8 +148,8 @@ public:
 	GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
 			m_self_object(p_self_object),
 			m_results(p_results),
-			m_exclude(p_exclude),
 			m_resultMax(p_resultMax),
+			m_exclude(p_exclude),
 			m_count(0),
 			collide_with_bodies(p_collide_with_bodies),
 			collide_with_areas(p_collide_with_areas) {}
@@ -164,8 +165,8 @@ public:
 	const btCollisionObject *m_self_object;
 	Vector3 *m_results;
 	int m_resultMax;
-	int m_count;
 	const Set<RID> *m_exclude;
+	int m_count;
 
 	bool collide_with_bodies;
 	bool collide_with_areas;
@@ -173,8 +174,8 @@ public:
 	GodotContactPairContactResultCallback(btCollisionObject *p_self_object, Vector3 *p_results, int p_resultMax, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
 			m_self_object(p_self_object),
 			m_results(p_results),
-			m_exclude(p_exclude),
 			m_resultMax(p_resultMax),
+			m_exclude(p_exclude),
 			m_count(0),
 			collide_with_bodies(p_collide_with_bodies),
 			collide_with_areas(p_collide_with_areas) {}
@@ -188,11 +189,11 @@ struct GodotRestInfoContactResultCallback : public btCollisionWorld::ContactResu
 public:
 	const btCollisionObject *m_self_object;
 	PhysicsDirectSpaceState::ShapeRestInfo *m_result;
+	const Set<RID> *m_exclude;
 	bool m_collided;
 	real_t m_min_distance;
 	const btCollisionObject *m_rest_info_collision_object;
 	btVector3 m_rest_info_bt_point;
-	const Set<RID> *m_exclude;
 	bool collide_with_bodies;
 	bool collide_with_areas;
 

+ 5 - 5
modules/bullet/rigid_body_bullet.cpp

@@ -259,21 +259,21 @@ RigidBodyBullet::RigidBodyBullet() :
 		RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_RIGID_BODY),
 		kinematic_utilities(NULL),
 		locked_axis(0),
-		gravity_scale(1),
 		mass(1),
+		gravity_scale(1),
 		linearDamp(0),
 		angularDamp(0),
 		can_sleep(true),
 		omit_forces_integration(false),
-		force_integration_callback(NULL),
-		isTransformChanged(false),
-		previousActiveState(true),
 		maxCollisionsDetection(0),
 		collisionsCount(0),
 		maxAreasWhereIam(10),
 		areaWhereIamCount(0),
 		countGravityPointSpaces(0),
-		isScratchedSpaceOverrideModificator(false) {
+		isScratchedSpaceOverrideModificator(false),
+		isTransformChanged(false),
+		previousActiveState(true),
+		force_integration_callback(NULL) {
 
 	godotMotionState = bulletnew(GodotMotionState(this));
 

+ 4 - 4
modules/bullet/soft_body_bullet.cpp

@@ -37,17 +37,17 @@
 
 SoftBodyBullet::SoftBodyBullet() :
 		CollisionObjectBullet(CollisionObjectBullet::TYPE_SOFT_BODY),
-		total_mass(1),
+		bt_soft_body(NULL),
+		isScratched(false),
 		simulation_precision(5),
+		total_mass(1.),
 		linear_stiffness(0.5),
 		areaAngular_stiffness(0.5),
 		volume_stiffness(0.5),
 		pressure_coefficient(0.),
 		pose_matching_coefficient(0.),
 		damping_coefficient(0.01),
-		drag_coefficient(0.),
-		bt_soft_body(NULL),
-		isScratched(false) {}
+		drag_coefficient(0.) {}
 
 SoftBodyBullet::~SoftBodyBullet() {
 }

+ 3 - 2
modules/bullet/space_bullet.cpp

@@ -332,16 +332,17 @@ Vector3 BulletPhysicsDirectSpaceState::get_closest_point_to_object_volume(RID p_
 
 SpaceBullet::SpaceBullet() :
 		broadphase(NULL),
+		collisionConfiguration(NULL),
 		dispatcher(NULL),
 		solver(NULL),
-		collisionConfiguration(NULL),
 		dynamicsWorld(NULL),
 		soft_body_world_info(NULL),
 		ghostPairCallback(NULL),
 		godotFilterCallback(NULL),
 		gravityDirection(0, -1, 0),
 		gravityMagnitude(10),
-		contactDebugCount(0) {
+		contactDebugCount(0),
+		delta_time(0.) {
 
 	create_empty_world(GLOBAL_DEF("physics/3d/active_soft_world", true));
 	direct_access = memnew(BulletPhysicsDirectSpaceState(this));

+ 1 - 1
modules/bullet/space_bullet.h

@@ -96,9 +96,9 @@ class SpaceBullet : public RIDBullet {
 	btCollisionDispatcher *dispatcher;
 	btConstraintSolver *solver;
 	btDiscreteDynamicsWorld *dynamicsWorld;
+	btSoftBodyWorldInfo *soft_body_world_info;
 	btGhostPairCallback *ghostPairCallback;
 	GodotFilterCallback *godotFilterCallback;
-	btSoftBodyWorldInfo *soft_body_world_info;
 
 	btGjkEpaPenetrationDepthSolver *gjk_epa_pen_solver;
 	btVoronoiSimplexSolver *gjk_simplex_solver;

+ 2 - 2
modules/gdnative/nativescript/nativescript.h

@@ -70,8 +70,6 @@ struct NativeScriptDesc {
 		String documentation;
 	};
 
-	String documentation;
-
 	Map<StringName, Method> methods;
 	OrderedHashMap<StringName, Property> properties;
 	Map<StringName, Signal> signals_; // QtCreator doesn't like the name signals
@@ -81,6 +79,8 @@ struct NativeScriptDesc {
 	godot_instance_create_func create_func;
 	godot_instance_destroy_func destroy_func;
 
+	String documentation;
+
 	const void *type_tag;
 
 	bool is_tool;

+ 2 - 2
modules/gdscript/gdscript.h

@@ -301,8 +301,8 @@ struct GDScriptWarning {
 	static Code get_code_from_name(const String &p_name);
 
 	GDScriptWarning() :
-			line(-1),
-			code(WARNING_MAX) {}
+			code(WARNING_MAX),
+			line(-1) {}
 };
 #endif // DEBUG_ENABLED
 

+ 2 - 2
scene/3d/physics_body.cpp

@@ -2509,12 +2509,12 @@ PhysicalBone::PhysicalBone() :
 		gizmo_move_joint(false),
 #endif
 		joint_data(NULL),
+		parent_skeleton(NULL),
 		static_body(false),
-		simulate_physics(false),
 		_internal_static_body(false),
+		simulate_physics(false),
 		_internal_simulate_physics(false),
 		bone_id(-1),
-		parent_skeleton(NULL),
 		bone_name(""),
 		bounce(0),
 		mass(1),

+ 2 - 1
scene/3d/spring_arm.cpp

@@ -36,8 +36,9 @@
 
 SpringArm::SpringArm() :
 		spring_length(1),
-		mask(1),
 		current_spring_length(0),
+		keep_child_basis(false),
+		mask(1),
 		margin(0.01) {}
 
 void SpringArm::_notification(int p_what) {

+ 1 - 1
scene/3d/spring_arm.h

@@ -39,8 +39,8 @@ class SpringArm : public Spatial {
 	Ref<Shape> shape;
 	Set<RID> excluded_objects;
 	float spring_length;
-	bool keep_child_basis;
 	float current_spring_length;
+	bool keep_child_basis;
 	uint32_t mask;
 	float margin;
 

+ 2 - 2
scene/animation/skeleton_ik.cpp

@@ -418,11 +418,11 @@ void SkeletonIK::_notification(int p_what) {
 SkeletonIK::SkeletonIK() :
 		Node(),
 		interpolation(1),
-		skeleton(NULL),
-		target_node_override(NULL),
 		use_magnet(false),
 		min_distance(0.01),
 		max_iterations(10),
+		skeleton(NULL),
+		target_node_override(NULL),
 		task(NULL) {
 
 	set_process_priority(1);

+ 4 - 5
scene/resources/tile_set.h

@@ -80,8 +80,8 @@ public:
 
 	struct AutotileData {
 		BitmaskMode bitmask_mode;
-		int spacing;
 		Size2 size;
+		int spacing;
 		Vector2 icon_coord;
 		Map<Vector2, uint16_t> flags;
 		Map<Vector2, Ref<OccluderPolygon2D> > occluder_map;
@@ -90,11 +90,10 @@ public:
 
 		// Default size to prevent invalid value
 		explicit AutotileData() :
+				bitmask_mode(BITMASK_2X2),
 				size(64, 64),
 				spacing(0),
-				icon_coord(0, 0) {
-			bitmask_mode = BITMASK_2X2;
-		}
+				icon_coord(0, 0) {}
 	};
 
 private:
@@ -111,8 +110,8 @@ private:
 		Vector2 navigation_polygon_offset;
 		Ref<NavigationPolygon> navigation_polygon;
 		Ref<ShaderMaterial> material;
-		Color modulate;
 		TileMode tile_mode;
+		Color modulate;
 		AutotileData autotile_data;
 		int z_index;
 

+ 2 - 2
servers/physics/body_sw.cpp

@@ -755,10 +755,10 @@ void BodySW::set_kinematic_margin(real_t p_margin) {
 
 BodySW::BodySW() :
 		CollisionObjectSW(TYPE_BODY),
+		locked_axis(0),
 		active_list(this),
 		inertia_update_list(this),
-		direct_state_query_list(this),
-		locked_axis(0) {
+		direct_state_query_list(this) {
 
 	mode = PhysicsServer::BODY_MODE_RIGID;
 	active = true;