Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Find reference fails after macro used in a functio
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kennyl
Ketchup Master

50 Posts

Posted - Aug 01 2024 :  03:32:02 AM  Show Profile  Reply with Quote
Notice that the macro EACH_OBJ_TEST_0 begins a loop block (but not ending it), another macro END_EACH_OBJ_TEST_0 should be used to end the loop block.

Put the caret on the function func_after_test, and do a find reference on it, VA fails to show any reference.



bool test_obj(int* p)
{
	return p != nullptr;
}

#define EACH_OBJ_TEST_0(p, __IS_SEL)	for( ; p; (p)++)	{	if( !__IS_SEL(p) )	continue;

#define	END_EACH_OBJ_TEST_0						}

#define EACH_OBJ_TEST(p)						EACH_OBJ_TEST_0(p, test_obj)

#define	END_EACH_OBJ_TEST						END_EACH_OBJ_TEST_0

void func_before_test()
{

}

void test_function_1(int* p)
{
	EACH_OBJ_TEST(p)
		p++;
	END_EACH_OBJ_TEST
}

void func_after_test()
{

}


int main() {
	
	func_after_test();
	return 0;
}

Edited by - feline on Aug 01 2024 08:19:58 AM

feline
Whole Tomato Software

United Kingdom
18938 Posts

Posted - Aug 01 2024 :  08:23:50 AM  Show Profile  Reply with Quote
Interesting, and thank you for providing the code showing the problem. I have a work around for this. Can you please create a new text file called "va_stdafx.h" in the same directory as your SLN file. Edit this file and add the code:

#define EACH_OBJ_TEST_0(p, __IS_SEL)
#define	END_EACH_OBJ_TEST_0
#define EACH_OBJ_TEST(p)
#define	END_EACH_OBJ_TEST


making sure that the file ends with a blank line.

When rebuilding its symbol database VA searches for this file, and if found, it parses it before parsing anything else. This file is used to give our parser helpful hints, and to work around odd problems that we encounter. The file should not be added to your solution, so it doesn't matter if the content of the file conflict with code inside your solution.

Having created and edited the file, in the IDE press the button:

VA Options -> Performance -> Rebuild symbol databases

and restart your IDE.

This has fixed the problem for me, so will hopefully work for you as well.

zen is the art of being at one with the two'ness
Go to Top of Page

kennyl
Ketchup Master

50 Posts

Posted - Aug 28 2024 :  02:45:36 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline
This has fixed the problem for me, so will hopefully work for you as well.



That did help fix the problem here too!

Are you going to fix it in VA too?

Thanks.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18938 Posts

Posted - Aug 28 2024 :  07:57:30 AM  Show Profile  Reply with Quote
The "problem" is what macros are. I assume you know that the first stage of the compiler is the preprocessor, which expands, and thus removes, all of the macros from your code files. So the rest of the compiler never sees or has to consider macros.

VA doesn't get to do that, since we need VA to help you with the code you are writing and editing. So we need to both have some awareness of what a macro does, but also treat a macro as a valid symbol in your code. This can cause some problems, depending on what you are doing with macros. We are working to improve VA's handling of all code, but some problems are easier than others.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000