View Issue Details

IDProjectCategoryView StatusLast Update
0002540FSSCPBuild systempublic2012-01-22 09:19
ReporterGoober5000 Assigned ToEchelon9  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Target Version3.6.14 
Summary0002540: Compile warnings in jump_nodes refactor
DescriptionCompiling the code leads to the following warnings:

1>c:\program files\microsoft visual studio 8\vc\include\list(42) : warning C4510: 'std::_List_nod<_Ty,_Alloc>::_Node' : default constructor could not be generated
1> with
1> [
1> _Ty=jump_node,
1> _Alloc=SCP_vm_allocator<jump_node>
1> ]
1> c:\program files\microsoft visual studio 8\vc\include\list(38) : see declaration of 'std::_List_nod<_Ty,_Alloc>::_Node'
1> with
1> [
1> _Ty=jump_node,
1> _Alloc=SCP_vm_allocator<jump_node>
1> ]
1> c:\program files\microsoft visual studio 8\vc\include\list(111) : see reference to class template instantiation 'std::_List_nod<_Ty,_Alloc>::_Node' being compiled
1> with
1> [
1> _Ty=jump_node,
1> _Alloc=SCP_vm_allocator<jump_node>
1> ]
1> c:\program files\microsoft visual studio 8\vc\include\list(110) : while compiling class template member function 'std::_List_nod<_Ty,_Alloc>::_Node *&std::list<_Ty,_Ax>::_Nextnode(std::_List_nod<_Ty,_Alloc>::_Node *)'
1> with
1> [
1> _Ty=jump_node,
1> _Alloc=SCP_vm_allocator<jump_node>,
1> _Ax=SCP_vm_allocator<jump_node>
1> ]
1> c:\my documents\visual studio projects\visual c++\fs2_open-stable\code\globalincs\vmallocator.h(95) : see reference to class template instantiation 'std::list<_Ty,_Ax>' being compiled
1> with
1> [
1> _Ty=jump_node,
1> _Ax=SCP_vm_allocator<jump_node>
1> ]
1> c:\my documents\visual studio projects\visual c++\fs2_open-stable\code\jumpnode\jumpnode.h(65) : see reference to class template instantiation 'SCP_list<T>' being compiled
1> with
1> [
1> T=jump_node
1> ]
1>c:\program files\microsoft visual studio 8\vc\include\list(42) : warning C4610: struct 'std::_List_nod<_Ty,_Alloc>::_Node' can never be instantiated - user defined constructor required
1> with
1> [
1> _Ty=jump_node,
1> _Alloc=SCP_vm_allocator<jump_node>
1> ]
TagsNo tags attached.

Relationships

related to 0002528 resolvedEchelon9 Jump Nodes in FRED and set-jumpnode-sexp 
related to 0002523 resolvedEchelon9 FRED not handling jump nodes correctly 

Activities

The_E

2011-11-13 11:52

administrator   ~0012961

Here's a thought: Why care? Who (apart from you, Goober) is actually using that version of MSVC? Why should we try to maintain 5 different projects for MSVC, when only 4, or rather 3 (2008, 2010 and 2011) are actually in widespread use?

Goober5000

2011-11-15 02:10

administrator   ~0012963

This is a build warning issue, not an IDE support issue. You should know that there were four separate issues in recent commits that prevented compilation on MSVC 2005 or MSVC 6. I've already fixed one and I intend to fix the other two shortly. This one is the only one I've posted on Mantis.

This issue is specifically pertinent to the code itself. Zacam told me that the very same warnings appeared on builds compiled with MSVC 2008, until recently. Apparently, the fix that solved the issue on MSVC 2008 wasn't a complete solution, because the warning still persists.

Note also that this is the only warning associated with STL collections in the entire workspace. So there is some peculiarity associated with the jump_nodes refactor that didn't affect any single one of the other STL refactors in the codebase.

Echelon9

2011-11-19 06:20

developer   ~0012973

Possibly resolved as of r8012. Please check.

Goober5000

2011-11-20 17:36

administrator   ~0012984

