Goto Implementation doesn't alway's work

General questions regarding the usage of CodeLite
user
CodeLite Curious
Posts: 6
Joined: Tue Feb 26, 2008 12:32 pm

Goto Implementation doesn't alway's work

Post by user » Thu Aug 07, 2008 2:05 pm

Hi,

Sometimes a "GoTo implementation" (right mouse menu on function name) results in a positioning to the Declaration/Prototype.
I managed to have a single function in a file to isolate my problem even than it doesn't work.

Could some one tell me if this is a know issue in CodeLite or is there something wrong I'm doing, forgetting a setting?

Currently I'm using revision 1927 on Windows XP.

Code: Select all

static int set_SubstractNameValuea(char *aLine, char *aVariableName, char *aVariableValue);

static int set_SubstractNameValuea(char *aLine, char *aVariableName, char *aVariableValue)
{
	int len =0;
	int done=0;
	int rt=0;
	char variableName[MAX_NAME];
	char variableValue[MAX_NAME];
	
	aLine = StripLeadingSpaces(aLine);
	if (aLine != NULL)
	{
		strcpy(variableName, aLine);
		strcpy(variableValue, "");

		while ((*aLine) && !(done)) {
			char *ptr;

			if (isspace(*aLine) || ('=' == *aLine)) {
				variableName[len] = NUL;
				// variablename  = StripTrailingSpaces(aVariableName);
				aLine = StripLeadingSpaces(aLine+1);

				while ((aLine && '=' == *aLine) && (!done))
					aLine = StripLeadingSpaces(aLine+1);
				if (aLine) {
					strcpy(variableValue, aLine);
					if (NULL != (ptr = strrchr(variableValue, ';')) &&
							NULL == strchr(ptr, '\"')) {
						*ptr = NUL;
					}
					StripTrailingSpaces(variableValue);
				}
				done = 1;
				
			} else {
				aLine++;
				len++;
			}
		}
		if (done)
		{
			strcpy (aVariableName,variableName);
			strcpy (aVariableValue,variableValue);
			rt = 1;
		}
	}

	return (rt);
}


User avatar
eranif
CodeLite Plugin
Posts: 6042
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Goto Implementation doesn't alway's work

Post by eranif » Thu Aug 07, 2008 2:30 pm

this bug was introduced lately since I moved to 'search by pattern'

The problem is that in your code, the prototype is declared at the top of the file:

Code: Select all

static int set_SubstractNameValuea(char *aLine, char *aVariableName, char *aVariableValue);
and the implementation is just under it:

Code: Select all

static int set_SubstractNameValuea(char *aLine, char *aVariableName, char *aVariableValue){
...
}
As you can see both patterns is the same or at least when searching the implementation CodeLite finds it as part of the declaration since the implementation pattern is part of the declaration pattern excluding the ';' at the end of the declaration.


static int set_SubstractNameValuea(char *aLine, char *aVariableName, char *aVariableValue)
;
static int set_SubstractNameValuea(char *aLine, char *aVariableName, char *aVariableValue)

Hope it helps you understand the bug and it can give you an idea of how to avoid it (for example: place the static methods at the top of the file, so they wont require the declaration lines)

Anyway, I am aware of it and it will be fixed.

Eran
Make sure you have read the HOW TO POST thread

User avatar
eranif
CodeLite Plugin
Posts: 6042
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Goto Implementation doesn't alway's work

Post by eranif » Thu Aug 07, 2008 3:33 pm

This is now fixed in SVN trunk

Eran
Make sure you have read the HOW TO POST thread

user
CodeLite Curious
Posts: 6
Joined: Tue Feb 26, 2008 12:32 pm

Re: Goto Implementation doesn't alway's work

Post by user » Thu Aug 07, 2008 3:51 pm

Tanks for your reply.

Well you suggestion works, but im my case it would be a hell to change all it in the codefiles as workaround, and then get it approved.

For now my workaround will be the use of cscope plugin.

User

User avatar
eranif
CodeLite Plugin
Posts: 6042
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Goto Implementation doesn't alway's work

Post by eranif » Thu Aug 07, 2008 3:57 pm

Read my last post: I already fixed it in SVN, and it will be part of the next development build release in about a week or so.

Cheers,
Eran
Make sure you have read the HOW TO POST thread

user
CodeLite Curious
Posts: 6
Joined: Tue Feb 26, 2008 12:32 pm

Re: Goto Implementation doesn't alway's work

Post by user » Thu Aug 07, 2008 5:33 pm

Tanks

Post Reply