tabgroupmanager fails to compile with older wxGTK

Discussion about CodeLite development process and patches
HJarausch
CodeLite Veteran
Posts: 98
Joined: Thu Feb 18, 2010 10:54 pm
Genuine User: Yes
IDE Question: C++
Contact:

tabgroupmanager fails to compile with older wxGTK

Post by HJarausch »

Hi,

on a machine with a somewhat older wxGTK
the conditional

#if wxVERSION_NUMBER >= 2808

is false. The following code

#if wxVERSION_NUMBER >= 2808
return TabInfoArrayNode->InsertChildAfter(node, previousnode); // >=2.8.8 has a convenient function to do this
#else
wxXmlNode* nextnode = previousnode->GetNext();
if (nextnode) {
return TabInfoArrayNode->InsertChild(node, nextnode) // <<<< missing semicolon
} else {
return TabInfoArrayNode->AddChild(node);
}
#endif
} else {
TabInfoArrayNode->AddChild(node); // this is line 133
}

return true;
}

doesn't compile here (even with the missing semicolon added) I get quite a strange error message (badly translated from German)

LiteEditor/tabgroupmanager.cpp: In member function
»bool TabgroupManager::DoAddItemToTabgroup(wxXmlDocument&, wxXmlNode*, const wxString&, const wxString&)«:
LiteEditor/tabgroupmanager.cpp:133: error : void value has not been ignored as it should.

(Fehler: void-Wert nicht ignoriert wie es sein sollte)

Has anybody an idea what's going wrong?

Many thanks,
Helmut.
HJarausch
CodeLite Veteran
Posts: 98
Joined: Thu Feb 18, 2010 10:54 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: tabgroupmanager fails to compile with older wxGTK

Post by HJarausch »

HJarausch wrote:Hi,

on a machine with a somewhat older wxGTK
the conditional

#if wxVERSION_NUMBER >= 2808

is false. The following code

#if wxVERSION_NUMBER >= 2808
return TabInfoArrayNode->InsertChildAfter(node, previousnode); // >=2.8.8 has a convenient function to do this
#else
wxXmlNode* nextnode = previousnode->GetNext();
if (nextnode) {
return TabInfoArrayNode->InsertChild(node, nextnode) // <<<< missing semicolon
} else {
// return TabInfoArrayNode->AddChild(node);
// is this the right fix : VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
TabInfoArrayNode->AddChild(node); return true;
}
#endif
nemesis
CodeLite Enthusiast
Posts: 37
Joined: Fri Oct 01, 2010 8:32 pm
Genuine User: Yes
IDE Question: all
Contact:

Re: tabgroupmanager fails to compile with older wxGTK

Post by nemesis »

hi there!

try using code-tags. this makes everything much more readable.
after having a look into this, i found out that the return is given wrong.
LiteEditor/tabgroupmanager.cpp:125 (in rev4375):

Code: Select all

	if (previousnode) {
#if wxVERSION_NUMBER >= 2808
		return TabInfoArrayNode->InsertChildAfter(node, previousnode); // >=2.8.8 has a convenient function to do this
#else
		wxXmlNode* nextnode = previousnode->GetNext();
		if (nextnode) {
			return TabInfoArrayNode->InsertChild(node, nextnode);
		} else {


			return TabInfoArrayNode->AddChild(node); // WRONG RETURN HERE


		}
#endif
	} else {
		TabInfoArrayNode->AddChild(node);
	}
AddChild is void instead of returning bool. replacing the line with

Code: Select all

TabInfoArrayNode->AddChild(node);
return true;
or something should work out (or updating wx).

greets,
nem
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: tabgroupmanager fails to compile with older wxGTK

Post by DavidGH »

Hi Helmut,

Yes, I'm afraid I didn't actually build against 2.8.7, which even then was antique. The missing semi-colon was added in r4391.

My g++ still doesn't seem to care about wxXmlNode::AddChild returning void :/

@nemesis: Your fix is correct, of course. I'll submit a patch.

Regards,

David
Post Reply