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
 Using a macro as return value breaks VS-X
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Stabiplan
New Member

Netherlands
8 Posts

Posted - Mar 03 2010 :  09:20:48 AM  Show Profile  Reply with Quote
Hi,

Visual Assist X seems to be having troubles parsing our project files and it looks like I localized the problem to the following issue:

We use a macro (let's call it ERRORBOOL) that is a normal boolean in a release build, but a more complex object in the debug build. It looked like the problem was that the macro was defined twice (one as 'bool' for release and one as a custom class for debug) but I managed to reproduce the error in a smaller setting (without it being defined two times).

In a new VC++ project, create the following two files:
macros.h
#define ERRORBOOL bool
someclass.h
#include "macros.h"

class SomeClass {
   public:
      ERRORBOOL doSomething();
};

I noticed that immediately after I typed 'doSomething()' that this method is not being highlighted by VS-X. If I would change the someclass.h file a bit:
someclass.h
#include "macros.h"

class SomeClass {
   public:
      ERRORBOOL doSomething();
      bool doSomethingElse();
};
It will immediately highlight the method name (and e.g. allow me to create an implementation for it)

In our specific case this means that I cannot do a find-references on about 80% of all our source methods, which is kind of a bummer. It looks like in the CPP files it colours those methods correctly though, but none of the refactorings will work on those methods.

Any clue on why this issue arises? (And can you fix this?)

Edit to add:
I have already tried defining this macro inside VS-X's stdafx.h but that doesn't help.


Edit to add (2):
I'm using version 10.5.1738.0 in Visual Studio 2005.

Edited by - Stabiplan on Mar 04 2010 02:24:29 AM

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Mar 04 2010 :  2:12:28 PM  Show Profile  Reply with Quote
Can you try installing VA 1814 please, and see if this makes any difference? I have just tried this test here, using VS2005 and VA 1814 and so far no sign of the problem.

This was without editing VA's StdAfx.h file.

http://www.wholetomato.com/downloads/default.asp

zen is the art of being at one with the two'ness

Edited by - feline on Mar 04 2010 2:12:48 PM
Go to Top of Page

Stabiplan
New Member

Netherlands
8 Posts

Posted - Mar 05 2010 :  03:33:12 AM  Show Profile  Reply with Quote
The seems example works properly as soon as I re-open the solution (but not before that).

The example does never work properly when the macro is also defined in the StdAfx.h file. This last case is more of a problem since that is what is happening in our regular solutions.

Here's what it looks like:


Where XBOOL is defined in StdAfx.h AND macros.h

Edited by - Stabiplan on Mar 05 2010 04:27:59 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Mar 05 2010 :  1:58:05 PM  Show Profile  Reply with Quote
Can you please go to:

VA Options -> System Info -> Copy Info

and paste the details (from the clipboard) into your reply. This will give us the basic information about your setup.

I still cannot reproduce this problem, so obviously something else must be going on here.

When you have the problem, if you place the caret into the macro return type, "XBOOL" here, what is show in the VA context and definition fields?

What does alt-g do?

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

Stabiplan
New Member

Netherlands
8 Posts

Posted - Mar 08 2010 :  01:25:50 AM  Show Profile  Reply with Quote
This is the result of pressing ALT+G:


As context it says: 'XBOOL', as definition it says:
#define XBOOL double...
Here's a copy of my system information:

System Info
VA_X.dll file version 10.6.1814.0 built 2010.03.01
Licensed to:
VA X: inkoop@<my username>.nl (5-user license) Support ends 2010.12.10
DevEnv.exe version 8.0.50727.762
msenv.dll version 8.0.50727.762
Font: Inconsolata-dz 13(Pixels)
Comctl32.dll version 6.0.2900.5512
Windows XP 5.1 Build 2600 Service Pack 3
2 processors (x86)

Platform: Custom
Stable Includes:
C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include;
C:\\Program Files\\Microsoft Visual Studio 8\\VC\\atlmfc\\include;
C:\\Program Files\\Microsoft Visual Studio 8\\VC\\PlatformSDK\\include;
C:\\Program Files\\Microsoft Visual Studio 8\\SDK\\v2.0\\include;

Other Includes:

Stable Source Directories:
C:\\Program Files\\Microsoft Visual Studio 8\\VC\\atlmfc\\src\\mfc;
C:\\Program Files\\Microsoft Visual Studio 8\\VC\\atlmfc\\src\\mfcm;
C:\\Program Files\\Microsoft Visual Studio 8\\VC\\atlmfc\\src\\atl;
C:\\Program Files\\Microsoft Visual Studio 8\\VC\\crt\\src;


I just noticed that my macros.h file does not end with an empty line, when I do add an empty line at the end of this file and reload my solution the VA-definition becomes:
static const FTYPE pows[] =
which seems quite off to me.

Edit to add:
In this last case the context dropdown says it could also be
static const FTYPE pows[] ={...}

Edited by - Stabiplan on Mar 08 2010 01:30:46 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Mar 08 2010 :  1:51:32 PM  Show Profile  Reply with Quote
After adding the blank line to the bottom of VA's StdAfx.h file and doing a rebuild of VA's symbol database has anything changed?

You should not need to edit VA's StdAfx.h file, but if you do then it does need to end with a blank line.

I am getting confused. I have no idea what the "FTYPE" line has to do with this.

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

Stabiplan
New Member

Netherlands
8 Posts

Posted - Mar 09 2010 :  01:40:33 AM  Show Profile  Reply with Quote
Okay, then let's try again... here are the steps I'm following:

Edit to add:
0) Follow this guide (http://docs.wholetomato.com?W363) to set VA to parse macros calling macros.

1) Create a new Visual Studio project (empty C++ project)
2) Create a file 'macros.h'
3) In 'macros.h' type the following (without the line numbers):
macros.h
1. #define VSXBUG_BOOL bool
2.

