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
 boost intrusive_ptr issue
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dixonqmg
Junior Member

USA
12 Posts

Posted - Jan 24 2020 :  4:25:58 PM  Show Profile  Reply with Quote
In the code below, when I type in boo-> no members are being shown.

#include <boost/intrusive_ptr.hpp>
class Test
{
public:
int a;
};


void foo()
{
boost::intrusive_ptr<Test> boo;
boo->
}

feline
Whole Tomato Software

United Kingdom
16338 Posts

Posted - Jan 25 2020 :  10:46:31 AM  Show Profile  Reply with Quote
So far I cannot reproduce this problem here, the listbox appears automatically and lists the class member for me.

Which IDE and version of VA are you using?

If you type "boo.", using backspace to undo the dot being converted to -> if this happens automatically, do you get a listbox showing the members of boost::instrusive_ptr?

On the #include line, if you place the caret into the filename "intrusive_ptr.hpp" what, if anything, does VA show in its context and definition fields? These are normally at the top of the editor window, and are where the Alt-M list appears.

I want to know if VA knows where to find this include file, so we should be able to understand this class.

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

dixonqmg
Junior Member

USA
12 Posts

Posted - Jan 27 2020 :  11:23:46 AM  Show Profile  Reply with Quote
Hmm. I have updated my VS version over the weekend, and now can't repro the issue. But I have started experimenting with it because I've had issue with a slightly more complex case below, which is still problematic. It works just fine if I uncomment direct typedef, but fails to show any members if I use MY_BIND version

#include <boost/intrusive_ptr.hpp>
class Test
{
public:
int a;
};


#define MY_BIND(X,Y) X##Y
void foo()
{
boost::intrusive_ptr<Test> boo;
typedef boost::intrusive_ptr<class Test> MY_BIND(Test, IPtr);
//typedef boost::intrusive_ptr<class Test> TestIPtr;
TestIPtr aaa;
aaa->
}
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16338 Posts

Posted - Jan 28 2020 :  11:06:27 AM  Show Profile  Reply with Quote
Something in combining the typedef with the macro is confusing our parser. Can you try this version instead, which should do the same thing, and see if VA works correctly for you with this code:

#define MY_BIND(X,Y) boost::intrusive_ptr<class Test> X##Y
void foo()
{
	MY_BIND(Test, IPtr);
	TestIPtr aaa;
	aaa;
}

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

dixonqmg
Junior Member

USA
12 Posts

Posted - Jan 28 2020 :  11:24:59 AM  Show Profile  Reply with Quote
Yep, that one worked. Alas it's deep inside the libraries, so changing it is non-trivial due to political issues (as in "we're not going to fix a perfectly working code just because your IDE doesn't support it"), so fix from you would be much appreciated.
Go to Top of Page

dixonqmg
Junior Member

USA
12 Posts

Posted - Jan 28 2020 :  11:33:18 AM  Show Profile  Reply with Quote
Interestingly this one
using MY_BIND(Test, IPtr) = boost::intrusive_ptr<class Test>;
also works, even with the original MY_BIND definition.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16338 Posts

Posted - Jan 28 2020 :  11:51:24 AM  Show Profile  Reply with Quote
Is this a suitable work around for you? Or are you still seeing problems here?

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

dixonqmg
Junior Member

USA
12 Posts

Posted - Jan 28 2020 :  12:19:22 PM  Show Profile  Reply with Quote
Yeah, it would work for now. I'd assume you guys will fix your parser anyway hopefully.
Thank you
Go to Top of Page

dixonqmg
Junior Member

USA
12 Posts

Posted - Jan 28 2020 :  1:05:13 PM  Show Profile  Reply with Quote
Related issue - all of this was in a linux cmake project in Visual studio. After I've changed the code in the headers on the linux side, VS noticed it, and correctly synced up the headers from linux. The only way I was able to make Visual assist to pick up changes in the headers - was to close the solution and reopen it. Tools->reparse current file didn't do anything.

Just to make it clear - the header in question wasn't part of the project, it's an outside library.

Edited by - dixonqmg on Jan 28 2020 1:13:09 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16338 Posts

Posted - Jan 28 2020 :  1:16:38 PM  Show Profile  Reply with Quote
Thank you for the update.

When you say an "outside library", is this covered by VA's stable include directories? These are listed in:

VA Options -> C/C++ Directories

and symbols from these directories / libraries are shown in Italic, if you have turned On:

VA Options -> Coloring and Attributes -> Show stable symbols in italics

by design, VA does not normally look for or parse changes to files in these directories, since by definition they don't change much. This means faster parsing, and these symbols can be shown in italic, but the cost is that they are only re-parsed when doing a VA symbol database rebuild:

VA Options -> Performance -> Rebuild symbol databases

So I am wondering if this is what has happened here, or if you have run into a separate problem.

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

dixonqmg
Junior Member

USA
12 Posts

Posted - Jan 28 2020 :  1:22:33 PM  Show Profile  Reply with Quote
It's a separate problem. I don't have anything listed in those c/c++ directories in options. Not sure if you're familiar with how linux cmake projects work in VS (it's a relatively new thing) - but after cmake is run, they ssh to a remote linux box, collect all the include directories that are needed by the project, and rsync it to something like User/AppData/Local/Microsoft/Linux/HeaderCache/bla
and then somehow make the IDE aware of those. Visual Assist picks them up correctly, and everything works, just didn't reparse automatically.
I didn't know about the rebuild button in performance, it would likely do the trick as well, thank you.