It's still present.

Echelon9

2012-01-22 08:44

developer  

jumpnodes-fix-2540-v2.patch (4,193 bytes)   
Index: code/jumpnode/jumpnode.cpp
===================================================================
--- code/jumpnode/jumpnode.cpp	(revision 8302)
+++ code/jumpnode/jumpnode.cpp	(working copy)
@@ -18,41 +18,60 @@
 SCP_list<jump_node> Jump_nodes;
 
 /**
- * Constructor for jump_node object
+ * Constructor for jump_node object, default
  */
-jump_node::jump_node(vec3d *pos)
+jump_node::jump_node() : m_radius(0.0f), m_modelnum(-1), m_objnum(-1), m_flags(0)
 {	
-	Assert(pos != NULL);
+    gr_init_alphacolor(&m_display_color, 0, 255, 0, 255);
+
+	m_name[0] = '\0';
 	
-	this->m_radius = 0.0f;
-	this->m_modelnum = -1;
-	this->m_objnum = -1;
-	this->m_flags = 0;
-	gr_init_alphacolor(&this->m_display_color, 0, 255, 0, 255);
+    pos.xyz.x = 0.0f;
+	pos.xyz.y = 0.0f;
+	pos.xyz.z = 0.0f;
+}
+
+/**
+ * Constructor for jump_node object, with world position argument
+ */
+jump_node::jump_node(vec3d *position) : m_radius(0.0f), m_modelnum(-1), m_objnum(-1), m_flags(0)
+{	
+	Assert(position != NULL);
 	
-	// Set name
-	sprintf(this->m_name, XSTR( "Jump Node %d", 632), Jump_nodes.size());
+	gr_init_alphacolor(&m_display_color, 0, 255, 0, 255);
 	
-	// Set model
-	this->m_modelnum = model_load(NOX("subspacenode.pof"), 0, NULL, 0);
-	if (this->m_modelnum < 0)
-		Warning(LOCATION, "Could not load default model for %s", this->m_name);
+	// Set m_name
+	sprintf(m_name, XSTR( "Jump Node %d", 632), Jump_nodes.size());
+	
+	// Set m_modelnum and m_radius
+	m_modelnum = model_load(NOX("subspacenode.pof"), 0, NULL, 0);
+	if (m_modelnum == -1)
+		Warning(LOCATION, "Could not load default model for %s", m_name);
 	else
-		this->m_radius = model_get_radius(this->m_modelnum);
+		m_radius = model_get_radius(m_modelnum);
 	
+    pos.xyz.x = position->xyz.x;
+	pos.xyz.y = position->xyz.y;
+	pos.xyz.z = position->xyz.z;
+    
 	// Create the object
-	this->m_objnum = obj_create(OBJ_JUMP_NODE, -1, -1, NULL, pos, this->m_radius, OF_RENDERS);
+	m_objnum = obj_create(OBJ_JUMP_NODE, -1, -1, NULL, &pos, m_radius, OF_RENDERS);
 }
 
+/**
+ * Destructor for jump_node object
+ */
 jump_node::~jump_node()
 {
 	model_unload(m_modelnum);
 	obj_delete(m_objnum);
 }
 
-color jump_node::get_color()
+// Accessor functions for private variables
+
+char *jump_node::get_name_ptr()
 {
-	return m_display_color;
+	return m_name;
 }
 
 int jump_node::get_modelnum()
@@ -67,14 +86,10 @@
 
 object *jump_node::get_obj()
 {
-	return &Objects[m_objnum];
+	Assert(m_objnum != -1);
+    return &Objects[m_objnum];
 }
 
-char *jump_node::get_name_ptr()
-{
-	return m_name;
-}
-
 bool jump_node::is_hidden()
 {
 	if(m_flags & JN_HIDE)
@@ -93,6 +108,18 @@
 	return ((m_flags & JN_SPECIAL_MODEL) != 0);
 }
 
