Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Macro with # operator breaks VAX parser

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
iusevax Posted - Sep 06 2013 : 06:44:11 AM
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.
1   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Sep 06 2013 : 4:33:13 PM
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

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000