A tool such as lint will probably catch all of those situations Guy
listed below ... and then some!
As an example of what lint can do, I ran lint twice on the
epan/dissectors/packet-bssgp.c dissector and attached are the results.
The 1st time I let lint complain about pretty much EVERYTHING. The
second time, I quieted it down by turning off a lot of warnings, etc.
It's difficult to know what to turn off, but if you don't turn off
things, you can be swamped with messages that you really don't care
about. Anyway, just keep in mind that the tool can be tuned to be as
quiet or noisy as you want it to be.
By the way, the tool that I'm running is from Gimpel software at
http://www.gimpel.com. And no, I'm not affiliated with them so I don't
get a sales commission if anyone decides to purchase the tool. :)
- Chris
-----Original Message-----
From: ethereal-dev-bounces@xxxxxxxxxxxx
[mailto:ethereal-dev-bounces@xxxxxxxxxxxx] On Behalf Of Guy Harris
Sent: Wednesday, December 29, 2004 6:49 PM
To: Ethereal development
Subject: Re: [Ethereal-dev] Use of C99 code in 0.10.8
Guy Harris wrote:
> That *might*, on some platforms, cause functions that Ethereal
requires
> not to be declared or cause macros that Ethereal requires not to be
> defined. I don't remember whether we've ever tried compiling with
> -ansi. I'll see what happens if I try that on OS X 10.3.7, at least -
> some other OSes might use __STRICT_ANSI__ in ways that OS X doesn't,
so
> even if it works on OS X it might not work on other platforms.
Well, compiling with -ansi seems to work - and it catches // comments.
Unfortunately, it *doesn't* catch:
enums where there's a comma after the last element;
initialization of automatic structures with non-constant values;
zero-length arrays at the end of a structure;
so it's not going to catch *all* of the GCCisms that might creep into
the source code.
-ansi -pedantic might, but it might also catch extensions we *want* to
use and that are properly protected by #ifdefs (e.g., declaring some
functions as being printf-like, so that the compiler can check the
format string against the argument list). I'll try using the
--with-extra-gcc-checks option to turn on -pedantic (and some other
warnings), to see how well -ansi -pedantic works.
_______________________________________________
Ethereal-dev mailing list
Ethereal-dev@xxxxxxxxxxxx
http://www.ethereal.com/mailman/listinfo/ethereal-dev
-----------------------------------------
This email may contain confidential and privileged material for the sole
use of the intended recipient(s). Any review, use, retention, distribution
or disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact the
sender by reply email and delete all copies of this message. Also, email is
susceptible to data corruption, interception, tampering, unauthorized
amendment and viruses. We only send and receive emails on the basis that we
are not liable for any such corruption, interception, tampering, amendment
or viruses or any consequence thereof.
Attachment:
lint.tar.gz
Description: lint.tar.gz