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
 Rename grayed out in 1722; red underlines
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jfreeman
Junior Member

22 Posts

Posted - Apr 08 2009 :  4:41:05 PM  Show Profile  Reply with Quote
Since upgrading from 1715 to build 1722, Rename on the refactor menu is now grayed out for most (not all) variable names. The graying only occurs in one source file, others files are ok. This is in a VS2008 C++ app that compiles perfectly. I did not have this problem with before upgrading. Tried 'reparse current file'; doesn't help.

The other possibly related problem is about 90% of variables in my app (across all source files) have red underlines, even though the app compiles fine. This problem was the same in build 1715. The graying out of Rename doesn't really seem to correspond to which variables are underlined or not.

Most of the code int the app is in a C++ namespace.

Jim

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 09 2009 :  10:23:43 AM  Show Profile  Reply with Quote
It is possible these two issues have the same cause.

If VA has underlined a variable as a mistyped symbol then it is not going to offer Rename, or any other refactoring command.

The underlining does not appear when you first open a file, only after you have edited the file. This is an optimisation to avoid the underlining getting "in the way" when you are just browsing through code.

So we need to try and work out why so many variables are being underlined. What variables is this? Local variables in functions? Class member variables? Function parameters?

Are functions and class names also being underlined, or only variables?

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

jfreeman
Junior Member

22 Posts

Posted - Apr 10 2009 :  5:22:01 PM  Show Profile  Reply with Quote
It's method args, local variables, class names (only at the point of declaration and definition in the.cpp). Also method names that are declared + defined in a .H file.

Jim
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 11 2009 :  11:03:36 AM  Show Profile  Reply with Quote
Close to everything them *sigh* This suggests some form of "cascade" error, something in the header files is confusing VA, and everything after that is just not understood.

If you copy one of these problem cpp files, and its matching .h file and place them into a new default solution and open them do you still see this problem? I know the code will not compile, but I want to know if VA still underlines "everything". Class names will probably be underlined, but local variables and parameters should be understood correctly.

If you do still see the problem could you send me these two files, so I can try and work out the problem? They will only be used to try and debug this. I understand this is often not possible, but it is worth asking.

Please submit the files via the form:

http://www.wholetomato.com/support/contact.asp

including this thread ID or URL in the description, so we can match it up.

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

jfreeman
Junior Member

22 Posts

Posted - Apr 14 2009 :  7:18:23 PM  Show Profile  Reply with Quote
I tried making the new project you suggest with just the cpp and the .h that contains the class def. VA works correctly in that case, only underlining symbols that aren't defined (since a bunch of other h. file are missing). VA no longer underlines "everything" in this case.

Jim
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 15 2009 :  1:18:48 PM  Show Profile  Reply with Quote
Thank you, this indicates that the problem is not in these two files themselves, but in something else. In your main solution can you try adding a simple test function, e.g.

static void felineTestFuncForUnderlining(int nParamFeline1, int nParamFeline2)
{
    nParamFeline1 = 2;
    nParamFeline1 = 3;
    nFelineBananaInvalid = 4;   // this line should have underlining!
}


into the problem cpp file *before* all of the #include statements. What happens? Is there any invalid underlining?

If the underlining is correct can you then move the function to after the #include statements but before the first function?

I am wondering if the problem is caused by something in one of your header files. This would explain why the problem effects most files in your solution.

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

jfreeman
Junior Member

22 Posts

Posted - Apr 15 2009 :  2:50:21 PM  Show Profile  Reply with Quote
Function felineTestFuncForUnderlining is fine before or after the includes. So I started moving your function down the .CPP file, and discovered that the excess redlining starts just after the end of first method that calls this macro (macro defined at top of CPP after includes and inside namespace block):

// curl_easy_setopt wrapper that throws exception if error.
// We use "while(alwaysFalse)" rather than "while(false)" to suppress
// compiler warnings about "conditional expression is constant".
// At least in MSVC, can't just pragma warning off here since this is a macro.
static int alwaysFalse2 = false;
#define SET_CURL_OPTION(pCurl, optionTag, optionalValue) \ do \ { \ CURLcode ret = curl_easy_setopt(pCurl, optionTag, optionalValue); \ if (ret) \ throw CurlLibException(Format("Curl error %d setting Curl socket option. CURLoption=%d", ret, optionTag)); \ } while(alwaysFalse2) \

Jim

Edited by - jfreeman on Apr 15 2009 7:04:21 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 16 2009 :  3:57:24 PM  Show Profile  Reply with Quote
If you add two dummy functions in a row are you able to reproduce the problem by adding a call to this macro to the first function?

The macro looks odd to me, simply because the last line ends with a \\, and I am not used to seeing that on multi-line macros. However I am not seeing anything else odd here.

I have tried adding this macro, and the slightly silly call:

	SET_CURL_OPTION(0, 1, 2)

to a cpp file in one of my solutions, and I am not seeing any problems, even after an IDE restart.

So I am wondering if there is something about how you are calling the macro that is confusing VA. VA does not seem to have any problems with the macro its self on my system.

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

jfreeman
Junior Member

22 Posts

Posted - Apr 16 2009 :  10:00:50 PM  Show Profile  Reply with Quote
> If you add two dummy functions in a row are you able to reproduce the problem by adding a call to this macro to the first function?

Yes. I even used SET_CURL_OPTION(0, 1, 2) as you did. I also tried adding the macro def plus the two dummy functions to another existing CPP file and got the same behavior.

Jim
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 17 2009 :  11:04:29 AM  Show Profile  Reply with Quote
I assume I am missing something obvious here, but what? Using VS2005, VA 1722, I have added the following code to a cpp file:

