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
 Parsing preprocessor namespace
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jeevcat
Senior Member

Germany
39 Posts

Posted - Sep 12 2018 :  4:23:09 PM  Show Profile  Reply with Quote
I'm using the C++ bindings for Vulkan (https://github.com/KhronosGroup/Vulkan-Hpp). Unfortunately, most of the API is not correctly parsed by Visual Assist due to a define which they use for the API's namespace.
The namespace (default: vk) is defined as follows:

#if !defined(VULKAN_HPP_NAMESPACE)
#define VULKAN_HPP_NAMESPACE vk
#endif

namespace VULKAN_HPP_NAMESPACE
{

Anything which uses the vk:: namespace fails to be parsed. I tried adding a custom define to a va_stdafx.h file,
#define vk VULKAN_HPP_NAMESPACE

but this didn't seem to work. I'm not sure if this is the correct approach at all... Any help would be greatly appreciated!

Edited by - jeevcat on Sep 12 2018 4:23:40 PM

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 12 2018 :  10:26:16 PM  Show Profile  Reply with Quote
Creating a namespace using a macro as its name causes troubles. Unfortunately, this is a know problem:

case=60804

The only workaround I can think as of now, is to change the API's file directly and replace the macro with the name:

namespace vk
{


This may improve the situation. Although I don't know whether changing this file is possible and whether this causes more problems that is solves. It worth a try.
Go to Top of Page

jeevcat
Senior Member

Germany
39 Posts

Posted - Sep 13 2018 :  11:42:53 AM  Show Profile  Reply with Quote
Yes this did work. I guess I was hoping for some solution which didn't require editing the library, but that's really more of a idealistic issue than a practical one. Thanks for the help.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 13 2018 :  2:50:07 PM  Show Profile  Reply with Quote
Yes, I would hoped for a better workaround, but I didn't find one. This is what I can offer until the fix which should solve this.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 13 2018 :  3:59:50 PM  Show Profile  Reply with Quote
Actually, Sean has pointed out a workaround and it seems to work for me.

#define VULKAN_HPP_NAMESPACE vk

You already tried this but I didn't notice that in your example the two word after #define were swapped. The order for #define and typedef is different.
Go to Top of Page

jeevcat
Senior Member

Germany
39 Posts

Posted - Sep 14 2018 :  05:08:09 AM  Show Profile  Reply with Quote
I've just tried this define now, and it doesn't seem to work for me. I'm not sure why. But I'm happy to just edit the header of the library for now.

On an related note (not sure if I should make a new thread for this), the editor hangs for a couple of seconds every time I switch between the tab with the vulkan.hpp header (~45,000 LOC) and any other tab in my project. Is there anything I can do to force VA not to re-parse the file each time (or whatever else it seems to be doing for a few seconds)?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18751 Posts

Posted - Sep 14 2018 :  11:17:40 AM  Show Profile  Reply with Quote
Which IDE and version of VA are you using?

When you are changing tabs, how are you doing so?
How large is the other file, that you are moving into?

I have downloaded the Vulkan code, and I am not seeing this delay when moving between the vulkan.hpp file and a small cpp file. This is using VS2015 and VA 2283.2. It is possible that my test is not right, but if the file size alone was the trigger then I would expect to see something happening here.

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