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
 Incorrect coloring with custom enum macro
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

phildunstan
Starting Member

Sweden
1 Posts

Posted - May 09 2017 :  05:36:32 AM  Show Profile  Reply with Quote
Hi

We use a custom enum macro and Visual Assist gets the coloring wrong and incorrectly shows error squiggles. You can see the incorrect coloring in the switch statement where MyEnumType::VALUE1 and MyEnumType::VALUE2 are used. Those values also show the incorrect error squiggles.

Example Code:

#include <iostream>

#define ENUM(type, first, ...) struct EnumType##Info { 	enum EnumType { Start, first = 0, __VA_ARGS__, End, Count = End - Start }; };typedef Enum<EnumType##Info> type;


template<typename EnumInfo>
struct Enum : public EnumInfo
{
	typedef typename EnumInfo::EnumType EnumType;
	EnumType m_value;

	Enum() : m_value(EnumInfo::Start) {}
	Enum(EnumType value) : m_value(value) {}

	operator int() const { return int(m_value); }
};



ENUM(MyEnumType, VALUE0, VALUE1, VALUE2);

int main()
{
	MyEnumType x = MyEnumType::VALUE1;
	switch (x)
	{
	case MyEnumType::VALUE0:
		std::cout << "VALUE0" << std::endl;
		break;
	case MyEnumType::VALUE1:
		std::cout << "VALUE1" << std::endl;
		break;
	case MyEnumType::VALUE2:
		std::cout << "VALUE2" << std::endl;
		break;
	}
}






Visual Assist Info:
License: Suede (100-user license) Support ends 2018.04.06
VA_X.dll file version 10.9.2217.0 built 2017.04.26
DevEnv.exe version 15.0.26403.7 Enterprise
msenv.dll version 15.0.26403.7
Comctl32.dll version 6.10.14393.953
Windows 10 10.0 Build 14393
12 processors (x86-64, WOW64)
Language info: 1252, 0x409

Edited by - phildunstan on May 09 2017 05:36:56 AM

feline
Whole Tomato Software

United Kingdom
19074 Posts

Posted - May 09 2017 :  10:49:41 AM  Show Profile  Reply with Quote
Have you turned off IDE intellisense, perhaps via:

IDE tools menu -> Options -> Text Editor -> C/C++ -> Advanced -> Disable Database = True

Normally VA underlining is not active in VS2010 and above, since the IDE does its own C++ underlining. VA underlining is normally only active when IDE intellisense has been disabled.

In your macro, what is "Info" used for? You are using ##Info, but I am not seeing any definition, or parameter, to specify Info. Is this actually being used, or does the macro struct name always expand to "EnumTypeInfo"? This is important, because VA currently does not expand the ## in a macro, to generate the new names, so VA won't be understanding this macro properly. But, if the ##Info is not being used, I may be able to help find a work around for this.

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