I also have "show stable symbols in italics" turned on, and those symbols are not shown in italics

Edited by - dixonqmg on Jan 28 2020 1:24:28 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16338 Posts

Posted - Jan 28 2020 :  2:28:11 PM  Show Profile  Reply with Quote
I have put in a bug for the parser problem with the macro, including some examples I found while working out when this works and when this fails:

case=141811

I am not familiar with Linux cmake projects behaving like this at all. I have some knowledge of cmake projects, but since cmake is capable of generating Visual Studio solution and project files directly, allowing you to build the solution inside Visual Studio normally. Obviously this is a different method entirely.

Do you have a link or two for some instructions on setting up and using this method, so I can study it here? If VA is picking up these header files automatically, then I would expect them to either behave as stable include directories, so show up in italics, or else to be reparsed automatically when changed. Odd.

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

dixonqmg
Junior Member

USA
12 Posts

Posted - Jan 28 2020 :  4:06:27 PM  Show Profile  Reply with Quote
Thanks!
As I mentioned, it's a pretty new thing - it really started to work well only in VS 2019, and it's not generating VS projects from cmake, but VS working with cmake projects directly and using remote linux box for compilations.

Start here
https://docs.microsoft.com/en-us/cpp/linux/cmake-linux-project?view=vs-2019
I also recommend browsing through this on anything cmake/linux related - this blog is low volume, and a lot of new features make it into latest version but not referenced in the documentation yet
https://devblogs.microsoft.com/cppblog/
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16338 Posts

Posted - Feb 04 2020 :  12:22:42 PM  Show Profile  Reply with Quote
I have a basic test up and running now.

Am I correct in assuming the library you edited under Linux is a local library you have developed in house? Or was this a standard library that you installed onto Linux? I am trying to work out how to set up a good test for VA detecting a change to the library.

Also, were any of your Linux symbols being shown in italic by Visual Assist?

As a test, I have tried adding the following variable to my Linux hello world app:

sig_atomic_t testAtomicType;

and the type is being shown correctly in italics by VA, even though both VA and the IDE are unable to locate where the symbol is being defined.

Slightly more worryingly, when I make my code invalid and tell Visual Studio to build it, it reports there is no work to do, and that everything built just fine.

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

dixonqmg
Junior Member

USA
12 Posts

Posted - Feb 04 2020 :  12:53:26 PM  Show Profile  Reply with Quote
Yes, it's a local in-house library.

VA shows some symbols in italic, but only small amount of them - mostly std::.

The last item is likely caused by something being off with your cmake, for me VS correctly deals with changes in code, dependencies tracking etc. Does it by chance show you yellow "c++ IntelliSense may be out of date" on top? If it does it means something failed in cmake cache generation. You can see it in output->cmake window. Also there's tools->options->cross platform->logging that could be useful to check header files sync issue with a remote linux box
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16338 Posts

Posted - Feb 04 2020 :  2:38:55 PM  Show Profile  Reply with Quote
I found my problem with the solution not building. Somehow I failed to save out my "CMakeLists.txt" under Windows, but I don't know how I missed that step. Now I have a valid and compiling test.

I will study italic once I get a simple Linux library working here. At a guess though we need to tell VA to add the local copy to its stable include directory list. To test this, can you please try changing your VA platform:

VA Options -> C/C++ Directories -> Platform = Custom

and adding the following directory to the list of stable include directories:

C:\Users\%USERENAME%\AppData\Local\Microsoft\Linux\HeaderCache
this directory is based on where, on my Windows 10 system, VS2019 is copying over the Linux header files required, so hopefully the path is valid on your system as well. After doing this just restart your IDE, and after VA does a symbol database rebuild, are your library symbols being shown in italic?

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

dixonqmg
Junior Member

USA
12 Posts

Posted - Feb 04 2020 :  2:55:52 PM  Show Profile  Reply with Quote
I've changed it, and I saw it parse the correct directories, but symbols are still not shown in italic. And it processed them correct - eg Alt-G goes to the correct file.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16338 Posts

Posted - Feb 07 2020 :  06:05:11 AM  Show Profile  Reply with Quote
Learning CMake by trial and error here, under Linux. So far, when I try telling CMake that I want to use a library with my program, it is placing a copy of the library into a sub-directory of the programs source code. Is this what is happening for you? Or are you referencing an "external" library in a different source code tree?

VA does not expect stable include directories / external libraries to be sub-directories of the source code you are editing, so I am wondering if I am looking at the right thing here.

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

dixonqmg
Junior Member

USA
12 Posts

Posted - Feb 07 2020 :  10:16:28 AM  Show Profile  Reply with Quote
The simplest way to use an outside library is like this:
INCLUDE_DIRECTORIES(your/header/dir)
LINK_DIRECTORIES(your/library/dir)
add_executable(your_exe your_source.cpp)
TARGET_LINK_LIBRARIES(your_exe your_lib1 your_lib2 ...)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16338 Posts

Posted - Feb 08 2020 :  09:07:23 AM  Show Profile  Reply with Quote
Thank you, this has moved me forward. I would have thought my searches for information on CMake would have turned up these lines already, but they didn't.

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

dixonqmg
Junior Member

USA
12 Posts

Posted - Feb 08 2020 :  09:52:55 AM  Show Profile  Reply with Quote
Note, I'm on the latest preview of VS, and they have changed things around syncing of outside headers in that release. Might be important for later, when you get it all to work ok
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000