Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 21256: /trunk/epan/dissectors/ /trun

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Thu, 29 Mar 2007 04:10:04 +0200
ronnie sahlberg wrote:
:-)

Well those files are not supposed to be manually edited/modified anyway.
I know, I know, that's the reason of the header comment, but I couldn't find another way :-(

I can change PIDL to always emit

#ifdef _MSC_VER
#pragma warning(disable:4005)
#pragma warning(disable:4013)
#endif

at the head of the file.
Sounds like a good approach. In the meantime the MSVC vs. MinGW problems have been fixed, so there shouldn't be further changes required with the #ifdef.

Are there any other pramgas you want it to emit as well?

A find over all files showed the following pragmas in generated files:

PIDL:

#ifdef _MSC_VER
/* disable: warning C4101: 'xy' : unreferenced local variable */
#pragma warning(disable:4101)
/* disable: warning C4018: '<' : signed/unsigned mismatch */
#pragma warning(disable:4018)
/* disable: warning C4013: 'xy' undefined; assuming extern returning int */
#pragma warning(disable:4013)
/* disable: warning C4005: 'xx' : macro redefinition */
#pragma warning(disable:4005)
#endif

Asn1 (only in rrlp):

#ifdef _MSC_VER
/* disable: "warning C4146: unary minus operator applied to unsigned type, result still unsigned" */
#pragma warning(disable:4146)
#endif


In my opinion:
4101: only annoying, pragma should be added to PIDL generation
4018: only annoying, pragma should be added to PIDL generation
4013: unclean code, should be fixed (BTW: As you've fixed some things, this might simply no longer be necessary :-)
4005: unclean code, but I don't know how this could be fixed, see below
4146: buggy code, needs to be fixed (uses a negative constant out of the valid range)!

An explanation of 4005: The winreg IDL file defines e.g. REG_NONE, which is already defined in the windows header files, which is obviously a bad thing. The only clean way I can see would be to add a prefix (e.g. WS_) to the generated symbols. Unfortunately I don't know if this will raise other problems in the generated code (e.g. constant strings might be a problem).


So the way to go:
- adding 4101, 4018 as a #pragma to the code - these warnings can be safely ignored - fixing 4013, 4146 - these warnings actually indicate unclean generated code so they shouldn't be just ignored - fix 4005 if possible, otherwise add it as a #pragma to the code - might be fixed later, but still a pending "time bomb" if definitions are actually *different*

Please add the corresponding comments to the pragmas, as remembering the meaning of the warning numbers is cumbersome.

Unfortunately, I don't know enough about the generated files to fix it myself, so I must beg you to put some work on it ...

Regards, ULFL