4) Create a file 'example.h'
5) In 'example.h' type the following (without the line numbers):
example.h
1. #include "macros.h"
2. 
3. class Example {
4.    private:
5.       VSXBUG_BOOL doSomething();
6.       double doSomethingElse();
7. };
8.

6) Go to VS-X options and clear history, cache etc. and rebuild the database.
7) Close Visual Studio (save the project)
8) Open Visual Studio again, open our project again
9) Here's what the file 'example.h' looks like on my machine:

* Notice how the method 'doSomething()' does not properly highlight (refactoring is also not available on this symbol according to VS-X).

This is what VA-X makes of it when I search for 'Example' in the 'VA View' dialog:

* Notice that as the method name it lists 'Example.bool', but in the mouse-hover it seems to have the right name.

--- Other steps I've tried that might or might not work ---
Replace step 6) Close Visual Studio
Replace step 7) Go to: C:\\Documents and Settings\\<your username>\\Local Settings\\Application Data\\VisualAssist and empty this folder.
* This does not work

11) Try it again with administrative privileges
* I haven't tried this yet, but this might be a difference between your (feline) tries and mine. --> Will try this today

12) Try it again on a different machine (same environment)
* Will try this today as well.

I will try it again on a different machine today, both on

Edited by - Stabiplan on Mar 09 2010 02:07:02 AM
Go to Top of Page

Stabiplan
New Member

Netherlands
8 Posts

Posted - Mar 09 2010 :  01:51:48 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

After adding the blank line to the bottom of VA's StdAfx.h file and doing a rebuild of VA's symbol database has anything changed?

You should not need to edit VA's StdAfx.h file, but if you do then it does need to end with a blank line.

I did have a blank line in the StdAfx.h already, that's in bold in the FAQ.

quote:
Originally posted by feline

I am getting confused. I have no idea what the "FTYPE" line has to do with this.
According to a quick grep this is something that's coming from a VC8-header file:
1 match in C:\\program files\\Microsoft Visual Studio 8\\VC\\crt\\src\\xxxdtent.h
       9  static const FTYPE pows[] = {

So my guess would be that VA-X' parser bugs somewhere.

When I re-open my project from yesterday (after today's steps above) it's still there.


Here's what those files look like:
macros.h
1. #define XBOOL double
2.
SomeClass.h
1. #include "macros.h"
2. 
3. class SomeClass {
4. public:
5.    XBOOL doSomething();
6.    void doSomethingElse();
7. };
8.
StdAfx.h
  1. <contents of original StdAfx.h>
     ...
241. #define AFX_EXT_DATA
242. 
243. // Custom ErrorStore Defines
244. #define XBOOL bool
245. 
246. // Continue from original VA-X StdAfx.h
247. struct tagVARIANT
     ...

Edited by - Stabiplan on Mar 09 2010 01:58:17 AM
Go to Top of Page

Stabiplan
New Member

Netherlands
8 Posts

Posted - Mar 09 2010 :  02:05:18 AM  Show Profile  Reply with Quote
Gotcha! It seems to have to do with the LimitMacro settings (http://docs.wholetomato.com?W363).

I have this setting on 'NoDepthLimit', when I remove that setting it works (when the macro is defined once inside macros.h).
When I provide VA-X with a simplified macro in StdAfx.h however, it still doesn't work (it does color it properly, but VA-X does not allow refactoring on the symbol.

Edited by - Stabiplan on Mar 09 2010 02:12:37 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Mar 09 2010 :  3:12:20 PM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the clear description.

case=40731

As you say, the key trigger is turning on extra macro parsing. Very strange, I have not seen it cause problems like this before.

Do you need to turn on extra macro parsing? We might be able to work around this by editing VA's StdAfx.h file.

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

Stabiplan
New Member

Netherlands
8 Posts

Posted - Mar 10 2010 :  01:44:38 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

Do you need to turn on extra macro parsing? We might be able to work around this by editing VA's StdAfx.h file.
I will give this another try (through I've tried it several times). As you can read in my comment above: If I add this to my StdAfx.h
StdAfx.h
#define VSXBUG_BOOL bool
then the highlighting works properly but refactoring is still not available on the symbol.

Will give it another shot today.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Mar 10 2010 :  08:51:04 AM  Show Profile  Reply with Quote
Apologies, I am not making myself clear.

Removing the "NoDepthLimit" setting in the registry is currently the only fix I can find for the function with the macro return type. What I am wondering is why you have set "NoDepthLimit", and if we can avoid setting this, but use VA's StdAfx.h file to work around any other problems you are seeing.

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

Stabiplan
New Member

Netherlands
8 Posts

Posted - Mar 11 2010 :  02:42:56 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

What I am wondering is why you have set "NoDepthLimit", and if we can avoid setting this, but use VA's StdAfx.h file to work around any other problems you are seeing.
I turned on the "NoDepthLimit" setting because I was having troubles with the macros regarding our error system. It does seem that this new version holds pretty well if I disable my custom StdAfx.h and the "NoDepthLimit".

Looks like it works properly... for now
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Mar 11 2010 :  10:40:19 AM  Show Profile  Reply with Quote
This is good news Unfortunately it is possible to confuse VA's parser with some complex macros. This is something we are aware of and working on, but it is not always an easy fix.

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