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.