Page 1 of 1

Goto Implementation doesn't alway's work

Posted: Thu Aug 07, 2008 2:05 pm
by user
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);
}


Re: Goto Implementation doesn't alway's work

Posted: Thu Aug 07, 2008 2:30 pm
by eranif
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

Re: Goto Implementation doesn't alway's work

Posted: Thu Aug 07, 2008 3:33 pm
by eranif
This is now fixed in SVN trunk

Eran

Re: Goto Implementation doesn't alway's work

Posted: Thu Aug 07, 2008 3:51 pm
by user
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

Re: Goto Implementation doesn't alway's work

Posted: Thu Aug 07, 2008 3:57 pm
by eranif
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

Re: Goto Implementation doesn't alway's work

Posted: Thu Aug 07, 2008 5:33 pm
by user
Tanks