// curl_easy_setopt wrapper that throws exception if error.
// We use "while(alwaysFalse)" rather than "while(false)" to suppress
// compiler warnings about "conditional expression is constant".
// At least in MSVC, can't just pragma warning off here since this is a macro.
static int alwaysFalse2 = false;
#define SET_CURL_OPTION(pCurl, optionTag, optionalValue) \do \{ \	CURLcode ret = curl_easy_setopt(pCurl, optionTag, optionalValue); \	if (ret) \	throw CurlLibException(Format("Curl error %d setting Curl socket option. CURLoption=%d", ret, optionTag)); \} while(alwaysFalse2) \
static void felineTestFuncForUnderlining1(int nParamFeline1, int nParamFeline2)
{
	SET_CURL_OPTION(0, 1, 2)
	nParamFeline1 = 2;
	nParamFeline1 = 3;
	nFelineBananaInvalid = 4;   // this line should have underlining!
}

static void felineTestFuncForUnderlining2(int nParamFeline3, int nParamFeline4)
{
	nParamFeline3 = 3;
	nParamFeline4 = 4;
	nFelineOrangeInvalid = 4;   // this line should have underlining!
}


and this is what I am seeing, I have functions set to an orange colour in VA options:



Based on your experience should I be seeing the problem with this code?

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

jfreeman
Junior Member

22 Posts

Posted - Apr 17 2009 :  1:45:19 PM  Show Profile  Reply with Quote
If I copy your code to a brand new .CPP file in a new VS2008 project, it works fine as it did for you. If I then take the same .cpp file and add it to my real app that's having the problem, everything (function name, params, vars) from the first nFelineBananaInvalid on down are underlined. So it must be something relating to project settings? Strange.

Jim
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 18 2009 :  5:34:03 PM  Show Profile  Reply with Quote
On the line where the macro is called:

SET_CURL_OPTION(0, 1, 2)

if you place the caret into the macro what does VA show in its context and definition fields? I have:

context = SET_CURL_OPTION
definition = #define SET_CURL_OPTION(pCurl, optionTag, optionalValue) do { CURLcode ret = curl_easy_setopt(pCurl, optionTag, optionalValue); if (ret) throw CurlLibException(Format("Curl error %d setting Curl socket option. CURLoption=%d", ret, optionTag)); } while(alwaysF

What happens if you press alt-g?

I am wondering if VA is picking up a second definition of this macro from somewhere else inside your solution.

Are any of the items in the macro coloured as macro's in your solution? The "function calls" are unknown on my system, but if some of them are macros this might help to explain this.

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

jfreeman
Junior Member

22 Posts

Posted - Apr 20 2009 :  1:39:31 PM  Show Profile  Reply with Quote
If I place the caret on a macro call, I get see the correct macro def, but I don't see any "context=" line. Alt-G takes me to the macro def just above. Everything in the macro def is properly colored. I can't find any other place in the source tree where SET_CURL_OPTION is defined.

I tried this for fun: If copy the following declaration and definition out of the the libcurl 3rd party library source code that's built as another project in my solution, and place it just above my macro def (and change the function name curl_easy_setopt to some other name to avoid conflict with the real one), the problem disappears.

.H file:
CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);

.C file (source code of libcurl)
#undef curl_easy_setopt
CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...)
{
va_list arg;
struct SessionHandle *data = curl;
CURLcode ret;

if(!curl)
return CURLE_BAD_FUNCTION_ARGUMENT;

va_start(arg, tag);

ret = Curl_setopt(data, tag, arg);

va_end(arg);
return ret;
}

Jim
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 20 2009 :  2:39:42 PM  Show Profile  Reply with Quote
I am not sure that I understand.

In your main solution, if you simply change the function names in the macro to invalid function names does the problem go away?

In the code you have just posted, I am wondering if CURL_EXTERN from the function declaration might be part of the problem. I am guessing this is some form of macro.

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

jfreeman
Junior Member

22 Posts

Posted - Apr 20 2009 :  4:02:04 PM  Show Profile  Reply with Quote
Right, if I change curl_easy_setopt() in the macro def to dummy() (but not change it elsewhere), the problem goes away.

CURL_EXTERN is defined in libcurl:
#define CURL_EXTERN __declspec(dllexport)

Jim
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 21 2009 :  6:25:39 PM  Show Profile  Reply with Quote
Can you have a look at this VS2008 console project please:

http://forum.wholetomato.com/colin/forumimages/8670_macro_underlining_1.zip

I have put together a simple test, based on the code samples posted here. It does not compile, but I don't really care at the moment. Can you reproduce the underlining problem with this, or by modifying this solution?

Note you need to edit a file before VA will start to underline mistyped symbols in the file.

The two "curl_library" files are for the library function, while the interesting code is in "macro_underlining.cpp".

Somehow I managed to get VA to underline everything after the macro, but only once. When this was happening scrolling the macro off the top of the screen was the trigger. However after an IDE restart the problem went away, and so far nothing I have tried has reproduced the error, so that is not really helping.

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

jfreeman
Junior Member

22 Posts

Posted - Apr 22 2009 :  1:34:41 PM  Show Profile  Reply with Quote
Your sample works fine for me -- I can't reproduce the underline problem with it. I tried lots of scrolling around. Not sure what mod I can try to make it reoccur.

Jim
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 23 2009 :  3:50:31 PM  Show Profile  Reply with Quote
If you have the time can you try making my test project look more like your main solution? I am not sure what the trigger for this problem is, but it does seem to be related to the declaration for curl_easy_setopt(). The function implementation should not matter.

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