Re# C++ Syntax Parsing and " __INTELLISENSE__"
I write kernel-mode software (like device drivers and file system minifilters) for Windows. A commonly used feature that's available to Windows kernel-mode developers is something called WPP Tracing. This feature dynamically creates (a long series of obtuse) macros that are defined in a build-time created created file, with definitions like this:// Functions
#undef DoDebugTrace
#ifdef __INTELLISENSE__
#define DoDebugTrace(TRACELEVEL, MSG, ...) ((void)(MSG, ## __VA_ARGS__))
#else
#define DoDebugTrace WPP_(CALL)
#endif
#undef DoTraceMessage
#ifdef __INTELLISENSE__
#define DoTraceMessage(LEVEL, MSG, ...) ((void)(MSG, ## __VA_ARGS__))
#else
#define DoTraceMessage WPP_(CALL)
#endif
Note that use of #ifdef __INTELLISENSE__ in the above.
When Re# encounters the invocation of these macros in source code, Re# of course flags them with an error “Cannot resolve symbol ‘WPP_<something here>’ "
This is super annoying and results in dozens of red-squiggle underlines in a typical source code file.
Is there ANY work-around that I could use that'll get Re# C++ to NOT flag these macros? Is there any reason that Re# can't define __INTELLISENSE__ when it does its very clever syntax parsing? Maybe, even, as an option or something?
This problem affects just about anybody who does Windows driver development AND uses Re# C++… I get that we're a small community, but it seems like this problem might occur in user-land in places as well.
Please sign in to leave a comment.
Hello Petergv,
Thank you for the detailed description.
You can use the same approach in ReSharper. ReSharper has a macro that is similar to
__INTELLISENSE__
called__RESHARPER__
, so you can use something like:Directly in the code or create/modify the templates used to generate
.tmh
.As an example, a template snippet for ReSharper might look like this:
Let me know if you encounter any issues in your environment using this method.
Thanks for the reply.
The problem is that this is a system supplied, build-time generated, file. So, I can’t change the definition.
Could I, perhaps, in another header, do:
#ifdef __RESHARPER__
#define __INTELLIESENSE__
#endif
Would you anticipate any issues with that?
Petergv, Thank you for the information.
Would you mind setting
__INTELLIESENSE__=1
in Project Properties under ReSharper? It should help with WPP macro resolution without source code changes.Ah, HA! THAT WORKS!
THANK you… I really appreciate you taking the time to look into this (I see you tested with the wdfserial example… excellent).
You have solved what has been a long-standing annoyance for me. I'm super grateful. :-)