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
 Macro with # operator breaks VAX parser
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

iusevax
Starting Member

1 Posts

Posted - Sep 06 2013 :  06:44:11 AM  Show Profile  Reply with Quote
It seems using the # operator (as in #x to stringify x) in a macro is confusing the VAX parser.

The result is that functions below a function that uses such a macro are no longer recognised as separate functions.
The code below is an example that exhibits the problem when searching for references to m_flag. The attached screenshot shows the "VAX Find References" result where all m_flag uses appear in Func1 even though Func1 ends at line 21.


#include <iostream>
#define Log(info)  {std::cout << info << std::endl;}
#define SomeAction()
#define LogAction(id,action)  \    { \        Log("Foo " << #id ); \        action; \    }

class Foo
{
    typedef enum {idA,idB,idC} Ids;
    bool m_flag;
public:
    void Func1()
    {
        m_flag = true;
        LogAction(idA,SomeAction());
        m_flag = false;
    }
    void Func2()
    {
        m_flag = true;
        LogAction(idB,SomeAction());
        m_flag = false;
    }
    void Func3()
    {
        m_flag = true;
        LogAction(idC,SomeAction());
        m_flag = false;
    }
};







There is a workaround by changing the macro as shown below but the issue with the VAX parser not handling the # operator correctly should be addressed nevertheless.


#define STR(x) #x
#define LogAction(id,action)  \    { \        Log("Foo " << STR(id) ); \        action; \    }


This was identified with Win7/64, VS2008 and VAX build 1949.

Edited by - iusevax on Sep 06 2013 06:48:22 AM

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Sep 06 2013 :  4:33:13 PM  Show Profile  Reply with Quote
Thank you for the clear bug report, and for the very simple and interesting work around, this looks like it could come in useful. This is a known problem with our parser, just not an easy one to solve:

case=729

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