Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of warning squiggles for WPP TraceEvent macro?

When using WPP in Visual Studio (2012) each occurence of TraceEvents(...) has a wavy underline and the help text is e.g.

#define TraceEvents WPP_(CALL)
error: identifier WPP_Call_Foo_cppNNN not defined

Well, it is defined, in the .tmh header file created by the WPP preprocessor and the project compiles just fine. But Visual Studio doesn't scan and/or recognize this file.
Is there a practical way of getting rid of those squiggles?

like image 361
VolkerK Avatar asked Nov 19 '12 10:11

VolkerK


People also ask

When to enable WPP tracing for debugging?

Oct 12 2018 03:38 PM Most Microsoft-provided drivers, included in Windows, enable WPP tracing for debugging purposes. It’s easier to debug when there are trace messages available.

How do I enable WPP trace annotations in Visual Studio?

In Windows 8, the switch –public:<funcName> was added to the WPP preprocessor so that it can keep <funcName> trace annotations in the public PDB file. To specify that switch, in your project settings in Visual Studio, select WPP Tracing->Command Line .

How do I add WPP Software tracing to a trace provider?

To add the default form of WPP software tracing to a trace provider, such as a kernel-mode driver or a user-mode application, add the following C preprocessor directives and WPP macro calls to the provider's source code: An #include directive of the following form to each source file that contains any WPP macros.

How do I Capture WPP trace messages in Windows 8?

In Windows 8, the build and other WPP utilities have been enhanced to include trace messages in public PDBs. You can use the symbol file to capture WPP trace messages without worrying about out-of-sync TMF and symbol files. In this blog post, we’ll describe:


2 Answers

For now I work around the problem by putting

#ifdef __INTELLISENSE__
#undef TraceEvents
#define TraceEvents(a,b,...)
#endif

in one of the header files that are included after the .tmh in all of the files anyway.
The define __INTELLISENSE__ is mentioned in http://blogs.msdn.com/b/vcblog/archive/2011/03/29/10146895.aspx

like image 147
VolkerK Avatar answered Sep 23 '22 21:09

VolkerK


Edit for Visual Studio 2012:

It appears you've reached the analysis limit of the preprocessor in Visual Studio 2012's IntelliSense engine. If you replace the TraceEvents reference with WPP_Call_Foo_cppNNN, it actually resolves the identifier without problems (until you rebuild the solution and the tmh header changes).

The solution is to load the solution in Visual Studio 2013, and choose to not upgrade the compiler toolchain, thus preserving backwards compatibility with Visual Studio 2012.


Previous Answer for Visual Studio 2013:

This was tested in Visual Studio 2013, so it may not apply to Visual Studio 2012. I couldn't find a release of the WDK that supports Visual Studio 2012, so you'll need to let me know how to configure the environment if the following steps do not work.

After building your project (to ensure the .tmh files exist), execute the Project → Rescan Solution command.

I also recommend you associate the files with the C++ editor through the following steps:

  1. Open Tools → Options... → Text Editor → File Extension
  2. Associate extension tmh with editor Microsoft Visual C++
like image 43
Sam Harwell Avatar answered Sep 23 '22 21:09

Sam Harwell