T O P I C R E V I E W |
sn0wpr0xy |
Posted - Mar 05 2012 : 03:45:40 AM Hi,
I have a somewhat complicated macro which I would like to hide from visual assist. The only other topic in this forum I found with a similar problem was this: http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=8208 however I could not get the solutions listed to work.
Basically the code looks like this
SOME_MACRO( ...
What I would like to do is
VISUAL_ASSIST_IGNORE_LINE SOME_MACRO(
So that this line is not seen by the vax parser. I tried editing the stdafx file to first define SOME_MACRO to nothing however this didn't work, I then tried defining VISUAL_ASSIST_IGNORE_LINE inside the stdafx to
#define VISUAL_ASSIST_IGNORE_LINE //
But this did not work either. After that I tried the method I use to strip asserts in release builds:
#define COMMENT SLASH(/) #define SLASH(s) /##s #define VISUAL_ASSIST_IGNORE_LINE COMMENT
But that also did not work. Is there a way I can hide this macro or line from the Visual Assist parser ? Its actually the ( which is causing the problem as I have more code inside macro which is not being understood correctly by the parser, so I would also be fine with disabling the ( ) matcher if possible.
Thanks.
|
5 L A T E S T R E P L I E S (Newest First) |
sn0wpr0xy |
Posted - Mar 07 2012 : 12:55:51 AM I tried putting the macro at the end of the file but it didn't work. I'll try the deep parsing next, but otherwise I found an alternative way of structuring this particular code using some macro tricks which doesn't run into this problem. Anyway, thanks for the help! |
accord |
Posted - Mar 06 2012 : 11:46:03 AM Feline is right, you don't need to match parens in all defines. However, when you use them they should be matched which is normally the case. One thing that can cause problems is that VA doesn't parse your defines correctly. Turning on recursive parsing that feline had offered can be a solution here. Replacing the macro with an empty one is not always a solution, consider the following case:
#define OPEN {
void func()
{
OPEN
}
}
If you replace OPEN with an empty one in the above code, VA will not like it.
If you have something like this:
#define OPEN2 {
#define OPEN OPEN2
void func()
{
OPEN
}
}
then VA will have a hard time understanding your code without recursive marco parsing. So you have 2 solutions: 1. Turn on recursive macro parsing. If it works, you are done. Just make sure that you delete your previous macro definitions from your stdafx.h that you were experiencing with, before taking this course of action. 2. Replace the macro with a simplified one: (Empty one will not work here)
#define OPEN {
Regarding tooltips: it may come from Visual Studio's intellisense. One way to be sure VA is using the proper definition is to see what's in the definition field: http://www.wholetomato.com/products/features/definition.asp
Another thing to consider if you still see the wrong definition is to rebuild symbol databases: VA Options -> Performance -> Rebuild |
feline |
Posted - Mar 06 2012 : 11:10:56 AM VA does not expect or require brackets to match in macro declarations, so I am not sure what is happening here. Can you try placing your edit to VA's StdAfx.h file at the bottom, this might just make a small difference.
If this makes no difference, can you try turning on deep macro parsing, as explained here:
http://docs.wholetomato.com?W363
If this does not help, can you post, or perhaps send me a code sample showing the problem, so I can test it here, and try to work out what is going on? If you send a file it will only be used for testing this. I appreciate this is not always possible, but it is worth asking. If this is possible, 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. |
sn0wpr0xy |
Posted - Mar 05 2012 : 11:47:33 PM Yes, I had tried that as well and tried it again just to make sure but it unfortunately didn't work. The macros defined in the stdafx don't seem to be overriding my macros. When I try to call my macro, I see my definition followed by the comment in the stdafx file in the yellow vax tooltip.
eg:
When I type:
SOME_MACRO(
This is what I see in the tooltip:
| My Macro Definition | | /////////////////////////////////////////////////////////////////////////////// | // macro overrides
I see the macro overrides text as I placed the macro at the top of the stdafx file and this comment lies above the definition. Also, I didn't edit the end of the stdafx so it should still have the blank line.
Any ideas on why this might not be working ? Otherwise, the real problem is that I am adding code inside my macro definition and the code lies before the ( is matched and Vax stops working in this section. Is there a way to disable the ( matching for a section (or globally) or is that functionality required for the parser to work correctly ? I was able to turn off the underlining for mismatched ( ) but the vax intellisense still doesn't work correctly if parens are not matched.
Thanks. |
feline |
Posted - Mar 05 2012 : 10:42:50 AM Have you tried adding:
#define SOME_MACRO(param) param
to VA's StdAfx.h? Simply defining the macro as nothing should hide the macro parameters from VA, while this should just limit VA's interest in the problem macro.
Please note you need to make sure VA's StdAfx.h ends with a blank line. |
|
|