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
 [[deprecated]] parsing glitch
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bta
Ketchup Master

Belgium
57 Posts

Posted - Nov 07 2017 :  03:53:40 AM  Show Profile  Reply with Quote
I'm working with VS2015 Professional and VAX10.9.2237.0

When using this code things go wrong for TestClass3 and TestClass4.
It seems that it thinks there is a class with the name class defined.
So after typing MyNamespace:: the code completion suggestion list contains an entry 'class'.
Note that for TestClass1 and TestClass2 everything goes fine, so it seems that the fact that the class is templated is causing the problem.


namespace MyNamespace
   {
   class [[deprecated]] TestClass1
      {
      public:
         void f() {}
      };
   class [[deprecated("use MyNamespace::XXX instead")]] TestClass2
      {
      public:
         void f() {}
      };

   template <typename TParam>
   class [[deprecated]] TestClass3
      {
      public:
         void f() {}
      };
   template <typename TParam>
   class [[deprecated("use MyNamespace::XXX instead")]] TestClass4
      {
      public:
         void f() {}
      };
   }

void myFunction2()
   {
   MyNamespace::   // class gets suggested
   }

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Nov 07 2017 :  06:58:41 AM  Show Profile  Reply with Quote
Interesting, I had no idea you could do that in C++, but it compiles quite happily, and I am seeing the same listbox problem:

case=112204

Can you please try setting:

VA Options -> Enhanced Listboxes -> Source of C/C++ content: Default Intellisense

this should fix the problem for you, it does for me. Hopefully it won't have to many side effects.

zen is the art of being at one with the two'ness
Go to Top of Page

bta
Ketchup Master

Belgium
57 Posts

Posted - Nov 07 2017 :  11:05:32 AM  Show Profile  Reply with Quote
We turned off Intellisense completely as it consumed too much memory/diskspace and wasn't working decently.

Related to the C++ attributes, there are more than just [[deprecated]]: cfr. http://en.cppreference.com/w/cpp/language/attributes
Note that Visual Studio does not implement all of them in VS2015, don't know about VS2017 though...
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Nov 07 2017 :  1:01:02 PM  Show Profile  Reply with Quote
When I did a quick search on this, I ended up with this page:

https://msdn.microsoft.com/en-us/library/044swk7y.aspx

which has a different approach to doing this.

Turning off the IDE intellisense makes sense. Is using a macro for this an option for you? I have changed the test code slightly, to end up with this:


#define DEPRECIATE(x) [[deprecated(x)]]

namespace MyNamespace
{
	class DEPRECIATE() TestClass1
	{
	public:
		void f() {}
	};
	class DEPRECIATE("use MyNamespace::XXX instead") TestClass2
	{
	public:
		void f() {}
	};

	template <typename TParam>
	class DEPRECIATE() TestClass3
	{
	public:
		void f() {}
	};
	template <typename TParam>
	class DEPRECIATE("use MyNamespace::XXX instead") TestClass4
	{
	public:
		void f() {}
	};
}

void myFunction2()
{
	MyNamespace::   // class gets suggested
}

I also created a new empty txt file in the same directory as the .SLN file, called "va_stdafx.h". Into this file I placed the code:

#define DEPRECIATE(x)

you need to make sure the va_stdafx.h file ends with a blank line, and then trigger a VA symbol database rebuild via:

VA Options -> Performance -> Rebuild symbol databases

and restart the IDE. The va_stdafx.h file is used as a helper tool for VA's parser, and VA looks for this file, and parses it first if found, even though it is not part of the solution. For me this fixes the "class" suggestion in the listbox, but it would require changing your code as you encounter the problem. Still, perhaps worth while if you don't have to much code to update.

zen is the art of being at one with the two'ness
Go to Top of Page

bta
Ketchup Master

Belgium
57 Posts

Posted - Nov 08 2017 :  03:19:43 AM  Show Profile  Reply with Quote
Yeah, the __declspec(deprecated) syntax is what we were using before.
But this is Microsoft specific syntax and as we strive to use standard C++ as much as possible (so we can use different compilers (ex. clang)),
we want to make use of these new standard C++ features.
As it was only 1 class that was causing the issue, I changed it back into using the __declspec(deprecated("xxx")) syntax for now, and the issue is gone.
However, I do hope that VAX will catch up and will not force us to not use some new, modern c++ features.
That would really be a pity. We had this kind of issue with a static analysis tool before and in the end we ditched it :-(

Related to the va_stdafx.h file: good to know that this exists, might come in handy...

Anyway, thanks for the support!
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Nov 08 2017 :  07:23:40 AM  Show Profile  Reply with Quote
We are looking to add support for all of these new C++ attributes to VA's parser, now you have pointed out the problem

case=112204

I don't currently have an estimate for when this will be done, but it is now in the list. Supporting all of the new features in C++ is important to us, and it is something we are working on.

As for va_stdafx.h, most of the time you don't need it, but sometimes it can be very helpful indeed. It often helps when you are using quite complex macros that VA struggles with.

zen is the art of being at one with the two'ness
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Sep 24 2018 :  2:16:43 PM  Show Profile  Reply with Quote
Support for attributes (case=112204) is improved in build 2291.
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