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
 Problem with "Create Implementation"
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

MrDoomMaster
Tomato Guru

251 Posts

Posted - Jun 04 2007 :  7:07:21 PM  Show Profile  Reply with Quote
Paste the following code in a header file. Also make sure you have a corresponding, empty, CPP file around for the implementation to go to.

#define DONT_THROW throw()

class foo
{
	virtual void something() DONT_THROW;
};


Now try to use the "Create Implementation" refactoring feature on the member function prototype. Notice how no refactoring options appear?

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Jun 05 2007 :  07:44:56 AM  Show Profile  Reply with Quote
Is the function underlined as a mistyped symbol for you? It is for me. Since VA does not understand what it is, refactoring will not be offered.

Try editing VA's "StdAfx.h" file as explained in this FAQ entry:

http://docs.wholetomato.com?W302

and add the entry:

#define DONT_THROW

at the bottom. This file is used to help VA's parser with difficult code, and can be used to work around odd effects. After modifying this file you need to rebuild the VA symbol database for the changes to take effect:

VA Options -> Performance -> General -> Rebuild symbol databases

With a bit of luck this will help.

case=4589

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

MrDoomMaster
Tomato Guru

251 Posts

Posted - Jun 05 2007 :  10:13:38 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

Is the function underlined as a mistyped symbol for you? It is for me. Since VA does not understand what it is, refactoring will not be offered.

Try editing VA's "StdAfx.h" file as explained in this FAQ entry:

http://docs.wholetomato.com?W302

and add the entry:

#define DONT_THROW

at the bottom. This file is used to help VA's parser with difficult code, and can be used to work around odd effects. After modifying this file you need to rebuild the VA symbol database for the changes to take effect:

VA Options -> Performance -> General -> Rebuild symbol databases

With a bit of luck this will help.

case=4589



No, it was not underlined or anything. In fact I'm rather confused as to why this code would confuse VAX. I think the parsing for function headers might need to be a little more general. For example, instead of explicitly looking for throw() after the last closing brace and before the semicolon, perhaps just expect any kind of string. For example, you could also have this:

virtual void something() DONT_THROW = 0;

In the case above, VAX is guaranteed two things: The prototype will have at least one ')' symbol and after it somewhere a ';' symbol, signifying the end of that function prototype. Simply copy and text between those two symbols and paste them in the "Create Implementation" output and it should work fine, I would think. However I have a feeling it might not be this trivial.

I personally don't like the idea of having to modify a VAX specific file to get the tool to work correctly. Especially since many developers at work use this tool as well and they don't really want to have to modify this file as well. It would be unmanageable on large scale projects.

However, I will most certainly give the workaround a shot and see what I get. Thank you Feline for your response.

EDIT::

I'm using Visual Studio 2005 and VAX build 1557

Edited by - MrDoomMaster on Jun 05 2007 10:16:32 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Jun 05 2007 :  12:20:33 PM  Show Profile  Reply with Quote
As a partial answer, consider the code:

#ifdef WIN32
#define NO_THROW throw()
#elif NASTY_CODE_HERE
#define NO_THROW QT_SPECIFIC_MACRO
#else
#define NO_THROW
#endif


Now consider that this block is several header files away from the class in question, and that QT_SPECIFIC_MACRO is several more header files away.

The general case is not at all simple. In fact we had a recent bug report where someone was using "odd" macro's after function declarations that were processed by their own parser.

In an ideal world VA would just handle everything perfectly, and we are working on it Until we get there VA's stdafx.h file is a good way of producing a quick fix that you can have today. I keep this to a minimum, but it is good to have the option.

Ignoring all of that though, I am curious as to why you did not see any underlining of mistyped symbols. If VA understands the function then refactoring should be offered.

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

MrDoomMaster
Tomato Guru

251 Posts

Posted - Jun 05 2007 :  3:18:23 PM  Show Profile  Reply with Quote
quote:
Originally posted by feline

I am curious as to why you did not see any underlining of mistyped symbols.


Because I have "Underline mistyped symbols using [color]" unchecked :)

I'm a bit confused about your example. You state that the definitions of those macros may be "several header files away", but doesn't VAX parse headers inside of headers? When you open the project, all header files referenced by other files are parsed in a chain (at least from what I can see, I may be wrong). I'm not quite sure of the point you're making. Are you saying that VAX would be unable to find the definition of the macro used at the end of the function prototype? And if this is the case, why would VAX need to care about the definition of the macro in the header? It seems to me like VAX, in terms of creating implementations, wouldn't need to care what the DONT_THROW macro is... all it needs to do is make sure that exact string shows up in the generated implementation.

I have a feeling I'm missing something and I do apologize for my confusion. I hope you won't mind elaborating a bit more.

Edited by - MrDoomMaster on Jun 05 2007 3:23:20 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Jun 05 2007 :  4:49:55 PM  Show Profile  Reply with Quote
Well that is the mystery of the missing underlining solved

I am not explaining myself very well, my fault. I am thinking of several vague things at once, and seeing how they can sort of fit together to cause a problem Not a very precise thought, so it is not being explained at all well.

#define's being several files away, the further away, in the include hierarchy something is, the greater the chance VA has not been told about this header file. Libraries / header files being included / found via "mysterious" methods happens now and then, especially when people start looking at cross platform development. So my first thought about this is "what happens when the #define is unknown", followed closely by "what happens when it has multiple definitions?"


Knowing what the macro is, my first thought referred back to Qt and its rather interesting signal's and slot's, they have effectively added new keywords to the C++ language, giving you "public slots:" in your class instead of just "public:" which tends to confuse VA. Of course this does not directly apply here, but consider the following code:

class testUnhelpfulThings
{
    int m_nSize;

    testUnhelpfulThings() : m_nSize(0);
    void doSomethingNasty() volatile;
    int getSize() const;
}


three different things after a function, any one of which can be done via a macro, but the first one needs to be treated differently. To add to this we recently had someone doing something like this:

class testUnhelpfulThings
{
    int m_nSize;

    int macroGetsParameter() DO_THING(0);
}


which rather confused VA as well. Here the macro was being used by their own parser - I didn't ask what or why

Hopefully at least some of this makes sense

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

support
Whole Tomato Software

5566 Posts

Posted - Oct 29 2007 :  02:35:39 AM  Show Profile  Reply with Quote
case=4589 is fixed in Build 1614
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