Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] How to handle "unreferenced local variables" warning on DCE/RPC

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Sun, 25 Mar 2007 18:56:48 +0200
Hi List!

I'm currently looking at the warnings that are triggered by the files generated by idl2eth files.

An example would be (plugins/giop):

packet-coseventcomm.c
packet-coseventcomm.c(139) : warning C4101: 'be' : unreferenced local variable packet-coseventcomm.c(140) : warning C4101: 'tree' : unreferenced local variable

The gcc builds prevent these warnings by appending _U_ to the variables. Unfortunately, this is not a real good option for the MSVC builds.

I see the follow solutions to this:
a) fix the root cause by "removing" the unreferenced variables - might not be easy to do b) add "#pragma warning(disable:4101)" to the generated files, to disable the warnings for all generated files - my preferred solution c) add "/wd4101" to the CFLAGS in Makefile.nmake, to disable the warnings for all files of this makefile - this disables this 4101 warning completely (not preferred)

To implement b), the following code snippet should be added to each IDL generated file (somewhere after the #include's):

#ifdef _WIN32
/* disable: "warning C4101: 'xy' : unreferenced local variable" */
#pragma warning(disable:4101)
#endif

Could someone with more knowledge than me add this - I will probably make things worse if I do it myself ;-)

Regards, ULFL