T O P I C R E V I E W |
anovy |
Posted - Jan 05 2014 : 06:36:06 AM Hi, I found a serious error in the Find References (FR) function. I simplified the case as much as possible, so here is very simple sample code, one source file and 3 header files:
c.cpp:
#include "stdafx.h"
#define USE_C3D
#include "c.h"
#ifdef USE_C3D
#include "c3d.h"
#else
#include "c2d.h"
#endif
void C::f()
{
Board()->setView();
}
c.h:
class C
{
public:
#ifdef USE_C3D
class C3D *Board(){return NULL;}
#else
class C2D *Board(){return NULL;}
#endif
void f();
};
c2d.h:
class C2D
{
public:
void setView(){}
};
c3d.h:
class C3D
{
public:
void setView(){}
};
The predefined directive USE_C3D causes that the class C3D takes effect. Hovewer the FR function behaves as if C2D takes effect. You can check this by searching references to the setView function. If you call the search on C3D::setView (within c3d.h), then FR window shows only its declaration and definition, not its use in c.cpp. If you call the search on C2D::setView (within c2d.h), then FR window shows also its use in c.cpp, which is of course error. And the Goto Implementation function called on setView within C::f() goes to C2D::setView, which is the same error.
Moreover if you call the search on setView within c.cpp (in C::f() function), then FR windows shows only setView use, not setView declaration in header file. I noticed this behaviour (not displayed declaration in header file, if the search is started from source file) in some more cases and I feel this also as a serious problem.
The last (but not so serious) problem with the above example is with searching references to the Board() function. FR windows shows both definitions (C3D *Board() and C2D *Board()) which is confusing. Maybe it is intent, but I think the definiton of C2D *Board() should not be visible or at least marked as inactive or so.
Generally I'm impressed by VA browsing capabilities (comparing to standard Visual) and I planed to buy a license. However after finding the above problem, I must wait for correction (the credibility of the browsing information is crucial). But my evaluation license is few days before expiration. Is there some way how I can prolong it?
|
3 L A T E S T R E P L I E S (Newest First) |
accord |
Posted - Jan 07 2014 : 3:05:16 PM I got the test project, thank you. What I have observed is that the headers are not part of your project, and Find References don't show references from external dependencies. Adding them to the project would help.
Regarding the other problems: Only implementing case=42316 would help there. |
anovy |
Posted - Jan 06 2014 : 2:15:58 PM I just sent the test project via your on-line form, so I hope you will get it.
Regarding the topic:
I think that parsing both active and inactive code should be an option (and at least the active and inactive references should be clearly differentiated). I do not feel that this means always an easier navigation. For example if I work on 64-bit platform, I don't want to be bothered with references to source code which are 32-bit specific and vice versa. And I expect that the navigation will show me the valid definitions and declarations (for example 64-bit definition of INT_PTR etc.).
And the proposed workarround is generally not usable. It only switches the error from one case to another (the references will be then invalid if the USE_C3D directive will not be used).
|
accord |
Posted - Jan 06 2014 : 12:59:46 PM Basically, we parse both active and inactive code to make navigation easier. For example, if you set "Solution Configuration" to "Debug", you can still work on code in the "Release" area. This was a design decision, but we're considering to change this at some point:
case=42316
This indeed has unfortunate "side effects". Since we parse both active and inactive code, VA offers both Board() and uses the last "seen" declaration for Board()->setView().
The only workaround for this would be to change which code VA sees last. So changing your source to...
#ifndef USE_C3D
class C2D *Board(){return NULL;}
#else
class C3D *Board(){return NULL;}
#endif
...would cause VA to use C3D instead of C2D.
quote: Moreover if you call the search on setView within c.cpp (in C::f() function), then FR windows shows only setView use, not setView declaration in header file.
I wasn't able to reproduce that part. VA finds setView in c2d.h for me, which is still not correct, but I get 2 references, not 1. Maybe if you would send in your test project I could repro the issue using that project. You can send it in using the following form: http://www.wholetomato.com/support/contact.asp
Please include the URL of this topic the "Your Request" field so we can match it up.
Regarding extended trial: please contact us with the same form and include the URL of this topic: http://www.wholetomato.com/support/contact.asp |
|
|