Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Find reference fails after macro used in a functio

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
kennyl Posted - Aug 01 2024 : 03:32:02 AM
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;
}
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Aug 28 2024 : 07:57:30 AM
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.
kennyl Posted - Aug 28 2024 : 02:45:36 AM
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.
feline Posted - Aug 01 2024 : 08:23:50 AM
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.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000