Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 VAX gets confused with 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
mikhail.matrosov Posted - Jul 23 2014 : 07:33:22 AM
We use plugins framework which heavily exploits macros. These macros may introduce new methods and fields in class definition. In this case sove VAX functionality fails for methods of this class. I cannot navigate with Alt+G from method declaration to method definition and Create Implementation of a method generates stub as a global function,without MyClass:: prefix. If I comment out our macros, everything immediately works right.

Here is the code:
class MyClass : public msa::IObject, private msa::ObjectImpl {
public:
  ...
  // These lines are confusing:
  MSA_BEGIN_IMPLEMENT_IOBJECT;
  MSA_END_IMPLEMENT_IOBJECT;
...
}


That's how macros are defined:
#define MSA_BEGIN_IMPLEMENT_IOBJECTBASE\  private:\  msa::internal::Counter m_counter;\  \  public:\  virtual int AddRef() const\  {\    return m_counter.AddRef();\  }\  \  virtual int Release() const\  {\    int iLocalCounter = m_counter.Release();\    if (iLocalCounter == 0) delete this;\    return iLocalCounter;\  }\  \  virtual msa::Status QueryInterface(const char* in_IID, const void** out_ppObject) const\  {\    return msa::internal::RemoveConst(this)->QueryInterface(in_IID, const_cast<void**>(out_ppObject));\  }\  \  virtual msa::Status QueryInterface(const char* in_IID, void** out_ppObject)\  {\    msa::Status result;

#define MSA_END_IMPLEMENT_IOBJECTBASE\    return msa::STATUS_ENOINTERFACE;\  }

#define MSA_BEGIN_IMPLEMENT_IOBJECT \  MSA_BEGIN_IMPLEMENT_IOBJECTBASE

#define MSA_END_IMPLEMENT_IOBJECT \  MSA_END_IMPLEMENT_IOBJECTBASE \  void RegisterDeleteTracker(msa::INotifiable3* in_pObject,void* in_pParam)\  {\    msa::ObjectImpl::RegisterDeleteTracker(in_pObject, in_pParam);\  }\  void UnregisterDeleteTracked(msa::INotifiable3* in_pObject)\  {\    msa::ObjectImpl::UnregisterDeleteTracker(in_pObject);\  }\  virtual unsigned long GetThreadAffinity()\  {\    return msa::ObjectImpl::GetThreadAffinity();\  }\  virtual msa::Status MoveToThread(unsigned long in_ulThread)\  {\    return msa::ObjectImpl::MoveToThread(in_ulThread);\  }
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jul 24 2014 : 3:43:34 PM
We are aware of problems with macros, and do work on them, but sometimes the easiest and best solution is to use the va_stdafx.h file, as you have, to give VA a helping hand. After all, the compiler gets to expand all of the macros before it has to think about the code, we don't get that luxury.
mikhail.matrosov Posted - Jul 24 2014 : 01:30:44 AM
Works like a charm, thanks! Any ideas on whether it will be fixed in the upcoming releases?
accord Posted - Jul 23 2014 : 7:22:27 PM
It seems that Visual Assist gets confused by these macros. There are multiple solutions for this problem, but the easiest, safest and maybe the fastest way to workaround this is to create a file named va_stdafx.h next to your solution file with the following content:

#define MSA_BEGIN_IMPLEMENT_IOBJECT
#define MSA_END_IMPLEMENT_IOBJECT
// keep this comment - you need EOL to parse this correctly


This will override the macro for Visual Assist, so it will use empty ones, effectively skipping them.

You can learn more about this here:
http://docs.wholetomato.com/default.asp?W302

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