Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Function declaration using macros

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
jschmidt Posted - Jan 27 2012 : 09:15:03 AM
Hi, I wonder if VA could be better to parse function prototype and declaration when they are decorated using macros.

For example we have something like this:


// .h
DNA_METHOD(DNAPtr<IHasNamePredicate>, CreateHasNamePredicate)(const String &in_Name);
// .cpp
DNA_METHOD_IMP(DNAPtr<IHasNamePredicate>) CDataModelMgr::CreateHasNamePredicate(const String &in_Name)
{
// [...]
}
// Macros definitions
#define DNA_FUNCTION(ReturnType, MethodName) ReturnType DNA_CALL MethodName
#define DNA_METHOD(ReturnType, MethodName)	virtual DNA_FUNCTION( ReturnType, MethodName )


But VA failed to parse these correctly, as an example when I type in a method and ask for parameter info I get something like this (showing the wrong parameter (return value)



Also in the .h, I can't go to the declaration from a prototype (it fails to find it in the .cpp). I also get other issues regarding this.
2   L A T E S T    R E P L I E S    (Newest First)
support Posted - Apr 11 2012 : 12:42:56 AM
case=64310 is fixed in build 1903
feline Posted - Jan 27 2012 : 3:05:31 PM
I am having some difficulty working out what is going on in your code, given the information you have posted here. The macros reference a macro you have not posted, and I am not sure quite what is happening. I have reproduced the parameter info tooltip bold problem with the following simplified code sample:

With this in the header file:

#define DNA_METHOD_IMP(Return_Type) Return_Type

class testMacroReturnFunc
{
public:
	DNA_METHOD_IMP(void) classMemberFuncMacroReturn(const int &in_AppVar, const int &in_Value);
};

and this in the cpp file:
DNA_METHOD_IMP(void) testMacroReturnFunc::classMemberFuncMacroReturn( const int &in_AppVar, const int &in_Value ) { }

static void testGeneralCode()
{
	testMacroReturnFunc classMacroReturn;
	// bug - parameter info tooltip shows the return type
	// in bold for the first parameter, and nothing in bold
	// for the second parameter
	classMacroReturn.classMemberFuncMacroReturn(2, 3);
}

I am seeing the problem, and I have put in a bug report for this:

case=64310

Can you help me extend my simple example to reproduce the problems you are seeing with alt-g?

My initial attempt is, in the header file:

// Macros definitions
#define DNA_METHOD_IMP(Return_Type) Return_Type
#define DNA_CALL
#define DNA_FUNCTION(ReturnType, MethodName) ReturnType DNA_CALL MethodName
#define DNA_METHOD(ReturnType, MethodName)	virtual DNA_FUNCTION( ReturnType, MethodName )

class testMacroReturnFunc
{
public:
	DNA_METHOD_IMP(void) classMemberFuncMacroReturn(const int &in_AppVar, const int &in_Value);
	// alt-g on the function works fine here
	DNA_METHOD(void, classMethodViaMacro)(const int &in_counter);
};

and in the matching cpp file:
DNA_METHOD_IMP(void) testMacroReturnFunc::classMemberFuncMacroReturn( const int &in_AppVar, const int &in_Value ) { }
// alt-g on the function works fine here
DNA_METHOD_IMP(void) testMacroReturnFunc::classMethodViaMacro(const int &in_counter) { }

static void testGeneralCode()
{
	testMacroReturnFunc classMacroReturn;
	// bug - parameter info tooltip shows the return type
	// in bold for the first parameter, and nothing in bold
	// for the second parameter
	classMacroReturn.classMemberFuncMacroReturn(2, 3);

	// alt-g on the function works fine here
	classMacroReturn.classMethodViaMacro(2);
}

using VS2005 and VA 1862.

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