+color jump_node::get_color()
+{
+	return m_display_color;
+}
+
+vec3d *jump_node::get_pos()
+{
+	return &pos;
+}
+
+// Settor functions for private variables
+
 void jump_node::set_alphacolor(int r, int g, int b, int alpha)
 {
 	CLAMP(r, 0, 255);
@@ -141,7 +168,7 @@
 void jump_node::set_name(char *new_name)
 {
 	Assert(new_name != NULL);
-	
+	Assert(jumpnode_get_by_name(new_name) == NULL);
 	strcpy_s(m_name, new_name);
 }
 
@@ -172,6 +199,7 @@
 void jump_node::render(vec3d *pos, vec3d *view_pos)
 {
 	Assert(pos != NULL);
+    // Assert(view_pos != NULL);
 	
 	if(m_flags & JN_HIDE)
 		return;
Index: code/jumpnode/jumpnode.h
===================================================================
--- code/jumpnode/jumpnode.h	(revision 8302)
+++ code/jumpnode/jumpnode.h	(working copy)
@@ -28,6 +28,7 @@
 
 class jump_node
 {
+private:
 	char m_name[NAME_LENGTH];
 	float m_radius;
 
@@ -36,20 +37,25 @@
 
 	int m_flags;
 	color m_display_color;			// Color node will be shown in (Default:0/255/0/255)
+    vec3d pos;
 public:
-	//Construction
-	jump_node(vec3d *pos);
+	//Constructors
+    jump_node();
+	jump_node(vec3d *position);
+    
+    //Destructor
 	~jump_node();
 	
 	//Getting
-	color get_color();
+    char *get_name_ptr();
 	int get_modelnum();
 	int get_objnum();
 	object *get_obj();
-	char *get_name_ptr();
 	bool is_hidden();
 	bool is_colored();
 	bool is_special_model();
+    color get_color();
+    vec3d *get_pos();
 
 	//Setting
 	void set_alphacolor(int r, int g, int b, int alpha);
jumpnodes-fix-2540-v2.patch (4,193 bytes)   

Goober5000

2012-01-22 09:18

administrator   ~0013107

The new patch fixes it. Well done. :)

It looks like the LoopingSoundInfo class has exactly the same warnings. If you could fix that as well, it would be much appreciated.

Echelon9

2012-01-22 09:19

developer   ~0013108

Fix committed to trunk@8306.

Related Changesets

fs2open: trunk r8306

2012-01-22 04:19

Echelon9


Ported: N/A

Details Diff
Fix for Mantis 0002540 - confirmed by Goober to resolve the constructor warnings Affected Issues
0002540
mod - /trunk/fs2_open/code/jumpnode/jumpnode.h Diff File
mod - /trunk/fs2_open/code/jumpnode/jumpnode.cpp Diff File

Issue History

Date Modified Username Field Change
2011-11-13 06:31 Goober5000 New Issue
2011-11-13 06:31 Goober5000 Status new => assigned
2011-11-13 06:31 Goober5000 Assigned To => chief1983
2011-11-13 06:31 Goober5000 Assigned To chief1983 => Echelon9
2011-11-13 06:31 Goober5000 Relationship added related to 0002528
2011-11-13 06:32 Goober5000 Relationship added related to 0002523
2011-11-13 08:33 Zacam Target Version => 3.6.14
2011-11-13 11:52 The_E Note Added: 0012961
2011-11-15 02:10 Goober5000 Note Added: 0012963
2011-11-19 06:20 Echelon9 Note Added: 0012973
2011-11-19 06:20 Echelon9 Status assigned => feedback
2011-11-20 17:36 Goober5000 Note Added: 0012984
2012-01-22 08:44 Echelon9 File Added: jumpnodes-fix-2540-v2.patch
2012-01-22 09:18 Goober5000 Note Added: 0013107
2012-01-22 09:18 Goober5000 Status feedback => assigned
2012-01-22 09:19 Echelon9 Changeset attached => fs2open trunk r8306
2012-01-22 09:19 Echelon9 Note Added: 0013108
2012-01-22 09:19 Echelon9 Status assigned => resolved
2012-01-22 09:19 Echelon9 Resolution open => fixed