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
 Struct decl not recognized if done via macro
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

HateDread
Junior Member

Australia
22 Posts

Posted - Jun 30 2021 :  05:15:51 AM  Show Profile  Reply with Quote
I hit this when playing with NoesisGUI's C++ SDK + VAX v10.9.2366.0 + VS19 v16.8.3.

The macro in question is defined as follows (cut down CompilerSettings.h from the SDK):


// Microsoft VC++
#if defined(_MSC_VER) && _MSC_VER >= 1400

    #define NS_INTERFACE struct __declspec(novtable)

// GCC - Clang
#elif defined(__GNUG__) && __GNUG__ >= 4

    #define NS_INTERFACE struct

#endif


And this macro is used like so:


////////////////////////////////////////////////////////////////////////////////////////////////////
/// Interface. Used as base for all component interfaces.
////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef SWIG
NS_INTERFACE Interface
{


and like so


////////////////////////////////////////////////////////////////////////////////////////////////////
/// Views manage UI trees
////////////////////////////////////////////////////////////////////////////////////////////////////
NS_INTERFACE IView: public Interface


If I manually copy-paste 'struct __declspec(novtable)' directly in place of the NS_INTERFACE macro, the classes are recognized again as normal. Without it, they're not coloured like classes and don't behave as such in VAX interface/autocomplete. I guess VAX isn't understanding this macro?

feline
Whole Tomato Software

United Kingdom
17334 Posts

Posted - Jun 30 2021 :  10:01:14 AM  Show Profile  Reply with Quote
I am seeing the same basic problem here, thank you for the clear explanation.

I assume that editing the library isn't a good option. So instead 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 line:

#define NS_INTERFACE struct

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 way VA will use this, simple, version of the macro. In the library code VA is picking up both versions of the macro, which isn't so helpful here. This is fixing the problem for me, in my simple test case, so should work for you to.

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

HateDread
Junior Member

Australia
22 Posts

Posted - Jul 01 2021 :  12:06:14 PM  Show Profile  Reply with Quote
quote:
Originally posted by feline

I am seeing the same basic problem here, thank you for the clear explanation.

I assume that editing the library isn't a good option. So instead 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 line:

#define NS_INTERFACE struct

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 way VA will use this, simple, version of the macro. In the library code VA is picking up both versions of the macro, which isn't so helpful here. This is fixing the problem for me, in my simple test case, so should work for you to.



Thanks for the advice - will try that locally.

I'll likely link the library authors to this thread, so if editing the library were an option, how could/should one make this play nicer with VAX?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17334 Posts

Posted - Jul 02 2021 :  07:50:52 AM  Show Profile  Reply with Quote
Hopefully the va_stdafx.h work around will fix this for you.

As for fixing the library, I am not sure off hand. VA parses both active and inactive code, by design, so that it can help you when you are working on currently inactive code, since you still need to edit it. Normally, in a situation like this, simply changing the order of the #define statements would work, but in my test case this isn't actually helping.

If the full library has the same effect, that simply swapping the #if and #elif blocks around don't help, we will need to do something a bit more cunning, and probably ugly looking, to hide this macro from VA.

Step one though is to see if the work around works for you, in the full situation.

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:
© 2021 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000